# write a simple op class **Published by:** [wincloud](https://paragraph.com/@wincloud/) **Published on:** 2023-03-29 **URL:** https://paragraph.com/@wincloud/write-a-simple-op-class ## Content test codeclass Op: def __init__(self): # 自身的数据,占好坑位 self.df = None self.s = '' self.i = '' self.side = '' def accept_data(self, df, side=''): """ 用于接收数据 :param df: :param side: 方向 LONG SHORT :return: """ self.df = df self.side = side k = df.iloc[-1] self.s = k['s'] self.i = k['i'] def verify(self): """ 是否验证通过, :return: """ return True def is_long(self): return self.side == 'LONG' def is_short(self): return self.side == 'short' ## Publication Information - [wincloud](https://paragraph.com/@wincloud/): Publication homepage - [All Posts](https://paragraph.com/@wincloud/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@wincloud): Subscribe to updates