-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature sequelize sqlite3 #131
base: master
Are you sure you want to change the base?
Conversation
just a quick hint about "sequelize / orm". the main reason why i not took it was performance. In any case its helpful for the database schema and so on. I am running this mainly on ~100 pairs with 3 time periods. So there is a lot of INSERT happing inside the database. Eg on every minute on most exchange there are a lot of candle informations. Binance provides this candles mainly every seconds, also for not closed one. This is also for strategies which provides also much of reading on many pairs. I also needed to took the optimized sqlite3 database package and optimized PRAGMA settings during connecting. So how ORM is performing here? |
First of all, I apologize, I had to raise a ticket and discuss before starting such update. Now I have to take risk that all the work can be thrown to trash bin :) Regarding performance, I understand your concern. I now checked several sources, and for sure there is some performance hit, mostly on complex SELECT statements. But, for candlestick inserts, I used bulkCreate method, so there I believe performance hit is minimal, see resulting query:
I also see than you started works on migrating to typescript. And here sequelize is not perfect solution. Here typeORM shines, and it's slowly getting more and more popular compared to sequelize. So let me know what you think. |
@egisz Thank you for this update, I had downloaded and working with it right now. I have some ideeas for the project if you don't mind to suggest.I really see that you are consistent and you make good updates, so it may worth to take a look: I have the following ideeas for the backtesting: For the buy and sell part: The strategy used for trading should look like this: Another crucial feature would be to pass a parameter inside the bot settings that would make the bot consider the winning trades in the capital ballance.For example if the bot won a trade, it will update somehow the maximum capital/pair.Without this feature, we have to manually close and update the instances.js to use the maximum balance. I had discovered this project yesterday.I still have to learn to use it, but I really hope that I had inspired the future developpment of it with some little suggestions. |
Hi, Thanks @cezarlacatus for testing and supporting my idea. If you find bugs, let me know. @cezarlacatus, I suggest to open separate issues for each your ideas. This way we can vote and discuss them separratly. I have my point regarding your ideas, and will happily share my opinion once you create issues. |
e6061ee
to
b9b8e02
Compare
Tests are green now, @Haehnchen, what's your opinion? |
@Haehnchen Any plans to approve this? It's six months old and the feature is kind of a blocker for production use. @egisz Bunch of conflicts with master since. |
no plans to improve from my side
|
Thanks for your elaboration. Are you saying performance is good with SQLite ? |
yes SQLite is every good on my side with "better-sqlite3" module and some connection parameter improvements. ~1000 queries per seconds are no problem on a small vhost with ~500 watching exchange pairs, i guess any other "really database" would have some more issues handle this traffic. |
I understand. FWIW, the reason I am looking for an ORM implementation, is so that I can centralize activities of different bot sessions on different hosts, and manage them. |
@Haehnchen would you consider a lightweight/thin DB adapter pattern? interface so users can plugin whatever storage tech? that wouldn't impact performance but still provide flexibility. Default adapter is the SqlLite code that you already have.. I would put time into this refactor. |
Boom!
Lots of improvements in both backend and front end. Where to start ? :)
Backend:
NOTE: config.json file must be updated in order to upgrade. See notes bellow.
NOTE2: all tables will be deleted during migration, so make copy in case you need old data
Frontend
Upgrading notes
add database objects to conf.json file: