示例#1
0
    def get_factor_settings(mm1_name: str, mm2_name: str, target_currency: str,
                            max_trade_coin_end: float, threshold_end: int,
                            appx_unit_coin_price: int):

        trading_coin_limit = (1000 / appx_unit_coin_price)
        min_trading_coin = int(
            max(Global.read_min_trading_coin(mm1_name, target_currency),
                Global.read_min_trading_coin(mm2_name, target_currency)))

        return {
            "max_trading_coin": {
                "start": 0,
                "end": max_trade_coin_end,
                "step_limit": float(trading_coin_limit)
            },
            "min_trading_coin": {
                "start": min_trading_coin,
                "end": min_trading_coin,
                "step_limit": 0
            },
            "new": {
                "threshold": {
                    "start": 0,
                    "end": threshold_end,
                    "step_limit": 1
                }
            },
            "rev": {
                "threshold": {
                    "start": 0,
                    "end": threshold_end,
                    "step_limit": 1
                }
            }
        }
    def set_initial_trade_setting(self):
        # set streamer_min_trading_coin
        self.MIN_TRDBLE_COIN_MULTIPLIER = float(input("Please indicate Min Tradable Coin Multiplier (gte 1.0): "))
        self.streamer_min_trading_coin \
            = max(Global.read_min_trading_coin(self.mm1_name, self.target_currency),
                  Global.read_min_trading_coin(self.mm2_name, self.target_currency)) * self.MIN_TRDBLE_COIN_MULTIPLIER

        # set settlement related var
        settle_hour = int(input("Please type settlement hour (int only): "))
        settle_min = int(input("Please type settlement minute (int only): "))
        anal_rewind_hr = int(input("Please type [Initiation Mode] Rewind hour (int only): "))
        self.TIME_DUR_OF_SETTLEMENT = settle_hour * 60 * 60 + settle_min * 60

        # set rewind time for MCTU anal init mode
        self.ocat_rewind_time = int(self.streamer_start_time - anal_rewind_hr * 60 * 60)
示例#3
0
    def get_settings(mm1_name: str, mm2_name: str, target_currency: str,
                     start_time: int, end_time: int, division: int, depth: int,
                     consecution_time: int, is_virtual_mm: bool):
        if is_virtual_mm:
            mm1_tag = "VIRTUAL_%s" % mm1_name.upper()
            mm2_tag = "VIRTUAL_%s" % mm2_name.upper()
        elif not is_virtual_mm:
            mm1_tag = mm1_name.upper()
            mm2_tag = mm2_name.upper()
        else:
            raise Exception("Please type mm1 and mm2 correctly! ex) coinone")

        return {
            "target_currency": target_currency,
            "mm1": {
                "market_tag":
                getattr(Market, mm1_tag),
                "taker_fee":
                Global.read_market_fee(mm1_name, is_taker_fee=True),
                "maker_fee":
                Global.read_market_fee(mm1_name, is_taker_fee=False),
                "min_trading_coin":
                Global.read_min_trading_coin(mm1_name, target_currency),
                "krw_balance":
                10000000,
                "coin_balance":
                100
            },
            "mm2": {
                "market_tag":
                getattr(Market, mm2_tag),
                "taker_fee":
                Global.read_market_fee(mm2_name, is_taker_fee=True),
                "maker_fee":
                Global.read_market_fee(mm2_name, is_taker_fee=False),
                "min_trading_coin":
                Global.read_min_trading_coin(mm2_name, target_currency),
                "krw_balance":
                10000000,
                "coin_balance":
                100
            },
            "division": division,
            "depth": depth,
            "consecution_time": consecution_time,
            "start_time": start_time,
            "end_time": end_time
        }
 def is_bigger_than_min_trading_coin(self, amount: float,
                                     target_currency: str):
     key = self.market_tag.name + "_" + target_currency
     value = self.min_trading_coin_dict.get(key)
     if not value:
         # memo to eliminate the need to read from file every time
         value = Global.read_min_trading_coin(self.market_tag.name,
                                              target_currency)
         self.min_trading_coin_dict[key] = value
     return amount > value