Inventors quantify the API documentation

Author: The Little Dream, Created: 2017-11-27 09:05:08, Updated: 2023-07-12 16:47:31

We have already received the data, and the follow-up to the EventLoop monitoring mechanism, and we missed these events. // Unless the first line of code starts calling EventLoop ((-1) and initializes the listening mechanism of the EventLoop first, these events will not be missed

// Log("GetDepth:", routine_getDepth.wait()) 如果这里提前调用wait函数取出GetDepth函数并发调用的结果,此次GetDepth函数收到请求结果的事件便不会在EventLoop函数返回
var ts1 = new Date().getTime()
var ret1 = EventLoop(0)

var ts2 = new Date().getTime()
var ret2 = EventLoop(0)

var ts3 = new Date().getTime()
var ret3 = EventLoop(0)

Log("第1个并发任务完成的为:", _D(ts1), ret1)
Log("第2个并发任务完成的为:", _D(ts2), ret2)
Log("第3个并发任务完成的为:", _D(ts3), ret3)

Log("GetTicker:", routine_getTicker.wait())
Log("GetDepth:", routine_getDepth.wait())
Log("GetTrades:", routine_getTrades.wait())

}


```python
import time
def main():
    routine_getTicker = exchange.Go("GetTicker")
    routine_getDepth = exchange.Go("GetDepth")
    routine_getTrades = exchange.Go("GetTrades")
    
    ts1 = time.time()
    ret1 = EventLoop(0)
    
    ts2 = time.time()
    ret2 = EventLoop(0)
    
    ts3 = time.time()
    ret3 = EventLoop(0)
    
    Log("第1个并发任务完成的为:", _D(ts1), ret1)
    Log("第2个并发任务完成的为:", _D(ts2), ret2)
    Log("第3个并发任务完成的为:", _D(ts3), ret3)
    
    Log("GetTicker:", routine_getTicker.wait())
    Log("GetDepth:", routine_getDepth.wait())
    Log("GetTrades:", routine_getTrades.wait())
void main() {
    auto routine_getTicker = exchange.Go("GetTicker");
    auto routine_getDepth = exchange.Go("GetDepth");
    auto routine_getTrades = exchange.Go("GetTrades");
    
    auto ts1 = Unix() * 1000;
    auto ret1 = EventLoop(0);
    
    auto ts2 = Unix() * 1000;
    auto ret2 = EventLoop(0);
    
    auto ts3 = Unix() * 1000;
    auto ret3 = EventLoop(0);
    
    Log("第1个并发任务完成的为:", _D(ts1), ret1);
    Log("第2个并发任务完成的为:", _D(ts2), ret2);
    Log("第3个并发任务完成的为:", _D(ts3), ret3);
    
    Ticker ticker;
    Depth depth;
    Trades trades;
    routine_getTicker.wait(ticker);
    routine_getDepth.wait(depth);
    routine_getTrades.wait(trades);
    
    Log("GetTicker:", ticker);
    Log("GetDepth:", depth);
    Log("GetTrades:", trades);
}

Built-in functions

_G(K, V)

_G(K, V)The function implements a saveable global dictionary function, which supports both retrieval and disk; after retrieval, the saved data is cleared. The data structure isKVTables, permanently stored local files, a separate database on each disk, that remain after a restart or administrator logs out.KIt has to be written as a string, without a big or small distinction.VIt can be used for anything.JSONSequential content. Calls during disk operation._G()If the function does not pass any parameters, then the function is not a function._G()The function returns the current disk.ID

function main(){
    // 设置一个全局变量num,值为1
    _G("num", 1)     
    // 更改一个全局变量num,值为字符串ok
    _G("num", "ok")    
    // 删除全局变量num
    _G("num", null)
    // 返回全局变量num的值
    Log(_G("num"))
    // 删除所有全局变量
    _G(null)
    // 返回实盘ID
    var robotId = _G()
}
def main():
    _G("num", 1)     
    _G("num", "ok")    
    _G("num", None)
    Log(_G("num"))
    _G(None)
    robotId = _G()
void main() {
    _G("num", 1);
    _G("num", "ok");
    _G("num", NULL);
    Log(_G("num"));
    _G(NULL);
    // 不支持 auto robotId = _G();
}

Please note: Use_GWhen storing functional persistent data, the memory and hard disk space of the hardware device should be used reasonably and not abused; otherwise, it may causeMemory leakageThe question is:

_D(Timestamp, Fmt)

_D(Timestamp, Fmt), returns the time string of the specified time frame.TimestampFor the numeric type, the value is milliseconds.FmtFor the string type,FmtThe implication is:yyyy-MM-dd hh:mm:ss, returns the value: String type. Returns the string that corresponds to the specified time frame (milli-second) without passing any parameters._D()Or_D(1478570053241)The default format isyyyy-MM-dd hh:mm:ss

function main(){
    var time = _D()
    Log(time)
}
def main():
    strTime = _D()
    Log(strTime)
void main() {
    auto strTime = _D();
    Log(strTime);
}

Please note:PythonStrategic use_D()The parameters that need to be taken into consideration are the second-level time stamp.JavaScriptC++In the strategy, a millisecond-scale timestamp is used, where 1 second equals 1000 milliseconds). Use in real time_D()When a function parses a timestamp as a readable time string, it is necessary to pay attention to the time zone and time setting of the operating system where the host program is located._D()The function parses a time stamp as a readable time string that is set based on the time of the host system.

For example, a time frame is1574993606000Use code to parse:

function main() {
    Log(_D(1574993606000))
}
def main():
    # 北京时间的服务器上运行:2019-11-29 10:13:26 ,另一台其它地区的服务器上的托管者运行此代码结果则为:2019-11-29 02:13:26
    Log(_D(1574993606))
void main() {
    Log(_D(1574993606000));
}

_N(Num, Precision)

_N(Num, Precision), format a floating point number.NumFor the numerical type,PrecisionFor the integer type. Return value: numeric type.

For example,_N(3.1415, 2)Will be deleted3.1415The function returns the value after the decimal point.3.14

function main(){
    var i = 3.1415
    Log(i)
    var ii = _N(i, 2)
    Log(ii)
}
def main():
    i = 3.1415
    Log(i)
    ii = _N(i, 2)
    Log(ii)
void main() {
    auto i = 3.1415;
    Log(i);
    auto ii = _N(i, 2);
    Log(ii);
}

If you want to change all the n digits to the left of the decimal point to 0, you can write it like this:

function main(){
    var i = 1300
    Log(i)
    var ii = _N(i, -3)
    // 查看日志得知为1000
    Log(ii)
}
def main():
    i = 1300
    Log(i)
    ii = _N(i, -3)
    Log(ii)
void main() {
    auto i = 1300;
    Log(i);
    auto ii = _N(i, -3);
    Log(ii);
}

_C(…)

_C(function, args...)This function is a re-test function, which is used to retrieve transactions, retrieve unfinished orders, etc.

The interface will continue to call the specified function until it successfully returns the ((parameter)functionReturns a null value when a function is called orfalseI'm going to try calling you again.)_C(exchange.GetTicker)By default, you can call the default retry interval of 3 seconds._CDelay(...)Functions to set retest intervals, such as_CDelay(1000), refers to change_CRe-test the function with an interval of 1 second.

For the following functions:

  • exchange.GetTicker()
  • exchange.GetDepth()
  • exchange.GetTrades()
  • exchange.GetRecords()
  • exchange.GetAccount()
  • exchange.GetOrders()
  • exchange.GetOrder()
  • exchange.GetPosition()

It's all good._C(...)Function to call error tolerance._C(function, args...)Functions are not limited to the error tolerance of the functions listed above, parametersfunctionIt's a function reference, not a function call._C(exchange.GetTicker)It's not_C(exchange.GetTicker())

function main(){
    var ticker = _C(exchange.GetTicker)
    // 调整_C()函数重试时间间隔为2秒
    _CDelay(2000)
    var depth = _C(exchange.GetDepth)
    Log(ticker)
    Log(depth)
}
def main():
    ticker = _C(exchange.GetTicker)
    _CDelay(2000)
    depth = _C(exchange.GetDepth)
    Log(ticker)
    Log(depth)
void main() {
    auto ticker = _C(exchange.GetTicker);
    _CDelay(2000);
    auto depth = _C(exchange.GetDepth);
    Log(ticker);
    Log(depth);
}

Use for functions with parameters_C(...)When to make mistakes:

function main(){
    var records = _C(exchange.GetRecords, PERIOD_D1)
    Log(records)
}
def main():
    records = _C(exchange.GetRecords, PERIOD_D1)
    Log(records)
void main() {
    auto records = _C(exchange.GetRecords, PERIOD_D1);
    Log(records);
}

It can also be used for error tolerance for custom functions:

var test = function(a, b){
    var time = new Date().getTime() / 1000
    if(time % b == 3){
        Log("符合条件!", "#FF0000")
        return true
    }
    Log("重试!", "#FF0000")
    return false
}

function main(){
    var ret = _C(test, 1, 5)
    Log(ret)
}
import time
def test(a, b):
    ts = time.time()
    if ts % b == 3:
        Log("符合条件!", "#FF0000")
        return True
    Log("重试!", "#FF0000")
    return False

def main():
    ret = _C(test, 1, 5)
    Log(ret)
// C++ 不支持这种方式对于自定义函数容错

_Cross(Arr1, Arr2)

_Cross(Arr1, Arr2)Returns the array.arr1andarr2The number of cross cycles of the array. A positive number is the up-and-down cycle, a negative number is the down-and-down cycle, and 0 is the same as the current price.

It can simulate a set of data tests._Cross(Arr1, Arr2)The function:

// 快线指标
var arr1 = [1,2,3,4,5,6,8,8,9]
// 慢线指标
var arr2 = [2,3,4,5,6,7,7,7,7]
function main(){
    Log("_Cross(arr1, arr2) : ", _Cross(arr1, arr2))
    Log("_Cross(arr2, arr1) : ", _Cross(arr2, arr1))
}
arr1 = [1,2,3,4,5,6,8,8,9]     
arr2 = [2,3,4,5,6,7,7,7,7]
def main():
    Log("_Cross(arr1, arr2) : ", _Cross(arr1, arr2))
    Log("_Cross(arr2, arr1) : ", _Cross(arr2, arr1))
void main() {
    vector<double> arr1 = {1,2,3,4,5,6,8,8,9};
    vector<double> arr2 = {2,3,4,5,6,7,7,7,7};
    Log("_Cross(arr1, arr2) : ", _Cross(arr1, arr2));
    Log("_Cross(arr2, arr1) : ", _Cross(arr2, arr1));
}

img

Visualize the simulated data for observation

img

Specific instructions for use:Built-in function_Cross analysis and instructions

JSONParse(strJson)

JSONParse(strJson)This function is used to parse JSON strings. It can correctly parse JSON strings containing larger numeric values, which will parse the larger numeric value as a string type. The backtest system does not support this function.

function main() {
    let s1 = '{"num": 8754613216564987646512354656874651651358}'
    Log("JSON.parse:", JSON.parse(s1))    // JSON.parse: {"num":8.754613216564988e+39}
    Log("JSONParse:", JSONParse(s1))      // JSONParse:  {"num":"8754613216564987646512354656874651651358"}
    
    let s2 = '{"num": 123}'
    Log("JSON.parse:", JSON.parse(s2))    // JSON.parse: {"num":123}
    Log("JSONParse:", JSONParse(s2))      // JSONParse:  {"num":123}
}
import json

def main():
    s1 = '{"num": 8754613216564987646512354656874651651358}'
    Log("json.loads:", json.loads(s1))    # json.loads: map[num:8.754613216564987e+39]
    Log("JSONParse:", JSONParse(s1))      # JSONParse:  map[num:8754613216564987646512354656874651651358]
    
    s2 = '{"num": 123}'
    Log("json.loads:", json.loads(s2))    # json.loads: map[num:123]
    Log("JSONParse:", JSONParse(s2))      # JSONParse:  map[num:123]
void main() {
    auto s1 = "{\"num\":8754613216564987646512354656874651651358}";
    Log("json::parse:", json::parse(s1));
    // Log("JSONParse:", JSONParse(s1));   // 不支持该函数
    
    auto s2 = "{\"num\":123}";
    Log("json::parse:", json::parse(s2));
    // Log("JSONParse:", JSONParse(s2));   // 不支持该函数
}

Customized colors

Each message string can be used.#ff0000This RGB value at the end represents the foreground that needs to be displayed.#ff0000112233In this format, the last six characters represent the background colour.

function main() {
    Log("红色", "#FF0000")
}
def main():
    Log("红色", "#FF0000")
void main() {
    Log("红色", "#FF0000");
}

Log information

Log information is stored in the database of the disk while the disk is running, using the database of the disksqlite3Databases, on-disc database files on the device where the host program is located, database files on the host program (((robotIn the executable directory. For example:130350The database files on the hard disk are../logs/storage/130350In this directory..I mean,robotThe directory where the administrator program is located), the database file is called130350.db3I'm not going to lie. The logs in the retrieval system can be retrieved after the retrieval is complete by clicking the retrieval button in the bottom right corner of the page.Download the log] button to download. When a host on another server needs to migrate a disk, it can move the database file on the disk (extension named db3) to the migration destination server, setting the file name to the corresponding disk ID on the platform. This way, all log information on the previous disk is not lost when moving to the new device.

Log(…)

Log(message), save a message to the log list.messageIt can be any type. If you add it after the string@The message will then be pushed into the push queue and pushed to the email, Telegram, WebHook, etc. configured in the push settings of the current inventor's account.The control centerPage, top right cornerAccount settingsThis is a page.Push settingsThe page setting is binding.)

Please note:

  • Push is not supported in the Debugging Tool.
  • Push is not supported in the Retesting System.
function main() {
    Log("发明者量化你好 !@")
    Sleep(1000 * 5)
    // 字符串内加入#ff0000,打印日志显示为红色,并且推送消息
    Log("你好, #ff0000@")
}
def main():
    Log("发明者量化你好 !@")
    Sleep(1000 * 5)
    Log("你好, #ff0000@")
void main() {
    Log("发明者量化你好 !@");
    Sleep(1000 * 5);
    Log("你好, #ff0000@");
}

WebHookPushed:

UseGolangDEMO is a service program written by:

package main
import (
    "fmt"
    "net/http"
)

func Handle (w http.ResponseWriter, r *http.Request) {
    defer func() {
        fmt.Println("req:", *r)
    }()
}

func main () {
    fmt.Println("listen http://localhost:9090")
    http.HandleFunc("/data", Handle)
    http.ListenAndServe(":9090", nil)
}

Set upWebHookhttp://XXX.XX.XXX.XX:9090/data?data=Hello_FMZ

After running the service program, execute the policy, the policy pushes the message:

function main() {
    Log("msg", "@")
}
def main():
    Log("msg", "@")
void main() {
    Log("msg", "@");
}

In the meantime, I'm going to try to get a copy of this post.

listen http://localhost:9090
req: {GET /data?data=Hello_FMZ HTTP/1.1 1 1 map[User-Agent:[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/xx.x.xxxx.xxx Safari/537.36] Accept-Encoding:[gzip]] {} <nil> 0 [] false 1XX.XX.X.XX:9090 map[] map[] <nil> map[] XXX.XX.XXX.XX:4xxx2 /data?data=Hello_FMZ <nil> <nil> <nil> 0xc420056300}

Printingbase64Image after coding LogFunction support for printingbase64The image is encoded to be displayed in the following way:`It starts with:`In the end, for example:

function main() {
    Log("`data:image/png;base64,AAAA`")
}
def main():
    Log("`data:image/png;base64,AAAA`")
void main() {
    Log("`data:image/png;base64,AAAA`");
}

LogSupport for direct printingPythonWhat?matplotlib.pyplotObject, as long as the object containssavefigThe method can be direct.LogPrinting, for example:

import matplotlib.pyplot as plt 
def main(): 
    plt.plot([3,6,2,4,7,1]) 
    Log(plt)

Automatic language switching of printed logs LogThe function supports language switching.LogThe function output text, which automatically switches to the corresponding language based on the language set on the platform page, for example:

function main() {
    Log("[trans]中文|abc[/trans]")
}
def main():
    Log("[trans]中文|abc[/trans]")
void main() {
    Log("[trans]中文|abc[/trans]");
}

LogProfit(Profit)

LogProfit(Profit), record the profit and loss, print the profit and loss and plot the income curve based on the profit and loss; parameter value:ProfitIt is a numeric type.

This function can be written as&In the end, just draw a profit chart and don't print a profit log, for example:LogProfit(10, '&')

LogProfitReset()

LogProfitReset(), clear all earnings logs, can be used with an integer parameter to specify the reserved entry.

function main() {
    // 在收益图表上打印30个点,然后重置,只保留最后10个点
    for(var i = 0; i < 30; i++) {
        LogProfit(i)
        Sleep(500)
    }
    LogProfitReset(10)
}
def main():
    for i in range(30):
        LogProfit(i)
        Sleep(500)
    LogProfitReset(10)
void main() {
    for(int i = 0; i < 30; i++) {
        LogProfit(i);
        Sleep(500);
    }
    LogProfitReset(10);
}

LogStatus(Msg)

LogStatus(Msg)This information is not stored in the log list, but only updates the status information of the current disk, which is displayed in the status bar above the log area of the disk page.MsgIt can be of any type.

function main() {
    LogStatus('这是一个普通的状态提示')
    LogStatus('这是一个红色字体的状态提示#ff0000')
    LogStatus('这是一个多行的状态信息\n我是第二行')
}
def main():
    LogStatus('这是一个普通的状态提示')
    LogStatus('这是一个红色字体的状态提示#ff0000')
    LogStatus('这是一个多行的状态信息\n我是第二行')
void main() {
    LogStatus("这是一个普通的状态提示");
    LogStatus("这是一个红色字体的状态提示#ff0000");
    LogStatus("这是一个多行的状态信息\n我是第二行");
}

LogStatus(Msg)Support for printingbase64The image is encoded to be displayed in the following way:`It starts with:`In the end, for example:LogStatus("`data:image/png;base64,AAAA`")LogStatus(Msg)Support for direct streamingPythonWhat?matplotlib.pyplotObject, as long as the object containssavefigThe method can be passed on.LogStatus(Msg)Functions, such as:

import matplotlib.pyplot as plt 
def main():
    plt.plot([3,6,2,4,7,1])
    LogStatus(plt) 

Examples of data output in the status bar:

function main() {
    var table = {type: 'table', title: '持仓信息', cols: ['列1', '列2'], rows: [ ['abc', 'def'], ['ABC', 'support color #ff0000']]}
    // JSON序列化后两边加上`字符,视为一个复杂消息格式(当前支持表格)
    LogStatus('`' + JSON.stringify(table) + '`')                    
    // 表格信息也可以在多行中出现
    LogStatus('第一行消息\n`' + JSON.stringify(table) + '`\n第三行消息')
    // 支持多个表格同时显示,将以TAB显示到一组里
    LogStatus('`' + JSON.stringify([table, table]) + '`')
    
    // 也可以构造一个按钮在表格中,策略用GetCommand接收cmd属性的内容                                
    var table = { 
        type: 'table', 
        title: '持仓操作', 
        cols: ['列1', '列2', 'Action'], 
        rows: [ 
            ['abc', 'def', {'type':'button', 'cmd': 'coverAll', 'name': '平仓'}]
        ]
    }
    LogStatus('`' + JSON.stringify(table) + '`') 
    // 或者构造一单独的按钮
    LogStatus('`' + JSON.stringify({'type':'button', 'cmd': 'coverAll', 'name': '平仓'}) + '`') 
    // 可以自定义按钮风格(bootstrap的按钮属性)
    LogStatus('`' + JSON.stringify({'type':'button', 'class': 'btn btn-xs btn-danger', 'cmd': 'coverAll', 'name': '平仓'}) + '`')
}
import json
def main():
    table = {"type": "table", "title": "持仓信息", "cols": ["列1", "列2"], "rows": [["abc", "def"], ["ABC", "support color #ff0000"]]}
    LogStatus('`' + json.dumps(table) + '`')
    LogStatus('第一行消息\n`' + json.dumps(table) + '`\n第三行消息')
    LogStatus('`' + json.dumps([table, table]) + '`')

    table = {
        "type" : "table", 
        "title" : "持仓操作", 
        "cols" : ["列1", "列2", "Action"], 
        "rows" : [
            ["abc", "def", {"type": "button", "cmd": "coverAll", "name": "平仓"}]
        ] 
    }
    LogStatus('`' + json.dumps(table) + '`')
    LogStatus('`' + json.dumps({"type": "button", "cmd": "coverAll", "name": "平仓"}) + '`')
    LogStatus('`' + json.dumps({"type": "button", "class": "btn btn-xs btn-danger", "cmd": "coverAll", "name": "平仓"}) + '`')
