策略參數
系統預留參數
請勿將系統預留參數用於其他用途
| Variable | Description | Type | Default Value | 
|---|---|---|---|
| exchange_fee | 設定回測及模擬的交易手續費,預設為 0.1% | Number | 0.001 | 
| spread | 設定回測及模擬的滑價比例 | Number | 0 | 
| leverage | 設定實單交易的槓桿倍數 | Number | 1 | 
| IS_DEBUG | 設定 True 以開啟回測的除錯模式 | Boolean | false | 
自定義參數
透過 self['OPTION_NAME'] 存取策略參數
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!
Type
- 
Boolean
A STRING that indicates either
trueorfalse - 
Number
A STRING that represents a
floatvalue. - 
String
A STRING that holds a
ASCIIstring - 
Select
A STRING that holds a list of
ASCIIstring. Separated by the symbol vertical bar|. 
Example
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 | 
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 self['argName']
def trade(self, information):
    CA.log(self['MyArgA']) # true
    CA.log(self['MyArgB']) # 10.9
    CA.log(self['MyArgC']) # Hello World!
    CA.log(self['MyArgD']) # OptionC
    CA.log(str(self['MyArgA'].__class__)) # <class 'str'>
    CA.log(str(self['MyArgB'].__class__)) # <class 'str'>
    CA.log(str(self['MyArgC'].__class__)) # <class 'str'>
    CA.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]