Skip to content
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

Merged
merged 5 commits into from
Mar 26, 2024
Merged

Conversation

bonomat
Copy link
Contributor

@bonomat bonomat commented Mar 25, 2024

Extracted from #2282

Copy link
Contributor

@holzeis holzeis left a 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
Copy link
Contributor

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
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 remove commented code.

@bonomat bonomat changed the title A bit of refactoring [breaking-api-change] A bit of refactoring Mar 26, 2024
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
@bonomat bonomat added this pull request to the merge queue Mar 26, 2024
Merged via the queue into main with commit 58f1af9 Mar 26, 2024
21 checks passed
@bonomat bonomat deleted the chore/refactorings branch March 26, 2024 06:57
@holzeis holzeis changed the title [breaking-api-change] A bit of refactoring chore!: Refactor limit and market order models Mar 29, 2024
@holzeis holzeis changed the title chore!: Refactor limit and market order models chore(api)!: Refactor limit and market order models Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants