-
Notifications
You must be signed in to change notification settings - Fork 14
[WIP] Contract/orderbook #150
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
Conversation
Jean-Lessa
left a comment
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.
All good to me. Comments are optional but recommended if merge is not urgent.
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.
I just realized this SafeVar is using old commit/revert logic (as in "write changes to copy by default", commit() does real = copy and revert() clears the copy).
At some point in the past we switched that to a more "optimistic" approach (as in "write changes to the real value by default" instead and keep copy as a "snapshot" of the initial value, so the logic is reversed - commit() clears the copy and revert() does real = copy). IIRC this has a lesser overhead - commit() has a higher probability of being called overall than revert(), and clearing data is faster than rewriting it (same logic as "keep your most probable outcome in the if branch, not the else branch"). This might also be the reason why check() was removed and other SafeVars did if (copy == nullptr) copy = ... manually, but my memory fails me.
I suppose this is working as-is though, so it's not an urgent problem. If it has to be merged ASAP then by all means go for it, but I would suggest having a look at how the other SafeVars do it just so we keep the pattern. Since this is abstracting a container, you might also need to create an undo stack or a similar functionality to make it work as intended (see SafeVector or SafeUnorderedMap).
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.
I'll try to update that.
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.
I would suggest also having unit tests for SafeMultiSet, mostly for SonarQube coverage, but like the other comments, it's not a priority right now.
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.
Sure, I'll add them.
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.
IIRC the SafeVar tests were isolated under a CMake macro due to their taking a lot of time and RAM to compile due to heavy template usage. Check the halley branch later.
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.
I'll do, thanks.
This is the OrderBook contract implementation.
The operations supported are:
We should remember that market orders will be not include in the orders list, i.e, will be executed or discarded. The interface for the contract creation is very simples and straightforward. See examples at the correspondent test file. We still need to implement the stop limit order, for this pull request to be completed and update the related documentation.