ClementPerroud / Gym-Trading-Env

A simple, easy, customizable Gymnasium environment for trading.
https://gym-trading-env.readthedocs.io/
MIT License
270 stars 56 forks source link

Suggestion create a standalone portfolio class that is not fed with info by the enviornment #13

Open sebnapi opened 10 months ago

sebnapi commented 10 months ago

I just wanted to write my own environment that works a bit differently. I noticed that it already is made quite well, so that it is easy to extend. In my case I want to create a portfolio that works with futures, they have a bit different characteristics.

So what I did is: I removed

                 trading_fees=0,
                 borrow_interest_rate=0,
                 portfolio_initial_value=1000,
                 initial_position='random',

from the environment and added it to the Portfolio class. Now the environment is decoupled from the asset class. I can now implement a FuturePortfolio, that has a tick_value and is based on the amount of contracts traded not a balance between cash and assets. The environment just pulls the necessary info from the portfolio class and works the same way. With this I can also create different portfolios for different assets and train the same agent. For example Nasdaq is trading with a tick value of 5$ and the S&P500 with 12.5$, etc.