-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added examples/order-book-extra-level-depth-param
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use strict"; | ||
|
||
const ccxt = require ('../../ccxt') | ||
const asTable = require ('as-table') | ||
const log = require ('ololog') | ||
|
||
require ('ansicolor').nice; | ||
|
||
(async function test () { | ||
|
||
const exchange = new ccxt.bitfinex () | ||
const orders = await exchange.fetchOrderBook ('BTC/USD', { | ||
'limit_bids': 5, // max = 50 | ||
'limit_asks': 5, // may be 0 in which case the array is empty | ||
'group': 1, // 1 = orders are grouped by price, 0 = orders are separate | ||
}) | ||
|
||
log (orders) | ||
}) () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
$root = dirname (dirname (dirname (__FILE__))); | ||
|
||
include $root . '/build/ccxt.php'; | ||
|
||
date_default_timezone_set ('UTC'); | ||
|
||
// instantiate the exchange by id | ||
$exchange = '\\ccxt\\kraken'; | ||
$exchange = new $exchange (); | ||
var_dump ($exchange->fetch_order_book ('BTC/USD', array ( | ||
'count' => 10, // up to ten order on each side for example | ||
))); | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
import sys | ||
|
||
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
sys.path.append(root) | ||
|
||
import ccxt # noqa: E402 | ||
|
||
# return up to ten bidasks on each side of the order book stack | ||
print(ccxt.cex().fetch_order_book('BTC/USD', {'depth': 10})) |