93 lines
2.6 KiB
Python
93 lines
2.6 KiB
Python
# # https://github.com/ccxt/ccxt/tree/master/examples/py
|
|
# # ! pip install ccxt
|
|
# # //cjs
|
|
# # var ccxt = require ('ccxt')
|
|
# # console.log (ccxt.exchanges) // print all available exchanges
|
|
# # py
|
|
# import ccxt
|
|
# #print(ccxt.exchanges)
|
|
# #import ccxt.async_support as ccxt
|
|
|
|
|
|
# # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# # import ccxt
|
|
|
|
# # hitbtc = ccxt.hitbtc({'verbose': True})
|
|
# # bitmex = ccxt.bitmex()
|
|
# # huobipro = ccxt.huobipro()
|
|
# # exmo = ccxt.exmo({
|
|
# # 'apiKey': 'YOUR_PUBLIC_API_KEY',
|
|
# # 'secret': 'YOUR_SECRET_PRIVATE_KEY',
|
|
# # })
|
|
# # kraken = ccxt.kraken({
|
|
# # 'apiKey': 'YOUR_PUBLIC_API_KEY',
|
|
# # 'secret': 'YOUR_SECRET_PRIVATE_KEY',
|
|
# # })
|
|
|
|
# # exchange_id = 'binance'
|
|
# # exchange_class = getattr(ccxt, exchange_id)
|
|
# # exchange = exchange_class({
|
|
# # 'apiKey': 'YOUR_API_KEY',
|
|
# # 'secret': 'YOUR_SECRET',
|
|
# # })
|
|
|
|
# # hitbtc_markets = hitbtc.load_markets()
|
|
|
|
# # print(hitbtc.id, hitbtc_markets)
|
|
# # print(bitmex.id, bitmex.load_markets())
|
|
# # print(huobipro.id, huobipro.load_markets())
|
|
|
|
# # print(hitbtc.fetch_order_book(hitbtc.symbols[0]))
|
|
# # print(bitmex.fetch_ticker('BTC/USD'))
|
|
# # print(huobipro.fetch_trades('LTC/USDT'))
|
|
|
|
# # print(exmo.fetch_balance())
|
|
|
|
# # # sell one ฿ for market price and receive $ right now
|
|
# # print(exmo.id, exmo.create_market_sell_order('BTC/USD', 1))
|
|
|
|
# # # limit buy BTC/EUR, you pay €2500 and receive ฿1 when the order is closed
|
|
# # print(exmo.id, exmo.create_limit_buy_order('BTC/EUR', 1, 2500.00))
|
|
|
|
# # # pass/redefine custom exchange-specific order params: type, amount, price, flags, etc...
|
|
# # kraken.create_market_buy_order('BTC/USD', 1, {'trading_agreement': 'agree'})
|
|
# # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
# # # -*- 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
|
|
|
|
# # -----------------------------------------------------------------------------
|
|
|
|
# # print('CCXT Version:', ccxt.__version__)
|
|
|
|
# # -----------------------------------------------------------------------------
|
|
|
|
# exchange = ccxt.coinbase({
|
|
# 'apiKey': 'tk2ShLJCmByejn78',
|
|
# 'secret': 'UcJfI5HzQmkEjclCeHFSfG8hnNYxaESv',
|
|
# # 'verbose': True, # for debug output
|
|
# })
|
|
|
|
# symbol = 'BTC/USDT'
|
|
# timeframe = '1m'
|
|
# since = None
|
|
# limit = None # not used by coinbase
|
|
|
|
# try:
|
|
# # Max 300 Candles
|
|
# candles = exchange.fetch_ohlcv(symbol, timeframe, since, limit)
|
|
# pprint(candles)
|
|
# except Exception as err:
|
|
# print(err)
|
|
|
|
|