Остання активність 1729055749

CCXT-readme-18.php Неформатований
1include 'ccxt.php';
2
3$poloniex = new \ccxt\poloniex ();
4$bittrex = new \ccxt\bittrex (array ('verbose' => true));
5$quoinex = new \ccxt\quoinex ();
6$zaif = new \ccxt\zaif (array (
7 'apiKey' => 'YOUR_PUBLIC_API_KEY',
8 'secret' => 'YOUR_SECRET_PRIVATE_KEY',
9));
10$hitbtc = new \ccxt\hitbtc (array (
11 'apiKey' => 'YOUR_PUBLIC_API_KEY',
12 'secret' => 'YOUR_SECRET_PRIVATE_KEY',
13));
14
15$exchange_id = 'binance';
16$exchange_class = "\\ccxt\\$exchange_id";
17$exchange = new $exchange_class (array (
18 'apiKey' => 'YOUR_API_KEY',
19 'secret' => 'YOUR_SECRET',
20));
21
22$poloniex_markets = $poloniex->load_markets ();
23
24var_dump ($poloniex_markets);
25var_dump ($bittrex->load_markets ());
26var_dump ($quoinex->load_markets ());
27
28var_dump ($poloniex->fetch_order_book ($poloniex->symbols[0]));
29var_dump ($bittrex->fetch_trades ('BTC/USD'));
30var_dump ($quoinex->fetch_ticker ('ETH/EUR'));
31var_dump ($zaif->fetch_ticker ('BTC/JPY'));
32
33var_dump ($zaif->fetch_balance ());
34
35// sell 1 BTC/JPY for market price, you pay ¥ and receive ฿ immediately
36var_dump ($zaif->id, $zaif->create_market_sell_order ('BTC/JPY', 1));
37
38// buy BTC/JPY, you receive ฿1 for ¥285000 when the order closes
39var_dump ($zaif->id, $zaif->create_limit_buy_order ('BTC/JPY', 1, 285000));
40
41// set a custom user-defined id to your order
42$hitbtc->create_order ('BTC/USD', 'limit', 'buy', 1, 3000, array ('clientOrderId' => '123'));