stat
Lists label and value pairs, for details such as balances, frozen funds, leverage or liquidation price.
Examples
Two columns show available and frozen funds and the update time.
javascript
function main() {
var account = exchange.GetAccount()
if (!account) return
var f2 = {precision: 2}
LogStatus({type: "stat", title: "Account", cols: 2, items: [
{label: "Available", value: account.Balance, unit: "USDT", format: f2},
{label: "Frozen", value: account.FrozenBalance, unit: "USDT", format: f2},
{label: "Updated", value: _D()}
]})
}
python
def main():
account = exchange.GetAccount()
if not account:
return
f2 = {"precision": 2}
LogStatus({"type": "stat", "title": "Account", "cols": 2, "items": [
{"label": "Available", "value": account["Balance"], "unit": "USDT", "format": f2},
{"label": "Frozen", "value": account["FrozenBalance"], "unit": "USDT", "format": f2},
{"label": "Updated", "value": _D()}
]})
rust
fn main() {
let Ok(a) = exchange.GetAccount() else { return };
let item = |label: &str, v: f64| format!(
r#"{{"label": "{}", "value": {}, "unit": "USDT", "format": {{"precision": 2}}}}"#,
label, v
);
let items = [
item("Available", a.Balance),
item("Frozen", a.FrozenBalance),
format!(r#"{{"label": "Updated", "value": "{}"}}"#, _D(None)),
];
LogStatus!(format!(
r#"{{"type": "stat", "title": "Account", "cols": 2, "items": [{}]}}"#,
items.join(",")
));
}Attributes
| Name | Type | Description |
type | string | Required. Always |
items | object array | Required. Entries without |
items[].label | string | Required. Label. |
items[].value | number / string | Required. Number or text. |
items[].unit | string | Unit. |
items[].color | string | Color: |
items[].format | object | Number format |
items[].hint | string | Note after the value. |
cols | number | Number of side-by-side columns, |
title | string | Title shown at the top left of the component. |
id | string | Stable identifier. Set it when the number or order of components changes, so refreshes do not rebuild the component. |
span | number | Number of columns it spans in the enclosing |
See Also