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 returns as daily heat cells (like a contribution graph) or as a year × month table.

Examples

Daily K-line changes drawn as a return calendar.

javascript
function main() { var r = exchange.GetRecords(PERIOD_D1) if (!r || r.length < 2) return var data = r.slice(1).map(function (b, i) { return [b.Time, b.Close / r[i].Close - 1] }) LogStatus({type: "calendar", title: "Daily change", data: data, format: {percent: true, precision: 2}}) }
python
def main(): r = exchange.GetRecords(PERIOD_D1) if not r or len(r) < 2: return data = [[r[i]["Time"], r[i]["Close"] / r[i - 1]["Close"] - 1] for i in range(1, len(r))] LogStatus({"type": "calendar", "title": "Daily change", "data": data, "format": {"percent": True, "precision": 2}})
rust
fn main() { let Ok(r) = exchange.GetRecords(None, PERIOD_D1, None) else { return }; if r.len() < 2 { return; } let data: Vec<String> = r.windows(2) .map(|w| format!("[{}, {}]", w[1].Time, w[1].Close / w[0].Close - 1.0)) .collect(); LogStatus!(format!( r#"{{"type": "calendar", "title": "Daily change", "data": [{}], "format": {{"percent": true, "precision": 2}}}}"#, data.join(",") )); }

Attributes

NameTypeDescription

type

string

Required. Always calendar.

data

array

Required. Array of [date, value]: the date is a millisecond timestamp or a YYYY-MM-DD / YYYY-MM string; values of the same day are added up.

mode

string

day: daily heat cells, up to 53 weeks; month: a year × month table with yearly totals. Default day.

format

object

Number format {precision, compact, percent}; 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

Positive values use the up color and negative ones the down color, shaded by magnitude. day mode shows only day-precise entries; month mode adds up the values of each month. Timestamps are converted to dates in the browser's time zone.