Gekko-BacktestTool icon indicating copy to clipboard operation
Gekko-BacktestTool copied to clipboard

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

Open thegamecat opened this issue 6 years ago • 11 comments

:)

thegamecat avatar May 02 '18 23:05 thegamecat

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.

xFFFFF avatar May 03 '18 09:05 xFFFFF

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

alvarheras avatar May 17 '18 19:05 alvarheras

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.

xFFFFF avatar May 17 '18 20:05 xFFFFF

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

alvarheras avatar May 18 '18 05:05 alvarheras

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.

xFFFFF avatar May 18 '18 06:05 xFFFFF

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!

alvarheras avatar May 18 '18 09:05 alvarheras

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?

xFFFFF avatar May 18 '18 16:05 xFFFFF

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...

alvarheras avatar May 21 '18 16:05 alvarheras

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 avatar May 22 '18 14:05 GO1984

Any ETA for this?

GO1984 avatar Jul 02 '18 09:07 GO1984

Still no postgresql support ?

rvrhee avatar Nov 15 '19 12:11 rvrhee