示例#1
0
def api_by_name(exchange_name):
    if exchange_name == 'exmo':
        return ccxt.exmo()
    elif exchange_name == 'yobit':
        return ccxt.yobit()
    elif exchange_name == 'hitbtc':
        return ccxt.hitbtc()
    elif exchange_name == 'livecoin':
        return ccxt.livecoin()
    else:
        raise Exception("Unknown exchange")
示例#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):
     self.k = ct.kraken()
     self.y = ct.yobit()
     self.p = ct.poloniex()
     self.coinmarket = ct.coinmarketcap()
     self.liqui = ct.bitfinex()
     print(ct.exchanges)
     print(self.k.hasFetchOHLCV, self.k.rateLimit)
     print(self.y.hasFetchOHLCV, self.y.rateLimit)
     print(self.p.hasFetchOHLCV, self.p.rateLimit)
     # print(self.coinmarket.hasFetchOHLCV, self.coinmarket.rateLimit)
     keys_conf = conf.TradeKeys()
     #print(keys_conf.keys_info)
     self.k.apiKey = keys_conf.keys_info['kraken']['public']
     self.k.secret = keys_conf.keys_info['kraken']['secret']
     #self.k.load_markets()
     print(self.k.symbols)
示例#4
0
 def setup_clients(self):
     self.exchanges['Bittrex'] = ccxt.bittrex({
         'apiKey':
         self.meta['Bittrex']['public'],
         'secret':
         self.meta['Bittrex']['secret'],
     })
     self.exchanges['Poloniex'] = ccxt.poloniex({
         'apiKey':
         self.meta['Poloniex']['public'],
         'secret':
         self.meta['Poloniex']['secret'],
     })
     self.exchanges['YoBit'] = ccxt.yobit({
         'apiKey':
         self.meta['YoBit']['public'],
         'secret':
         self.meta['YoBit']['secret'],
     })
     self.exchanges['HitBTC'] = ccxt.hitbtc2({
         'apiKey':
         self.meta['HitBTC']['public'],
         'secret':
         self.meta['HitBTC']['secret'],
     })
     self.exchanges['Tidex'] = ccxt.tidex({
         'apiKey':
         self.meta['Tidex']['public'],
         'secret':
         self.meta['Tidex']['secret'],
     })
     self.exchanges['Binance'] = ccxt.binance({
         'options': {
             'adjustForTimeDifference': True
         },
         'apiKey':
         self.meta['Binance']['public'],
         'secret':
         self.meta['Binance']['secret'],
     })
     self.exchanges['Bitfinex'] = ccxt.bitfinex({
         'apiKey':
         self.meta['Bitfinex']['public'],
         'secret':
         self.meta['Bitfinex']['secret'],
     })
def yobitAgg(symbols):
    result = []
    try:
        yobit = ccxt.yobit({
            'apiKey': 'apiKey',
            'secret': 'secret',
            'options': {
                'adjustForTimeDifference': True
            }
        })
        totalBalance = yobit.fetch_balance()["free"]
        exchangeSymbols = yobit.symbols
        checkSymbols = list(np.intersect1d(exchangeSymbols, symbols))
        allData = yobit.fetch_tickers(checkSymbols)
        ethPrice = yobit.fetch_ticker("ETH/USD")["last"]
        btcPrice = yobit.fetch_ticker("BTC/USD")["last"]
        for s in checkSymbols:
            try:
                quote = s.split("/")[-1]
                dataSymbols = allData[s]
                coinBalance = totalBalance.get(s.split("/")[0], 0)
                volume = int(float(dataSymbols["baseVolume"]))
                ask = dataSymbols["ask"]
                bid = dataSymbols["bid"]
                last = float(dataSymbols["last"])
                if quote == "BTC":
                    volume = int(volume * btcPrice * last)
                elif quote == "ETH":
                    volume = int(volume * ethPrice * last)
                else:
                    volume = int(volume * dataSymbols["last"])
                volume = volume / ethPrice
                result.append(["yobit", s, coinBalance, ask, bid, volume])
            except:
                print("Yobit couldn`t get " + s)
                continue
    except Exception as e:
        print(str(e)[:150])
    return (result)
