-
Notifications
You must be signed in to change notification settings - Fork 23
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
chore(api)!: Refactor limit and market order models #2316
Conversation
245570c
to
caaff84
Compare
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.
Very nice 👍
The first 3 commit could be created in a separate PR. Since we use the PR titles for our changelog I would at least change the title to reflect this major refactoring. Commit 4+5 are nice but definitely not as impactful as 1-3. :)
@@ -262,7 +289,7 @@ pub fn insert_limit_order( | |||
pub fn insert_market_order( | |||
conn: &mut PgConnection, | |||
// TODO: use market order here |
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.
🔧 you can remove the todo now :)
@@ -16,10 +16,10 @@ impl OrderbookClient { | |||
Self { url } | |||
} | |||
|
|||
pub(crate) async fn post_new_order( | |||
pub(crate) async fn post_new_market_order( | |||
&self, | |||
// TODO: use market order |
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.
🔧 you can remove the todo now :)
bool marginInputFieldEnabled = false; | ||
bool quantityInputFieldEnabled = true; | ||
|
||
// Amount quantity = Amount(sats); |
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.
🔧 remove commented code.
caaff84
to
92364c6
Compare
We move the differentiation of the order type one level up by changing the api to handle an enum. This way we can have different fields for different types of orders without having to have lots of nullable values, e.g. Market, Limit but also others such as Margin (which tells how much margin to use), StopLoss, TakeProfit, etc.
We should probably introduce a `Quantity` type if we want to support different contracts. For now, a contract equals $1, hence, USD is correct.
this will allow us to differentiate between newOrders and Orders
92364c6
to
4149538
Compare
Extracted from #2282