def table(values): first = values[0] keys = list(first.keys()) if isinstance(first, dict) else range( 0, len(first)) widths = [max([len(str(v[k])) for v in values]) for k in keys] string = ' | '.join(['{:<' + str(w) + '}' for w in widths]) return "\n".join( [string.format(*[str(v[k]) for k in keys]) for v in values]) symbol = 'BTC/USDT' exchange = ccxt.latoken({ 'enableRateLimit': True, # 'verbose': True, # uncomment for debugging purposes # uncomment and change for your keys to enable private calls # 'apiKey': 'YOUR_API_KEY', # 'secret': 'YOUR_API_SECRET', }) exchange.load_markets() print('-------------------------------------------------------------------') print(exchange.id, 'has:') pprint(exchange.has) # public API print('-------------------------------------------------------------------')
def init_supported_exchanges(): objects = { "acx": ccxt.acx(), "aofex": ccxt.aofex(), "bequant": ccxt.bequant(), "bibox": ccxt.bibox(), "bigone": ccxt.bigone(), "binance": ccxt.binance(), "bitbank": ccxt.bitbank(), "bitbay": ccxt.bitbay(), "bitfinex": ccxt.bitfinex(), "bitflyer": ccxt.bitflyer(), "bitforex": ccxt.bitforex(), "bithumb": ccxt.bithumb(), "bitkk": ccxt.bitkk(), "bitmax": ccxt.bitmax(), "bitstamp": ccxt.bitstamp(), "bittrex": ccxt.bittrex(), "bitz": ccxt.bitz(), "bl3p": ccxt.bl3p(), "bleutrade": ccxt.bleutrade(), "braziliex": ccxt.braziliex(), "btcalpha": ccxt.btcalpha(), "btcbox": ccxt.btcbox(), "btcmarkets": ccxt.btcmarkets(), "btctradeua": ccxt.btctradeua(), "bw": ccxt.bw(), "bybit": ccxt.bybit(), "bytetrade": ccxt.bytetrade(), "cex": ccxt.cex(), "chilebit": ccxt.chilebit(), "coinbase": ccxt.coinbase(), "coinbasepro": ccxt.coinbasepro(), "coincheck": ccxt.coincheck(), "coinegg": ccxt.coinegg(), "coinex": ccxt.coinex(), "coinfalcon": ccxt.coinfalcon(), "coinfloor": ccxt.coinfloor(), "coinmate": ccxt.coinmate(), "coinone": ccxt.coinone(), "crex24": ccxt.crex24(), "currencycom": ccxt.currencycom(), "digifinex": ccxt.digifinex(), "dsx": ccxt.dsx(), "eterbase": ccxt.eterbase(), "exmo": ccxt.exmo(), "exx": ccxt.exx(), "foxbit": ccxt.foxbit(), "ftx": ccxt.ftx(), "gateio": ccxt.gateio(), "gemini": ccxt.gemini(), "hbtc": ccxt.hbtc(), "hitbtc": ccxt.hitbtc(), "hollaex": ccxt.hollaex(), "huobipro": ccxt.huobipro(), "ice3x": ccxt.ice3x(), "independentreserve": ccxt.independentreserve(), "indodax": ccxt.indodax(), "itbit": ccxt.itbit(), "kraken": ccxt.kraken(), "kucoin": ccxt.kucoin(), "lakebtc": ccxt.lakebtc(), "latoken": ccxt.latoken(), "lbank": ccxt.lbank(), "liquid": ccxt.liquid(), "livecoin": ccxt.livecoin(), "luno": ccxt.luno(), "lykke": ccxt.lykke(), "mercado": ccxt.mercado(), "oceanex": ccxt.oceanex(), "okcoin": ccxt.okcoin(), "okex": ccxt.okex(), "paymium": ccxt.paymium(), "poloniex": ccxt.poloniex(), "probit": ccxt.probit(), "southxchange": ccxt.southxchange(), "stex": ccxt.stex(), "surbitcoin": ccxt.surbitcoin(), "therock": ccxt.therock(), "tidebit": ccxt.tidebit(), "tidex": ccxt.tidex(), "upbit": ccxt.upbit(), "vbtc": ccxt.vbtc(), "wavesexchange": ccxt.wavesexchange(), "whitebit": ccxt.whitebit(), "yobit": ccxt.yobit(), "zaif": ccxt.zaif(), "zb": ccxt.zb() } return objects
# -*- 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 + '/python') import ccxt # noqa: E402 exchange = ccxt.latoken({ 'apiKey': 'YOUR_API_KEY', 'secret': 'YOUR_SECRET', }) symbol = 'ETH/BTC' type = 'limit' # only support limit side = 'buy' # or 'sell' amount = 0.01 price = 0.015881 # or None order = exchange.create_order(symbol, type, side, amount, price) print(order)
# -*- 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 + '/python') import ccxt # noqa: E402 exchange = ccxt.latoken({ 'apiKey': 'YOUR_API_KEY', 'secret': 'YOUR_SECRET', 'enableRateLimit': True, # this is required, as documented in the Manual! }) symbol = 'ETH/BTC' type = 'limit' # only support limit side = 'buy' # or 'sell' amount = 0.01 price = 0.015881 # or None order = exchange.create_order(symbol, type, side, amount, price) print(order)
import ccxt import ttm import keyring from pprint import pprint # # Init # data_folder = 'output/universe' exchange = ccxt.latoken({ 'enableRateLimit': False, 'apiKey': keyring.get_password('latoken', 'apiKey'), 'secret': keyring.get_password('latoken', 'secret'), }) pairs = ttm.Tools.get_pairs(exchange) #; print('# PAIRS:') ; pprint(pairs) ; print(len(pairs)) strategy = ttm.strategy.Universe( endpoint='USDT', exchange_pairs=pairs, executor=ttm.strategy.universe.WorsePriceExecutor(), minimal_value=1.00, minimal_worse_value=1.00, path_length=4, tick_period=1, limits={'USDT': 20.0}, ) storage = ttm.storage.JSONFile(data_folder + '/storage-universe.json') # storage for strategy data cache = ttm.storage.JSONFile('cache-universe.json') # storage for performance optimalisation logger = ttm.logger.Multi(
] gap_retrieval_interval = 5 gap_recheck_interval = 10 gap_fetch_interval = 25 aofex = ccxt.aofex() bequant = ccxt.bequant() bitkk = ccxt.bitkk() bitmax = ccxt.bitmax() gateio = ccxt.gateio() hitbtc = ccxt.hitbtc() hollaex = ccxt.hollaex() huobipro = ccxt.huobipro() kucoin = ccxt.kucoin() latoken = ccxt.latoken() lbank = ccxt.lbank() okex = ccxt.okex() lbank.apiKey = '26b170f8-d842-49f2-a97d-d2c9d8fbf69e' lbank.secret = 'MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAKGUSuql25yd1YQHrwSm9JUglV+ExhaTHVEFx08ekYmxZ1fI0Ly888fEQKlVmuMBlCYWMejA8JKvSL5tndawzPL/2nEjf99TuTeTXJoxnbyKeO5v62vKCg1ZKr39VPsKFJWeJj6r2xv4YhjCRSpfQex4cW8Ptb0evPMluom7bAf5AgMBAAECgYArhJgk2KTsaqoeFD+0Hg9TtuHkRwte+yJzNv42NgJ2tlwiDYkCvFVgIWBU+yRrLXqsQ2AP0x84MpOCDl3re9TG0chAW5vQMZSMd/ecg/KQARQUsMWS9YE97BUeqEgkUUHhW9fx6qxswYWCNzg4FPz77Pi8SOnAiHV88wPKtIUhnQJBAPvKwp+JdzRvx2DqISdDTnKFWj73qWLFkP6jlLZwkGZCks6LW5WDSI2BlbbMFW9+lQ8pJBC50xOlTRl9w79/LGcCQQCkR5Ns07tdvguM3/d5JM/DzSXsff7WiO+MtY+84WuP9lj+jFf2IEHKEttrC1R5HAuwg34CepSomWtcEWmFLGyfAkBuv75fIb226LuPmyu981Lb+F+7dn+gnDmsZxMQM+6vq/SauJ0t5DLTWv4ZCycahVjW9EeSu8llyL1iyviAkFVdAkACYufJVOoL2o7gZQB7SgWamohKfyoMg8C3Eowb+kpNtQ5l5DQC50UNYmi9jVSUzct9rOtPregq6s+cbsRRouuRAkAtlNZ4Ag7uj9n67ClneAQKguDvUeZLBbQF0s2hFIaeYwEqcuo8mLECjWc35xSS8DZwnRzg8pu8Uo/8S10UWhEU' line_token = 'QcmhPgDAY69Sit9fxbJzy8lE5C98bumPzSHcSbe3UyX' def short_entry(xrp_balance, usdt_balance): lbank_ticker = lbank.fetch_ticker('XRP/USDT') lbank_last = lbank_ticker['last'] adjusted_rate_for_limit_sell = lbank_last * 0.01 lbank.create_order(symbol='XRP/USDT',