Triggers

The following triggers can be used in DEX/AMM. Please check the development status as well. For more details, please contact the team.
Function Name | Category | Variable | Explanation | Example | Availability |
---|---|---|---|---|---|
period_exc() | Market Data | period, unit, n | Triggers to be executed periodically | period_exc(1,hour,2) means buy btc 2 times per hour | 🛠 |
price() | Market Data | marketName, minutes(optional) | Takes a market name as an argument and returns the final price of the asset. When user input n, it returns the price n minute before the asset. | price("ETH/USD",7) returns the price 7 minute before ETH/USD. | 🛠 |
last_trade_price() | Market Data | marketName | Returns the last traded price of the asset. | last_trade_price("LINKBULL/USD") Returns the last trade price for that asset. | 🛠 |
free_collateral | Account Data | - | Returns the amount of collateral not required in U.S. dollars in the Wallet. | free_collateral>500. This rule is triggered when the collateral-free amount in the wallet exceeds $500. | 🛠 |
total_position_size | Account Data | - | Returns the total account position size (in USD) for all futures. | total_position_size<2*total_collateral This rule is triggered when the total position is less than twice the collateral in the account. | 🛠 |
position() | Position Data | marketName | Returns the size of the asset position. Returns a positive value or 0. | position("BTC-USDC") returns the size of the BTC position in spot. | 🛠 |
position_side() | Position Data | marketName | Returns 1 if the position is long, -1 if the position is short, or 0 if the position is neither. | position_side("ETH-USDC")Returns 1 if ETH bought. | 🛠 |
abs() | Math Function | x | Takes a numeric value as an argument and returns its absolute value. | In the case of abs(-2), 2 is returned. | 🛠 |
max() | Math Function | x,y | The two numbers are taken as arguments and return the greater of x and y. | max(3.2, 10) returns 10 | 🛠 |
min() | Math Function | x,y | The two numbers are taken as arguments and return the smaller of x and y. | min(1, 5), 1 is returned. | 🛠 |
sqrt() | Math Function | x | Takes a positive number and returns its square root. | sqrt(25) returns 5. | 🛠 |
floor() | Math Function | x | Takes a numeric argument and returns the largest integer less than or equal to x. | floor(2.5) returns 2. | 🛠 |
ceil() | Math Function | x | Takes a numeric argument and returns the smallest integer greater than or equal to x. | ceil(2.5) returns 3. | 🛠 |
sign() | Math Function | x | It takes a numeric argument and returns 1 for positive values and 0 for negative values. | sign(10) returns 1 and sign(-5) returns 0. | 🛠 |
get_variable() | Others | name | It takes a variable name as an argument and returns the value stored in this variable. | When you store 10 in the variable named myVariable. In that case, get_variable('myVariable') returns 10. | 🛠 |
time | Others | Returns the current UNIX time. | | | 🛠 |
minute | Others | Returns only the minute of the current time. | | | 🛠 |
hour | Others | Returns only the current Universal Standard Time. | | | 🛠 |
Last modified 25d ago