Kismuz / btgym

Scalable, event-driven, deep-learning-friendly backtesting library
https://kismuz.github.io/btgym/
GNU Lesser General Public License v3.0
988 stars 261 forks source link

Can i apply other RL framework to the gym and how to add indicators to the state space? #108

Closed Ray-0403 closed 5 years ago

Ray-0403 commented 5 years ago

hey, i am thinking about using stable-baselines to create the agent, how to do that? Also i want to use some my indicators as state space, how to add it?

mobias17 commented 5 years ago

Hi,

let me give you my two cents worth thoughts, at least the sfor the second question. In general, the btgym is doing the general plumbing in the background for you and you can overwrite parts and replace them with yours. How to overwrite the statespace and e.g. add your own indicators is illustrated in the Examply "setting_up_environment_full.ipynb". You can also perform similar action in the research package I guess.

As for the stable-baseline I'd pass on hte answer as I am not familiar with that. Still, I assume that it should be possible. Read the documentation and spot the areas you need to overwrite.

Ray-0403 commented 5 years ago

Thank you, i will look that file again

developeralgo8888 commented 5 years ago

Hey Andrew, Stable-baselines is the same as Baselines except it usually has updated and current state of the art RL Algorithms compared to baselines. its a complete Fork of baselines

Ray-0403 commented 5 years ago

Should i install both backtrader and btgym? since i saw that it import backtrader as bt, but after i install them all and run the code to test env, it shows no backtrader.indicators module, but there's indicators file in the backtrader file, i don't know how to fix it, can anyone help me? :)

Kismuz commented 5 years ago

@Ray-0403,

using stable-baselines to create the agent, how to do that?

  1. you can use btgym as standalone environment with gym-like API and plug it into existing rl framework i.e. using this part of the package: https://kismuz.github.io/btgym/intro.html#environment-engine-description

  2. use async. training framework for btgym and adapt and plug-in any existing algorythm implementation that supports asynchronous updates: https://kismuz.github.io/btgym/intro.html#a3c-framework-description

Also i want to use some my indicators as state space

this is the same as include your indicator to underlying backtrader strategy, see #31

Should i install both backtrader and btgym

btgym depends on backtrader and installs it as one of requirements

Ray-0403 commented 5 years ago

Thank you very much:)