def __init__(self, target_currency: str, mm1: MarketManager, mm2: MarketManager, is_test: bool): mm1_name = mm1.get_market_name().lower() mm2_name = mm2.get_market_name().lower() if is_test: self.trade_commander_col = SharedMongoClient.get_test_streamer_db( )["trade_commander"] self.balance_commander_col = SharedMongoClient.get_test_streamer_db( )["balance_commander"] if not is_test: self.trade_commander_col = SharedMongoClient.get_streamer_db( target_currency, mm1_name, mm2_name)["trade_commander"] self.balance_commander_col = SharedMongoClient.get_streamer_db( target_currency, mm1_name, mm2_name)["balance_commander"] self.trade_strategy = MCTSAnalyzer.min_coin_tradable_spread_strategy super().__init__(mm1, mm2, target_currency)
def __init__(self, target_currency: str, mm1_name: str, mm2_name: str, start_time: int, end_time: int, is_test: bool): self.mm1_name = mm1_name self.mm2_name = mm2_name self.target_currency = target_currency self.start_time = start_time self.end_time = end_time if is_test: self.rfab_ledger_col = SharedMongoClient.get_test_streamer_db( )["rfab_ledger"] self.transfer_ledger_col = SharedMongoClient.get_test_streamer_db( )["transfer_ledger"] self.invest_ledger_col = SharedMongoClient.get_test_streamer_db( )["invest_ledger"] else: self.rfab_ledger_col = SharedMongoClient.get_streamer_db( target_currency, mm1_name, mm2_name)["rfab_ledger"] self.transfer_ledger_col = SharedMongoClient.get_streamer_db( target_currency, mm1_name, mm2_name)["transfer_ledger"] self.invest_ledger_col = SharedMongoClient.get_streamer_db( target_currency, mm1_name, mm2_name)["invest_ledger"] try: self.file_dir = self.DEFAULT_DIR + '%s_%s_%s_ledger.xlsx' % ( self.target_currency, self.mm1_name, self.mm2_name) # set workbook self.target_wb: Workbook = load_workbook(self.file_dir) # set worksheet self.rfab_ws: Worksheet = self.target_wb.get_sheet_by_name("rfab") self.transfer_ws: Worksheet = self.target_wb.get_sheet_by_name( "transfer") self.invest_ws: Worksheet = self.target_wb.get_sheet_by_name( "investment") except FileNotFoundError: logging.error( "Filed Not Found!! Now creating New RFAB ledger xlsx!") self.write_new_ledger()
def __init__(self, target_currency: str, mm1: MarketManager, mm2: MarketManager, is_initiation_mode: bool, is_trading_mode: bool): self.streamer_db = SharedMongoClient.get_streamer_db() self.is_initiation_mode = is_initiation_mode self.is_trading_mode = is_trading_mode self.ocat_final_result = None self.mm1 = mm1 self.mm2 = mm2 self.mm1_name = self.mm1.get_market_name().lower() self.mm2_name = self.mm2.get_market_name().lower() self.mm1_krw_bal = float(self.mm1.balance.get_available_coin("krw")) self.mm2_krw_bal = float(self.mm2.balance.get_available_coin("krw")) self.mm1_coin_bal = float( self.mm1.balance.get_available_coin(target_currency)) self.mm2_coin_bal = float( self.mm2.balance.get_available_coin(target_currency)) self.target_currency = target_currency self.slicing_interval = Global.read_sliced_iyo_setting_config( self.target_currency)["slicing_interval"] self.streamer_start_time = int(time.time()) self.init_s_iyo_rewined_time = int(self.streamer_start_time - self.INITIATION_REWEIND_TIME) self.trading_mode_start_time = None self.trading_mode_s_iyo_rewined_time = None self._settlement_time = None self.cur_exhaust_ctrl_stage = 0 self.init_exhaust_ctrl_currency_bal = None self.cur_exhaust_ctrl_currency_bal = None
def __init__(self, target_currency: str, mm1: MarketManager, mm2: MarketManager, is_test: bool): # make instance of handler ref self.th_instance = Threshold() self.cond_instance = Condition() self.rec_instance = Recorder() # MARKET relevant self.mm1 = mm1 self.mm2 = mm2 self.is_test = is_test self.target_currency = target_currency self.mm1_name = self.mm1.get_market_name().lower() self.mm2_name = self.mm2.get_market_name().lower() self.mm1_krw_bal = float(self.mm1.balance.get_available_coin("krw")) self.mm2_krw_bal = float(self.mm2.balance.get_available_coin("krw")) self.mm1_coin_bal = float(self.mm1.balance.get_available_coin(target_currency)) self.mm2_coin_bal = float(self.mm2.balance.get_available_coin(target_currency)) # steamer init relevant if is_test: self.streamer_db = SharedMongoClient.get_test_streamer_db() if not is_test: self.streamer_db = SharedMongoClient.get_streamer_db(self.target_currency, self.mm1_name, self.mm2_name) # MCTU relevant self.mm1_ob = None self.mm2_ob = None self.streamer_min_trading_coin = None # TIME relevant self.streamer_start_time = int(time.time()) self.ocat_rewind_time = None self._bot_start_time = None self._settlement_time = None self.trading_mode_now_time = None
import logging from config.global_conf import Global from trader.market_manager.okcoin_market_manager import OkcoinMarketManager from trader.market_manager.bithumb_market_manager import BithumbMarketManager from config.shared_mongo_client import SharedMongoClient from temp.arbbot_ideas.risk_free_arb_bot_v3 import RiskFreeArbBotV3 Global.configure_default_root_logging(should_log_to_file=True, log_level=logging.WARNING) SharedMongoClient.initialize(should_use_localhost_db=True) RiskFreeArbBotV3( target_currency="xrp", mm1=BithumbMarketManager(), mm2=OkcoinMarketManager(), streamer_db=SharedMongoClient.get_streamer_db() ).run()