输入/搜索内容
内置函数
结构体
Trade
Ticker
Record
Order
OrderBook
Depth
Account
Position
Market
OtherStruct
HttpQuery-options
HttpQuery-return
LogStatus-table
LogStatus-btnTypeOne
LogStatus-btnTypeTwo
状态栏组件
grid
tabs
kpi
stat
progress
gauge
sparkline
chart
heatmap
calendar
histogram
pie
timeline
markdown
alert
badge
Chart-options
KLineChart-options
SetData-data
EventLoop-return
DBExec-return
Thread.join-return
内置变量

键值列表:一组「名称—数值」,适合账户余额、冻结资金、杠杆、强平价等明细。

示例

两列显示账户的可用资金、冻结资金和更新时间。

javascript
function main() { while (!exchange.IO("status")) Sleep(1000) exchange.SetContractType("rb888") var account = exchange.GetAccount() if (!account) return var f2 = {precision: 2} LogStatus({type: "stat", title: "账户", cols: 2, items: [ {label: "可用", value: account.Balance, unit: "元", format: f2}, {label: "冻结", value: account.FrozenBalance, unit: "元", format: f2}, {label: "更新时间", value: _D()} ]}) }
python
def main(): while not exchange.IO("status"): Sleep(1000) exchange.SetContractType("rb888") account = exchange.GetAccount() if not account: return f2 = {"precision": 2} LogStatus({"type": "stat", "title": "账户", "cols": 2, "items": [ {"label": "可用", "value": account["Balance"], "unit": "元", "format": f2}, {"label": "冻结", "value": account["FrozenBalance"], "unit": "元", "format": f2}, {"label": "更新时间", "value": _D()} ]})
rust
fn main() { while !exchange.IO("status").is_ok_and(|v| v.as_i64() == Some(1)) { Sleep(1000); } if exchange.SetContractType("rb888").is_err() { return; } let Ok(a) = exchange.GetAccount() else { return }; let item = |label: &str, v: f64| format!( r#"{{"label": "{}", "value": {}, "unit": "元", "format": {{"precision": 2}}}}"#, label, v ); let items = [ item("可用", a.Balance), item("冻结", a.FrozenBalance), format!(r#"{{"label": "更新时间", "value": "{}"}}"#, _D(None)), ]; LogStatus!(format!( r#"{{"type": "stat", "title": "账户", "cols": 2, "items": [{}]}}"#, items.join(",") )); }

属性

名称类型描述

type

string

必填,固定为 stat。

items

object数组

必填。缺少 label 或 value 的项被跳过。

items[].label

string

必填。名称。

items[].value

number / string

必填。数值或文字。

items[].unit

string

单位。

items[].color

string

颜色:up、down、primary、warning、muted,见状态栏组件。

items[].format

object

数值格式 {precision, compact, percent},见状态栏组件。

items[].hint

string

数值后的补充说明。

cols

number

并排几列,1–4。默认 1。

title

string

标题,显示在组件左上角。

id

string

稳定标识。组件的个数或顺序会变化时设置,状态栏刷新时组件不重建。

span

number

在所在grid中占几列。默认 1。

参考