QuantConnect / QuantConnect/Lean.Brokerages.Coinbase

Support orders placed outside of the algorithm (brokerage-side orders)

Open
#39 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
5
Forks
14
Avg merge
9h 29m
Merged PRs (30d)
2

Description

Description

Orders placed outside the algorithm (Coinbase Advanced Trade UI/app, or another system on the same account) are silently dropped. The brokerage subscribes to the account-wide user channel, so their updates arrive, but CoinbaseBrokerage.Messaging.cs:201-205 does if (leanOrder == null) continue; on an unknown brokerage id. The algorithm never learns about the order or the position it creates.

Expected behaviour

Follow the pattern already implemented in TradeStation, Alpaca, Interactive Brokers, Binance and ClearStreet, and proposed for Tradier in QuantConnect/Lean.Brokerages.Tradier#53:

  1. When an order update arrives for a brokerage id the IOrderProvider does not know, convert it to a LEAN Order and offer it through OnNewBrokerageOrderNotification(new NewBrokerageOrderNotificationEventArgs(order)).
  2. If the brokerage message handler accepts it (LEAN assigns order.Id != 0), emit Submitted plus any fills the order already had, and keep tracking it through the normal update path from then on.
  3. If it is declined (order.Id == 0), leave the order alone and do not emit further events for it — the algorithm must keep running.
  4. Orders that cannot be represented in LEAN (unsupported order types, multi-leg/combo, missing price fields) should raise a single message rather than terminating the algorithm, and GetOpenOrders should skip them instead of failing the launch.
  5. Offer each unknown order only once, so repeated updates for the same id do not re-notify.

Tests

Unit tests covering the accepted, declined, unconvertible and partial-fill paths, plus a live/paper run with an order placed outside the algorithm.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in CoinbaseBrokerage.Messaging.cs:201-205 and compare the existing TradeStation, Alpaca, Interactive Brokers, Binance and ClearStreet handling patterns. Add unit coverage for accepted, declined, unconvertible and partial-fill updates, then verify a live or paper run with an externally placed order. Done means unknown orders are offered once, valid orders and fills are tracked, and unsupported orders do not stop the algorithm or launch.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.