示例#6
0
    # (ccxt.bitstamp(), 'https://www.bitstamp.net/'),
    # 10. bitFlyer (need apiKey and secret)
    # (ccxt.bitflyer(), 'https://lightning.bitflyer.jp/trade/{0}{1}'),
    # # 12. Gemini
    # (ccxt.gemini(), 'https://gemini.com/marketplace/'),
    # # 14. Binance
    # (ccxt.binance({
    #     'apiKey': BINANCE_KEY,
    #     'secret': BINANCE_SECRET,
    # }), 'https://www.binance.com/trade.html?symbol={0}_{1}'),
    # # 16. WEX
    # (ccxt.wex(), 'https://wex.nz/exchange/{0}_{1}'),
    # # 21. CEX.IO
    # (ccxt.cex(), 'https://cex.io/{0}-{1}'),
    # 22. YoBit
    (ccxt.yobit(), 'https://yobit.net/en/trade/{0}/{1}'),
    # # 24. Gatecoin
    # (ccxt.gatecoin(), 'https://gatecoin.com/marketData'),
    # 25. Liqui
    (ccxt.liqui(), 'https://liqui.io/#/exchange/{0}_{1}'),
    # # 26. OKEx
    # (ccxt.okex(), 'https://www.okex.com/'),
    # 43. Tidex
    (ccxt.tidex(), 'https://tidex.com/exchange/{0}/{1}'),
    # 52. Cryptopia
    (ccxt.cryptopia(), 'https://www.cryptopia.co.nz/Exchange/?market={0}_{1}'),
]


def main():
    now = datetime.now()
示例#7
0
from cursesmenu import *
from cursesmenu.items import *
import time
import ccxt

yobit = ccxt.yobit()
yobit.apiKey = '5CB21016D65C1AA4D0B8AA5749A0C0EB'
yobit.secret = '6e51261d69538557dc3b145e94785d80'


def pump():
    print("Pump")
    balance_dispo = yobit.fetch_balance()["BTC"]["total"]
    print("Voici la balance BTC disponible: " + str(balance_dispo))
    montant_achat = float(
        input("Merci de renseigner le montant d'achat desirée en btc: ")
    )  # BTC/ASK
    pourcent_ask = float(
        input(
            "Merci de renseigner le pourcentage en plus du ask desirée(1.xx): "
        ))
    pourcent_vente = float(
        input("Merci de renseigner le pourcentage de vente desirée(1.xx): "))
    market = input("Selectionner la crypto monnaie: ")
    marketbtc = market + "_BTC"
    ticker_rate = yobit.fetch_ticker(marketbtc.lower())['ask']
    rate_raw = '{0:.10f}'.format(ticker_rate)
    rate_buy = float(rate_raw) * pourcent_ask
    rate_buy_form = '{0:.10f}'.format(rate_buy)
    rate_sell = float(rate_raw) * pourcent_vente
    rate_sell_form = '{0:.10f}'.format(rate_sell)
示例#8
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
示例#9
0
文件: ccxtbot.py 项目: ynzheng/ccbot
def main(argv):
    delay = 1

    all_dict = {
        'ETH/DOGE': [
            'cryptopia',
            'yobit',
        ],
        #'ETH/USDT': [
        #'cryptopia',
        #'yobit',
        #],
    }

    #tikers = cpia.fetch_ticker('ETH/DOGE')
    #pp(tikers)
    local_data = True
    if not local_data:
        cryptopia = ccxt.cryptopia()
        yobit = ccxt.yobit()
        oba = cryptopia.fetch_order_book('ETH/DOGE', {'orderCount': 5})
        obb = yobit.fetch_order_book('ETH/DOGE', {'limit': 5})
        name_a = cryptopia.name
        name_b = yobit.name
        pp(oba)
        pp(obb)
    else:
        name_a = "Cryptopia"
        name_b = "YoBit"
        oba = g_a
        obb = g_b
    print_exchange_info('ETH/DOGE', name_a, oba, name_b, obb)

    if local_data:
        return

    for symbol, v in all_dict.iteritems():
        exlst = []
        for idx, ex in enumerate(v):
            exlst.append(eval('ccxt.%s()' % ex))
            #print(exlst[idx].name)

        if not exlst:
            print('%s can not be exchange in any exchang' % symbol)
            continue
        if len(exlst) == 1:
            print("%s can only be exchange in %s\n" % (symbol, exlst[0].name))
            continue

        # TODO: 需要两两组合来测试
        # 暂时只处理首两个交易所的测试
        oblst = []
        for ex in exlst:
            if ex.name == 'Cryptopia':
                oblst.append(ex.fetch_order_book(symbol, {'orderCount': 5}))
            elif ex.name == 'YoBit':
                oblst.append(ex.fetch_order_book(symbol, {'limit': 5}))
            else:
                oblst.append(ex.fetch_order_book(symbol))

        print_exchange_info(symbol, exlst[0].name, oblst[0], exlst[1].name,
                            oblst[1])
示例#10
0
    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(),
    ccxt.therock(),
    ccxt.tidex(),
    ccxt.urdubit(),
    ccxt.vaultoro(),
    ccxt.vbtc(),
    ccxt.virwox(),
    ccxt.wex(),
    ccxt.xbtce(),
    ccxt.yobit(),
    ccxt.yunbi(),
    ccxt.zaif(),
    ccxt.zb()
]