void main() {
    json table = R"({"type": "table", "title": "持仓信息", "cols": ["列1", "列2"], "rows": [["abc", "def"], ["ABC", "support color #ff0000"]]})"_json;
    LogStatus("`" + table.dump() + "`");
    LogStatus("第一行消息\n`" + table.dump() + "`\n第三行消息");
    json arr = R"([])"_json;
    arr.push_back(table);
    arr.push_back(table);
    LogStatus("`" + arr.dump() + "`");

    table = R"({
        "type" : "table", 
        "title" : "持仓操作", 
        "cols" : ["列1", "列2", "Action"], 
        "rows" : [
            ["abc", "def", {"type": "button", "cmd": "coverAll", "name": "平仓"}]
        ] 
    })"_json;
    LogStatus("`" + table.dump() + "`");
    LogStatus("`" + R"({"type": "button", "cmd": "coverAll", "name": "平仓"})"_json.dump() + "`");
    LogStatus("`" + R"({"type": "button", "class": "btn btn-xs btn-danger", "cmd": "coverAll", "name": "平仓"})"_json.dump() + "`");
}

Disable the status bar button, describe the function:

img

function main() {
    var table = {
        type: "table",
        title: "状态栏按钮的禁用、描述功能测试",
        cols: ["列1", "列2", "列3"], 
        rows: []
    }
    var button1 = {"type": "button", "name": "按钮1", "cmd": "button1", "description": "这是第一个按钮"}
    var button2 = {"type": "button", "name": "按钮2", "cmd": "button2", "description": "这是第二个按钮,设置为禁用", "disabled": true}
    var button3 = {"type": "button", "name": "按钮3", "cmd": "button3", "description": "这是第三个按钮,设置为启用", "disabled": false}
    table.rows.push([button1, button2, button3])
    LogStatus("`" + JSON.stringify(table) + "`")
}
import json
def main():
    table = {
        "type": "table",
        "title": "状态栏按钮的禁用、描述功能测试",
        "cols": ["列1", "列2", "列3"], 
        "rows": []
    }
    button1 = {"type": "button", "name": "按钮1", "cmd": "button1", "description": "这是第一个按钮"}
    button2 = {"type": "button", "name": "按钮2", "cmd": "button2", "description": "这是第二个按钮,设置为禁用", "disabled": True}
    button3 = {"type": "button", "name": "按钮3", "cmd": "button3", "description": "这是第三个按钮,设置为启用", "disabled": False}
    table["rows"].append([button1, button2, button3])
    LogStatus("`" + json.dumps(table) + "`")
