Inventors quantify the API documentation

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

[TOC]

Basic information

The entrance

What can FMZ's quantitative trading platform do?

FMZ (inventor) quantified trading platformIt is the most specialized quantitative community in the field of quantitative trading, where you can learn, write, share, buy and sell quantitative strategies; online retargeting and using analogue discs to perform analogue trading; running, public, and visual discs; and supporting almost all mainstream digital currency exchanges.

The complete series of tutorials

I'm not sure what you mean.

The video tutorial:

If you encounter any problem, you can always go to the forum to post questions, discussions, submit work orders on the platform, telegraph (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((TelegramThe group @administrator, questions are usually answered quickly.

Support for ChatGPT support

The FMZ Quantum Trading Platform has access to ChatGPT as an auxiliary development tool, which can be accessed by clicking "ChatGPT" in the Control Center shortcut bar.Chat GPT help page

What programming languages can I use to implement my strategy?

FMZ Quantitative Trading Platform is supportedJavaScriptTypeScriptPythonC++PINE麦语言Blockly可视化I've been writing a design strategy.

SupportTypeScriptThe language, which is still set as a strategy when it's created,JavaScriptThe first thing you need to do is to write a policy, and then write it at the beginning of the policy code.// @ts-checkOr click the "TypeScript" button in the upper right corner of the policy edit area to switch toTypeScriptThe platform automatically identifies the code as:TypeScriptThis is the first time I have seen this feature on my computer.

  • Type of security:TypeScriptThe static type checker can help you find potential errors when writing code and improve code quality.
  • The code is auto-complete:TypeScriptThe type system allows you to find the properties and methods you need faster when writing code, improving development efficiency.
  • Clearer code structure: useTypeScriptYou can better organize and maintain your code to make it easy to read and understand.
  • It is a powerful object-oriented programming feature:TypeScriptProvides powerful object-oriented programming features such as interfaces, classes, and generic types to help you write more robust, reusable policy code.

It is enough to have a command of one of these strategies in the design language. In addition to supporting the way code is written, the design strategy can also be used to create strategies with visualized modules (Blockly). The visualization of module splicing build strategies uses a more intuitive way of designing strategies, without coding.

BlocklyThis is a visual tutorial:

Set upPythonUse of the strategy programPythonThe Interpreter

UsePythonWritten policy, retested or on disk if the host's system environment is installed simultaneouslyPython2andPython3, which can be started when the policy starts the first line of setting the policy to runPythonThe following are some examples:#!python3#!python2This will automatically search for the interpreter. You can also specify an absolute path, such as:#!/usr/bin/python3

What is a trustee?

The TrusteeUnderstandably the executor of your trading strategy, responsible for complex data requests, data reception, network linking, log retransmission, etc. The host runs on your server, even if a network failure occurs on the FMZ Quantitative Trading Platform website.LinuxWindowsMac OSandroidARM Linux by the BushmenI'm not going to say anything else.Hosted pageLinux host installation and host update steps◦ The logs of the virtual disk managed by the administrator are kept in the directory where the administrator's program is located./logs/storageThe document isdb3What?SqliteIn the database file.SqliteIt is a direct edit of the management software, and these extensions are calleddb3The file name is the file name of the database file on the disk.ID

Agreements supported

  • Blockchain assets: More than 50 mainstream blockchain assets (digital currencies) exchanges are now supported.
  • Access to the General Protocol:General agreement

Strategic security

Develop policies on the FMZ Quantitative Trading Platform, which are only visible to FMZ Quantitative Account holders.PythonThe package is loaded into the policy code, which enables policy localization.

PythonThe security of the code: BecausePythonIt is an open-source and highly counter-compiled language, which can be rented out if the policy is not self-contained, or leased out as a sub-account or full-hosted management if there is a concern that a policy leak could allow the policy to run on a host that it deploys.

PythonThis is the code of the policy encryption: I'm not sure what you mean.PythonThe policy is that the authors of the code do not encrypt when they use it themselves, but encrypt when they rent it to others.PythonThe policy starts by editing the following code, which you can specify for self-use or lease.PythonWhether to encrypt policy code when the policy is running.PythonThe version is as follows:Python 2.7This is the first time I've seen it.Python 3.5This is the first time I've seen it.Python 3.6This is the version.

  • The author of the policy runs it himself, and shares the encryption policy code with others through the registration code:#!pythonUse a comma to specify the version of the Python interpreter,Pause, enter encryption commandsencrypt◦ If not specifiedPythonAdded version directly#!encrypt

    #!python,encrypt
    

    Or

    #!encrypt
    
  • The author of the policy runs it himself, and does not use the code to encrypt the policy for others through the registration code:

    #!python,not encrypted
    

    Or

    #!not encrypted
    

JudgmentPythonPolicy code encryption is effective using codeos.getenv('__FMZ_ENV__')Returns the string"encrypt"Explanation is in effect. Only the physical disk is valid, retesting is not encrypted.PythonThis is the code of the strategy.

#!encrypt
def main():
    ret = os.getenv('__FMZ_ENV__')
    # 打印变量ret为字符串encrypt或者ret == "encrypt"为真,即代表加密生效
    Log(ret, ret == "encrypt")

Security of keys

Sensitive data such as account information configured on the FMZ Quantitative Trading Platform and encrypted strings in policy parameters are encrypted on the browser side. This information stored on the FMZ Quantitative Trading Platform is encrypted ("non-manifest data"). It can only be decrypted by the user's private device, which greatly improves the security of sensitive data. If other sensitive information is contained in the policy code, parameter settings, policy description, etc., please do not make or sell the policy.

  • The platform supports the localization and configuration of sensitive information such as exchange account information, secret keys, etc.

    On the platform's Configure Exchange information page, all encrypted text box controls with masking are supported in a configuration file path way, to be used to load the custodian's local file.RSA KEYThe verification method is an example, detailing how to configure sensitive information locally on the device where the host program is located.

    1, create an RSA public key, private key.PKCS#8There are a lot of tools that can be created, such as:opensslI'm not sure. 2 Create on the ExchangeRSA KEY, created and uploadedThe first stepThe public key created in. 3, willThe first stepThe private key created intxtThe file format preserves the host-level directory, but can also preserve other paths in the directory where the host program resides. 4, Configure the exchange when configuring the FMZAccess KeyIn the edit box, fill in the code created on the exchange.RSA KEYI'm not sure. 5. Configure the exchange on FMZSecret KeyIn the edit box, fill inThe third stepIn the Administrator Peer DirectorytxtThe path of the file, for example, the file placed is named:rsaKey.txtThe document and the trustee will fill in the same level directory:file:///rsaKey.txt◦ If the document is in the next level of the directory where the trustee procedure is locatedrsa_keyIn the middle, fill in:file:///rsa_key//rsaKey.txt◦ If placedrsaKey.txtNote that the file only supports placement in a host-level directory or subdirectory.

    This makes private keys more secure to store locally, and details of the process can be consulted.Video explains

The feedback system

What is a retesting system and what is it for?

When you have completed the design of a quantitative trading strategy, how do you know the basics of the logic of your strategy, the direction of the strategy's earnings? Of course we can't just take the real gold and silver to the market and run the strategy, we can test your strategy with historical data. See how your strategy performs in historical data.

Is the data from the retest system accurate, and how accurate are the retest results?

FMZ quantified trading platform divides the retrograde mode intoRepeat at the real disk levelandSimulated retesting❖ Real-time retrieval is based entirely on complete historical data; analogue retrieval is based on real K-line datatickThe data is retested. Both are based on real historical data, but the real-disc data is more accurate and the results are more reliable.The FMZ feedback mechanism is describedBut retrospective analysis is merely the performance of a strategy against historical data, and historical data cannot fully represent future trends. Historical trends can be repeated, or they can fly out of the black swan. So it is rational and objective to treat retrospective results.

The following questions should be considered when revising different language strategies:

JavaScriptandC++The policy review is done on the browser side, on the hard drive or on the desktop.WexAppThe simulated trading platform (i.e. FMZ Quantum Trading Platform) is a virtual trading platform.WexAppSimulated exchanges) run without installing any other software, libraries or modules.PythonRe-testing is performed on a host, and can be performed on a public server quantified by FMZ, or on a user's own host. Both disk and re-testing depend on the system on which the host is installedPythonIf you need to use some libraries, you need to install them yourself (only support common libraries on public servers).

Data in the retesting system

FMZ Quantified Trading Platform Retest Score Analogue-level retest and Real-Disk-level retest are two types, with analogue-level retesting based on the underlying K-line cycle generated by the simulation.tick, each bottom K-line cycle will generate 12 retrieval time points, while the real disk level is actually collectedtickFMZ's feedback mechanism allows the strategy to be traded multiple times on a single K-line, avoiding the situation where only the closing price of the transaction can be closed, and is more accurate and takes into account the feedback speed.Links

DEBUG policy in the retrieval system

JavaScript policy retrieval debug in the DevTools of the Chrome browser

Exchanges supported in the retest system

  • Cryptocurrency (digital currency)

    Title Types Explained
    Bitfinex The object of the spot exchange Support for limited transactions for example:BTC_USD,ETH_USD,LTC_USDSo, note that the transaction price for the currency isUSDIt's in dollars.
    Binance The object of the spot exchange Support for limited transactions for example:BTC_USDT,ETH_USDT,ETH_BTC,LTC_BTCAnd so on
    OKX The object of the spot exchange Support for limited transactions for example:BTC_USDT,ETH_USDT,ETH_BTC,LTC_BTCAnd so on
    Coin The object of the spot exchange Support for limited transactions for example:BTC_USDT,ETH_USDT,ETH_BTC,LTC_BTCAnd so on
    OKX futures Object of the futures exchange Support for limited transactions for example:BTC_USD,ETH_USDSo, the transaction is for the currency.USD, set the specific contract code ((seeexchange.SetContractTypeAfter the function, the contract is called a coin-based contract. The supported contract code is:this_weeknext_weekquarterswap
    HuobiDM Object of the futures exchange HuobiDM, which stands for token futures ("token contracts"), supports limited trading pairs such as:BTC_USD,ETH_USDSo, the transaction is for the currency.USD, set the specific contract code ((seeexchange.SetContractTypeAfter the function, the contract is called a coin-based contract. The supported contract code is:this_weeknext_weekquarterswap
    BitMEX Object of the futures exchange The transaction pairs are:XBT_USD, set the specific contract code ((seeexchange.SetContractTypeAfter the function, the contract is called a coin-based contract. The supported contract code is:XBTUSD
    Binance futures Object of the futures exchange Support for limited transactions for example:BTC_USDT,ETH_USDTSo, the transaction is for the currency.USDT, set the specific contract code ((seeexchange.SetContractTypeSo we have a function that is going to beUSDTThis contract. The contract codes supported are:swap
    The Deribit option The subject of the options exchange The transaction pairs are:BTC_USD,ETH_USD, set the specific contract code ((seeexchange.SetContractTypeThe contract is then called the spot contract. The specific option contract code is required.

    Reverse system futures exchange objects do not support switching pairs in strategy code for the time being.

Simulated level

Analogue-level retracement is based on the underlying K-line data of the retracement system, which is simulated according to a certain algorithm within the framework of the numerical composition of the highest, lowest, opening and closing prices of the underlying K-line Bar.tickThe data, as real-timetickThe data is returned when the interface is requested.Inventors describe the mechanism of quantitative analogue level retesting

Real-time

The real-world level is real.tickThe level data is in the time sequence of Bar.tickThe strategy for level data is to use real-disc-level backscaling that is closer to the truth.tickThis is real recorded data, not analogue generated. Supports depth data, market transaction recording data playback, support custom depth, support penetration data. Real-time penetration data supports up to 50 MB, without limiting the penetration time range within the data limit.GetDepthGetTradesThe function retrieves the transaction data. At a certain moment on the timeline, the transaction data is called.GetTickerGetTradesGetDepthGetRecords, which does not push time multiple times on the retest timeline ((does not trigger jump to the next market data moment);); for one of the functions above, repeated calls will push the retest time on the retest timeline ((jump to the next market data moment); retesting using real disk level retesting is not advisable to select too early time, there may be no real disk level data for too early a time period.

Real-time retest currently supported

  • Binance
  • OKX ((OKX cash))
  • HuobiDM (Tokens and Futures)

Repeat and tweak the system parameters

The parametric fine-tuning function of the FMZ Quantified Trading Platform Retesting System is to fine-tune the parametric fine-tuning options at the time of retesting, as follows:

  • Minimum value: the starting value of the limiting parameter.
  • Maximum value: Maximum value after incremental change of the limiting parameter.
  • Step length: The parameter increases the amount of variation.

Generate a set of parameters, which are repeated over the set of parameters (i.e. each set of parameters is repeated once); the policy parameter can only be modified in the repeating system if the parameter type is ** numeric ((number) **.

For example, set the parameter fine-tuning option on the review page:

img

The parametric modeling is retested:

img

Save the retest settings

On the policy edit page, the "Analogue Returns" section (i.e. Returns system) can set up options such as Returns configuration, Returns policy parameters, etc. The returns configuration is used to set up the returns time range, returns trading venues, returns slippage points, fees, etc. The policy parameter is the parameter option for the policy. When these parameters are set, the configuration information can be saved according to the set returns policy.

img

I mean,JavaScriptFor example, click on "Save retrieval settings to the source file":

img

JavaScript/Python/C++/麦语言Save Returns is set to the source file format slightly differently:

/*backtest
start: 2021-06-26 00:00:00
end: 2021-09-23 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/
'''backtest
start: 2021-06-26 00:00:00
end: 2021-09-23 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
'''
/*backtest
start: 2021-06-26 00:00:00
end: 2021-09-23 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/

This is the first time I've seen it.

(*backtest
start: 2021-06-26 00:00:00
end: 2021-09-23 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_OKCoin","currency":"BTC_USD"}]
*)

Customized data sources

Use of systemGETThe method requests a custom URL (a publicly accessible URL) to retrieve an external data source for retrieval, with the following additional request parameters:

Parameters Meaning Explained
symbol Name of the variety For example: BTC_USD_OKCoin_EN
eid The Exchange For example: OKCoin_EN
round Price accuracy If it's 3, then the price in the data that's being returned is going to be multiplied by 1000.
vround Quantitative accuracy If it's a 2, then the number in the data that's returned is going to be multiplied by 100 to get the integer.
period bar cycle ((milliseconds) For example, 60000 for a request bar per minute.
depth Depth of field 1-20
trades Do you need to split the data? true/false
from Starting time Unix time stamps
to End time Unix time stamps

Please note:

round与vround是为了避免网络传输过程中浮点数的精度丢失设计的两个参数,价格数据和成交量、订单量数据都采用整型传输。

Here is an example of spliced data:

http://customserver:80/data?symbol=BTC_USD_OKCoin_EN&eid=OKCoin_EN&round=3&vround=3&period=900000&from=1564315200&to=1567267200

The format returned must be one of the following two formats (system automatically recognized):

Normal Bar level retesting

{
    "schema":["time","open","high","low","close","vol"],
    "data":[[1564315200000,9531300,9531300,9497060,9497060,787],[1564316100000,9495160,9495160,9474260,9489460,338]]
}

Tick-level retested data ((contains depth information, depth format is [price, quantity] array, depth can be multiple levels, asks as price escalation, bids as price decomposition)

{
    "schema":["time","asks", "bids","trades","close","vol"],
    "data":[[1564315200000,[[9531300,10]], [[9531300,10]],[[1564315200000,0,9531300,10]],9497060,787]]
}

Explained

Fields Explained
schema Specifies properties for columns in a data array, distinguished by small letters, limited to time, open, high, low, close, vol, asks, bids
data An array that refers to a column of data stored in schema

The data format

Fields Explained
asks/bids [Pricing, quantity,...]
trades [time, direction, 0: buy, 1: sell], price, quantity, etc.]

Data on the rate of funding: For example, when a binary futures retest is requested, additional capital rate data is required, and a custom data source is required. For example, the capital rate data structure requested when a binary futures retest is requested is as follows.

{
	"detail": {},
	"symbol": "futures_binance.eth_usdt.funding",
	"schema": ["time", "open", "high", "low", "close", "vol"],
	"data": [
		[1582876800000, 25289, 25289, 25289, 25289, 0],
		[1582905600000, 30522, 30522, 30522, 30522, 0],
		[1582934400000, 40998, 40998, 40998, 40998, 0],
        ...
		[1626652800000, 198, 198, 198, 198, 0],
		[1626681600000, 691, 691, 691, 691, 0],                  // 相邻的周期间隔8小时
		[1626710400000, 310, 310, 310, 310, 0],                  // 币安资金费率8小时更新一次,资金费率数据为什么为310?
		[1626739200000, 310, 310, 310, 310, 0],                  // 因为和K线数据一样,为了避免网络传输过程中浮点数的精度丢,数据采用整型,所以需要根据round参数处理数据,处理后用于返回给回测系统的数据就为310
		[1626768000000, -41610, -41610, -41610, -41610, 0],      // 资金费率数据也可能为负值
		[1626796800000, -5125, -5125, -5125, -5125, 0],
        ...		
		[1627977600000, 10000, 10000, 10000, 10000, 0]
	]
}

Examples of data requests made by the retrieval system are:

http://customserver:80/data?symbol=futures_binance.eth_usdt.funding&eid=Futures_Binance&round=8&vround=5&depth=20&trades=1&custom=0&period=3600000&from=1360771200&to=1628006400

Custom data source example:

Please specify the data source and the web address:http://xxx.xx.x.xx:9090/dataCustom data server, written in golang:

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

func Handle (w http.ResponseWriter, r *http.Request) {
    // e.g. set on backtest DataSourse: http://xxx.xx.x.xx:9090/data
    // r.URL: /data?depth=20&detail=true&eid=Binance&from=1566820800&period=900000&round=3&symbol=BTC_USDT_Binance&to=1569686400&trades=1&vround=5
    // response
    defer func() {
        // response data
        /* e.g. data
        {
            "schema":["time","open","high","low","close","vol"],
            "data":[
                [1564315200000,9531300,9531300,9497060,9497060,787],
                [1564316100000,9495160,9495160,9474260,9489460,338]
            ]
        }
        */
        ret := map[string]interface{}{
            "schema" : []string{"time","open","high","low","close","vol"},
            "data" : []interface{}{
                []int64{1564315200000,9531300,9531300,9497060,9497060,787},
                []int64{1564316100000,9495160,9495160,9474260,9489460,338},
            },
        }
        b, _ := json.Marshal(ret)
        w.Write(b)
    }()
}

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

The test strategy is:JavaScriptExample:

/*backtest
start: 2019-07-28 00:00:00
end: 2019-07-29 00:00:00
period: 1m
exchanges: [{"eid":"OKX","currency":"BTC_USDT","feeder":"http://120.24.2.20:9090/data"}]
*/

function main() {
    var ticker = exchange.GetTicker()
    var records = exchange.GetRecords()
    Log(ticker)
    Log(records)
}

Graphs of customized data drawn in the retesting system:

This is the first time I've seen this video.

Local retesting engine

FMZ Quantitative Trading Platform is open sourceJavaScriptLanguage andPythonNative retrieval engine for languages, supporting retrieval time settingsBottom K-line cycle

Quick-click to retrieve the page

  • Shortcuts for policy edit pages and policy review page switches

    UseCtrl + ,Key, switch to retrieve page and policy edit page, press and holdCtrlAfter the key, press,The knot.

  • Shortcut to save policy

    UseCtrl + sButton, save policy.

  • The shortcut to start the retry

    UseCtrl + bButton to start the retesting.

Code of conduct

Input function

Function name Explained
main() For the input function.
onexit() For a sweep tail function that exits normally, the maximum execution time is 5 minutes, can be undeclared, and will return an error if overtime occursinterruptThis is a mistake.
onerror() A function that triggers execution for an exceptional exit has a maximum execution time of 5 minutes, and can be undeclared.PythonThe language,C++The policy written in the language does not support this function.
init() For initializing functions, the policy program is called first automatically at start-up, but cannot be declared.
  • Explained:
    • The retest system is not supported.onerror()The function ≠ ∞
    • It was triggered in real time.onerror()The function will no longer trigger.onexit()The function ≠ ∞

onexit()

onexit()This is the first time that a user has been able to do this.

function main(){
    Log("开始运行, 5秒后停止,并执行扫尾函数!")
    Sleep(1000 * 5)
}

// 扫尾函数实现
function onexit(){
    var beginTime = new Date().getTime()
    while(true){
        var nowTime = new Date().getTime()
        Log("程序停止倒计时..扫尾开始,已经过去:", (nowTime - beginTime) / 1000, "秒!")
        Sleep(1000)
    }
}
import time 
def main():
    Log("开始运行, 5秒后停止,并执行扫尾函数!")
    Sleep(1000 * 5)

def onexit():
    beginTime = time.time() * 1000
    while True:
        ts = time.time() * 1000
        Log("程序停止倒计时..扫尾开始,已经过去:", (ts - beginTime) / 1000, "秒!")
        Sleep(1000)
void main() {
    Log("开始运行, 5秒后停止,并执行扫尾函数!");
    Sleep(1000 * 5);
}

void onexit() {
    auto beginTime = Unix() * 1000;
    while(true) {
        auto ts = Unix() * 1000;
        Log("程序停止倒计时..扫尾开始,已经过去:", (ts - beginTime) / 1000, "秒!");
        Sleep(1000);
    }
}

init()

init(), the user implements the initialization functioninit()When the policy starts running, it is first executed automatically.init()Function, completing the initialization task designed in the policy.

function main(){
    Log("程序第一行代码执行!", "#FF0000")
    Log("退出!")
}

// 初始化函数
function init(){     
    Log("初始化!")
}
def main():
    Log("程序第一行代码执行!", "#FF0000")
    Log("退出!")

def init():
    Log("初始化!")
void main() {
    Log("程序第一行代码执行!", "#FF0000");
    Log("退出!");
}

void init() {
    Log("初始化!");
}

onerror()

onerror()This is the first time I have seen this in my life.onerror()Execute a function that is not supportedPythonC++The language strategy.

function main() {
    var arr = []
    Log(arr[6].Close)
}

function onerror() {
    Log("错误")
}
# python不支持
// C++不支持

The classic strategic framework

In theJavaScriptPythonC++In languages written with a policy that needs to be called in the policy master loopSleep()The function ─ is used to control the speed of retrograde measurement and the time intervals of real-time strategy rounding, thereby controlling the frequency of requests to access the exchange's API interface ─ is used to control the speed of retrograde measurement.

  • The basic framework for a digital currency strategy is:

    function onTick(){
        //在这里写策略逻辑,将会不断调用,例如打印行情信息
        Log(exchange.GetTicker())
    }
    
    function main(){
        while(true){
            onTick()
            // Sleep函数主要用于数字货币策略的轮询频率控制,防止访问交易所API接口过于频繁
            Sleep(60000)
        }
    }
    
    def onTick():
        Log(exchange.GetTicker())
    
    def main():
        while True:
            onTick()
            Sleep(60000)
    
    void onTick() {
        Log(exchange.GetTicker());
    }
    
    void main() {
        while(true) {
            onTick();
            Sleep(60000);
        }
    }
    

    To give you the simplest example, if I wanted to post a price of 100 on the exchange every 1 second, and the number of payments is 1, it could be written like this:

    function onTick(){
        // 这个仅仅是例子,回测或者实盘会很快把资金全部用于下单,实盘请勿使用
        exchange.Buy(100, 1)
    }
    
    function main(){
        while(true){
            onTick()
            // 暂停多久可自定义,单位为毫秒,1秒等于1000毫秒
            Sleep(1000)
        }
    }
    
    def onTick():
        exchange.Buy(100, 1)
    
    def main():
        while True:
            onTick()
            Sleep(1000)
    
    void onTick() {
        exchange.Buy(100, 1);
    }
    
    void main() {
        while(true) {
            onTick();
            Sleep(1000);
        }
    }
    

Template class library

Template class libraryis a reusable code module in the FMZ quantitative trading platform, a category of the policy code.Template class libraryIn this case, the inventor can create a template class library in the account policy library of the inventor's current logged-in account.

JavaScriptThe language template library:

img

PythonThe language template library:

img

C++The language template library:

img

  • Export functions from template class libraries The export function is an interface function for a template library and can be called by reference to the template library's policy. The export function is declared in the template library and the example code implemented is as follows:

    /*
    -- 策略引用该模板以后直接用 $.Test() 调用此方法
    -- main 函数在策略中不会触发, 只做为模板调试的入口
    */
    $.Test = function() {
        Log('Test')
    }
    
    function main() {
        $.Test()
    }
    
    def Test():
        Log("template call")
    
    # 导出Test函数, 主策略可以通过ext.Test()调用
    ext.Test = Test 
    
    // 策略引用该模板以后直接用 ext::Test() 调用此方法
    void Test() {
        Log("template call");
    }
    
  • Parameters for the template library Template libraries can also set their own interface parameters, which are used as global variables in the template library code.

    Template class library setting parameters:

    img

    The template class library code is:

    $.SetParam1 = function(p1) {
        param1 = p1
    }
    
    $.GetParam1 = function() {
        Log("param1:", param1)
        return param1
    }
    
    def SetParam1(p1):
        global param1
        param1 = p1
    
    def GetParam1():
        Log("param1:", param1)
        return param1
    
    ext.SetParam1 = SetParam1
    ext.GetParam1 = GetParam1
    
    void SetParam1(float p1) {
        param1 = p1;
    }
    
    float GetParam1() {
        Log("param1:", param1);
        return param1;
    }
    

    See also:Template class libraryThe example of the strategy code:

    function main () {
        Log("调用$.GetParam1:", $.GetParam1())
        Log("调用$.SetParam1:", "#FF0000")
        $.SetParam1(20)
        Log("调用$.GetParam1:", $.GetParam1())
    }
    
    def main():
        Log("调用ext.GetParam1:", ext.GetParam1())
        Log("调用ext.SetParam1:", "#FF0000")
        ext.SetParam1(20)
        Log("调用ext.GetParam1:", ext.GetParam1())
    
    void main() {
        Log("调用ext::GetParam1:", ext::GetParam1());
        Log("调用ext::SetParam1:", "#FF0000");
        ext::SetParam1(20);
        Log("调用ext::GetParam1:", ext::GetParam1());
    }
    

    img

  • Refer to the template library

    After selecting a reference in the policy edit page template bar, you can save the policy.

    img

Built-in structure

Global variables

exchange

exchangeThe first exchange object to be added to the policy parameter by default; all interactions with the exchange are implemented through functions inside the object.

  • Retest adding exchange objects

  • Add exchange objects to the desktop page

The exchange object added corresponds to the code.exchangeThe object:

function main() {
    Log("实盘页面或者回测页面上,添加的第一个交易所对象名字:", exchange.GetName(), ",标签:", exchange.GetLabel())
}
def main():
    Log("实盘页面或者回测页面上,添加的第一个交易所对象名字:", exchange.GetName(), ",标签:", exchange.GetLabel())
void main() {
    Log("实盘页面或者回测页面上,添加的第一个交易所对象名字:", exchange.GetName(), ",标签:", exchange.GetLabel());
}
exchanges

It's the same thing as storage.exchangeAn array of all exchange objects of an exchange may contain multiple exchange objects, and may be used to represent a set of exchange objects.exchanges[0]That is,exchange

Added exchange objects correspond to the policy codeexchanges[0]exchanges[1]exchanges[2]And I'm not going to lie to you.

function main() {
    for(var i = 0; i < exchanges.length; i++) {
        Log("添加的交易所对象索引(第一个为0以此类推):", i, "名称:", exchanges[i].GetName(), "标签:", exchanges[i].GetLabel())
    }
}
def main():
    for i in range(len(exchanges)):
        Log("添加的交易所对象索引(第一个为0以此类推):", i, "名称:", exchanges[i].GetName(), "标签:", exchanges[i].GetLabel())
void main() {
    for(int i = 0; i < exchanges.size(); i++) {
        Log("添加的交易所对象索引(第一个为0以此类推):", i, "名称:", exchanges[i].GetName(), "标签:", exchanges[i].GetLabel());
    }
}
Order status

OrderIn the structureStatusAttributes.

The name of the constant Defined Value
ORDER_STATE_PENDING Unfinished 0
ORDER_STATE_CLOSED It's finished. 1
ORDER_STATE_CANCELED Cancelled 2
ORDER_STATE_UNKNOWN Status unknown (other status) 3

ORDER_STATE_UNKNOWNState can be calledexchange.GetRawJSON()You can access the original order status information, consult the exchange documentation, and see the specific description. The variable names in the table can be used directly in the policy code andOrderStructuredStatusAttribute comparison, determining the order status by determining whether the attributes are equal. Printing these constant names will show theseThe name of the constantCorrespondingValueThe following other constant names are no longer used.

Type of order

OrderIn the structureTypeAttributes.

The name of the constant Defined Value
ORDER_TYPE_BUY Payment 0
ORDER_TYPE_SELL The sale 1
Type of position

PositionIn the structureTypeAttributes.

The name of the constant Defined Explained Applicable Value
PD_LONG Indicates the multihead position Future use of digital currenciesexchange.SetDirection("closebuy")Set the position direction to flatten the type of position The future of digital currency 0
PD_SHORT Indicates the blank position Future use of digital currenciesexchange.SetDirection("closesell")Set the position direction to flatten the type of position The future of digital currency 1
The futures are heading for a placement.

OrderIn the structureOffsetAttributes.

The name of the constant Defined Value
ORDER_OFFSET_OPEN Orders to open 0
ORDER_OFFSET_CLOSE Orders for the warehouse 1
Policy parameters

The policy parameters set on the policy interface in the policy code are expressed in the form of global variables.JavaScriptIn the language, parameters set in the policy interface can be accessed or modified directly.PythonUsed when modifying global variables in a policy functionglobalThe keyword is.

Parameter types:

img

Variable Describe Notes Types The default Explained
number Type of value Notes Numbers (number) 1 C++ policies are floating point.
string String Notes String (s) Hello FMZ Default values are entered without quotation marks, and are processed as strings.
combox Draw box Notes Drag box ((selected)) 1|2|3 The combox variable itself is a numeric value, representing the target index of the drop-down box controller selection, the first drop-down box header content is 1, its index value is 0, and so on.
bool Select Notes Bull type ((true/false)) true If selected, the variable bool is true, if not selected, the variable bool is false.
secretString Encrypted strings Notes Encrypted string passWord Using the same method as strings, encrypted strings are sent encrypted and not transmitted in plain text.
  • Interface parameters, set in the policy parameters area below the policy edit page code edit area.
  • Interface parameters exist in the policy code as global variables, i.e. interface parameters can be modified in the code.
  • Interface parameters are the name of the variable in the policy code: i.e. in the diagram abovenumberstringcomboxboolsecretString
  • Describe the option: Interface parameter name in the policy interface.
  • Optional Notes: Detailed description of the interface parameter, which will be displayed when the mouse is on the interface parameter.
  • Type Options: The type of this interface parameter.
  • Default value option: Default value of this interface parameter.

The parameters depend on the setting: You can set one parameter so that another parameter based on that parameter's selection can be displayed and hidden.numberA, is a numeric type.numberAIt is based on one parameter:isShowAThis is the true decision of the Bull type.numberAShow and hide.numberAThe variable is set to:numberA@isShowA

img

It's not like that.isShowAThe parameters,numberAThe parameter is hidden. For the parameter of the type of drop-down control, the parameter is dependent in part on whether the drop-down is equal to a certain option.Indexed valueThe same goes forisShowAFor example, the parameter is written as:numberA@combox==2numberAThe parameters are based oncomboxWhether the parameter is selected to be displayed or hidden for the third option (index 0 corresponds to the first option, index 1 corresponds to the second option, index 2 corresponds to the third option).

Policy interface parameters, interaction controls, and parameter grouping functions on templates: Add only the description of the parameter at the beginning of the grouping(?第一组)This is the case, for example, with the following diagram.

img

When using the policy, the parameters are grouped:

img

The default value of the parameter is saved: The policy parameter is shown below. If you want to save the policy parameter default value during retesting, you can click after the policy parameter has been modified.保存回测设置The button.

img

img

The policy parameters that have been set can also be stored in the policy in code form:

/*backtest
start: 2020-02-29 00:00:00
end: 2020-03-29 00:00:00
period: 1d
args: [["number",2],["string","Hello FMZ.COM"],["combox",2],["bool",false],["numberA@isShowA",666],["isShowA",true]]
*/
'''backtest
start: 2020-02-29 00:00:00
end: 2020-03-29 00:00:00
period: 1d
args: [["number",2],["string","Hello FMZ.COM"],["combox",2],["bool",false],["numberA@isShowA",666],["isShowA",true]]
'''
/*backtest
start: 2020-02-29 00:00:00
end: 2020-03-29 00:00:00
period: 1d
args: [["number",2],["string","Hello FMZ.COM"],["combox",2],["bool",false],["numberA@isShowA",666],["isShowA",true]]
*/

The structure of the data

Some functions will have the original requested return when called.JSONThe data, the originalJSONReturns the object where the data is storedInfoIn the attribute. Since it is not an interface to visit an exchange when retesting, none of the data returned when retesting is present.InfoAttributes, the following are descriptions of the main properties of each data structure.

Trade

Access all transaction history (other than your own)exchange.GetTrades()The function returns.

{
    Id      : 9585306,          // 交易记录ID,如果交易所接口没有提供订单ID则使用时间戳填充
    Time    : 1567736576000,    // 时间(Unix timestamp 毫秒)
    Price   : 1000,             // 价格
    Amount  : 1,                // 数量
    Type    : 0                 // 订单类型,参考常量里的订单类型,0即为ORDER_TYPE_BUY,ORDER_TYPE_BUY的值为0
}
Ticker

The market is dominatedexchange.GetTicker()The function returns.

{
    Info    : {...},             // 请求交易所接口后,交易所接口应答的原始数据,回测时无此属性
    High    : 1000,              // 最高价,如果交易所接口没有提供24小时最高价则使用卖一价格填充
    Low     : 500,               // 最低价,如果交易所接口没有提供24小时最低价则使用买一价格填充
    Sell    : 900,               // 卖一价
    Buy     : 899,               // 买一价
    Last    : 900,               // 最后成交价
    Volume  : 10000000,          // 最近成交量,原则上现货成交量单位为交易币种(baseCurrency),期货成交量单位为合约张数。如果交易所接口没有提供此类数据则使用交易所接口现有的数据填充,例如可能为计价币(quoteCurrency)为单位的成交量
    Time    : 1567736576000      // 毫秒级别时间戳
}
Record

The standardOHLCStructure, used for drawing K-lines and indicator calculation analysis.exchange.GetRecords()The function returns an array of this structure.RecordThe structure represents a K-line column, a K-line.BARRecordOne of themTimeThe start time of this K-line column cycle.

{
    Time    : 1567736576000,     // 一个时间戳,精确到毫秒,与Javascript的new Date().getTime()得到的结果格式一样
    Open    : 1000,              // 开盘价
    High    : 1500,              // 最高价
    Low     : 900,               // 最低价
    Close   : 1200,              // 收盘价
    Volume  : 1000000            // 交易量,原则上现货成交量单位为交易币(baseCurrency),期货成交量单位为合约张数,如果交易所接口没有提供此类数据则使用交易所接口现有的数据填充,例如可能为计价币(quoteCurrency)为单位的成交量
}
Order

The order structure can beexchange.GetOrder()exchange.GetOrders()The function returns.exchange.GetOrders()Returns an array of the structure or an empty array (if there is not one)Unfinished ordersI'm going back.[], which is an empty array) ≠

{
    Info        : {...},         // 请求交易所接口后,交易所接口应答的原始数据,回测时无此属性
    Id          : 123456,        // 交易单唯一标识
    Price       : 1000,          // 下单价格,注意市价单的该属性可能为0或者-1
    Amount      : 10,            // 下单数量,注意市价单的该属性可能为金额并非币数
    DealAmount  : 10,            // 成交数量,如果交易所接口不提供该数据则可能使用0填充
    AvgPrice    : 1000,          // 成交均价,注意有些交易所不提供该数据。不提供、也无法计算得出的情况该属性设置为0
    Status      : 1,             // 订单状态,参考常量里的订单状态,例如:ORDER_STATE_CLOSED
    Type        : 0,             // 订单类型,参考常量里的订单类型,例如:ORDER_TYPE_BUY
    Offset      : 0              // 数字货币期货的订单数据中订单的开平仓方向。ORDER_OFFSET_OPEN为开仓方向,ORDER_OFFSET_CLOSE为平仓方向
    ContractType : ""            // 现货订单中该属性为""即空字符串,期货订单该属性为具体的合约代码
}
MarketOrder

The market depth index, orexchange.GetDepth()The function returns to the data structureBidsAsksThe data structure of the elements in the array.

{
    Price   : 1000,              // 价格
    Amount  : 1                  // 数量
}
Depth

Market depth, byexchange.GetDepth()The function returns.

{
    Asks    : [...],             // 卖单数组,MarketOrder数组,按价格从低向高排序
    Bids    : [...],             // 买单数组,MarketOrder数组,按价格从高向低排序
    Time    : 1567736576000      // 毫秒级别时间戳
}
Account

Account information provided byexchange.GetAccount()The function returns. The data in the returned structure is related to the current set of transaction pairs, set of contract codes.

{
    Info            : {...},     // 请求交易所接口后,交易所接口应答的原始数据,回测时无此属性
    Balance         : 1000,      // 可用计价币数量,现货中如果交易对是BTC_USDT,Balance指的是当前可用USDT数量。U本位期货合约中Balance指的是可用保证金USDT的数量
    FrozenBalance   : 0,         // Balance表示的资产用于挂单的冻结数量
    Stocks          : 1,         // 可用交易币数量,现货中如果交易对是BTC_USDT,Stocks指的是当前可用BTC数量。币本位期货合约中Stocks指的是可用保证金的币(baseCurrency)的数量
    FrozenStocks    : 0          // Stocks表示的资产用于挂单的冻结数量
}
Position

The position information held in the futures trading is provided byexchange.GetPosition()The function returns here.PositionStructuredArrays

{
    Info            : {...},     // 请求交易所接口后,交易所接口应答的原始数据,回测时无此属性
    MarginLevel     : 10,        // 持仓杆杠大小,如果交易所接口没有提供该数据则通过计算填充,可能会有误差
    Amount          : 100,       // 持仓量,持仓合约张数,通常是正整数。注意每个交易所的合约乘数、价值等合约规格可能不一样,下单规则也可能不一样,例如币安合约可以0.1张下单
    FrozenAmount    : 0,         // 仓位冻结量,用于平仓挂单时的临时冻结仓位数量
    Price           : 10000,     // 持仓均价,原则上该属性为仓位总体的平均价格(不参与结算),如果交易所接口没有提供该数据则用交易所接口现有的持仓均价填充(参与结算)
    Profit          : 0,         // 持仓浮动盈亏,原则上为持仓的未实现盈亏,如果交易所接口没有提供该数据则用交易所接口其它盈亏数据填充,盈亏数值的单位和当前合约保证金的单位相同
    Type            : 0,         // PD_LONG为多头仓位,PD_SHORT为空头仓位
    ContractType    : "quarter", // 合约代码,具体可以参看SetContractType函数描述中传入的参数
    Margin          : 1          // 仓位占用的保证金,如果交易所接口没有提供该数据则使用0填充
}

In addition, the digital currency futures market has been experiencing a significant decline in the number of digital currency futures.exchange.GetPosition()The function returnsPositionStructured arrays.FrozenAmountProfitMarginAttributes, because the data provided by the exchange is not uniform, the objects of different exchanges are calledexchange.GetPosition()The definition of the data that is returned at the interface may be different. For example, some exchanges hold no position freeze data in their warehouse data.FrozenAmount0; can be used to calculate some data if neededInfoPrimitive data computation analysis in the property.

Market

Market information on the trade varieties is provided byexchange.GetMarkets()The function returns thisMarketStructuredEnglish dictionary

{
    Symbol          : "btcusdt",       // 该交易品种在交易所的原始名称
    BaseAsset       : "BTC",           // baseCurrency 交易币,统一大写
    QuoteAsset      : "USDT",          // quoteCurrency 计价币,统一大写
    TickSize        : 0.01,            // 价格最小变动数值
    AmountSize      : 0.01,            // 下单量最小变动数值
    PricePrecision  : 2,               // 价格精度,表示价格精确到2位小数
    AmountPrecision : 3,               // 下单量精度,表示下单量精确到3位小数
    MinQty          : 0.001,           // 最小下单量
    MaxQty          : 1000,            // 最大下单量
    MinNotional     : 5,               // 最小下单金额
    MaxNotional     : 9999999,         // 最大下单金额
    CtVal           : 100,             // 合约价值
    Info            : {...}            // 交易所该品种的原始数据
}

Since the degree of market information data support varies from exchange to exchange, fields that are not supported by the exchange will be ignored. Each of the above fields is derived from the raw data of the exchange interface.InfoThe content of the field.

Global functions

Version()

Version()Returns the current version of the system. Returns string type.

Sleep(Millisecond)

Sleep(Millisecond), a sleep function that pauses the program for a period of time.MillisecondThe parameter is the number of milliseconds, for example:Sleep(1000)I'm going to take a nap for a second. Supports operations with a sleep time of less than 1 millisecond, such as settingSleep(0.1)The minimum parameters supported are:0.000001, nanoseconds of sleep. 1 nanosecond is equal to1e-6I'm not going to lie.

Please note: In usePythonWhen writing a language policy, you should use operations for consultation intervals, time waiting.Sleep(Millisecond)Functions. Not recommendedPythonWhat?timeThe Kitchentime.sleep(second)Function. Because it's used in the policytime.sleep(second)A function that actually waits a certain number of seconds for the policy program to retest.secondThe parameter is set to pause for seconds), which causes the policy to retry very slowly.

IsVirtual()

IsVirtual(), determines whether the current policy is running for analog retesting. Returns value: Boolean type. Returns the state of the simulated responsetrueThe real disk is back.false

Mail(…)

Mail(smtpServer, smtpUsername, smtpPassword, mailTo, title, body), sends a mail function. The parameter value is: All the parameters are of string type. The return value is: Boolean type.truesmtpServerTo send the mailsmtpServices,smtpUsernameI'm not sure how to do that.smtpPasswordThe SMTP password for the mailbox (not the login password for the mailbox)mailToIn order to receive the email, the user has to use the e-mail address of the email account.titleThe title of the e-mails sent,bodyThe content of the emails sent, for example:

function main(){
    Mail("smtp.163.com", "asdf@163.com", "password", "111@163.com", "title", "body")
}
def main():
    Mail("smtp.163.com", "asdf@163.com", "password", "111@163.com", "title", "body")

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.