Browse Source

yoyo

pull/24/head
ErwanFagnou 7 months ago
parent
commit
f1d5941449
  1. 22
      auto_trading/strat/Yoyo.py

22
auto_trading/strat/Yoyo.py

@ -0,0 +1,22 @@
from auto_trading.interfaces import Strategy
from auto_trading.orders import Long, Short
class Yoyo(Strategy):
def __init__(self, stock_name: str):
super().__init__()
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)]
else:
self.c = True
return [Short('GOOGL', 0.1, market_price)]
Loading…
Cancel
Save