这是class optiondata里的一段, updatetrade只需要更新pos greeks但是update tick的时候应该是都要计算,因为option的greek 组合的greek都会受impv的影响
def update_tick(self, tick: TickData) -> None:
""""""
super().update_tick(tick)
self.calculate_option_impv()
def update_trade(self, trade: TradeData) -> None:
""""""
super().update_trade(trade)
self.calculate_pos_greeks()
def update_underlying_tick(self, underlying_adjustment: float) -> None:
""""""
self.underlying_adjustment = underlying_adjustment
self.calculate_option_impv()
self.calculate_theo_greeks()
self.calculate_pos_greeks()
因为我自己构造几个tick然后手工触发update tick发现不同的顺序传入tick,最后算出来组合的结果不同:
p.update_tick(tick_data)
p.update_tick(tick_data_p)
p.update_tick(tick_data_c)
所以我觉得optiondata updatetick的时候,需要计算impv greek posgreek 同时chain updatetick的时候也需要计算posgreeks