void main() {
    json table = R"({
        "type": "table",
        "title": "状态栏按钮的禁用、描述功能测试",
        "cols": ["列1", "列2", "列3"], 
        "rows": []
    })"_json;
    json button1 = R"({"type": "button", "name": "按钮1", "cmd": "button1", "description": "这是第一个按钮"})"_json;
    json button2 = R"({"type": "button", "name": "按钮2", "cmd": "button2", "description": "这是第二个按钮,设置为禁用", "disabled": true})"_json;
    json button3 = R"({"type": "button", "name": "按钮3", "cmd": "button3", "description": "这是第三个按钮,设置为启用", "disabled": false})"_json;
    json arr = R"([])"_json;
    arr.push_back(button1);
    arr.push_back(button2);
    arr.push_back(button3);
    table["rows"].push_back(arr);
    LogStatus("`" + table.dump() + "`");
}

Status button style setting:

img

function main() {
    var table = {
        type: "table",
        title: "状态栏按钮样式",
        cols: ["默认", "原始", "成功", "信息", "警告", "危险"], 
        rows: [
            [
                {"type":"button", "class": "btn btn-xs btn-default", "name": "默认"},
                {"type":"button", "class": "btn btn-xs btn-primary", "name": "原始"},
                {"type":"button", "class": "btn btn-xs btn-success", "name": "成功"},
                {"type":"button", "class": "btn btn-xs btn-info", "name": "信息"},
                {"type":"button", "class": "btn btn-xs btn-warning", "name": "告警"},
                {"type":"button", "class": "btn btn-xs btn-danger", "name": "危险"}
            ]
        ]
    }
    LogStatus("`" + JSON.stringify(table) + "`")
}
import json
def main():
    table = {
        "type": "table",
        "title": "状态栏按钮样式",
        "cols": ["默认", "原始", "成功", "信息", "警告", "危险"], 
        "rows": [
            [
                {"type":"button", "class": "btn btn-xs btn-default", "name": "默认"},
                {"type":"button", "class": "btn btn-xs btn-primary", "name": "原始"},
                {"type":"button", "class": "btn btn-xs btn-success", "name": "成功"},
                {"type":"button", "class": "btn btn-xs btn-info", "name": "信息"},
                {"type":"button", "class": "btn btn-xs btn-warning", "name": "告警"},
                {"type":"button", "class": "btn btn-xs btn-danger", "name": "危险"}
            ]
        ]
    }
    LogStatus("`" + json.dumps(table) + "`")
