资源加载中... loading...

可视化策略编写范例 BITMEX 策略测试

Author: 发明者量化-小小梦, Date: 2018-10-29 16:13:19
Tags: StudyVisualizationBitMEX


{"xml":"<xml xmlns=\"http://www.w3.org/1999/xhtml\">\n  <variables>\n    <variable type=\"\" id=\"Vg+2k:6=?nWh~j,r5iT+\">ticker1</variable>\n    <variable type=\"\" id=\"vQ*h=(352BUSo$Vj3X_{\">id</variable>\n    <variable type=\"\" id=\"3wsE0Qm,c03qmoR$(vIE\">pos</variable>\n  </variables>\n  <block type=\"ext_exchange_SetContractType\" id=\"}w();g2!(Oo8*N*a?(Bm\" x=\"86\" y=\"84\">\n    <field name=\"INPUT_0\">0</field>\n    <value name=\"INPUT_1\">\n      <shadow type=\"text\" id=\"c~tKouCyOZx#HsdrG749\">\n        <field name=\"TEXT\">XBTUSD</field>\n      </shadow>\n    </value>\n    <next>\n      <block type=\"controls_whileUntil\" id=\"LK^{xkUyFUG{7O=[_wr9\">\n        <field name=\"MODE\">WHILE</field>\n        <value name=\"BOOL\">\n          <block type=\"logic_boolean\" id=\"vkp!oC#{9IJ8;^~!Hv3F\">\n            <field name=\"BOOL\">TRUE</field>\n          </block>\n        </value>\n        <statement name=\"DO\">\n          <block type=\"variables_set\" id=\"C_xe8.R,bGo4p*fRgcyj\">\n            <field name=\"VAR\" id=\"Vg+2k:6=?nWh~j,r5iT+\" variabletype=\"\">ticker1</field>\n            <value name=\"VALUE\">\n              <block type=\"ext_exchange_GetTicker\" id=\"S[)He35wMY.!ejExf@=V\">\n                <field name=\"INPUT_0\">0</field>\n              </block>\n            </value>\n            <next>\n              <block type=\"controls_if\" id=\"[ZH*NW@8vd:Hfycf6Z9)\">\n                <value name=\"IF0\">\n                  <block type=\"logic_compare\" id=\":?LRDfP}I%..-4!,6{O6\">\n                    <field name=\"OP\">GT</field>\n                    <value name=\"A\">\n                      <block type=\"ext_TickerOf\" id=\"XoSvM3I}~b2c[{|8)b4K\">\n                        <field name=\"INPUT_0\">Last</field>\n                        <value name=\"INPUT_1\">\n                          <block type=\"variables_get\" id=\"IwGDFf^gd:gdyfXb8lA^\">\n                            <field name=\"VAR\" id=\"Vg+2k:6=?nWh~j,r5iT+\" variabletype=\"\">ticker1</field>\n                          </block>\n                        </value>\n                      </block>\n                    </value>\n                    <value name=\"B\">\n                      <block type=\"math_number\" id=\"H1A,:ukX~%M*1[#rz%,q\">\n                        <field name=\"NUM\">6500</field>\n                      </block>\n                    </value>\n                  </block>\n                </value>\n                <statement name=\"DO0\">\n                  <block type=\"ext_exchange_SetDirection\" id=\"nzM*5qQpz?MyChOq6dLP\">\n                    <field name=\"INPUT_0\">0</field>\n                    <field name=\"INPUT_1\">buy</field>\n                    <next>\n                      <block type=\"variables_set\" id=\"8}I;`orw9D19u8DzOcv7\">\n                        <field name=\"VAR\" id=\"vQ*h=(352BUSo$Vj3X_{\" variabletype=\"\">id</field>\n                        <value name=\"VALUE\">\n                          <block type=\"ext_exchange_Trade\" id=\",fRYPzaHyk~St?6sa@lw\">\n                            <field name=\"INPUT_0\">0</field>\n                            <field name=\"INPUT_1\">Buy</field>\n                            <value name=\"INPUT_2\">\n                              <shadow type=\"math_number\" id=\"7UoNedC#kal]f*Xs1v0.\">\n                                <field name=\"NUM\">0</field>\n                              </shadow>\n                              <block type=\"ext_TickerOf\" id=\"Fwt34XVv:^.OnMFF:3;x\">\n                                <field name=\"INPUT_0\">Last</field>\n                                <value name=\"INPUT_1\">\n                                  <block type=\"variables_get\" id=\"3g5x!FfVj(lwx22I?^tQ\">\n                                    <field name=\"VAR\" id=\"Vg+2k:6=?nWh~j,r5iT+\" variabletype=\"\">ticker1</field>\n                                  </block>\n                                </value>\n                              </block>\n                            </value>\n                            <value name=\"INPUT_3\">\n                              <shadow type=\"math_number\" id=\"F2,6mEEj!41dhuJAWXM[\">\n                                <field name=\"NUM\">10</field>\n                              </shadow>\n                            </value>\n                          </block>\n                        </value>\n                        <next>\n                          <block type=\"controls_if\" id=\"_J~L}2*:(5)%w$UIr,r:\">\n                            <value name=\"IF0\">\n                              <block type=\"variables_get\" id=\"AL@5Ch*`5O[`d-zJbQn:\">\n                                <field name=\"VAR\" id=\"vQ*h=(352BUSo$Vj3X_{\" variabletype=\"\">id</field>\n                              </block>\n                            </value>\n                            <statement name=\"DO0\">\n                              <block type=\"variables_set\" id=\"%sM|+_28jp*I:9^N!~#%\">\n                                <field name=\"VAR\" id=\"3wsE0Qm,c03qmoR$(vIE\" variabletype=\"\">pos</field>\n                                <value name=\"VALUE\">\n                                  <block type=\"ext_exchange_GetPosition\" id=\"Z,wI6Hj`m[T^hsa9{=eF\">\n                                    <field name=\"INPUT_0\">0</field>\n                                  </block>\n                                </value>\n                                <next>\n                                  <block type=\"ext_Log\" id=\"X[pmQ$.FiT`)lU$Z.itV\">\n                                    <value name=\"VALUE\">\n                                      <shadow type=\"text\" id=\"`)eR3T~{dpo#0@O-4r=?\">\n                                        <field name=\"TEXT\">abc</field>\n                                      </shadow>\n                                      <block type=\"variables_get\" id=\"VPkrN2ZO`C0=1xaby37E\">\n                                        <field name=\"VAR\" id=\"3wsE0Qm,c03qmoR$(vIE\" variabletype=\"\">pos</field>\n                                      </block>\n                                    </value>\n                                  </block>\n                                </next>\n                              </block>\n                            </statement>\n                          </block>\n                        </next>\n                      </block>\n                    </next>\n                  </block>\n                </statement>\n              </block>\n            </next>\n          </block>\n        </statement>\n      </block>\n    </next>\n  </block>\n</xml>","javascript":"function main() {\n    var ticker1, id, pos;\n\n\n    exchanges[0].SetContractType('XBTUSD');\n    while (true) {\n        ticker1 = _C(exchanges[0].GetTicker);\n        if (ticker1.Last > 6500) {\n            exchanges[0].SetDirection('buy');\n            id = exchanges[0].Buy(ticker1.Last, 10);\n            if (id) {\n                pos = _C(exchanges[0].GetPosition);\n                Log(pos);\n            }\n        }\n    }\n}"}
template: strategy.tpl:40:21: executing "strategy.tpl" at <.api.GetStrategyListByName>: wrong number of args for GetStrategyListByName: want 7 got 6