Skip to content

v1.1.0 — Orders, brokerage status, corrected deploy warning

Latest

Choose a tag to compare

@austin-starks austin-starks released this 27 Jul 19:22

Order staging, brokerage status, and a corrected warning about deploy.

npm install nexustrade

Orders

Paper orders are accepted immediately. Live orders are staged for approval and
are never sent to a broker by this call
— the response carries
requiresApproval and an approvalUrl, and nothing has traded until a human
approves it there. No argument changes that: live orders are written
PENDING_USER_APPROVAL, and the brokerage boundary refuses an unapproved live
order regardless of caller.

const result = await client.createOrders(
  portfolioId,
  [{ asset: { name: "SPY", type: "STOCK", symbol: "SPY" },
     side: "BUY", quantity: 10, orderType: "MARKET" }],
  { idempotencyKey: "rebalance-2024-04-01" },
);

Retrying with the same idempotencyKey adopts the orders the first call staged
rather than staging a second set.

Brokerage status

listBrokerages(), getBrokerage(name), and connectBrokerage(name). Linking
is an OAuth redirect an API key cannot complete, so connectBrokerage logs the
URL and waits — and only when stdout is a TTY. In CI or cron it rejects
immediately instead of stalling in front of nobody.

Corrected: deploy is not always paper

1.0.0 said live trading was unreachable from this SDK. That was wrong for an id
that is already deployed live: deploy(portfolioId) reactivates such a
portfolio as whatever it already is, which resumes live trading against the
connected brokerage. A portfolio you create through the SDK is still always
paper. Check deploymentType on the response before treating a deploy as
simulated.