Last active 1729055749

knox revised this gist 1729055749. Go to revision

1 file changed, 42 insertions

CCXT-readme-18.php(file created)

@@ -0,0 +1,42 @@
1 + include '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 +
24 + var_dump ($poloniex_markets);
25 + var_dump ($bittrex->load_markets ());
26 + var_dump ($quoinex->load_markets ());
27 +
28 + var_dump ($poloniex->fetch_order_book ($poloniex->symbols[0]));
29 + var_dump ($bittrex->fetch_trades ('BTC/USD'));
30 + var_dump ($quoinex->fetch_ticker ('ETH/EUR'));
31 + var_dump ($zaif->fetch_ticker ('BTC/JPY'));
32 +
33 + var_dump ($zaif->fetch_balance ());
34 +
35 + // sell 1 BTC/JPY for market price, you pay ¥ and receive ฿ immediately
36 + var_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
39 + var_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'));
Newer Older