-
Notifications
You must be signed in to change notification settings - Fork 115
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
[Full node streaming] emit taker order status at end of matching loop #2022
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -512,6 +512,12 @@ func (f *FakeMemClobKeeper) SendOrderbookFillUpdates( | |||||||||||||||||||||||
) { | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
func (f *FakeMemClobKeeper) SendTakerOrderStatus( | ||||||||||||||||||||||||
ctx sdk.Context, | ||||||||||||||||||||||||
takerOrder types.StreamTakerOrder, | ||||||||||||||||||||||||
) { | ||||||||||||||||||||||||
} | ||||||||||||||||||||||||
Comment on lines
+515
to
+519
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Provide a mock implementation or a TODO comment. The new method + // TODO: Implement the mock logic for SendTakerOrderStatus Committable suggestion
Suggested change
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
// Placeholder to satisfy interface implementation of types.MemClobKeeper | ||||||||||||||||||||||||
func (f *FakeMemClobKeeper) AddOrderToOrderbookSubaccountUpdatesCheck( | ||||||||||||||||||||||||
ctx sdk.Context, | ||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,3 +157,28 @@ func (m *MemClobPriceTimePriority) GetOrderbookUpdatesForOrderUpdate( | |
} | ||
return offchainUpdates | ||
} | ||
|
||
// GenerateStreamTakerOrder returns a `StreamTakerOrder` object used in full node | ||
// streaming from a matchableOrder and a taker order status. | ||
func (m *MemClobPriceTimePriority) GenerateStreamTakerOrder( | ||
takerOrder types.MatchableOrder, | ||
takerOrderStatus types.TakerOrderStatus, | ||
) types.StreamTakerOrder { | ||
if takerOrder.IsLiquidation() { | ||
liquidationOrder := takerOrder.MustGetLiquidationOrder() | ||
streamLiquidationOrder := liquidationOrder.ToStreamLiquidationOrder() | ||
return types.StreamTakerOrder{ | ||
TakerOrder: &types.StreamTakerOrder_LiquidationOrder{ | ||
LiquidationOrder: streamLiquidationOrder, | ||
}, | ||
TakerOrderStatus: takerOrderStatus.ToStreamingTakerOrderStatus(), | ||
} | ||
} | ||
order := takerOrder.MustGetOrder() | ||
return types.StreamTakerOrder{ | ||
TakerOrder: &types.StreamTakerOrder_Order{ | ||
Order: &order, | ||
}, | ||
TakerOrderStatus: takerOrderStatus.ToStreamingTakerOrderStatus(), | ||
} | ||
} | ||
Comment on lines
+161
to
+184
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactor suggestion: Simplify the nested if-else. The nested if-else can be simplified for better readability. func (m *MemClobPriceTimePriority) GenerateStreamTakerOrder(
takerOrder types.MatchableOrder,
takerOrderStatus types.TakerOrderStatus,
) types.StreamTakerOrder {
if takerOrder.IsLiquidation() {
liquidationOrder := takerOrder.MustGetLiquidationOrder()
streamLiquidationOrder := liquidationOrder.ToStreamLiquidationOrder()
return types.StreamTakerOrder{
TakerOrder: &types.StreamTakerOrder_LiquidationOrder{
LiquidationOrder: streamLiquidationOrder,
},
TakerOrderStatus: takerOrderStatus.ToStreamingTakerOrderStatus(),
}
}
order := takerOrder.MustGetOrder()
return types.StreamTakerOrder{
TakerOrder: &types.StreamTakerOrder_Order{
Order: &order,
},
TakerOrderStatus: takerOrderStatus.ToStreamingTakerOrderStatus(),
}
}
|
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.
for my understanding - do we need to send any fill amounts for taker orders?
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.
It should have the fill amounts in a following full node stream update if you are subscribed to the correct clob pair id!