Ejemplo n.º 1
0
    def __init__(self, settings, order_log_path, cache_handler):
        ''' 
        
        '''
        logging.info('[BotCore] Initilizing the BotCore object.')

        self.rest_api           = rest_master.Binance_REST(settings['public_key'], settings['private_key'])
        self.socket_api         = socket_master.Binance_SOCK()

        self.order_log_path     = order_log_path
        self.cache_handler      = cache_handler

        self.run_type           = settings['run_type']
        self.market_type        = settings['market_type']

        self.max_candles        = settings['max_candles']
        self.max_depth          = settings['max_depth']

        ## Trader settings.
        self.MAC                = settings['trading_currency']
        self.candle_Interval    = settings['trader_interval']

        self.trader_objects     = []
        self.trading_markets    = settings['trading_markets']

        self.coreState          = 'READY'
Ejemplo n.º 2
0
    def __init__(self, settings, logs_dir, cache_dir):
        ''' 
        
        '''
        logging.info('[BotCore] Initilizing the BotCore object.')

        self.rest_api = rest_master.Binance_REST(settings['public_key'],
                                                 settings['private_key'])
        self.socket_api = socket_master.Binance_SOCK()

        self.logs_dir = logs_dir
        self.cache_dir = cache_dir

        self.run_type = settings['run_type']
        self.market_type = settings['market_type']

        self.update_bnb_balance = settings['update_bnb_balance']

        self.max_candles = settings['max_candles']
        self.max_depth = settings['max_depth']

        pair_one = settings['trading_markets'][0]

        self.quote_asset = pair_one[:pair_one.index('-')]
        self.base_currency = settings['trading_currency']
        self.candle_Interval = settings['trader_interval']

        self.trader_objects = []
        self.trading_markets = settings['trading_markets']

        self.coreState = None
Ejemplo n.º 3
0
    def __init__(self, runType, marketType, publicKey, privateKey, MAC,
                 trading_markets, candle_Interval, max_candles, max_depth,
                 order_log_path):
        ''' 
        
        '''
        logging.info('[BotCore] Initilizing the BotCore object.')

        self.rest_api = rest_master.Binance_REST(publicKey, privateKey)
        self.order_log_path = order_log_path

        self.run_type = runType
        self.market_type = marketType

        logging.info('[BotCore] Initilizing BinancesSOCK object.')
        self.socket_api = socket_master.Binance_SOCK()

        for market in trading_markets:
            self.socket_api.set_candle_stream(symbol=market,
                                              interval=candle_Interval)
            self.socket_api.set_manual_depth_stream(symbol=market,
                                                    update_speed='1000ms')

        self.socket_api.set_userDataStream(self.rest_api, marketType)

        self.socket_api.BASE_CANDLE_LIMIT = max_candles
        self.socket_api.BASE_DEPTH_LIMIT = max_depth

        self.socket_api.build_query()
        self.socket_api.set_live_and_historic_combo(self.rest_api)

        ## Trader settings.
        self.MAC = MAC
        self.candle_Interval = candle_Interval

        self.trader_objects = []
        self.trading_markets = trading_markets

        self.coreState = 'READY'
Ejemplo n.º 4
0
#! /usr/bin/env python3

from binance_api import rest_master

rest_api = rest_master.Binance_REST(public_key='', private_key='')

# Rest endpoints to test:
def test_rest():
	print('Testing... [get_blvt_info]')
	rest_api.get_blvt_info(IS_TEST=True)
	print('Testing... [subscribe_blvt]')
	rest_api.subscribe_blvt(IS_TEST=True)
	print('Testing... [query_subscription_record]')
	rest_api.query_subscription_record(IS_TEST=True)
	print('Testing... [redeem_blvt]')
	rest_api.redeem_blvt(IS_TEST=True)
	print('Testing... [query_redemption_record]')
	rest_api.query_redemption_record(IS_TEST=True)
	print('Testing... [get_blvt_userLimit]')
	rest_api.get_blvt_userLimit(IS_TEST=True)
	print('Testing... [get_swap_pools]')
	rest_api.get_swap_pools()
	print('Testing... [get_liquidity_poolInfo]')
	rest_api.get_liquidity_poolInfo(IS_TEST=True)
	print('Testing... [add_liquidity]')
	rest_api.add_liquidity(IS_TEST=True)
	print('Testing... [remove_liquidity]')
	rest_api.remove_liquidity(IS_TEST=True)
	print('Testing... [get_liquidity_record]')
	rest_api.get_liquidity_record(IS_TEST=True)
	print('Testing... [get_quote]')