-
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/[y/cryptopia-fetch-order-books.py and minor fixes to c…
…ryptopia fetchOrderBook fix ccxt#1930
- Loading branch information
Showing
2 changed files
with
47 additions
and
8 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,33 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
import sys | ||
from pprint import pprint | ||
|
||
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
sys.path.append(root + '/python') | ||
|
||
import ccxt # noqa: E402 | ||
|
||
id = 'cryptopia' | ||
|
||
# instantiate the exchange by id | ||
exchange = getattr(ccxt, id)({ | ||
# 'proxy':'https://cors-anywhere.herokuapp.com/', | ||
}) | ||
|
||
# load all markets from the exchange | ||
markets = exchange.load_markets() | ||
|
||
|
||
# this will work | ||
result = exchange.fetch_order_books(['ETH/BTC', 'LTC/BTC']) | ||
pprint(result) | ||
|
||
# this will also work | ||
result = exchange.fetch_order_books(exchange.symbols[0:10]) | ||
pprint(result) | ||
|
||
# this will not work (too many symbols) | ||
result = exchange.fetch_order_books(exchange.symbols) | ||
pprint(result) |
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