# Path: OnePy/constants.py
# class ActionType(Enum):
# 
#     Buy = 'Buy'
#     Sell = 'Sell'
#     Short = 'Short'
#     Cover = 'Cover'
# 
#     Exit_all = 'Exit_all'
#     Cancel = 'Cancel'
# 
# class OrderType(Enum):
# 
#     Market = 'Market'
#     Limit = 'Limit'
#     Stop = 'Stop'
#     Trailing_stop = 'Trailing_stop'
# 
#     Limit_pct = 'Limit_pct'
#     Stop_pct = 'Stop_pct'
#     Trailing_stop_pct = 'Trailing_stop_pct'
# 
# Path: OnePy/sys_module/components/exceptions.py
# class OrderConflictError(Exception):
#     pass
# 
# class PctRangeError(Exception):
#     pass
# 
# Path: OnePy/sys_module/metabase_env.py
# class OnePyEnvBase:
#     """作为基类，提供env共享单例给各个模块"""
#     env = Environment


from itertools import count
from typing import Union
from dataclasses import dataclass, field
from OnePy.constants import ActionType, OrderType
from OnePy.sys_module.components.exceptions import (OrderConflictError,
                                                    PctRangeError)
from OnePy.sys_module.metabase_env import OnePyEnvBase
        self.env.signals_pending_cur.append(self)

        if self.env.is_save_original:
            self.env.signals_pending.append(self)


@dataclass
class SignalByTrigger(SignalForPending):
    counter = count(1)

    order_type: OrderType = None

    mkt_id: int = None
    trigger_key: str = None

    execute_price: float = None  # 用来确定是否是必成单,用于挂单
    first_cur_price: float = None  # 记录挂单信号产生时候的价格
    parent_order: str = None  # 其实不是str，是一个order对象

    def _save_signals(self):
        self.env.signals_trigger_cur.append(self)

        if self.env.is_save_original:
            self.env.signals_trigger.append(self)


@dataclass
class SignalCancelBase(OnePyEnvBase):

    counter = None

# Path: OnePy/constants.py
# class ActionType(Enum):
# 
#     Buy = 'Buy'
#     Sell = 'Sell'
#     Short = 'Short'
#     Cover = 'Cover'
# 
#     Exit_all = 'Exit_all'
#     Cancel = 'Cancel'
# 
# class OrderType(Enum):
# 
#     Market = 'Market'
#     Limit = 'Limit'
#     Stop = 'Stop'
#     Trailing_stop = 'Trailing_stop'
# 
#     Limit_pct = 'Limit_pct'
#     Stop_pct = 'Stop_pct'
#     Trailing_stop_pct = 'Trailing_stop_pct'
# 
# Path: OnePy/sys_module/components/exceptions.py
# class OrderConflictError(Exception):
#     pass
# 
# class PctRangeError(Exception):
#     pass
# 
# Path: OnePy/sys_module/metabase_env.py
# class OnePyEnvBase:
#     """作为基类，提供env共享单例给各个模块"""
#     env = Environment


# Path: OnePy/sys_module/models/signals.py
from itertools import count
from typing import Union
from dataclasses import dataclass, field
from OnePy.constants import ActionType, OrderType
from OnePy.sys_module.components.exceptions import (OrderConflictError,
                                                    PctRangeError)
from OnePy.sys_module.metabase_env import OnePyEnvBase

        self.env.signals_pending_cur.append(self)

        if self.env.is_save_original:
            self.env.signals_pending.append(self)


@dataclass
class SignalByTrigger(SignalForPending):
    counter = count(1)

    order_type: OrderType = None

    mkt_id: int = None
    trigger_key: str = None

    execute_price: float = None  # 用来确定是否是必成单,用于挂单
    first_cur_price: float = None  # 记录挂单信号产生时候的价格
    parent_order: str = None  # 其实不是str，是一个order对象

    def _save_signals(self):
        self.env.signals_trigger_cur.append(self)

        if self.env.is_save_original:
            self.env.signals_trigger.append(self)


@dataclass
class SignalCancelBase(OnePyEnvBase):

    counter = None

    action_type: ActionType