You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
595 B

from auto_trading.interfaces import Strategy
from auto_trading.orders import Long, Short
class Yoyo(Strategy):
def __init__(self, stock_name: str):
self.stock_name = stock_name
self.c = True
def execute(
self, data, indicators_results, ptf_state
market_price = data.loc[data.index[-1][0]].close.to_dict().get('GOOGL')
if self.c:
self.c = False
return [Long('GOOGL', 0.1, market_price)]
self.c = True
return [Short('GOOGL', 0.1, market_price)]