Closed wuzxc1230123 closed 1 year ago
Hi, Let me pick an example. Image you want to keep the position short (with the env you created) for an entire episode. You will do :
while True: env.step(0) # because 0 is the index of the -1 (SHORT) in your positions
If you use an RL-agent, your agent will learn to keep a position (if your reward function is good enough). As every change of position has a real cost (= trading fees including spread, slipage ...) - that absolutely needs to be reflected in your reward function !
env = gym.make("TradingEnv", name= "BTCUSD", df = df, # Your dataset with your custom features positions = [ -1, 0, 1], # -1 (=SHORT), 0(=OUT), +1 (=LONG) trading_fees = 0.01/100, # 0.01% per stock buy / sell (Binance fees) borrow_interest_rate= 0.0003/100, # 0.0003% per timestep (one timestep = 1h here) )
How to keep a position?