GetStrategyList
Queries strategies by scope, type, language, keyword and other conditions.
Examples
Get your first 10 strategies with positional arguments, or all your Rust strategies with named arguments.
python
# api() is the function in the Python example on the signature authentication page
r = api('GetStrategyList', 0, 10, -3, -1, -1, '') # your first 10 strategies
r = api('GetStrategyList', strategyType=-3, language=7) # all your Rust strategies
for s in r['data']['result']['strategies']:
print(s['id'], s['name'])Returns
| Type | Description |
object | On success |
Arguments
| Name | Type | Required | Description |
offset | number | Yes | Paging offset. |
length | number | Yes | Page size; less than or equal to 0 returns all. |
strategyType | number | Yes | Scope, e.g. |
category | number | Yes | Strategy type: |
language | number | Yes | Programming language, |
kw | string | Yes | Keyword matched fuzzily against strategy names, several words separated by spaces; an empty string means no filter. Starting with |
groupId | number | No | Strategy group: |
orderBy | string | No | Sort field: |
Attributes
| Name | Type | Description |
all | number | Total number of matching strategies. |
strategies | array | Array of strategies. |
strategies[].id | number | Strategy ID, the |
strategies[].category | number | Strategy type, same values as the |
strategies[].language | number | Programming language, same values as the |
Remarks
There is no needArgs parameter: passing an extra argument after category as old documentation did shifts the following arguments. Pass the arguments in the order above, or by name.
Positional calls accept only 0, 6, 7 or 8 arguments. With no arguments (args is []) the server fills in (-1, -1, -1, -1, 1, ""), so language is 1 and only Python strategies are returned; to get all languages pass language as -1, or pass arguments by name (then language defaults to -1).
Parameter values
strategyType (scope):
| Value | Meaning |
|---|---|
-1 | Your own and rented strategies (official strategies included) |
0 | Your own and rented strategies (official strategies excluded) |
-3 | Only your own strategies |
-6 | Only rented strategies (expired ones included) |
-4 | Official strategies |
-2 | Public and paid strategies in the strategy square |
1 | Published strategies |
2 | Strategies pending review |
category (strategy type): -1 all, 0 normal strategy, 20 template library, 21 trading plugin.
language (programming language):
| Value | Meaning |
|---|---|
-1 | All languages |
0 | JavaScript |
1 | Python |
3 | A discontinued strategy type that appears only in existing strategies |
4 | My language |
5 | PINE |
6 | Workflow |
7 | Rust |
Example response
json
{
"code": 0,
"data": {
"result": {
"all": 123,
"strategies": [{
"category": 0,
"date": "2024-11-10 20:40:04",
"description": "",
"forked": 0,
"hits": 0,
"id": 123,
"is_buy": false,
"is_owner": false,
"language": 0,
"last_modified": "2024-11-11 17:23:52",
"name": "HedgeGridStrategy",
"profile": {
"avatar": "...",
"nickname": "abc",
"uid": "4ed225440db1eda23fe05ed10184113e"
},
"public": 0,
"tags": "",
"uid": "4ed225440db1eda23fe05ed10184113e",
"username": "abc"
}]
},
"error": null
}
}