Releases: austin-starks/nexustrade-ts
Release list
v1.1.0 — Orders, brokerage status, corrected deploy warning
Order staging, brokerage status, and a corrected warning about deploy.
npm install nexustradeOrders
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.
v1.0.0 — NexusTrade TypeScript SDK
Author NexusTrade trading strategies in typed TypeScript and backtest them on
the engine that runs them live.
npm install nexustradeimport {
NexusTradeClient, always, backtest, buy, portfolio, stockAsset, strategy,
} from "nexustrade";
const client = new NexusTradeClient();
const book = portfolio("Example", [
strategy("Buy SPY", always(), buy(stockAsset("SPY"), 100)),
]);
const operation = await client.createBacktest(
backtest(book, { startDate: "2024-01-01", endDate: "2024-12-31" }),
{ idempotencyKey: "example-v1" },
);
console.log((await client.waitForBacktest(operation.id as string)).result);What's in it
170+ generated builders. Indicators, conditions, and actions are generated
from the same specification the engine executes, so a book is structurally
valid before it leaves the process — and fully typed, so your editor completes
the whole surface.
Backtests, optimizations, and walk-forward studies. Every job kind reports
the same {id, kind, status, result?, error?} envelope, so one poller serves
all of them. Submissions are idempotent — a retry with the same key returns the
original operation instead of launching a second paid job.
Agent runs. Iterate a run and answer it when it blocks for plan approval,
action approval, or input.
Lake SQL. Read-only SQL over the market-data catalog, returned as Parquet.
Your own data. Create a custom data source, seed it, and grow it without
leaving the SDK:
const series = await client.createCustomIndicator(
{
name: "WSB NVDA Mentions",
scope: "asset",
points: [{ timestamp: "2024-04-01", value: 152, ticker: "NVDA" }],
},
{ idempotencyKey: "wsb-mentions-v1" },
);
gt(CustomIndicator(stockAsset("NVDA"), String(series.customIndicatorId)), 100);Point batches are unlimited in size. A batch that fits the request is sent with
it; a larger one is uploaded to storage and validated server-side, and the
returned indicator reflects what landed either way. An upload interrupted after
its bytes arrive resumes at polling rather than re-sending. Recurring
collection appends to the same series with appendCustomIndicatorPoints.
Notes
Zero runtime dependencies. ESM and CommonJS builds ship together, with types.
Node 18+.
Requires an API key from https://nexustrade.io/developers, read from
NEXUSTRADE_API_KEY / NEXUSTRADE_API_BASE_URL or a local .env.