Describes @stxapp/stx-typescript 0.12.1, the current release.
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); // 746.8600
for (const p of await client.positions()) { console.log(p.market_id, p.position); // e00651a3-10cb-4bc1-9e1f-c5ea1796c83b 40.00}
for await (const fill of client.iterFills({ marketIds: [marketId] })) { console.log(fill.trade_id, fill.action, fill.filled, "@", fill.price); // a7469e3a-b608-483d-b12f-1c1534793274 buy 40.00 @ 0.5800}
const settlements = await client.settlements({ limit: 50 });for (const s of settlements) console.log(s.market_id, s.type, s.quantity, s.gross_pnl);// fd6a5668-ffda-4f97-b8fe-7aa6d79d9c5f expired_long 50.00 32.0000| 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.
Docs version v1.10.5

