def __init__(self, cta_engine: CtaEngine, strategy_name, vt_symbol, setting): """""" super().__init__(cta_engine, strategy_name, vt_symbol, setting) self.last_filled_order: Optional[OrderData, None] = None self.tick: Optional[TickData, None] = None self.contract: Optional[ContractData, None] = None self.account: Optional[AccountData, None] = None self.bg_1hour = BarGenerator(self.on_bar, 1, on_window_bar=self.on_1hour_bar, interval=Interval.HOUR) # 1hour self.bg_4hour = BarGenerator(self.on_bar, 4, on_window_bar=self.on_4hour_bar, interval=Interval.HOUR) # 4hour # self.cta_engine.event_engine.register(EVENT_ACCOUNT + 'BINANCE.币名称', self.process_acccount_event) # self.cta_engine.event_engine.register(EVENT_ACCOUNT + "BINANCE.USDT", self.process_account_event) self.buy_orders = [] # 买单id列表。 self.sell_orders = [] # 卖单id列表。 self.min_notional = 11 # 最小的交易金额.
def __init__(self, cta_engine, strategy_name, vt_symbol, setting): """""" super().__init__(cta_engine, strategy_name, vt_symbol, setting) self.rsi_long = 50 + self.rsi_signal self.rsi_short = 50 - self.rsi_signal self.bg5 = BarGenerator(self.on_bar, 5, self.on_5min_bar) self.am5 = ArrayManager() self.bg15 = BarGenerator(self.on_bar, 15, self.on_15min_bar) self.am15 = ArrayManager()
def __init__(self, cta_engine: CtaEngine, strategy_name, vt_symbol, setting): """""" super().__init__(cta_engine, strategy_name, vt_symbol, setting) self.bg2 = BarGenerator(self.on_bar, 2, self.on_2min_bar, Interval.MINUTE) self.bg5 = BarGenerator(self.on_bar, 5, self.on_5min_bar, Interval.MINUTE) self.bg_1hour = BarGenerator(self.on_bar, 1, self.on_1hour_bar, Interval.HOUR) self.place_order = False self.orders = []
def __init__(self, cta_engine, strategy_name, vt_symbol, setting): """""" super().__init__(cta_engine, strategy_name, vt_symbol, setting) self.bg = BarGenerator(self.on_bar) self.am = ArrayManager() self.bars = []
def __init__(self, cta_engine: CtaEngine, strategy_name, vt_symbol, setting): """""" super().__init__(cta_engine, strategy_name, vt_symbol, setting) self.last_filled_order: Optional[OrderData, None] = None self.tick: Optional[TickData, None] = None self.contract: Optional[ContractData, None] = None self.account: Optional[AccountData, None] = None self.bg = BarGenerator(self.on_bar, 15, self.on_15min_bar, Interval.MINUTE) # 15分钟的数据. self.am = MyArrayManager(60) # 默认是100,设置60 # ArrayManager # self.cta_engine.event_engine.register(EVENT_ACCOUNT + 'BINANCE.币名称', self.process_acccount_event) # 现货的资产订阅 # self.cta_engine.event_engine.register(EVENT_ACCOUNT + "BINANCE.USDT", self.process_account_event) # # 合约的资产订阅 # self.cta_engine.event_engine.register(EVENT_ACCOUNT + "BINANCES.USDT", self.process_account_event) self.buy_orders = [] # 买单id列表。 self.sell_orders = [] # 卖单id列表。 self.min_notional = 11 # 最小的交易金额.
def __init__(self, cta_engine: CtaEngine, strategy_name, vt_symbol, setting): """""" super().__init__(cta_engine, strategy_name, vt_symbol, setting) self.bg_1hour = BarGenerator(self.on_bar, 1, self.on_1hour_bar, Interval.HOUR) self.am = ArrayManager(size=100) # 时间序列,类似我们用的pandas, 值保留最近的N个K线的数据.
def __init__(self, cta_engine, strategy_name, vt_symbol, setting): """""" super(AtrRsiStrategy, self).__init__(cta_engine, strategy_name, vt_symbol, setting) self.bg = BarGenerator(self.on_bar, 15, self.on_15min_bar) self.am = ArrayManager()