-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[cxxt][2/2] Add columns for slippage detection #640
[cxxt][2/2] Add columns for slippage detection #640
Conversation
I also think it is a good idea to do both schema changes in one. I would prefer a migration script over a custom check, maybe PR #101 can be used for that. |
quickly looking at #101, it appears break usage in docker containers (it renames the DB - but with Docker containers it's a mount into the container - so the "updated" database would not be persisted anymore). From looking at this - i don't really see any benefit to using caribou - it's a script recreating / altering the table as needed if the filename is wrong - but i'll leave a comment there explaining what i mean. my idea for this was to detect if all tables are present, and either recreate the new version (but using sqlalchemy's feature to do so) - or to alter the table to have all columns - depending on the required change. A quick draft (untested - probably not flake8 compatible) is here Not sure this is the best way - but #101 duplicates the "create table" statements (it's in the class already - why need a explicit statement??) |
I just added a script to automate the database conversation. I think this should be merged before #652 to avoid problems for users simply running |
That was fast :-) I will take a look |
i've had most of it since a week without time to finish testing ... :) |
I did some tests and it looks very good, but we should also take care of the pair format.
I'm not sure yet if there are other implications for open trades. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I think we should add some migration logging and also cover the pair format conversion from (BTC_XYZ -> XYZ/BTC) within this PR.
Great catch, didn't think about this anymore. Added a 2nd test for this, to make sure both cases (old format, new format) are tested properly. Also added a conversion to the exchange now - ccxt saves it all lowercase, while previously it was |
Nice, thanks a lot. Good catch with the exchange name. LGTM |
Summary
As mentioned in #606, i think having a slippage detection would help determine good exchanges.
Solve the issue: #606
Quick changelog
open_rate_requested
andclose_rate_requested
.What's new?
The currently available columns
open_rate
andclose_rate
are updated once the trade is executed. This means, we loose the information of the bot buy decision rate, only saving the rate the trade was executed at.As explained in #606 - this is not necessarily related to changes to ccxt - however i think this is a good time for this due to the database-changes required for #623 - so once ccxt is merged into develop the database needs to be recreated only once.
Important note
Existing database-files are currently incompatible due to the change in the schema.
A migration can be facilitated - however I'm not sure if a custom check / add is a good choice, or if
sqlalchemy-migrate
oralembic
should be considered (i haven't used any of the 2 so far).