예제 #1
0
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
예제 #2
0
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.btcx(),ccxt.bxinth(),ccxt.ccex(),ccxt.cex(),ccxt.chbtc(),ccxt.chilebit(),ccxt.coincheck(),ccxt.coinfloor(),ccxt.coingi(),ccxt.coinmarketcap(),ccxt.coinmate(),
                         ccxt.coinsecure(),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.huobi(),ccxt.huobicny(),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
예제 #3
0
    def __init__(self,
                 key=None,
                 secret=None,
                 currency_from="ZAR",
                 currency_to="BTC"):
        super().__init__(currency_from, currency_to)

        self.exchange = ccxt.luno()
        self.exchange.apiKey = key
        self.exchange.secret = secret

        self.set_sell_fees(variable=1 / 100)
        # TODO: This fee is for BTC receive... I need to still add an init method to set appropriate fees
        self.set_receive_fees(fixed=0.0002)
        self.set_withdrawl_fees(fixed=8.50)
예제 #4
0
def getLunoPrices(type):
    print()
    print("### Luno ###")
    luno = ccxt.luno()

    global luno_tickers
    luno_tickers = None
    while luno_tickers == None:
        try:
            luno_tickers = luno.fetch_ticker('BTC' + "/" + locCurrency)
            #print(luno_tickers)
            time.sleep(2)
        except:
            print("Timeout exception. Waiting....")
            time.sleep(10)

        luno_ask = (luno_tickers[type])
        ex3Prices['BTC'] = (luno_ask)
        print("Unit: " + 'BTC' + " ; Prices: " + str(ex3Prices['BTC']))
예제 #5
0
파일: main.py 프로젝트: CBChurch/PyBot
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)
예제 #6
0
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
예제 #7
0
 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(),
 ccxt.negociecoins(),
 ccxt.nova(),
 ccxt.okcoincny(),
 ccxt.okcoinusd(),
 ccxt.okex(),
 ccxt.paymium(),
 ccxt.poloniex(),
 ccxt.qryptos(),
 ccxt.quadrigacx(),
 ccxt.quoinex(),
 ccxt.southxchange(),
 ccxt.surbitcoin(),
예제 #8
0
import ccxt
from datetime import datetime
import pandas
import matplotlib.pyplot as plt

# collect the candlestick data from Luno
luno = ccxt.luno()
trading_pair = 'BTC/EUR'
candles = luno.fetch_ohlcv(trading_pair, '1h')

dates = []
open_data = []
high_data = []
low_data = []
close_data = []

# format the data to match the charting library
for candle in candles:
    dates.append(datetime.fromtimestamp(candle[0] / 1000.0))
    open_data.append(candle[1])
    high_data.append(candle[2])
    low_data.append(candle[3])
    close_data.append(candle[4])

#plt.plot(dates,open_data)
#plt.plot(dates,close_data)
plt.plot(dates,low_data)
plt.plot(dates,high_data)
plt.show()