Appearance
account
The script's own account: cash, position, fills and open orders.
| Name | Description |
|---|---|
account.equity() | Cash plus the position valued at the pool price, in TAO. |
account.cash() | TAO not invested. |
account.position() | The current position; alpha is 0 when flat. |
account.fills() | Every fill so far, oldest first. |
account.openIntents() | Intents still waiting for a fill. |
account.conditionals() | Active stop, take-profit and trailing-stop orders. |
account.pnl() | Realized profit of closed trades and unrealized profit of the open position, in TAO, fees included. |
account.equity()
ts
account.equity(): numberCash plus the position valued at the pool price, in TAO. 0 in indicator scripts.
account.cash()
ts
account.cash(): numberTAO not invested. 0 in indicator scripts.
account.position()
ts
account.position(): PositionThe current position; alpha is 0 when flat.
Types: Position
account.fills()
ts
account.fills(): readonly Fill[]Every fill so far, oldest first.
Types: Fill
account.openIntents()
ts
account.openIntents(): readonly Intent[]Intents still waiting for a fill.
Types: Intent
account.conditionals()
ts
account.conditionals(): readonly Conditional[]Active stop, take-profit and trailing-stop orders.
Types: Conditional
account.pnl()
ts
account.pnl(): { realizedTao: number; unrealizedTao: number }Realized profit of closed trades and unrealized profit of the open position, in TAO, fees included.
Types
Position
The script's position in the market. Long only: alpha is 0 when flat.
| Field | Type | Description |
|---|---|---|
alpha | number | alpha held |
avgPrice | Price | average entry price, fees included (costTao / alpha); 0 when flat |
costTao | number | TAO spent on the alpha still held, fees included |
unrealizedTao | number | alpha × pool price − costTao |
openedBlock | BlockNumber | null | first block of the bar in which the position was opened; null when flat |
Fill
A completed fill of an intent, as passed to event.onFill.
| Field | Type | Description |
|---|---|---|
intentId | IntentId | |
block | BlockNumber | |
time | Ms | |
side | Side | |
tao | number | TAO spent (buy, fee included) or received before the fee (sell) |
alpha | number | alpha received (buy) or sold (sell) |
price | Price | average price, fee excluded |
fee | number | fee in TAO |
impactBps | number | price impact of this fill in basis points (1 bps = 0.01 %) |
partial | boolean | only part of the requested size filled |
Intent
An order the script asked for. The engine fills it against the pool at a later block, or rejects or expires it.
| Field | Type | Description |
|---|---|---|
id | IntentId | |
side | Side | |
tao? | number | |
alpha? | number | |
maxPrice? | Price | |
minPrice? | Price | |
ttlBlocks | number | |
partialOk | boolean | |
reason? | string | |
createdBlock | BlockNumber | block in which the script created the intent |
status | "queued" | "submitted" | "filled" | "partial" | "rejected" | "expired" | "cancelled" | queued: waiting for its first block; submitted: waiting for a fill; then filled, partial, rejected, expired or cancelled |
Conditional
A stop, take-profit or trailing-stop order the engine watches. It is cancelled when the position closes, or when it is checked while there is no position.
| Field | Type | Description |
|---|---|---|
id | string | |
kind | "stop" | "takeProfit" | "trailing" | |
price? | Price | trigger price (stop, takeProfit) |
trailPct? | number | trail distance in percent (trailing) |
high | number | running high since creation (trailing) |
alpha | number | "all" | |
status | "active" | "triggered" | "cancelled" |
