0

我正在为 python 使用ccxt模块。我可以初始化它以进行交流。例如比特雷克斯:

exchange = ccxt.bittrex({
    'enableRateLimit': True
})
return exchange

但以下不起作用:

ex = 'bittrex'
print(ex)
exchange = ccxt.ex({
    'enableRateLimit': True
})
return exchange

错误:AttributeError: module 'ccxt' has no attribute 'ex' 我怎样才能使这项工作?

4

1 回答 1

4
import ccxt
ex = 'bittrex'
ex_obj = getattr(ccxt, ex)
exchange = ex_obj({
    'enableRateLimit': True
})
return exchange

ex必须是以下支持的交换列表之一

打印(ccxt.exchanges)['_1broker','_1btcxe','acx','allcoin','anxpro','anybits','bcex','bibox','bigone','binance','bit2c' ,'bitbank','bitbay','bitfinex','bitfinex2','bitflyer','bitforex','bithumb','bitkk','bitlish','bitmarket','bitmex','bitsane',' bitso'、'bitstamp'、'bitstamp1'、'bittrex'、'bitz'、'bl3p'、'bleutrade'、'braziliex'、'btcalpha'、'btcbox'、'btcchina'、'btcexchange'、'btcmarkets' ,'btctradeim','btctradeua','btcturk','btcx','bxinth','ccex','cex','chbtc','chilebit','cobinhood','coinbase','coinbaseprime','coinbasepro','coincheck','coinegg','coinex','coinexchange','coinfalcon','coinfloor','coingi','coinmarketcap ','coinmate','coinnest','coinone','coinsecure','coinspot','cointiger','coolcoin','crypton','cryptopia','deribit','dsx','ethfinex', 'exmo'、'exx'、'fcoin'、'flowbtc'、'foxbit'、'fybse'、'fybsg'、'gatecoin'、'gateio'、'gdax'、'gemini'、'getbtc'、'hadax ','hitbtc','hitbtc2','火币','huobicny','huobipro','ice3x','Independentreserve','indodax','itbit','jubi','kraken','kucoin','kuna','lakebtc','lbank','liqui','livecoin','luno','lykke' , 'mercado', 'mixcoins', 'negociecoins', 'nova', 'okcoincny', 'okcoinusd', 'okex', 'paymium', 'poloniex', 'qryptos', 'quadrigacx', 'quoinex', ' rightbtc','southxchange','surbitcoin','theocean','therock','tidebit','tidex','uex','urdubit','vaultoro','vbtc','virwox','wex' , 'xbtce', 'yobit', 'yunbi', 'zaif', 'zb']'jubi'、'kraken'、'kucoin'、'kuna'、'lakebtc'、'lbank'、'liqui'、'livecoin'、'luno'、'lykke'、'mercado'、'mixcoins'、'negociecoins ','nova','okcoincny','okcoinusd','okex','paymium','poloniex','qryptos','quadrigacx','quoinex','rightbtc','southxchange','surbitcoin', 'theocean'、'therock'、'tidebit'、'tidex'、'uex'、'urdubit'、'vaultoro'、'vbtc'、'virwox'、'wex'、'xbtce'、'yobit'、'yunbi '、'zaif'、'zb']'jubi'、'kraken'、'kucoin'、'kuna'、'lakebtc'、'lbank'、'liqui'、'livecoin'、'luno'、'lykke'、'mercado'、'mixcoins'、'negociecoins ','nova','okcoincny','okcoinusd','okex','paymium','poloniex','qryptos','quadrigacx','quoinex','rightbtc','southxchange','surbitcoin', 'theocean'、'therock'、'tidebit'、'tidex'、'uex'、'urdubit'、'vaultoro'、'vbtc'、'virwox'、'wex'、'xbtce'、'yobit'、'yunbi '、'zaif'、'zb']'livecoin'、'luno'、'lykke'、'mercado'、'mixcoins'、'negociecoins'、'nova'、'okcoincny'、'okcoinusd'、'okex'、'paymium'、'poloniex'、'qryptos ','quadrigacx','quoinex','rightbtc','southxchange','surbitcoin','theocean','therock','tidebit','tidex','uex','urdubit','vaultoro', 'vbtc'、'virwox'、'wex'、'xbtce'、'yobit'、'yunbi'、'zaif'、'zb']'livecoin'、'luno'、'lykke'、'mercado'、'mixcoins'、'negociecoins'、'nova'、'okcoincny'、'okcoinusd'、'okex'、'paymium'、'poloniex'、'qryptos ','quadrigacx','quoinex','rightbtc','southxchange','surbitcoin','theocean','therock','tidebit','tidex','uex','urdubit','vaultoro', 'vbtc'、'virwox'、'wex'、'xbtce'、'yobit'、'yunbi'、'zaif'、'zb'],'quadrigacx','quoinex','rightbtc','southxchange','surbitcoin','theocean','therock','tidebit','tidex','uex','urdubit','vaultoro',' vbtc','virwox','wex','xbtce','yobit','yunbi','zaif','zb'],'quadrigacx','quoinex','rightbtc','southxchange','surbitcoin','theocean','therock','tidebit','tidex','uex','urdubit','vaultoro',' vbtc','virwox','wex','xbtce','yobit','yunbi','zaif','zb']

于 2018-09-09T08:11:56.987 回答