Example #1
0
def get_symbol_df():
    """
    BiboxAPI: https://github.com/Biboxcom/API_Docs/wiki
    ccxt: https://github.com/ccxt/ccxt/
    """

    api = {"apiKey": 'eeccea338ecb24b796497f82765ba8ab71561d52',
           "secret": '5f7e2c9bd79ca6b3a7676ff7cdc6765e6d1c68ac'}

    ccxt_client = ccxt.bibox(api)
    symbol = 'BIX/GUSD'
    interval = '1m'

    symbol_l = ccxt_client.fetch_ohlcv(symbol, interval)
    bibox_index = [
        'date',
        'Open',
        'High',
        'Low',
        'Close',
        'Volume'
    ]
    symbol_df = pd.DataFrame(symbol_l, columns=bibox_index)

    symbol_df['date'] = symbol_df['date'].astype('datetime64[ms]')
    symbol_df['Close'] = symbol_df['Close'].astype('float64')
    symbol_df = symbol_df.sort_values(by=['date'], ascending=False)
    symbol_df = symbol_df.set_index(['date'])
    symbol_df.to_csv('./symbol_org.csv')
    df = symbol_df.copy()
    # df = df.rolling(min_periods=1, window=1).mean()
    df.to_csv('./symbol_mean.csv')
    df = df.reset_index()
    logging.info(df)
    return df
Example #2
0
 def __init__(self, instance=None, data=empty, **kwargs):
     super().__init__(instance=instance, data=data, **kwargs)
     params = {
         'apiKey': settings.BIBOX['API_KEY'],
         'secret': settings.BIBOX['SECRET_KEY'],
         'timeout': 30000,
         'enableRateLimit': True
     }
     self.ex = ccxt.bibox(params)
Example #3
0
def load_pairs():
    print('loading pairs')
    pairs = {}
    for index, exchange_name in enumerate(exchange_names):
        if exchange_name == 'bibox':
            pairs[exchange_name] = list(
                ccxt.bibox({
                    'apiKey': '0d218d65c98fe7941bf5f51cc6fcec874fc9706d',
                    'secret': 'caa17d59c68c8f8c09987774d98f52428a3834bf'
                }).load_markets().keys())
        else:
            pairs[exchange_name] = list(
                getattr(ccxt, exchange_name)().load_markets().keys())
    return pairs
