Built-in Functions
Structures
Ticker
Depth
OrderBook
Trade
Record
Market
Order
Condition
Account
Asset
Position
Funding
Other Structures
Built-in Variables and Constants
Conventions
Exchanges
alert
Shows an info, success, warning or error message with an icon, for risk and error notices.
Examples
Shows a warning when available funds fall below a threshold, otherwise a passed check.
javascript
function main() {
var account = exchange.GetAccount()
if (!account) return
var alert = account.Balance < 100
? {type: "alert", level: "warning", title: "Low funds", text: "Below 100, opening paused"}
: {type: "alert", level: "success", title: "Funds check passed"}
LogStatus(alert)
}
python
def main():
account = exchange.GetAccount()
if not account:
return
if account["Balance"] < 100:
alert = {"type": "alert", "level": "warning", "title": "Low funds",
"text": "Below 100, opening paused"}
else:
alert = {"type": "alert", "level": "success", "title": "Funds check passed"}
LogStatus(alert)
rust
fn main() {
let Ok(a) = exchange.GetAccount() else { return };
let alert = if a.Balance < 100.0 {
r#"{"type": "alert", "level": "warning",
"title": "Low funds", "text": "Below 100, opening paused"}"#
} else {
r#"{"type": "alert", "level": "success", "title": "Funds check passed"}"#
};
// This JSON is the whole status bar, so it may span lines
LogStatus!(alert);
}Attributes
| Name | Type | Description |
type | string | Required. Always |
level | string | Level: |
title | string | Title. At least one of |
text | string | Description; when only |
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