void main() {
    json table = R"({
        "type": "table",
        "title": "状态栏按钮样式",
        "cols": ["默认", "原始", "成功", "信息", "警告", "危险"], 
        "rows": [
            [
                {"type":"button", "class": "btn btn-xs btn-default", "name": "默认"},
                {"type":"button", "class": "btn btn-xs btn-primary", "name": "原始"},
                {"type":"button", "class": "btn btn-xs btn-success", "name": "成功"},
                {"type":"button", "class": "btn btn-xs btn-info", "name": "信息"},
                {"type":"button", "class": "btn btn-xs btn-warning", "name": "告警"},
                {"type":"button", "class": "btn btn-xs btn-danger", "name": "危险"}
            ]
        ]
    })"_json;
    LogStatus("`" + table.dump() + "`");
}

CombinedGetCommand()Functions, construct the state button interaction:

function test1() {
    Log("调用自定义函数")
}

function main() {
    while (true) {
        var table = {
            type: 'table',
            title: '操作',
            cols: ['列1', '列2', 'Action'],
            rows: [
                ['a', '1', {
                    'type': 'button',                       
                    'cmd': "CoverAll",                      
                    'name': '平仓'                           
                }],
                ['b', '1', {
                    'type': 'button',
                    'cmd': 10,                              
                    'name': '发送数值'
                }],
                ['c', '1', {
                    'type': 'button',
                    'cmd': _D(),                          
                    'name': '调用函数'
                }],
                ['d', '1', {
                    'type': 'button',
                    'cmd': 'test1',       
                    'name': '调用自定义函数'
                }]
            ]
        }
        LogStatus(_D(), "\n", '`' + JSON.stringify(table) + '`')

        var str_cmd = GetCommand()
        if (str_cmd) {
            Log("接收到的交互数据 str_cmd:", "类型:", typeof(str_cmd), "值:", str_cmd)
            if(str_cmd == "test1") {
                test1()
            }
        }

        Sleep(500)
    }
}
import json
def test1():
    Log("调用自定义函数")

def main():
    while True:
        table = {
            "type": "table", 
            "title": "操作", 
            "cols": ["列1", "列2", "Action"],
            "rows": [
                ["a", "1", {
                    "type": "button", 
                    "cmd": "CoverAll",
                    "name": "平仓"
                }],
                ["b", "1", {
                    "type": "button",
                    "cmd": 10,
                    "name": "发送数值" 
                }], 
                ["c", "1", {
                    "type": "button",
                    "cmd": _D(),
                    "name": "调用函数" 
                }],
                ["d", "1", {
                    "type": "button",
                    "cmd": "test1",
                    "name": "调用自定义函数" 
                }]
            ]
        }

        LogStatus(_D(), "\n", "`" + json.dumps(table) + "`")
        str_cmd = GetCommand()
        if str_cmd:
            Log("接收到的交互数据 str_cmd", "类型:", type(str_cmd), "值:", str_cmd)
            if str_cmd == "test1":
                test1()
        Sleep(500)
void test1() {
    Log("调用自定义函数");
}

void main() {
    while(true) {
        json table = R"({
            "type": "table", 
            "title": "操作", 
            "cols": ["列1", "列2", "Action"],
            "rows": [
                ["a", "1", {
                    "type": "button", 
                    "cmd": "CoverAll",
                    "name": "平仓"
                }],
                ["b", "1", {
                    "type": "button",
                    "cmd": 10,
                    "name": "发送数值" 
                }], 
                ["c", "1", {
                    "type": "button",
                    "cmd": "",
                    "name": "调用函数" 
                }],
                ["d", "1", {
                    "type": "button",
                    "cmd": "test1",
                    "name": "调用自定义函数" 
                }]
            ]
        })"_json;
        table["rows"][2][2]["cmd"] = _D();
        LogStatus(_D(), "\n", "`" + table.dump() + "`");
        auto str_cmd = GetCommand();
        if(str_cmd != "") {
            Log("接收到的交互数据 str_cmd", "类型:", typeid(str_cmd).name(), "值:", str_cmd);
            if(str_cmd == "test1") {
                test1();
            }
        }
        Sleep(500);
    }
}

It also supports input data when the Build State Button interacts, and interaction instructions are ultimately executed by the Build State Button.GetCommand()Function capture. Increase in data structure of button controls in the status barinputFor example, give{"type": "button", "cmd": "open", "name": "开仓"}Increased"input": {"name": "开仓数量", "type": "number", "defValue": 1}When the button is clicked, a pop-up window with an input box control (data set to defValue by default in the input box) can be entered and sent along with the button command. For example, when the following test code is run, a pop-up window with an input box pops up after clicking the "Open" button and is entered in the input box.111After that, click "Confirm".GetCommandThe function captures the message:open:111

function main() {
    var tbl = {
        type: "table",
        title: "操作",
        cols: ["列1", "列2"],
        rows: [
            ["开仓操作", {"type": "button", "cmd": "open", "name": "开仓", "input": {"name": "开仓数量", "type": "number", "defValue": 1}}],
            ["平仓操作", {"type": "button", "cmd": "coverAll", "name": "全部平仓"}]
        ] 
    }

    LogStatus(_D(), "\n", "`" + JSON.stringify(tbl) + "`")
    while (true) {
        var cmd = GetCommand()
        if (cmd) {
            Log("cmd:", cmd)
        }
        Sleep(1000)
    }
}
import json

