async def test(): gdax = ccxt.gdax({ 'apiKey': "a43edfe629bc5991acc83a536ac6358e", 'secret': "xOvq+iH8NT07TheFB/fmY3GcnMZMwP7Xct9zwWtAZxsCbJh8rxeEe/0BGxfbV2em7P9iqQD7/TJGqmsDO8B/kw==", 'password': '******', 'verbose': True, # switch it to False if you don't want the HTTP log }) # move gdax to sandbox gdax.urls['api'] = 'https://api-public.sandbox.gdax.com' print(await gdax.fetch_balance())
def __init__(self): self.url = "wss://ws-feed.gdax.com" self.public_client = ccxt.gdax() self.product_ids = GDAX_PRODUCT_IDS self.order_books = {x: {} for x in self.product_ids} self.inside_order_books = { x: {"bids": {}, "asks": {}} for x in self.product_ids } self.last_trade_ids = {x: None for x in self.product_ids} self.db_worker = DBWorker() self.trades_backfiller = BackFillTrades()
def main(): exchanges = [ ccxt.gdax(), ccxt.kraken(), ccxt.hitbtc2(), ccxt.huobipro(), ccxt.bitstamp() ] symbols = ['BTC/USD', 'BTC/USD', 'BTC/USDT', 'BTC/USDT', 'BTC/USD'] tasks = [] for i in range(len(exchanges)): task = get_exchange_tickerDepth(exchanges[i], symbols[i]) tasks.append(asyncio.ensure_future(task)) loop = asyncio.get_event_loop() loop.run_until_complete(asyncio.wait(tasks))
async def test_gdax(): gdax = ccxt.gdax() return await gdax.load_markets()
fybsg = ccxt.fybsg({ 'enableRateLimit': True, 'rateLimit': 1000, }) gatecoin = ccxt.gatecoin({ 'enableRateLimit': True, 'rateLimit': 1000, }) gateio = ccxt.gateio({ 'enableRateLimit': True, 'rateLimit': 1000, }) gdax = ccxt.gdax({ 'enableRateLimit': True, 'rateLimit': 1000, 'apiKey': "GnFmvkkPinzOXSWM", 'secret': "", 'password': '******', }) gemini = ccxt.gemini({ 'enableRateLimit': True, 'rateLimit': 1000, }) getbtc = ccxt.getbtc({ 'enableRateLimit': True, 'rateLimit': 1000, }) hitbtc = ccxt.hitbtc({ 'enableRateLimit': True, 'rateLimit': 1000, "apiKey": "00c576eec474fab35709aeb546dcf577",
import sys root = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(root + '/python') import ccxt. async as ccxt # noqa: E402 async def main(exchange, symbol): while True: print('--------------------------------------------------------------') print(exchange.iso8601(exchange.milliseconds()), 'fetching', symbol, 'ticker from', exchange.name) # this can be any call really ticker = await exchange.fetch_order_book(symbol) print(exchange.iso8601(exchange.milliseconds()), 'fetched', symbol, 'ticker from', exchange.name) print(ticker) # you can set enableRateLimit = True to enable the built-in rate limiter # this way you request rate will never hit the limit of an exchange # the library will throttle your requests to avoid that exchange = ccxt.gdax({ 'enableRateLimit': True, # this option enables the built-in rate limiter }) asyncio.get_event_loop().run_until_complete(main(exchange, 'LTC/USD'))
async def startup(self): self.public_client = ccxt.gdax() self.db_worker = DBWorker()
import asyncio import os import sys root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(root + '/python') import ccxt.async as ccxt # noqa: E402 async def main(exchange, symbol): while True: print('--------------------------------------------------------------') print(exchange.iso8601(exchange.milliseconds()), 'fetching', symbol, 'ticker from', exchange.name) # this can be any call really ticker = await exchange.fetch_order_book(symbol) print(exchange.iso8601(exchange.milliseconds()), 'fetched', symbol, 'ticker from', exchange.name) print(ticker) # you can set enableRateLimit = True to enable the built-in rate limiter # this way you request rate will never hit the limit of an exchange # the library will throttle your requests to avoid that exchange = ccxt.gdax({ 'enableRateLimit': True, # this option enables the built-in rate limiter }) asyncio.get_event_loop().run_until_complete(main(exchange, 'LTC/USD'))
async def print_complex_arbs_task(self): while True: self.print_arbs(self.complex_arbs()) await asyncio.sleep(1) async def populate_task(self, exchange): while True: try: await self.exchange_rates.populate( exchange, blacklisted=self.blacklisted) except (TimeoutError, RequestTimeout, ExchangeError) as e: logging.error(e) await asyncio.sleep(5) if __name__ == "__main__": EXCHANGES = { ccxt.bittrex({'enableRateLimit': True}), ccxt.gdax({'enableRateLimit': True}), ccxt.kraken({'enableRateLimit': True}), ccxt.poloniex({'enableRateLimit': True}), FastCryptopia({'enableRateLimit': True}), ccxt.gemini({'enableRateLimit': True}), ccxt.kucoin({'enableRateLimit': True}), ccxt.binance({'enableRateLimit': True}) } logging.basicConfig(level=logging.INFO) start_with = ("ETH", 10) arbs = Sharpshooter(EXCHANGES, start_with).run_once() Sharpshooter.print_arbs(arbs)
async def test_gdax(): gdax = ccxt.gdax() return await gdax.load_markets()
async def test_gdax(): gdax = ccxt.gdax() markets = await gdax.load_markets() await gdax.close() return markets
import asyncio import time import ccxt.async as ccxt import pandas as pd from IPython.display import display gateio = ccxt.gateio() gdax = ccxt.gdax() binance = ccxt.binance() bitbank = ccxt.bitbank() bit2c = ccxt.bit2c() bitbay = ccxt.bitbay() exchanges = { gateio: ['ETH/BTC', 'LTC/BTC'], gdax: ['ETH/BTC', 'LTC/BTC', 'BTC/USD'], binance: ['ETH/BTC', 'LTC/BTC'], bitbank: ['ETH/BTC', 'LTC/BTC'], bit2c: ['BTC/NIS', 'LTC/NIS'], bitbay: ['ETH/BTC', 'LTC/BTC'] } async def get_top_of_book(top_bids, top_asks, exchange, symbol): book = await exchange.fetch_order_book(symbol) top_bids[exchange.name][symbol] = float(book['bids'][0][0]) top_bids[exchange.name]["taker"] = exchange.fees['trading']['taker'] top_asks[exchange.name][symbol] = float(book['asks'][0][0])
async def test_gdax(): gdax = ccxt.gdax() markets = await gdax.load_markets() await gdax.close() return markets