xFFFFF / Gekko-BacktestTool

Batch backtest, import and strategy params optimalization for Gekko Trading Bot. With one command you will run any number of backtests.
MIT License
231 stars 85 forks source link

Any chance of hooking this up to postgres instead of sqlite? #15

Open thegamecat opened 6 years ago

thegamecat commented 6 years ago

:)

xFFFFF commented 6 years ago

You are not the first to ask about it ... I have read the documentation and the inquiries are almost identical to those in sqlite. If I do not encounter problems, it will be done quickly. ;-)

I will also prepare a trigger for disabling the BacktestTool database in the settings. Without access, sqlite will work, but it will not have some features like: last, now with import and values volume and trades in output.

alvarheras commented 6 years ago

His extension is great. It would be a big step! Yes, we could resolve error SQLITE_BUSY: database is locked in the tests.

xFFFFF commented 6 years ago

I've already started to write postgre support. Maybe in the next version it will already be. To get rid of sqlite busy error , all you need to do is during backtest tool test do not use ui and import on the same database. I can bet that the error will not appear.

alvarheras commented 6 years ago

Migrate to postgres for SQLITE_BUSY error: database is locked.

On the other hand, I use as data source the data I downloaded from your repository Gekko-Datasets and import it in history, I disable the ui when I do the back test and the problem persists.

Do you comment that I can solve this error using SQLITE?

What do you mean, import into the same database? Don't use historical data?

Thank you

xFFFFF commented 6 years ago

Try: Are You on linux? Kill all gekko and node processes. killall -9 node. In windows You can do it in task manager.

Previous message: I mean dont use backtest.pl -i or node gekko --import when You are performing backtests. You can do it when backtest is finished.

alvarheras commented 6 years ago

I don't use any of these methods to import data. I don't do any processing at the same time as the back test, the data imported as I'm telling you is in history

I don't quite understand what you mean, wouldn't the solution to this error be to migrate to postgres?

ERROR : SQLITE_BUSY: The database is locked.

Thank you!

xFFFFF commented 6 years ago

No, no. Solution is: not writing anything to sqlite DB when You want perform backtest.

Documentation said:

We are aware of no other embedded SQL database engine that supports as much concurrency as SQLite. SQLite allows multiple processes to have the database file open at once, and for multiple processes to read the database at once. When any process wants to write, it must lock the entire database file for the duration of its update.

During performing backtest gekko only READ from DB. So havent limits for connections. Some process must locked Your file or maybe You have MS Windows?

But use caution: this locking mechanism might not work correctly if the database file is kept on an NFS filesystem. This is because fcntl() file locking is broken on many NFS implementations. You should avoid putting SQLite database files on NFS if multiple processes might try to access the file at the same time.

Source: https://www.sqlite.org/faq.html#q5

Do You use live trading gekko on this same computer where want perform backtests?

alvarheras commented 6 years ago

It seems that if so, I should have an open process on my sqlite-related MAC, now I can successfully roll out the NNv2 strategy against all BTC pairs.

Do you have new developments of this extension in mind?

PS: I already deleted my commit you told me about, I knew there was personal data I hope you didn't save it;) but I needed to pass it to the server, ajaja:S and I forget it later...

GO1984 commented 6 years ago

I do appreciate your afford too, coding a posibility to use postgreSQL database, as it is my favorite db while using gekko. A big advantage is, that multiple gekkos can use the same db (e. g. a test site and a live gekko bot). Thank you for you time an work in this project.

GO1984 commented 6 years ago

Any ETA for this?

rvrhee commented 5 years ago

Still no postgresql support ?