Type/to search
Built-in Functions
Structures
Ticker
Depth
OrderBook
Trade
Record
Market
Order
Condition
Account
Asset
Position
Funding
Other Structures
HttpQuery-options
HttpQuery-return
LogStatus-table
LogStatus-btnTypeOne
LogStatus-btnTypeTwo
Status Bar Components
grid
tabs
kpi
stat
progress
gauge
sparkline
chart
heatmap
calendar
histogram
pie
timeline
markdown
alert
badge
Chart-options
Chart-return
KLineChart-options
KLineChart-return
SetData-data
EventLoop-return
exchange.Go-return
DBExec-return
Dial-return
Thread.join-return
Built-in Variables and Constants
Conventions
Exchanges

Shows a number with a small trend line, colored by the first-to-last change by default.

Examples

Shows the close prices of the last 24 hourly K-lines.

javascript
function main() { var r = exchange.GetRecords(PERIOD_H1) if (!r || r.length < 24) return var closes = r.slice(-24).map(function (b) { return b.Close }) LogStatus({type: "sparkline", title: "Last 24 hours", data: closes}) }
python
def main(): r = exchange.GetRecords(PERIOD_H1) if not r or len(r) < 24: return closes = [b["Close"] for b in r[-24:]] LogStatus({"type": "sparkline", "title": "Last 24 hours", "data": closes})
rust
fn main() { let Ok(r) = exchange.GetRecords(None, PERIOD_H1, None) else { return }; if r.len() < 24 { return; } let closes: Vec<String> = r[r.len() - 24..].iter().map(|b| b.Close.to_string()).collect(); LogStatus!(format!( r#"{{"type": "sparkline", "title": "Last 24 hours", "data": [{}]}}"#, closes.join(",") )); }

Attributes

NameTypeDescription

type

string

Required. Always sparkline.

data

numeric array

Required. At least 2 numbers; non-numeric items are ignored.

value

number / string

The large value. Defaults to the last item of data.

unit

string

Unit.

format

object

Number format {precision, compact, percent}; see Status Bar Components.

color

string

Line color, by default up or down from comparing the first and last items. Values: see Status Bar Components.

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 grid. Default 1.

See Also

Remarks

When the first and last items have the same sign, the change between them is shown as a percentage next to the value; it is hidden when the signs differ (for example a funding rate turning negative).