andrewbaronick / BacktestJS

Full and easy cli driven tool to get candle data and backtest any trading strategy you want!!
Apache License 2.0
8 stars 4 forks source link

Hello. Could you help me one thing? #3

Closed miroshar-success closed 20 hours ago

miroshar-success commented 1 day ago

I want to create a bot that automatically generates a trading strategy and does backtesting with data from the last 3 months. If the strategy gives bad results, automatically try another one on the same data set. If the strategy gives good results, save it and optimize it. I am going to use this for backtesting.

Is it possible to use this library for my goal? If possible, how can I implement this in which part?

Please help me.

mrddter commented 1 day ago

While waiting for the author, I'll try to answer you .. 😃

If I understood correctly, you want the bot to use the backtesting library and not use the backtesting library with your bot (small differences but substantial).

This library works slightly differently, namely through CLI (it's possible to actually transform it with some work into a pure library). It executes strategies within which you can decide what to do (run an AI bot, technical indicators, etc.).

Basically, it's a simulation close to what happens in reality, where you have a stream of changing data that is received by your "strategy" which decides what to do. You can iterate or permute that as many times as you want.

In this scenario, this library is perfect. However, if you want your bot to decide when to execute and re-execute the backtesting from scratch, and have a callback on each tick to run some reasoning and possibly restart from scratch changing the reasoning, then this library is not exactly what you need (although it could be modified to work in a headless mode).

If this library suits your needs, also consider the fork I made, because due to the wait, I'm maintaining the library in another repo (more detail here)

ps: Feel free to add details about the method/technology your bot would use to operate so we can delve deeper into the specifics.

andrewbaronick commented 20 hours ago

Thanks @mrddter i think you gave a perfect explanation.

@miroshar-success To sum up this will not write a strategy and test it, you must write the strategy yourself :)

While you can essentially have some ai chatbot write strategies for you pretty easily you will first have to train the chatbot with the backtestjs implementation and how it works which might not be the most straightforward as this project is not too known and they wont know how to write code for it out of the box.

When i wrote this program chatbots were just starting to become a thing. I have been thinking of making an instructional manual on how to train chatbots to write code that can be pasted in and used as a strategy but unfortunately you will still need to know coding at least to some intermediate level to make sure the AI code matches the strategy you want.