Пример #1
0
    def __init__(self,
                 target_currency: str,
                 target_interval_in_sec: int = 5,
                 should_db_logging: bool = True,
                 is_backtesting: bool = False,
                 start_time: int = None,
                 end_time: int = None):

        # init virtual mm when backtesting
        v_mm1 = VirtualMarketManager(Market.VIRTUAL_CO, 0.001, 4000000, 0.04,
                                     target_currency)
        v_mm2 = VirtualMarketManager(Market.VIRTUAL_GP, 0.00075, 400000, 0.4,
                                     target_currency)

        super().__init__(v_mm1, v_mm2, target_currency, target_interval_in_sec,
                         should_db_logging, is_backtesting, start_time,
                         end_time)

        self.COIN_TRADING_UNIT = 0.0005
        self.NEW_SPREAD_THRESHOLD = 0
        self.REV_SPREAD_THRESHOLD = 0
        self.MARGIN_KRW_THRESHOLD = 0
        self.SLIPPAGE_HEDGE = 0  # 향후에 거래량을 보고 결정할 parameter, 0.01로 거래한다는 가정하에 0.03으로 설정
        self.REV_FACTOR = 1

        # init mongo related
        self.mm1_data_col = SharedMongoClient.get_coinone_db()[
            self.target_currency + "_orderbook"]
        self.mm2_data_col = SharedMongoClient.get_gopax_db()[
            self.target_currency + "_orderbook"]

        self.mm1_buy_coin_trading_unit = self.mm1.calc_actual_coin_need_to_buy(
            self.COIN_TRADING_UNIT)
        self.mm2_buy_coin_trading_unit = self.mm2.calc_actual_coin_need_to_buy(
            self.COIN_TRADING_UNIT)
Пример #2
0
    def __init__(self,
                 target_currency: str,
                 target_interval_in_sec: int = 5,
                 should_db_logging: bool = True,
                 is_backtesting: bool = False,
                 is_init_setting_opt: bool = False,
                 start_time: int = None,
                 end_time: int = None):

        if not is_backtesting:
            mm1 = CoinoneMarketManager()
            mm2 = GopaxMarketManager()
        else:
            mm1 = VirtualMarketManager(Market.VIRTUAL_CO, 0.001, 5000000, 0.5,
                                       target_currency)
            mm2 = VirtualMarketManager(Market.VIRTUAL_GP, 0.00075, 500000, 5,
                                       target_currency)

        super().__init__(mm1, mm2, target_currency, target_interval_in_sec,
                         should_db_logging, is_backtesting, start_time,
                         end_time)

        self.MAX_COIN_TRADING_UNIT = 1
        self.MIN_COIN_TRADING_UNIT = 0
        self.MAX_OB_INDEX_NUM = 1
        self.NEW_SPREAD_THRESHOLD = 0
        self.REV_SPREAD_THRESHOLD = 0
        self.NEW_FACTOR = 1
        self.REV_FACTOR = 1

        self.mm1_data_cur = None
        self.mm2_data_cur = None
        self.trade_new = 0
        self.trade_rev = 0

        # init mongo related
        self.mm1_data_col = SharedMongoClient.get_coinone_db()[
            self.target_currency + "_orderbook"]
        self.mm2_data_col = SharedMongoClient.get_gopax_db()[
            self.target_currency + "_orderbook"]
        self.is_init_setting_opt = is_init_setting_opt