Example #4
0
 def get(self, request, ticker, *args, **kwargs):
     ticker = ticker.upper()
     currency = 'USDT'
     symbol = f'{ticker}/{currency}'
     timeframe = '1d'
     from_datetime = '2015-01-01 00:00:00'
     params = {
         'apiKey': settings.BIBOX['API_KEY'], 'secret': settings.BIBOX['SECRET_KEY'],
         'timeout': 30000,
         'enableRateLimit': True
     }
     ccxt_ex = ccxt.bibox(params)
     from_timestamp = ccxt_ex.parse8601(from_datetime)
     ohlcv = ccxt_ex.fetch_ohlcv(symbol, timeframe, from_timestamp)
     
     df = pd.DataFrame(ohlcv, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume'])
     # print(list(df['close'].rolling(20).std().fillna('null')))
     sma = [
         list(df['close'].rolling(20).mean().fillna(0)),
         list(df['close'].rolling(50).mean().fillna(0)),
         list(df['close'].rolling(100).mean().fillna(0)),
     ]
     stda = [
         list(df['close'].rolling(20).std().fillna(0)),
         list(df['close'].rolling(50).std().fillna(0)),
         list(df['close'].rolling(100).std().fillna(0)),
     ]
     
     # print(type(df['close'].rolling(20).std().values), df['close'].rolling(20).std().values)
     serializer = self.serializer_class(data={
         'ticker': ticker, 'currency': currency,
         'timeframe': '1d', 'from_datetime': '2017-01-01 00:00:00',
         'ohlcv': ohlcv,
         'sma': sma, 'stda': stda,
     })
     serializer.is_valid()
     return Response(serializer.data)
Example #5
0
def log_for(pairs, name, current_time):
    if name == 'bibox':
        exchange = ccxt.bibox({
            'apiKey':
            '0d218d65c98fe7941bf5f51cc6fcec874fc9706d',
            'secret':
            'caa17d59c68c8f8c09987774d98f52428a3834bf'
        })
    else:
        exchange = getattr(ccxt, name)()
    exchange_dict = {}
    for symbol in pairs:
        print('trying for', symbol)
        try:
            order_book = exchange.fetch_l2_order_book(symbol)
            exchange_dict[symbol] = {'asks': [], 'bids': []}
            exchange_dict[symbol]['asks'] = order_book['asks']
            exchange_dict[symbol]['bids'] = order_book['bids']
        except:
            print('no luck for', symbol)
    with open(str(current_time) + '_' + name + '_orderbook.json',
              "w") as outfile:
        print('writing to file')
        json.dump(exchange_dict, outfile, indent=4)
Example #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
Example #7
0
import logging
import os

import ccxt

from core.exchange import CryptoExchange
from core.telegrambot import TelegramBot
from core.tradeexcutor import TradeExecutor

if __name__ == '__main__':
    logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s',
                        level=logging.INFO)

    c_dir = os.path.dirname(__file__)
    with open(os.path.join(c_dir, "config/secrets.txt")) as key_file:
        api_key, secret, telegram_tkn, user_id = key_file.read().splitlines()

    ccxt_ex = ccxt.bibox()
    ccxt_ex.apiKey = api_key
    ccxt_ex.secret = secret

    exchange = CryptoExchange(ccxt_ex)
    trade_executor = TradeExecutor(exchange)
    telegram_bot = TelegramBot(telegram_tkn, user_id, trade_executor)

    telegram_bot.start_bot()
Example #8
0
        return False


logging.basicConfig(
    level=logging.INFO,
    format=
    '%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
    datefmt='%Y/%m/%d %H:%M:%S',
    filename='myapp.log',
    filemode='w')
logger = logging.getLogger(__name__)
coinEX = ccxt.coinex()
zb = ccxt.zb()
okex = ccxt.okex()
bibox = ccxt.bibox({
    'apiKey': 'e115769a73f5e0d26e646da98ced53d5282e2646',
    'secret': '7c0d8b2769d952ed8a5ff5c9fd45721f6fdee76f',
})
while True:
    try:
        orderbookCoinEx_BCH = coinEX.fetch_order_book("BCH/USDT", 5)
        orderbookZB_BCH = zb.fetch_order_book("BCH/USDT", 5)
        orderbookOkEx_BCH = okex.fetch_order_book("BCH/USDT", 5)
        orderbookBibox_BCH = bibox.fetch_order_book("BCH/USDT", 5)
        orderbookCoinEx_BCH['exchangeID'] = 'CoinEx'
        orderbookZB_BCH['exchangeID'] = 'ZB'
        orderbookOkEx_BCH['exchangeID'] = 'OkEx'
        orderbookBibox_BCH['exchangeID'] = 'BiBox'

        orderbookCoinEx_ETC = coinEX.fetch_order_book("ETC/USDT", 5)
        orderbookZB_ETC = zb.fetch_order_book("ETC/USDT", 5)
        orderbookOkEx_ETC = okex.fetch_order_book("ETC/USDT", 5)
Example #9
0
import ccxt

exchanges = [
    ccxt._1broker(),
    ccxt._1btcxe(),
    ccxt.acx(),
    ccxt.allcoin(),
    ccxt.anxpro(),
    ccxt.bibox(),
    ccxt.binance(),
    ccxt.bit2c(),
    ccxt.bitbank(),
    ccxt.bitbay(),
    ccxt.bitfinex(),
    ccxt.bitfinex2(),
    ccxt.bitflyer(),
    ccxt.bithumb(),
    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(),