def get_btc_rates(): luno = ccxt.luno() bitstamp = ccxt.bitstamp() ice3x = ccxt.ice3x() luno_btc = luno.fetch_ticker('BTC/ZAR') bs_btc = bitstamp.fetch_ticker('BTC/USD') ice_btc = ice3x.fetch_ticker('BTC/ZAR') return luno_btc, bs_btc, ice_btc
def main(): last_update_id = None start_time = datetime.datetime.now() RunBot = True morningMessage = False sesh = requests.session() # ccxt luno = ccxt.luno() bitstamp = ccxt.bitstamp() ice3x = ccxt.ice3x() src_bot.check_arb(start_time - start_time, start_time, base_chat_id, URL, db, runNow=True, s=sesh, bitstamp=bitstamp, luno=luno, ice3x=ice3x) db.setup() print("Listening...") try_count = 0 triggerFlag = True while RunBot: with sesh as bot_session: try: updates = src_bot.get_updates(URL, s=bot_session, offset=last_update_id) if len(updates["result"]) > 0: last_update_id = src_bot.get_last_update_id(updates) + 1 tdiff = datetime.datetime.now() - start_time RunBot, triggerFlag = src_bot.bot_responses( updates, URL, token, db, s=bot_session, triggerFlag=triggerFlag) start_time, triggerFlag = src_bot.check_arb( tdiff, start_time, base_chat_id, URL, db, s=bot_session, bitstamp=bitstamp, luno=luno, ice3x=ice3x, triggerFlag=triggerFlag) morningMessage = src_bot.good_morning(morningMessage, base_chat_id, URL, token, db, s=bot_session) gc.collect() try_count = 0 except Exception as e: CT = datetime.datetime.now() logging.debug(str(CT) + ' ' + str(e)) try_count += 1 #print updates print("Bot has failed {n} times".format(n=try_count)) gc.collect() if try_count >= 100: src_bot.send_message("Bot failed 100 times in a row", chat_id=base_chat_id, URL=URL, s=bot_session) RunBot = False else: time.sleep(3 * 60) time.sleep(5)
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.flowbtc(), ccxt.foxbit(), ccxt.fybse(), ccxt.fybsg(), ccxt.gatecoin(), ccxt.gateio(), ccxt.gdax(), ccxt.gemini(), ccxt.getbtc(), ccxt.hadax(), ccxt.hitbtc(), ccxt.hitbtc2(), ccxt.huobi(), ccxt.huobicny(), ccxt.huobipro(), ccxt.ice3x(), ccxt.independentreserve(), ccxt.indodax(), ccxt.itbit(), ccxt.jubi(), ccxt.kraken(), ccxt.kucoin(), ccxt.kuna(), ccxt.lakebtc(), ccxt.lbank(), ccxt.liqui(), ccxt.livecoin(), ccxt.luno(), ccxt.lykke(), ccxt.mercado(), ccxt.mixcoins(),