Giter Site home page Giter Site logo

Support Tensorflow 2 about btgym HOT 14 OPEN

mcrowson avatar mcrowson commented on June 12, 2024
Support Tensorflow 2

from btgym.

Comments (14)

yglpyn8888 avatar yglpyn8888 commented on June 12, 2024 1
  • in general, yes, I do not see reasons to further develop the project since it became evident that one can't build realistic trading strategies based only on OHLC data and its derivative indicators. To get good predictors one should utilise level2 data and build features upon order flow and order book events. This can't be implemented without rebuilding Btgym from scratch since it is the limitation imposed by Backtrader package -- a core backtesting library Btgym uses under the hood.

Hello, it's so sad to see this project will not be updated. You mentioned before " To get good predictors one should utilise level2 data and build features upon order flow and order book events. This can't be implemented without rebuilding Btgym from scratch",
I really don't know why I can't use features like order flow to train in this environment. Because I don't think what features users use has anything to do with the environment framework itself, the environment just need receive my feature dataframe (eg. the df include ohlcv columns and other features columns), and then it's ok.
The environment does not need to be related to the specific feature implementation at all, and users will use other methods to generate this feature DF.
Therefore, I only need an environment, which can provide the correct order matching process, correctly simulate the commission fee, margin, support long and short selling, etc., and provide users with their own reward function and action space. thats enough! Thank you again for your work.

from btgym.

Kismuz avatar Kismuz commented on June 12, 2024

@mcrowson , sorry for late reply/ I do not have plans to make support for TF2 ( should been mentioned that in package description) in near future due to lack of time/ If you can do commit on that - think it would be extremely helpful for others/ note that current tf code relies heavily on variables collections which needs to be refactored manually, so the process could take more time than expected

from btgym.

woj-i avatar woj-i commented on June 12, 2024

Hi @mcrowson! Are you going to work on this upgrade? If not- I can take it. If you have some work already done please commit it to your repo, then I could start from that point.

from btgym.

mcrowson avatar mcrowson commented on June 12, 2024

I do not plan to work on this. Go for it.

from btgym.

woj-i avatar woj-i commented on June 12, 2024

I did some fixes and now I am try to run all notebooks in examples. I can't see any unit tests in the project. Are they somewhere? Any suggestions how to test my changes?

from btgym.

Kismuz avatar Kismuz commented on June 12, 2024

@woj-i - sorry for late reply,
no there is no unit tests for algorithms-related code.
I only used it for some complex data iteration checks like here:
https://github.com/Kismuz/btgym/blob/master/btgym/datafeed/test_data.py

from btgym.

woj-i avatar woj-i commented on June 12, 2024

The migration process is not easy in this case. I would need some help here #144

from btgym.

viper7882 avatar viper7882 commented on June 12, 2024

Hi @Kismuz,

Using Virtual Environment created through PyCharm UBuntu Linux, I'm getting the following error during installation of setup.py:

ERROR: Could not find a version that satisfies the requirement tensorflow<2,>=1.5 (from btgym) (from versions: 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0rc0, 2.4.0rc1, 2.4.0rc2, 2.4.0rc3, 2.4.0rc4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3, 2.5.0, 2.5.1, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.7.0rc0, 2.7.0rc1)
ERROR: No matching distribution found for tensorflow<2,>=1.5

It does not seems like PyPI is officially supporting tensorflow <2 anymore. If no one is willing to migrate this btgym to Tensorflow 2, I foresee that btgym is going to EOL soon because new user like myself could no longer install btgym.

If that's the direction btgym is heading to, I feel sad to see this fantastic project going to EOL.

Alternatively, is there a plan to allow user to switch to other backend such as PyTorch besides Tensorflow?

Or even better, strip btgym from any backend and let user hook them up by their own?

My understanding for matplotlib to plot chart is slower than Plotly. Is there any plan to allow user to switch to Plotly as graph backend as well?

from btgym.

Kismuz avatar Kismuz commented on June 12, 2024

@viper7882

  • environment itself does not requires TF, it is only algorithms subpackage that uses it. One can comment out the requirement and proceed with installation. As far as I know there are users running standalone btgym env with pytorch-implemented policies
  • TF 2 can be run in v1 compatibility mode, there is a branch by contributing people went to stall, see #144
  • in general, yes, I do not see reasons to further develop the project since it became evident that one can't build realistic trading strategies based only on OHLC data and its derivative indicators. To get good predictors one should utilise level2 data and build features upon order flow and order book events. This can't be implemented without rebuilding Btgym from scratch since it is the limitation imposed by Backtrader package -- a core backtesting library Btgym uses under the hood.

from btgym.

mysl avatar mysl commented on June 12, 2024

it became evident that one can't build realistic trading strategies based only on OHLC data and its derivative indicators.

@Kismuz even for statistical arbitrage scenario? I remembered you have mentioned some fund had success in applying RL in arbitrage (sure, we don't know if they use level2 or OHLC)? Maybe you could share some of your personal experience? thanks!

from btgym.

Kismuz avatar Kismuz commented on June 12, 2024

@Kismuz even for statistical arbitrage scenario?

@mysl - It depends on market efficiency. From my experience OHLC-data approach does not works steadily on FX, stocks and other mature markets. A year ago it was possible to apply it to crypto; but as for now these strategies performance has been degraded.

I remembered you have mentioned some fund had success in applying RL in arbitrage (sure, we don't know if they use level2 or OHLC)? Maybe you could share some of your personal experience? thanks!

to my humble experience LOB and trade flow data bear sufficient predictive ability even on mature markets

from btgym.

mysl avatar mysl commented on June 12, 2024

@Kismuz , thanks so much for the sharing. May I know the timeframe of the trade driven by the prediction from LOB? Holding position for a few or dozens of seconds?

from btgym.

Kismuz avatar Kismuz commented on June 12, 2024

@yglpyn8888 , you're correct

which can provide the correct order matching process,

... and that's exactly what is not possible with current environment implementation which uses Backtrader package as core backtesting engine

from btgym.

yglpyn8888 avatar yglpyn8888 commented on June 12, 2024

@yglpyn8888 , you're correct

which can provide the correct order matching process,

... and that's exactly what is not possible with current environment implementation which uses Backtrader package as core backtesting engine

OK,do you have plan to implement a new trading environment in the future, which is not based on backtrader, just provides the core functions of an environment ?
(by the way, a fully functional trading environment is hard to find. I tried tensortrade before, but they don't support short selling)

from btgym.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.