def main():
    tbl = {
        "type": "table", 
        "title": "操作", 
        "cols": ["列1", "列2"],
        "rows": [
            ["开仓操作", {"type": "button", "cmd": "open", "name": "开仓", "input": {"name": "开仓数量", "type": "number", "defValue": 1}}],
            ["平仓操作", {"type": "button", "cmd": "coverAll", "name": "全部平仓"}]
        ]
    }

    LogStatus(_D(), "\n", "`" + json.dumps(tbl) + "`")
    while True:
        cmd = GetCommand()
        if cmd:
            Log("cmd:", cmd)
        Sleep(1000)
void main() {
    json tbl = R"({
        "type": "table", 
        "title": "操作", 
        "cols": ["列1", "列2"],
        "rows": [
            ["开仓操作", {"type": "button", "cmd": "open", "name": "开仓", "input": {"name": "开仓数量", "type": "number", "defValue": 1}}],
            ["平仓操作", {"type": "button", "cmd": "coverAll", "name": "全部平仓"}]
        ]
    })"_json;

    LogStatus(_D(), "\n", "`" + tbl.dump() + "`");
    while(true) {
        auto cmd = GetCommand();
        if(cmd != "") {
            Log("cmd:", cmd);
        }
        Sleep(1000);
    }
}

MergerLogStatus(Msg)The cells in the table drawn by the function are:

  • Merging laterally

    function main() {
        var table = { 
            type: 'table', 
            title: '持仓操作', 
            cols: ['列1', '列2', 'Action'], 
            rows: [ 
                ['abc', 'def', {'type':'button', 'cmd': 'coverAll', 'name': '平仓'}]
            ]
        } 
        var ticker = exchange.GetTicker()
        // 添加一行数据,第一个和第二个单元格合并,并且输出ticker变量在合并后的单元格内
        table.rows.push([{body : JSON.stringify(ticker), colspan : 2}, "abc"])    
        LogStatus('`' + JSON.stringify(table) + '`')
    }
    
    import json
    def main():
        table = {
            "type" : "table",
            "title" : "持仓操作",
            "cols" : ["列1", "列2", "Action"],
            "rows" : [
                ["abc", "def", {"type": "button", "cmd": "coverAll", "name": "平仓"}]
            ]
        }
        ticker = exchange.GetTicker()
        table["rows"].append([{"body": json.dumps(ticker), "colspan": 2}, "abc"])
        LogStatus("`" + json.dumps(table) + "`")
    
    void main() {
        json table = R"({
            "type" : "table",
            "title" : "持仓操作",
            "cols" : ["列1", "列2", "Action"],
            "rows" : [
                ["abc", "def", {"type": "button", "cmd": "coverAll", "name": "平仓"}]
            ]
        })"_json;
    
        auto ticker = exchange.GetTicker();
        json jsonTicker = R"({"Buy": 0, "Sell": 0, "High": 0, "Low": 0, "Volume": 0, "Last": 0, "Time": 0})"_json;
        jsonTicker["Buy"] = ticker.Buy;
        jsonTicker["Sell"] = ticker.Sell;
        jsonTicker["Last"] = ticker.Last;
        jsonTicker["Volume"] = ticker.Volume;
        jsonTicker["Time"] = ticker.Time;
        jsonTicker["High"] = ticker.High;
        jsonTicker["Low"] = ticker.Low;
    
        json arr = R"([{"body": {}, "colspan": 2}, "abc"])"_json;
        arr[0]["body"] = jsonTicker;
        table["rows"].push_back(arr);
        LogStatus("`" + table.dump() + "`");
    }
    

  • Vertical merger

    function main() {
        var table = { 
            type: 'table', 
            title: '表格演示', 
            cols: ['列A', '列B', '列C'], 
            rows: [ 
                ['A1', 'B1', {'type':'button', 'cmd': 'coverAll', 'name': 'C1'}]
            ]
        } 
    
        var ticker = exchange.GetTicker()
        var name = exchange.GetName()
    
        table.rows.push([{body : "A2 + B2:" + JSON.stringify(ticker), colspan : 2}, "C2"])
        table.rows.push([{body : "A3 + A4 + A5:" + name, rowspan : 3}, "B3", "C3"])
        // A3被上一行第一个单元格合并
        table.rows.push(["B4", "C4"])
        // A2被上一行第一个单元格合并
        table.rows.push(["B5", "C5"])                                            
        table.rows.push(["A6", "B6", "C6"])
        LogStatus('`' + JSON.stringify(table) + '`')
    }
    
    import json
    def main():
        table = {
            "type" : "table", 
            "title" : "表格演示", 
            "cols" : ["列A", "列B", "列C"], 
            "rows" : [
                ["A1", "B1", {"type": "button", "cmd": "coverAll", "name": "C1"}]
            ]
        }
        
        ticker = exchange.GetTicker()
        name = exchange.GetName()
        
        table["rows"].append([{"body": "A2 + B2:" + json.dumps(ticker), "colspan": 2}, "C2"])
        table["rows"].append([{"body": "A3 + A4 + A5:" + name, "rowspan": 3}, "B3", "C3"])
        table["rows"].append(["B4", "C4"])
        table["rows"].append(["B5", "C5"])
        table["rows"].append(["A6", "B6", "C6"])
        LogStatus("`" + json.dumps(table) + "`")
    
    void main() {
        json table = R"({
            "type" : "table", 
            "title" : "表格演示", 
            "cols" : ["列A", "列B", "列C"], 
            "rows" : [
                ["A1", "B1", {"type": "button", "cmd": "coverAll", "name": "C1"}]
            ]
        })"_json;
        // 为了测试,代码简短易读,这里使用构造的数据
        json jsonTicker = R"({"High": 0, "Low": 0, "Buy": 0, "Sell": 0, "Last": 0, "Time": 0, "Volume": 0})"_json;
        auto name = exchange.GetName();
        json arr1 = R"([{"body": "", "colspan": 2}, "C2"])"_json;
        arr1[0]["body"] = "A2 + B2:" + jsonTicker.dump();
        json arr2 = R"([{"body": "", "rowspan": 3}, "B3", "C3"])"_json;
        arr2[0]["body"] = "A3 + A4 + A5:" + name;
        table["rows"].push_back(arr1);
        table["rows"].push_back(arr2);
        table["rows"].push_back(R"(["B4", "C4"])"_json);
        table["rows"].push_back(R"(["B5", "C5"])"_json);
        table["rows"].push_back(R"(["A6", "B6", "C6"])"_json);
        LogStatus("`" + table.dump() + "`");
    }
    

The status bar page divider shows:

function main() {
    var table1 = {type: 'table', title: 'table1', cols: ['列1', '列2'], rows: [ ['abc', 'def'], ['ABC', 'support color #ff0000']]}
    var table2 = {type: 'table', title: 'table2', cols: ['列1', '列2'], rows: [ ['abc', 'def'], ['ABC', 'support color #ff0000']]}
    LogStatus('`' + JSON.stringify([table1, table2]) + '`')
}
import json
def main():
    table1 = {"type": "table", "title": "table1", "cols": ["列1", "列2"], "rows": [ ["abc", "def"], ["ABC", "support color #ff0000"]]}
    table2 = {"type": "table", "title": "table2", "cols": ["列1", "列2"], "rows": [ ["abc", "def"], ["ABC", "support color #ff0000"]]}
    LogStatus("`" + json.dumps([table1, table2]) + "`")
void main() {
    json table1 = R"({"type": "table", "title": "table1", "cols": ["列1", "列2"], "rows": [ ["abc", "def"], ["ABC", "support color #ff0000"]]})"_json;
    json table2 = R"({"type": "table", "title": "table2", "cols": ["列1", "列2"], "rows": [ ["abc", "def"], ["ABC", "support color #ff0000"]]})"_json;
    json arr = R"([])"_json;
    arr.push_back(table1);
    arr.push_back(table2);
    LogStatus("`" + arr.dump() + "`");
}

img

In addition to the split-page display of tables, multiple tables can be displayed in a top-down order.

