zvtvz / zvt

modular quant framework.
https://zvt.readthedocs.io/en/latest/
MIT License
3.08k stars 843 forks source link

可以更新几个trader的example吗 #194

Open kingmoon3 opened 2 years ago

kingmoon3 commented 2 years ago

例如examples里的macd_day_trader,

def on_profit_control(self):
    # 覆盖该函数做止盈 止损
    return super().on_profit_control()

def on_time(self, timestamp: pd.Timestamp):
    # 对selectors选出的标的做进一步处理,或者不使用selector完全自己根据时间和数据生成交易信号
    super().on_time(timestamp)

def on_trading_signals(self, trading_signals: List[TradingSignal]):
    # 批量处理交易信号,比如连接交易接口,发邮件,微信推送等
    super().on_trading_signals(trading_signals)

def on_trading_signal(self, trading_signal: TradingSignal):
    # 处理交易信号,比如连接交易接口,发邮件,微信推送等
    super().on_trading_signal(trading_signal)

def on_trading_open(self, timestamp):
    # 开盘自定义逻辑
    super().on_trading_open(timestamp)

诸如此类的自定义函数,没有例子可供参考,交易信号如何产生,文档内也没有相关说明,建议完善文档,谢谢。

foolcage commented 2 years ago

正在完善,出了文档的部分是比较稳定的,有些还需要优化代码的,文档会慢一点。