Functionality
- A monitoring service that tracks portfolio values and market prices on Aster DEX, alerting when thresholds are breached.
- Two modes: ‘portfolio’ (monitors account balance value) or ‘market’ (monitors price changes). To monitor both, create two separate detector instances with different modes.
- The monitor generates events for: portfolio value falling below threshold, significant price drops in monitored assets, and API connection errors.
- API keys are required for ‘portfolio’ mode. Market monitoring only uses public endpoints and doesn’t require authentication.
- The detector runs on a configurable interval (default: 600 seconds / 10 minutes). You can adjust the check_interval parameter to customize the monitoring frequency. Each check evaluates all configured conditions for portfolio thresholds and/or price drops depending on the monitoring mode. Minimum recommended: 60 seconds to avoid API rate limits.
-
SUPPORTED SYNTAX
1. BASIC COMPARISON OPERATORS
2. ABSOLUTE VALUE HANDLING
3. EXPLICIT SIGN HANDLING (no absolute value)
3.5. ONCE OPERATORS (edge detection – trigger only when condition transitions from false to true)
Note:
- These operators return
trueonly when the condition transitions from false → true (edge detection).- Once true, subsequent evaluations return false even if the condition remains true.
- Useful for detecting threshold crossings or one-time events.
4. PERCENTAGE OPERATIONS
Formula:
(v - v₀) / v₀ * 100
Examples:
v₀ = 1000,v = 700→ -30% (decreased by 30%)v₀ = 1000,v = 1300→ 30% (increased by 30%)v₀ = 100,v = 100→ 0% (no change)
5. DELTA OPERATIONS (change from previous value)
6. PERCENTAGE DELTA OPERATIONS
7. SPACES SUPPORT
NOTES
-
=and!=always use exact value matching -
>,<,>=,<=respect absolute value handling -
>>,<<(once operators) trigger only on false → true transitions -
++,--(delta operations) work with all comparison operators (including once operators) - Percentage operations are compatible with all comparison operators
- Spaces are ignored during parsing
-
The
absparameter is automatically detected:+/-prefixes disable absolute value handling
- Once operators trigger only when a condition transitions from false to true (edge detection). For example, ’>> 5%’ triggers when portfolio change exceeds 5%, but won’t trigger again until the change drops below 5% and then exceeds it again. This prevents repeated alerts for the same event. Use > instead of >> if you want alerts every check while the condition is true.
-
Use the ‘Mock Account Data’ field to provide a JSON string with fake balance data. When set, the detector skips the /api/v1/account API call and uses your mock data instead. Price data is still fetched from real public endpoints. Format:
{"balances": [{"asset": "BTC", "free": "100", "locked": "0"}]}
Configuration
- API Key (Portfolio mode) (
api_key, default:None): Asterex API key for authentication - API Secret (Portfolio mode) (
api_secret, default:None): Asterex API secret for HMAC SHA256 signature - Check Interval (seconds) (
check_interval, default:600): Time interval between monitoring checks in seconds. Default is 600 seconds (10 minutes). Minimum recommended: 60 seconds to avoid API rate limits. - Monitoring Mode (
monitoring_mode, default:portfolio): Monitoring mode: ‘portfolio’ or ‘market’ - Monitored Assets - Market mode (
monitored_assets, default:[{'asset': 'BTC', 'condition': '>> 10'}, {'asset': 'BNB', 'condition': '> 5%'}]): List of assets to monitor with flexible conditions (only used in market mode). Each asset has its own condition. Not needed for portfolio mode. - Mock Account Data (Testing Only) - Portfolio mode (
mock_account_data, default:None): Optional JSON string with mock account balance data for testing. When provided, skips the /api/v1/account API call. Format:{"balances": [{"asset": "BTC", "free": "100", "locked": "0"}]} - Portfolio Condition - Portfolio mode (
portfolio_condition, default:>> 5%): Flexible condition using Scala SDK syntax. Examples: >> 5% (alert once when portfolio drops >5%), > 10% (alert every time portfolio changes >10%), < 10000000 (alert when below 1M)
Supported networks: evm.