function main(){
    var tab1 = {
        type : "table",
        title : "表格1",
        cols : ["1", "2"],
        rows : []
    }
    var tab2 = {
        type : "table",
        title : "表格2",
        cols : ["1", "2", "3"],
        rows : []
    }
    var tab3 = {
        type : "table",
        title : "表格3",
        cols : ["A", "B", "C"],
        rows : []
    }

    tab1.rows.push(["jack", "lucy"])
    tab2.rows.push(["A", "B", "C"])
    tab3.rows.push(["A", "B", "C"])

    LogStatus('`' + JSON.stringify(tab1) + '`\n' + 
        '`' + JSON.stringify(tab2) + '`\n' +
        '`' + JSON.stringify(tab3) + '`')
  
    Log("exit")
}
import json
def main():
    tab1 = {
        "type": "table", 
        "title": "表格1", 
        "cols": ["1", "2"], 
        "rows": []
    }
    tab2 = {
        "type": "table", 
        "title": "表格2", 
        "cols": ["1", "2", "3"], 
        "rows": []
    }
    tab3 = {
        "type": "table", 
        "title": "表格3", 
        "cols": ["A", "B", "C"], 
        "rows": []
    }

    tab1["rows"].append(["jack", "lucy"])
    tab2["rows"].append(["A", "B", "C"])
    tab3["rows"].append(["A", "B", "C"])
    LogStatus("`" + json.dumps(tab1) + "`\n" + 
        "`" + json.dumps(tab2) + "`\n" + 
        "`" + json.dumps(tab3) + "`")
void main() {
    json tab1 = R"({
        "type": "table", 
        "title": "表格1", 
        "cols": ["1", "2"], 
        "rows": []
    })"_json;
    json tab2 = R"({
        "type": "table", 
        "title": "表格2", 
        "cols": ["1", "2", "3"], 
        "rows": []
    })"_json;
    json tab3 = R"({
        "type": "table", 
        "title": "表格3", 
        "cols": ["A", "B", "C"], 
        "rows": []
    })"_json;
    tab1["rows"].push_back(R"(["jack", "lucy"])"_json);
    tab2["rows"].push_back(R"(["A", "B", "C"])"_json);
    tab3["rows"].push_back(R"(["A", "B", "C"])"_json);
    LogStatus("`" + tab1.dump() + "`\n" + 
        "`" + tab2.dump() + "`\n" +
        "`" + tab3.dump() + "`");
}

Running effects:

Please note: When the policy is running on the hard disk, the status bar will go into sleep mode and stop updating if the history is reviewed on the hard disk page. Only the status bar data will refresh when the log is on the first page. Supports output in the status barbase64Encoded images, also supported for output in the form shown in the status barbase64Post-encoded images. The example code is no longer displayed because the string data of post-encoded images is generally very long.

EnableLog()

EnableLog(IsEnable)Log records of order information opened or closed. Parameter value:isEnableIt's called the Bull type.IsEnableSet tofalseIn addition, the order logs are not printed and are not written to the physical database.

Chart(…)

Chart(...), customized graph drawing graph function.

Chart({...})The parameters are:JSONSequentialHighStocksWhat?Highcharts.StockChartParameters. Add one more than the original parameters.__isStockAttributes, if specified__isStock:falseIn this case, the graph is shown as a normal graph.

Please note: If set__isStockAttribute tofalseThe following graphs are used:HighchartsThis is a picture:

Highcharts图表

If set__isStockAttribute totrueThe following graphs are used:Highstocks(default)__isStockFor thetrueThe following is a picture:

Highstocks图表

Return to the same call.add(n, data)nFor theseriesThe index (e.g. 0),dataFor data to be written to the graph) to the specified indexseriesAdd data, callreset()The data is cleared from the graph.resetYou can use a numeric parameter to specify the number of reserved items.

You can calladd(n, data, i)iSo the data isseriesIn the index) to change the correspondingseriesThe data in this article.

It can be negative, -1 being the last, -2 being the second negative, for example when drawing a line, modifying the data at the last point of the line:

chart.add(0, [1574993606000, 13.5], -1)Changedseries[0].dataThe data of the first decimal point of the decimal point of the decimal point of the decimal point of the decimal point of the decimal point of the decimal point of the decimal point of the decimal point of the decimal point of the decimal point.

Supports displaying multiple charts, and configuring by inputting array parameters such as:var chart = Chart([{...}, {...}, {...}])For example, graph one has two.seriesAnd then there's one in Figure 2.seriesFigure 3 has one.seriesSo, what?addWhen specifying 0 and 1 sequence IDs to represent the data of the two sequences in the update graph 1,addWhen the sequence ID is set to 2, the first one of the graph 2 is shown.seriesThe data, the specified sequence 3 refers to the first one of the graph 3.seriesThe data is very good.

HighStockshttp://api.highcharts.com/highstock

Multiple graphs show some of the associated property settings:Example

For example, a graph configuration object:

var cfgA = {
    extension: {
        // 不参于分组,单独显示,默认为分组 'group'
        layout: 'single', 
        // 指定高度,可以设置为字符串,"300px",设置数值300会自动替换为"300px"
        height: 300,      
        // 指定宽度占的单元值,总值为12
        col: 8            
    },
    title: {
        text: '盘口图表'
    },
    xAxis: {
        type: 'datetime'
    },
    series: [{
        name: '买一',
        data: []
    }, {
        name: '卖一',
        data: []
    }]
}

var cfgB = {
    title: {
        text: '差价图'
    },
    xAxis: {
        type: 'datetime'
    },
    series: [{
        name: '差价',
        type: 'column',
        data: []
    }]
}

var cfgC = {
    __isStock: false,
    title: {
        text: '饼图'
    },
    series: [{
        type: 'pie',
        name: 'one',
        // 指定初始数据后不需要用add函数更新,直接更改图表配置就可以更新序列
        data: [                    
            ["A", 25],
            ["B", 25],
            ["C", 25],
            ["D", 25]
        ]                
    }]
}

var cfgD = {
    extension: {
        layout: 'single',
        // 指定宽度占的单元值,总值为12
        col: 8,                    
        height: '300px'
    },
    title: {
        text: '盘口图表'
    },
    xAxis: {
        type: 'datetime'
    },
    series: [{
        name: '买一',
        data: []
    }, {
        name: '卖一',
        data: []
    }]
}

var cfgE = {
    __isStock: false,
    extension: {
        layout: 'single',
        col: 4,
        height: '300px'
    },
    title: {
        text: '饼图2'
    },
    series: [{
        type: 'pie',
        name: 'one',
        data: [
            ["A", 25],
            ["B", 25],
            ["C", 25],
            ["D", 25]
        ]
    }]
}
cfgA = {
    "extension" : {
        "layout" : "single", 
        "height" : 300,
        "col" : 8
    }, 
    "title" : {
        "text" : "盘口图表"
    },
    "xAxis" : {
        "type" : "datetime" 
    }, 
    "series" : [{
        "name" : "买一",
        "data" : []
    }, {
        "name" : "卖一", 
        "data" : []
    }]
}    

cfgB = {
    "title" : {
        "text" : "差价图"
    }, 
    "xAxis" : {
        "type" : "datetime"
    }, 
    "series" : [{
        "name" : "差价", 
        "type" : "column", 
        "data" : []
    }]
}    

cfgC = {
    "__isStock" : False,
    "title" : {
        "text" : "饼图"
    }, 
    "series" : [{
        "type" : "pie", 
        "name" : "one", 
        "data" : [
            ["A", 25],
            ["B", 25],
            ["C", 25],
            ["D", 25]
        ]
    }]
}    

cfgD = {
    "extension" : {
        "layout" : "single",
        "col" : 8,
        "height" : "300px"
    }, 
    "title" : {
        "text" : "盘口图表"
    }, 
    "series" : [{
        "name" : "买一", 
        "data" : []
    }, {
        "name" : "卖一",
        "data" : []
    }]
}    

