Found in tensorflow-js what you need for the first steps in ML and trading.
This is dqn training, where the agent is given rewards and penalties for actions.
It turns out that we have a snake that learns from its own experience to move. She has a certain number of moves (turn or continue) and her task is to get to the fruit. Initially, the snake does not know how to do anything, but in the course of training it gains the ability to find fruits and dodge. Very similar to trading, isn’t it?
Well, at least for our task, when we have data running, and the robot needs to make a decision to buy or sell.
The downside of the snake is that it was written for node.js, and we need to be able to train in a browser (so that any user can do it). Therefore, it was necessary to start the same on the client.
I took the snake as it is to my page with the graph and tried to start it. It was not so!
The snake resisted in every possible way,
then arguments. (by the way, I also made a pull request next to the fix https://github.com/tensorflow/tfjs-examples/pull/353),
then %% Unhandled Rejection (TypeError): Cannot call a class as a function %%. Which is repaired here https://github.com/tensorflow/tfjs/pull/3906/files, but since there is no release yet, then I had to substitute my hands. Here, by the way, many people have a problem https://github.com/tensorflow/tfjs/issues/3384.
Then there were the minors, like substituting fs for indexeddb. The work with which I spied on here, by the way. Well, in general, cart-pole initially inspired to do everything on the client.
in the end, this is what happened:
Well, that’s all, the next stage will be:
- Fit to charts
- Train a robot on known data to show the maximum result
Below in the video is a demo of the work-training of robots on the client. Someday they will also trade Sberbank futures instead of me.