def get_kraken_to_btcmarkets(): #compare prices for EUR and AUD markets on Kraken and BTCmarkets #returns a dataframe of timestamp, token, profit # find all the AUD markets on btcmarkets btcmarkets = ccxt.btcmarkets() btcmarkets.load_markets() for name, marketdata in btcmarkets.markets.items(): if marketdata['quote'] == 'AUD': marketdata.update(btcmarkets.fetch_ticker(name)['info']) btcmarketsdf = pd.DataFrame(btcmarkets.markets).T.query('quote == "AUD"') # Now do the same thing on Kraken kraken = ccxt.kraken() #here we can actually get all markets and all tickers in just 2 calls krakendf = pd.DataFrame(kraken.load_markets()).T #we are mainly interested in the bid price since we just need to make the highest bid krakenbids = pd.Series({ name: tickerdata['bid'] for name, tickerdata in kraken.fetch_tickers().items() }) krakendf['bid'] = krakenbids # only look at euro ones krakendf = krakendf.query( 'quote=="EUR" and active==True and darkpool==False') #withdrawal_fees = {'BTC':0.001} ## Okay how can we sell these tokens at btcmarkets? df = pd.merge(btcmarketsdf, krakendf, on='base') rates = get_euro_rate() df['eurobid'] = df.bestBid / rates['AUD'] df['profit'] = (df.eurobid / df.bid) * (1 - df.taker_y) * (1 - df.taker_x) - 1 df = df.sort_values('profit', ascending=False) #assign all these results the same timestamp because they are close enough df.timestamp = pd.to_datetime(df.timestamp.max(), unit='s') results_df = df[['timestamp', 'instrument', 'bid', 'eurobid', 'profit']] results_df.columns = [ 'timestamp', 'instrument', 'from_price', 'to_price', 'profit' ] return results_df
'exchangeName': "bitbay", 'database': bitbay_db }) bl3p = ccxt.bl3p({ 'rateLimit': 3000, 'enableRateLimit': True, # 'verbose': True, 'exchangeName': "bl3p" , 'database': bl3p_db }) btcmarkets = ccxt.btcmarkets({ 'rateLimit': 3000, 'enableRateLimit': True, # 'verbose': True, 'exchangeName': "btcmarkets" , 'database': btcmarkets_db }) coinfloor = ccxt.coinfloor({ 'rateLimit': 3000, 'enableRateLimit': True, # 'verbose': True, 'exchangeName': "coinfloor", 'database': coinfloor_db }) gemini = ccxt.gemini({ 'rateLimit': 3000, 'enableRateLimit': True,
pip install ccxt from datetime import datetime import plotly.graph_objects as go import ccxt import pandas as pd #Affichage des différentes classes de ccxt print (ccxt.exchanges) #Sélection de l'obejt btcmarkets btcmarkets = ccxt.btcmarkets() #Selection des échanges entre btc et aud trading_pair = 'BTC/AUD' # fetch_ohclv permet de recupérer les données de ccxt et les mettre dans candles candles = btcmarkets.fetch_ohlcv(trading_pair, '1h', btcmarkets.parse8601('2020-07-08T00:00:00')) #Construire les listes date, open_data etc.. qui contiennent la date et les prix dates = [] open_data = [] high_data = []
def exchangeObject(exchange_in): exchanges = [ ccxt.acx(), ccxt.bitbay(), ccxt.bitfinex(), ccxt.bitflyer(), ccxt.bithumb(), ccxt.bitlish(), ccxt.bitmarket(), ccxt.bitmex(), ccxt.bitso(), ccxt.bitstamp(), ccxt.bitstamp1(), ccxt.bittrex(), ccxt.bl3p(), ccxt.bleutrade(), ccxt.btcbox(), ccxt.btcchina(), ccxt.btcexchange(), ccxt.btcmarkets(), ccxt.btctradeua(), ccxt.btcturk(), ccxt.bxinth(), ccxt.ccex(), ccxt.cex(), ccxt.chbtc(), ccxt.chilebit(), ccxt.coincheck(), ccxt.coinfloor(), ccxt.coingi(), ccxt.coinmarketcap(), ccxt.coinmate(), ccxt.coinspot(), ccxt.cryptopia(), ccxt.dsx(), ccxt.exmo(), ccxt.flowbtc(), ccxt.foxbit(), ccxt.fybse(), ccxt.fybsg(), ccxt.gatecoin(), ccxt.gateio(), ccxt.gdax(), ccxt.gemini(), ccxt.getbtc(), ccxt.hitbtc(), ccxt.independentreserve(), ccxt.itbit(), ccxt.jubi(), ccxt.kraken(), ccxt.kucoin(), ccxt.kuna(), ccxt.lakebtc(), ccxt.liqui(), ccxt.livecoin(), ccxt.luno(), ccxt.mercado(), ccxt.mixcoins(), ccxt.nova(), ccxt.okcoincny(), ccxt.okcoinusd(), ccxt.okex(), ccxt.paymium(), ccxt.poloniex(), ccxt.qryptos(), ccxt.quadrigacx(), ccxt.southxchange(), ccxt.surbitcoin(), ccxt.therock(), ccxt.tidex(), ccxt.urdubit(), ccxt.vaultoro(), ccxt.vbtc(), ccxt.virwox(), ccxt.wex(), ccxt.xbtce(), ccxt.yobit(), ccxt.yunbi(), ccxt.zaif(), ccxt.zb() ] for count, exchange in enumerate([str(x) for x in exchanges]): if exchange_in.lower() in exchange: return exchanges[count] break
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
ccxt.bitkk(), ccxt.bitlish(), ccxt.bitmarket(), ccxt.bitmex(), ccxt.bitso(), ccxt.bitstamp(), ccxt.bitstamp1(), ccxt.bittrex(), ccxt.bitz(), ccxt.bl3p(), ccxt.bleutrade(), ccxt.braziliex(), ccxt.btcbox(), ccxt.btcchina(), ccxt.btcexchange(), ccxt.btcmarkets(), ccxt.btctradeim(), ccxt.btctradeua(), ccxt.btcturk(), ccxt.btcx(), ccxt.bxinth(), ccxt.ccex(), ccxt.cex(), ccxt.chbtc(), ccxt.chilebit(), ccxt.cobinhood(), ccxt.coincheck(), ccxt.coinegg(), ccxt.coinex(), ccxt.coinexchange(), ccxt.coinfloor(),