cfgE = {
    "__isStock" : False, 
    "extension" : {
        "layout" : "single", 
        "col" : 4,
        "height" : "300px"
    }, 
    "title" : {
        "text" : "饼图2"
    },
    "series" : [{
        "type" : "pie",
        "name" : "one", 
        "data" : [
            ["A", 25], 
            ["B", 25], 
            ["C", 25], 
            ["D", 25]
        ]
    }]
}
json cfgA = R"({
    "extension" : {
        "layout" : "single", 
        "height" : 300,
        "col" : 8
    }, 
    "title" : {
        "text" : "盘口图表"
    },
    "xAxis" : {
        "type" : "datetime" 
    }, 
    "series" : [{
        "name" : "买一",
        "data" : []
    }, {
        "name" : "卖一", 
        "data" : []
    }]
})"_json;    

json cfgB = R"({
    "title" : {
        "text" : "差价图"
    }, 
    "xAxis" : {
        "type" : "datetime"
    }, 
    "series" : [{
        "name" : "差价", 
        "type" : "column", 
        "data" : []
    }]
})"_json;    

json cfgC = R"({
    "__isStock" : false,
    "title" : {
        "text" : "饼图"
    }, 
    "series" : [{
        "type" : "pie", 
        "name" : "one", 
        "data" : [
            ["A", 25],
            ["B", 25],
            ["C", 25],
            ["D", 25]
        ]
    }]
})"_json;    

json cfgD = R"({
    "extension" : {
        "layout" : "single",
        "col" : 8,
        "height" : "300px"
    }, 
    "title" : {
        "text" : "盘口图表"
    }, 
    "series" : [{
        "name" : "买一", 
        "data" : []
    }, {
        "name" : "卖一",
        "data" : []
    }]
})"_json;    

