Skip to content

Conversation

dboyliao
Copy link
Collaborator

@dboyliao dboyliao commented Mar 7, 2025

The purpose of this PR is to:

  1. minor refactoring, moving type conversion logics from api modules to application module
  2. renaming ActiveMessage as ActivateMessage to be aligned with Coinbase documentation.

These are preliminary works for the upcoming PR #1928.

@dboyliao dboyliao force-pushed the dboy/coinbase-stream-fix branch 2 times, most recently from e2e05b0 to 2f1e02b Compare March 8, 2025 05:25
@dboyliao dboyliao changed the title WIP: [coinbase] fix stream handlers and order placing logics FIX: [coinbase] fix stream handlers and order placing logics Mar 9, 2025
@dboyliao dboyliao marked this pull request as ready for review March 9, 2025 03:20
@dboyliao dboyliao force-pushed the dboy/coinbase-stream-fix branch from 2f1e02b to 318d4c5 Compare March 9, 2025 03:22
if order.FilledSize.Eq(order.Size) {
return types.OrderStatusFilled
} else {
return types.OrderStatusPartiallyFilled
Copy link
Owner

Choose a reason for hiding this comment

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

return types.OrderStatusCanceled for this line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

https://docs.cdp.coinbase.com/exchange/docs/websocket-channels#done

It should be filled.
No partially filled for done message.
Will fix it.

case api.OrderStatusRejected:
return types.OrderStatusRejected
case api.OrderStatusReceived:
return types.OrderStatusReceived
Copy link
Owner

@c9s c9s Mar 10, 2025

Choose a reason for hiding this comment

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

btw, Is Received = Update?

if this means if an order is working, then you will receive incremental "ExecutedQuantity" ? you might need update the status to PartiallyFilled and add the same check like LINE35-39?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After discussion with @kbearXD, I think received is more close to new in bbgo.
In that case, a dedicated status for received is not necessary.
I will remove it and map received status on Coinbase to new in bbgo.

case api.OrderStatusRejected:
return types.OrderStatusRejected
case api.OrderStatusReceived:
return types.OrderStatusReceived
Copy link
Collaborator

Choose a reason for hiding this comment

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

The status "received" in coinbase means that the order you submitted is valid and it will go into the matching engine. I think it's closed to "NEW" in bbgo.

The status "open" in coinbase means that the order is on the orderbook, so if you submit a order and it will be fully taker order. there will no "open" status. I think we need to check the remaining size to know the status is bbgo's PartiallyFilled or New

@dboyliao dboyliao requested a review from kbearXD March 10, 2025 09:35
@dboyliao dboyliao force-pushed the dboy/coinbase-stream-fix branch from 062dbce to 5b615ac Compare March 10, 2025 11:37
@dboyliao dboyliao merged commit 502c557 into main Mar 10, 2025
3 checks passed
@dboyliao dboyliao deleted the dboy/coinbase-stream-fix branch March 10, 2025 12:01
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.

3 participants