"""Use WonderTrader Simulator"""
"""https://github.com/drlgistics/Wt4ElegantRL"""
from meta.env_future_trading.wt4elegantrl.envs_simple_cta import SimpleCTAEnv
from meta.env_future_trading.wt4elegantrl.envs_simple_cta import (
    SimpleCTASubProcessEnv,
)


class FutureTradingEnv_WtTrainer(SimpleCTASubProcessEnv):
    env_num = 1
    max_step = 1500
    if_discrete = False

    @property
    def state_dim(self):
        return self.observation_space.shape[0]

    @property
    def action_dim(self):
        # if len(self.action_space.shape) > 0 else 10
        return self.action_space.shape[0]

    def __init__(self):
        super().__init__(
            **{
                # 'time_start': 202108301600,
                # 'time_end': 202108311600,
                "time_range": (
                    # (201901011600, 202101011600),
                    # (201901011600, 201906301600),
                    # (201906301600, 202001011600),
                    # (202001011600, 202006301600),
                    # (202006301600, 202101011600),
                    # (201812311600, 201901311600),
                    # (201901311600, 201902311600),
                    # (201902311600, 201903311600),
                    # (201903311600, 201904311600),
                    # (201904311600, 201905311600),
                    # (201905311600, 201906311600),
                    # (201906311600, 201907311600),
                    # (201907311600, 201908311600),
                    # (201908311600, 201909311600),
                    # (201909311600, 201910311600),
                    # (201910311600, 201911311600),
                    # (201911311600, 201912311600),
                    # (201912311600, 202001311600),
                    # (202001311600, 202002311600),
                    # (202002311600, 202003311600),
                    # (202003311600, 202004311600),
                    # (202004311600, 202005311600),
                    # (202005311600, 202006311600),
                    # (202006311600, 202007311600),
                    # (202007311600, 202008311600),
                    # (202008311600, 202009311600),
                    (202009311600, 202010311600),
                    (202010311600, 202011311600),
                    (202011311600, 202012311600),
                ),
                "slippage": 0,
                "mode": 1,
            }
        )


class FutureTradingEnv_WtEvaluator(SimpleCTASubProcessEnv):
    env_num = 1
    max_step = 1500
    if_discrete = False

    @property
    def state_dim(self):
        return self.observation_space.shape[0]

    @property
    def action_dim(self):
        # if len(self.action_space.shape) > 0 else 10
        return self.action_space.shape[0]

    def __init__(self):  # mode=3可以打开详细调试模式
        super().__init__(
            **{
                "time_range": (
                    # (202101011600, 202106301600),
                    # (201701011600, 201706301600),
                    # (201706301600, 201801011600),
                    # (201801011600, 201806301600),
                    # (201806301600, 201901011600),
                    (202012311600, 202101311600),
                    (202101311600, 202102311600),
                    (202102311600, 202103311600),
                    (202103311600, 202104311600),
                    (202104311600, 202105311600),
                    (202105311600, 202106311600),
                    (201612311600, 201701311600),
                    (201701311600, 201702311600),
                    (201702311600, 201703311600),
                    (201703311600, 201704311600),
                    (201704311600, 201705311600),
                    (201705311600, 201706311600),
                    (201706311600, 201707311600),
                    (201707311600, 201708311600),
                    (201708311600, 201709311600),
                    (201709311600, 201710311600),
                    (201710311600, 201711311600),
                    (201711311600, 201712311600),
                    (201712311600, 201801311600),
                    (201801311600, 201802311600),
                    (201802311600, 201803311600),
                    (201803311600, 201804311600),
                    (201804311600, 201805311600),
                    (201805311600, 201806311600),
                    (201806311600, 201807311600),
                    (201807311600, 201808311600),
                    (201808311600, 201809311600),
                    (201809311600, 201810311600),
                    (201810311600, 201811311600),
                    (201811311600, 201812311600),
                ),
                "slippage": 0,
                "mode": 1,
            }
        )


class FutureTradingEnv_WtTester(SimpleCTAEnv):
    env_num = 1
    max_step = 1500
    if_discrete = False

    @property
    def state_dim(self):
        return self.observation_space.shape[0]

    @property
    def action_dim(self):
        # if len(self.action_space.shape) > 0 else 10
        return self.action_space.shape[0]

    def __init__(self):  # mode=3可以打开详细调试模式
        super().__init__(
            **{
                "time_range": (
                    # (202101011600, 202106301600),
                    # (201701011600, 201706301600),
                    # (201706301600, 201801011600),
                    # (201801011600, 201806301600),
                    # (201806301600, 201901011600),
                    (202012311600, 202101311600),
                ),
                "slippage": 0,
                "mode": 2,
            }
        )