json cfgE = R"({
    "__isStock" : false, 
    "extension" : {
        "layout" : "single", 
        "col" : 4,
        "height" : "300px"
    }, 
    "title" : {
        "text" : "饼图2"
    },
    "series" : [{
        "type" : "pie",
        "name" : "one", 
        "data" : [
            ["A", 25], 
            ["B", 25], 
            ["C", 25], 
            ["D", 25]
        ]
    }]
})"_json;
  • cfgA.extension.layoutAttributes

    If this property is set to "single", the graph will not be overlaid (not displayed as a split-page tag) and will be displayed separately (flat display).

  • cfgA.extension.heightAttributes

    This property is used to set the height of the chart, which can be set to a numerical type, or to "300px".

  • cfgA.extension.colAttributes

    This property is used to set the width of the chart, which is divided into 12 units of page width, and set to 8, which means that the chart is 8 units wide.

    The following is a complete example of a strategy:

    The graph configuration object in the example above shows the effect:

  • Data on the chart configuration object can be updated by modifying the chart configuration directly and then updating the chart:

    For example, in this example,JavaScriptParts of the code paragraph of the exampleThe complete paradigm):

    cfgC.series[0].data[0][1] = Math.random() * 100
    cfgE.series[0].data[0][1] = Math.random() * 100
    // update实际上等于重置了图表的配置
    chart.update([cfgA, cfgB, cfgC, cfgD, cfgE])
    

    AdoptedaddMethods to update data, such as adding an item to a pie chart,JavaScriptParts of the code paragraph of the exampleThe complete paradigm):

    // 为饼图增加一个数据点,add只能更新通过add方式添加的数据点,内置的数据点无法后期更新
    chart.add(3, {
        name: "ZZ",
        y: Math.random() * 100
    })
    
  • Additional useChartExamples of functions

    A simple example of a graphic:

    // 这个chart在JavaScript语言中是对象,在使用Chart函数之前我们需要声明一个配置图表的对象变量chart
    var chart = {                                           
        // 该字段标记图表是否为一般图表,有兴趣的可以改成false运行看看
        __isStock: true,                                    
        // 缩放工具
        tooltip: {xDateFormat: '%Y-%m-%d %H:%M:%S, %A'},    
        // 标题
        title : { text : '差价分析图'},                       
        // 选择范围
        rangeSelector: {                                    
            buttons:  [{type: 'hour',count: 1, text: '1h'}, {typ

More

qq89520There's a problem with whether the C_function is going to try it all over again or only once.

haiwwhai_C ((function, args...) is this default 3s? Can I change the default to put _CDelay ((1000) directly before _C ((function, args...)?

lanchaiyeCluster: If you create 1000 robots simultaneously and without the stress, you can create multiple hosts to decentralize tasks. There are code examples for building clusters. How to build multiple hosts to decentralize tasks

wangyj1Log ((talib.help (('MACD')); can only be used in js, there is no talib.help attribute in python...

cjz140What's the difference between _C (function, args...) and sleep function, I think it all means waiting to try again.

3263243yHow to clear ErrorFilter after SetErrorFilter? without filtering error messages.

qq47898077Is there a way to use a third-party library?

qq47898077If you want to inherit a new class defined by an exchange object, what should the parent class fill in?

ethanwuDo you have any local debug tools?

penglihengWhat about exange.IO?

penglihengWhy is the sell function in gray, is the representation function no longer available?

penglihengWhy is the sell function in gray, is the representation function no longer available?

penglihengJS doesn't speak English, haha, I just want to ask if it supports ES6.

penglihengJS doesn't speak English, haha, I just want to ask if it supports ES6.

Don.How do you write the volume mean?

zjuturtleWhat will be the return if the exchange.Buy ((1000) fails to buy at market price?

The NinjaThe new font is beautiful.

hippoBitmex's testing network ((testnet.bitmex.com) also has an API interface, but currently the exchange can only select Bitmex's main station, and the API documentation address is https://testnet.bitmex.com/app/apiOverview How can you support?

cxjijinvar ret1 = exchanges[0].IO (("api", "future_estimated_price", "symbol=btc_usd"); Log (('ok futures estimated delivery price', ret1)); https://dn-filebox.qbox.me/d1ed268c1e75753c5d289447d279aa9d81e41b5f.png Why is it that when you call the functional interface of other exchanges, you write an error message?

allenfrostlineI was wondering what the difference is between realTicker and Ticker? Recently, a strategy for re-writing the utility has appeared simultaneously, but the former API does not seem to mention it.

visionsHello, as a Python developer, what do you think your API documentation is writing about? Some of the field function interfaces look weird, can you write a document like githubpage and readdocs?

allenfrostlineGetAccount: [EAPI:Rate limit exceeded] Want to know how to solve this?

zhjx2314Doesn't support StochRSI, can it be added soon?

yhfggIs the script on your own Ali Cloud server or a botvs cluster?

yhfggWhat version of python do you use?

fkyslyThe interpretation of GetFee should be that it returns a Fee structure string, minus one construct.

zkwapIs there a way to call talib using js?

yhfggRequest the python documentation

wmjbs123Can the background of the code for the strategy editor be black? White prickly eyes, writing code at night, easy nearsightedness

Don.How do I set up the summary in the WeChat push of the robot?

The number is crazy.Is it possible to add a transaction-level field to the order structure?

The little one.GetOrders: Returns all unfinished orders, returns an Order array structure, in China Bitcoin trading ETH, returns only the most recent 10 items, here is a function that returns all unfinished orders in China Bitcoin ETH, meaning that other platforms can return all with GetOrders, only this ghost Chinese Bitcoin returns 10 items,

yhfggThe mathematical functions that are needed for statistical probability theory, where do they come from?

jiebangWhat is the return value of the function $.Cross ((x, y)?

My mother-in-lawThis LogReset clears all logs, and can have a numeric parameter that specifies the number of records to be reserved How does this delete the most recent logs?

edwardgywThe CORRE function in talib doesn't seem to have been ported or missed?

The poor mountain of YangyangIt doesn't seem to have any indicator referencing features!

SmallHow do you translate the k-line time to the present time?

SmallHow to delete numbers in arrays, I'm using records.remove ((records[0])

snakeayuThe most commonly obtained is the hourly K line, how to call the ATR of the daily K line?

snakeayuThe most commonly obtained is the hourly K line, how to call the ATR of the daily K line?

57278863Learn how to get traditional futures priced and ordered, sorry, the roots are thin.

kirinThis is the case with traditional futures trading!

SmallZero, can you write an example of traditional futures trading?

SmallHow to print the holding status when holding multiple blanks at the same time, how to print my [object object], how to get the holding status of multiple and blank blanks, and GetTicker (((), how to get the week, next week, and quarter of the week, the price, the week, next week, and quarter in parentheses I write.

cxjijinIs it possible for a futures exchange to get a market with GetTicker (??), returning a market for that type of contract (??, next week...)?

Selling outWhat indicator can you add to the StochRSI?

momoxCancelOrder ((orderId) Cancel an order based on the order number, return true or false, ask true= The cell was successfully canceled, right?

momox_G(K, V) Can global dictionaries be stored This method saves global variables that can be used to share data between different policies?

flufy3dRising to Popularity

ZeroYou can reset the earnings log with LogProfitReset. The history on the earnings chart before is gone.

xcyCan you directly copy the EA?

sjironmanI feel like this platform is great, great, more interaction in the group.

SmallWhat language is this, is there any material to learn?

jxhbtcData error for a week, can't connect the robot, how to fix it

dyhhuThe index library TA, is it just a calculation of the closing price?

btcrobot hi, world

The Little DreamThe _C function will try again without thinking until it gets a successful result.

The Little DreamPython's talib library needs to be installed.https://www.botvs.com/bbs-topic/669 can be found in this post.

The Little DreamSleep is the number of milliseconds the program does nothing while waiting for the parameter to be set, and _C is the number of milliseconds the function has to re-call the parameter once.

The Little DreamWithout inheritance, JS directly wrapped in the object goes {name: "new object", old_exchange : exchange[0],...... }

The Little DreamLocal editor Remote sync plug-in, basically local editor Remote debugging.

The Little DreamYou can come to the QQ group, and it's easy to discuss.

The Little DreamIn the API documentation, gray means that the function does not have too many open explanations, it shows gray, blue represents more explanations, that's all.

The Little DreamES6 is currently not supported, ^^

The Little DreamCan you come to the group QQ, describe the problem, I'll answer ^^

The Little DreamIt will immediately return an error, and will not order (actually, it is to buy, not enough money!).

zjuturtleFor example, OKCoin, what will be the return if the amount purchased is more than the amount of RMB held?

The Little DreamI'm going to return an order number in OK futures to which exchange.

ZeroIt already supports switching transaction pairs at runtime, and requires downloading the latest host. Supports Bter/Poloniex Detailed API documentation The description of the transaction function bar below ((clear browser cache after refresh if not visible)

The Little DreamQQ me, I'll help you find the problem.

Professional breadwinnersI'm going to set the host's IP?

The Little DreamThis is the underlying link not established The server is not responding. Is the IP address set when the API KEY is requested?

Professional breadwinnersIt's embarrassing... the policies I could run changed to fail in the bit era, and GetAccount can't access GetAccount: Post http://api.btc38.com/v1/getMyBalance.php: read tcp 192.168.0.227:58596->211.149.148.144:80: wsarecv: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. 2017-05-23 21:08:24 BitTorrent error GetAccount: timeout This is a list of all the different ways GetAccount is credited in the database. 2017-05-23 21:08:02 Bit Era Error GetAccount: timeout This is a list of all the different ways GetAccount is credited in the database. 2017-05-23 21:07:40 BitTorrent error GetAccount: timeout This is a list of all the different ways GetAccount is credited in the database. This article is part of our upcoming edition of The New York Times Best Seller list. Is it the IP whitelist problem???

The Little DreamThe exchange's servers did not respond, and the TCP protocol was not established for the three handshakes.

Professional breadwinnersA connection attempt failed because the connected party did not properly respond after a period of time, and the connection attempt failed because the connected party did not properly respond after a period of time.

The Little DreamHello! This is exchange.IO ((api, ApiName, Args) This function is not supported, see https://www.botvs.com/bbs-topic/812

Professional breadwinners A connection attempt failed because the connected party did not properly respond after a period of time,

Professional breadwinnersBitcoin Age is not supported?

The Little DreamThis is a list of all the different ways Dn-filebox.qbox.me/a709b30c6cc0a3565234b9e0c99b073f7ba8b454.png is credited in the database. I'm sure it will be okay.

The NinjaFor example, I want to do a full-currency transaction on poloniex, but there are only a few currencies supported by BOTvs, and exchange.IO doesn't seem to support Pnet.

The Little DreamYou can call this exchange.IO.

The NinjaWhat about the API that needs to verify the account?

The Little DreamIf an API that does not require account verification can be used with httpQuery (see BotVS documentation for more details), the actual transaction API needs access.

The Little DreamYou can use the HttpQuery API to transmit parameters: https://www.okcoin.com/api/v1/future_estimated_price.do?symbol=btc_usd, that's it. For exchange APIs that don't require verification of accounts, use the HttpQuery function directly on the platform. This post was originally published on the website: https://www.botvs.com/bbs-topic/850

visionsThank you very much, I hope you have a good API documentation.

The Little DreamWhere did you see the realTicker API?

The Little DreamThis is a list of all the different ways Fe1a6f5563ed43a5357f858ecf8a50239619228e.png is credited in the database. The API documentation is in JavaScript language. The python version is described in the posts at the top of the plugin page.

ZeroHi, thanks for the suggestion, the API documentation is currently being rebuilt.

The Little DreamHello~ shows that the frequency of access is beyond the limit. This is a list of all the different ways Dn-filebox.qbox.me is credited in the database. Is the Sleep function used in the policy? This 1000 is to allow the program to pause one second per round, which can be set by itself, the purpose is to control the frequency of access to the API, because some exchanges set maximum access limits, a certain amount of time beyond a certain number of visits will deny access, block IP addresses.

The Little Dreamhttps://dn-filebox.qbox.me/c29ab7fc279e1b758355f137907cf52dc8257df6.png I personally wrote that the STOCHRSI indicator, which has been compared to OK, is consistent that the speed is a bit slow and needs to be optimized, but is available for now.

ZeroYou can choose to retest on the server provided by botvs or retest on the server hosted by your host, version 2.7.5

The Little DreamThis is the first time I've seen this post.

The Little DreamNow you can configure your own background style.

The Little DreamThe python documentation is being written.

The Little DreamTalib library support is available.

hzzgood48 https://www.botvs.com/bbs-topic/276

The Little DreamIt seems that there is an example in Strategy Square, https://www.botvs.com/strategy/15098

ZeroAccess the AveragePrice attribute of the Order, which the exchange supports, and the one that does not support the attribute will always be 0.

yhfggHow does a third-party source cite?

ZeroIf mathjs is not satisfied, it can only look for a third-party library copy-import policy. To speed up compilation, the system only has a small number of libraries built in.

The Little DreamI'm not polite, there are problems in the group can M me - I'm basically online.

jiebangThank you.

The Little DreamYou can look at the annotated version of the digital currency trading library code analysis, and there's an annotation for the $.Cross function.

ZeroYou can't delete the latest, you can just keep the latest few posts... delete all the old ones before.

kirinTo get each holding using position[i], position is an array.

The Ninja exchange.GetRecords(PERIOD_D1);

kirinMy traditional futures are always the "GetAccount: not login", "password not entered, login not possible"

ZeroThe default is week, which requires the specified SetContractType first.

ZeroSo, this is the return value of the cancellation order that the exchange returned, but the actual cancellation was not cancelled, depending on how it was handled inside the exchange.

momox 3q

ZeroNot for a while, but separated.

xuanxuanOf course not, that's exclusive to MT4.

ZeroJavascript resources are everywhere on the web.

Selling outIs your problem solved?

ZeroMost of the time, the input data can be directly records or an array of pure prices.