Skip to content

Portfolio

These calls read your own account. The fields are described in the API reference. To keep these figures current without polling, use the live account view.

import { STX } from "@stxapp/stx-typescript";
const client = new STX();
const balance = await client.balance();
console.log(balance.available_balance);
for (const p of await client.positions()) {
console.log(p.market_id, p.position);
}
for await (const fill of client.iterFills({ marketIds: [marketId] })) {
console.log(fill.trade_id, fill.action, fill.filled, "@", fill.price);
}
const settlements = await client.settlements({ limit: 50 });
Method Filters
balance() none
positions() marketIds
fills() marketIds, orderIds, status
settlements() marketIds, type
accountMarketStats() marketIds, eventIds, sports, competitions, fromTime, toTime, excludeZeroSettlements
deposits(), withdrawals(), adjustments(), fees(), loyalty() limit, cursor

Every list method returns one page and has an iter* twin (iterFills, iterSettlements, iterDeposits, …) that walks all pages. See pagination.

v1.5.9Changelogllms.txtllms-full.txt