The official reference for the Bot Assistant Query Language (BAQL)
BAQL (Bot Assistant Query Language) is a domain specific language used for expressing declarative requirements for Bot Assistant engines used in automated trading systems.
Its goal is to provide a flexible and ergonomic semantic to users and a machine parseable set of instructions that can be used to query for the requested data.
It’s designed to be platform agnostic, albeit some expressions might not be available in all dialects.
The syntax of the language is currently maintained by The Trading Parrot community and it’s subject to evolution over time. It follows the rules of semantic versioning.
Queries are implicit assumed as part of the language, therefore it’s not required to have explicit imperative clauses.
500
characters, including the ignored ones100000
Each action contains an operator and a predicate. Each operator comes with its own rules (criteria) but all of them should complain about the restrictions of BAQL grammar and syntax. The operators should be extensible and independent one each other.
Operator to command changes to the pairs settings of a bot.
PS
Operator name
Here is the EBNF-like grammar of the BAQL. The spaces in the grammar definition are for human readability. The grammar described here isn’t meant to be 100% accurate. Here are some missing details:
sentence: prefix actions
actions: action ((action_separator)+ action)*
prefix: 'BAQL:'
action_separator: ' '
action: operator
| operator operator_separator predicate
operator: 'PS'
operator_separator: ':'
predicate: categories criteria_separator sort
categories: 'ALL'
| category_list
category_list: category (category_separator category)*
category: 'DEFI'
| 'ERC'
| 'NFT'
| 'DOT'
| 'BSC'
| 'ZIL'
| 'MEME'
| 'SC'
category_separator: '&'
criteria_separator: '_'
sort: criteria_separator sort_number criteria_separator sort_keyword reverse_keyword
sort_number: [0-9]+
sort_keyword: 'LCGS'
| 'LCAR'
| 'DUSD'
| 'DBTC'
| 'HUSD'
| 'SV'
| 'BES'
| 'BUS'
| 'MC'
| 'MV'
reverse_keyword: '.r'
| ''
Sort keywords:
Sort Name | Description | Default Sort Order |
---|---|---|
LCGS | LunarCrush Galaxy Scoretm | descending |
LCAR | LunarCrush AltRanktm | ascending |
DUSD | 24h % change (USD) | descending |
DBTC | 24h % change (BTC) | descending |
HUSD | 1h % Change (USD) | descending |
SV | Social Volume | descending |
BUS | Bullish Sentiment | descending |
BES | Bearish Sentiment | descending |
MC | Market cap | descending |
MV | Market volume | descending |
Supported categories:
Category | Description |
---|---|
DEFI | DeFi |
ERC | ERC-20 |
NFT | NFT |
DOT | DOT ecosystem |
BSC | BSC ecosystem |
ZIL | ZIL ecosystem |
SC | Stable coins |
MEME | Meme coins |
❌ ALL_50_BUS
INVALID:
Missing starting BAQL tag
❌ BAQL:ALL_50BUS
INVALID:
No available actions
❌ BAQL:XXX:ALL_50BUS
INVALID:
No available actions
✅ BAQL:PS:ALL_50_BUS
✅ BAQL:PS:MEME_25_DUSD
✅ BAQL:PS:ALL_200_MC.r
✅ BAQL:PS:DEFI&NFT_25_DBTC
✅ BAQL:PS:ALL_10_LCAR
❌ BAQL:PS:ALL_10_ZZ
INVALID:
PS: Invalid sorting order keyword
❌ BAQL:PS:ALL_LCAR
INVALID:
PS: action malformed
Comments are not allowed in BAQL.
Code | Meaning |
---|---|
1001 |
String too long: Max 500 chars |
1002 |
Missing starting BAQL tag |
1003 |
Additional start tags |
2001 |
No available actions |
2002 |
Unsupported action |
2003 |
Multiple occurences of the same action |
3001 |
PS: action malformed |
3002 |
PS: Unsupported categories |
3003 |
PS: Invalid n. of tokens [1,99999] |
3004 |
PS: Invalid sorting criteria |
3005 |
PS: Invalid sorting order keyword |