This repository contains document files for https://www.crypto-arsenal.io/
File Name | Description | Language |
---|---|---|
WritingStrategy.md | 使用 JavaScript 開發策略 | 中文 |
WritingStrategy_en.md | Develop My Strategy in JS | English |
WritingPyStrategy.md | 使用 Python 開發策略 | 中文 |
WritingPyStrategy_en.md | Develop My Strategy in Python | English |
LocalStrategy.md | 本地策略 | 中文 |
LocalStrategy_en.md | Local Strategy | English |
You can add some extra arguments for the strategy and change these arguments for every live trade, backtest or simulation. For example, if you have the following configuration for a strategy
All arguments are actually stored and parsed as String
type in your strategy code. So you have to parse it by your self!
-
Boolean
A STRING that indicates either
true
orfalse
-
Number
A STRING that represents a
float
value. -
String
A STRING that holds a
ASCII
string -
Select
A STRING that holds a list of
ASCII
string. Separated by the symbol vertical bar|
.
Suppose you use the following configuration
Variable | Description | Type | Default Value |
---|---|---|---|
MyArgA | true/false | Boolean | true |
MyArgB | a float num | Number | 10.9 |
MyArgC | a ASCII Str | String | Hello World! |
MyArgD | a ASCII list | Select | OptionA|OptionB|OptionC |
Note: Only ASCII string is supported currently.
Then you're allowed to tweak these variables to be used in your strategy before trading. MyArgD
will appear as a list consisting of OptionA
, OptionB
and OptionC
.
You can access these arguments by this.argName
or this['argName']
.
Log(this['MyArgA']); // true
Log(typeof this['MyArgA']); // string
Log(this['MyArgB']); // 10.9
Log(typeof this['MyArgB']); // string
Log(this['MyArgC']); // Hello World!
Log(typeof this['MyArgC']); // string
Log(this['MyArgD']); // OptionC
Log(typeof this['MyArgD']); // string
So if you want to check MyArgA is true or not, you have to use it like if(this['MyArgA'] === 'true') {...}
instead of .if(this['MyArgA]) { ... }
You can access these arguments by self['argName']
.
Log(self['MyArgA']) # true
Log(str(self['MyArgA'].__class__)) # <class 'str'>
Log(self['MyArgB']) # 10.9
Log(str(self['MyArgB'].__class__)) # <class 'str'>
Log(self['MyArgC']) # Hello World!
Log(str(self['MyArgC'].__class__)) # <class 'str'>
Log(self['MyArgD']) # OptionC
Log(str(self['MyArgD'].__class__)) # <class 'str'>
So if you want to check MyArgA is true or not, you have to use it like if self['MyArgA'] == 'true'
instead of .if self['MyArgA]