In the previous articles we have learned that the so-called programmatic, quantitative trading is a script based on the data obtained from the exchange, after a series of calculations, judgments and triggers to perform some operations to operate the exchange account to trade. These actions of obtaining data, operating the account are carried out through the exchange API interface. Simply put, the script and the exchange interact, since it is interaction, there must be normal interaction, abnormal interaction.
Of course, there are all kinds of error prompts and error messages in the market, whether programmatic, quantitative trading systems, or self-developed programs. These errors are not limited to the exchange's API interface. There are also errors such as: abnormal errors when running programs, configuration errors, program errors, syntax errors, etc.
In the inventor quantified trading platforms, misinformation is also likely to fall into several categories:
Strategic grammatical errors These errors are most commonly caused by newcomer's unfamiliarity with programming, and syntax errors in learning test-stage code; for example:
The code has fewer characters, such as parentheses. Errors such as this can often be seen on the edit policy page, and the policy itself cannot be run (it will return an error directly when run, as shown below).
So, after writing the policy, take a look at the usual editing habits on the platform's policy page to see if there is a red little XX, if there is, there is definitely a glaring error.
Runtime program error caused by policy program BUG The program has a BUG, and when the program is running, triggering an exception causes the program to stop abnormally, displaying such error messages.
These errors cause the program to fail and stop running.
Errors caused by incorrect configuration, setup
The FMZ platform defines a transaction as:X_Y
In such a format, X represents the name of the transaction currency and Y represents the name of the quote currency (the quote currency of the futures contract trading pair is usually expressed in USD, as described in the previous articles).BTC_USDT
So if I write the transaction in pairs, it's writtenBTC-USDT
。
An error was reported in the FMZ platform's feedback system:
In the real world, the error is:
In addition, one of the most common mistakes made by Deng Xiaoping:
This type of error is caused by changing the password of the FMZ platform account, which causes configuring the exchange object in the database.API KEY
Failed (the user's API KEY is configured in the FMZ platform after being encrypted on the browser side), the policy could not be started, and an error was reported.
Interface call error reported
Interface call errors are a common occurrence in the runtime, and in previous articles we learned about the interface on the FMZ platform.Interface that generates network requests、Interfaces that do not generate network requestsInterface error reports do not cause a policy program to stop, usually due to an interface call exception, return incorrect data, and then the policy does not do the error tolerance, using the incorrect data triggered program exception error causes the program to stop (the concept of error tolerance was mentioned in the previous articles).
Here are a few interface error messages that generate network requests:
The Internet is overdue
One of the most common mistakes that newcomers encounter is that they are using a device on a domestic network (their own computer or a local server). Since most exchanges are walled, the domestic network is basically inaccessible to many exchanges, and access interfaces report overtime.
http 429 is wrong
One of the classic error messages is that the call to the exchange interface is too frequent, exceeding the frequency limit of the exchange.
Some of my freshman classmates might say, "I'm applying to more than a few exchanges".API KEY
We need to know that the exchange limits the frequency of access to the interface usually based on the IP address, simply put, as long as the requests sent to an IP address are all statistically based on this IP address, and the exchange server denies access if it exceeds the limit of this IP.
Exchange interface business-level error reported
The above timeout, 429, are network-level errors. Exchange interface business-level problems will also be reported, for example, I want to access a spot market, but I set up a non-existent transaction pair. I tested in the FMZ platform's debug tool, which is a very convenient testing tool, very suitable for real-time testing of function calls, data acquisition, etc.
Debugging tool execution results, debugging tool execution and real disk execution are not distinguished.
Huobi 错误 GetTicker: Invalid ticker: {"Info":{"err-code":"invalid-parameter","err-msg":"invalid symbol","status":"error","ts":1620872079355},"High":0,"Low":0,"Sell":0,"Buy":0,"Last":0,"Volume":0,"OpenInterest":0,"Time":0}
The error message here means that the transaction is invalid."err-msg":"invalid symbol"
I'm not sure.
There are many other examples of this type of business-related reporting errors, such as when some exchanges do not support leverage with a fractional part when setting the leverage, in which case leverage with a fractional part will also result in an interface call reporting error.
List an interface call that does not generate a network request
Set up the code of the futures contract Some interfaces simply set certain global variables in the system that do not generate network requests, such as:
However, it is also possible to transmit errors or misspell parameters.
But regardless of the type of error, the error message displayed is the key information to find the problem, and it is usually possible to see the problem from the error message."err-msg":"invalid symbol"
This is probably because the English symbol is usually used to represent the transaction code, the transaction pair.
We'll briefly explore these in regards to error reporting, and a post will be continuously collected for frequently asked questions:https://www.fmz.com/bbs-topic/1427
The retest system is also a focus in a quantitative tool, which can be used to prototype a convenient test strategy, potential bugs, logical problems in the initial test strategy, etc.
Below is a simple explanation of the different strategy language levels supported by FMZ for the FMZ platform's feedback system.
JavaScript
Browser-side feedback, using native hardware resources.
Python
In the host reassessment, you can choose which host to specifically assign to (the host that deploys itself, the public host of the FMZ platform both go). Given the large load of public hosts on the FMZ platform, it is recommended to use local host reassessment (this will also be faster, when the public host reassesses, when more tasks exceed the load, some reassessment tasks will be canceled, causing reassessment interruption).
C++
Unlike scripting languages, C++ policies require compilation before execution. C++ policies are compiled on the FMZ platform (server) first.
Mayan language
The underlying implementation is JavaScript, which is also executed on the browser side when retweeted.
Visualized
The underlying implementation is JavaScript, which is also executed on the browser side when retweeted.
The inventors of the QT system of retargeting are divided into two types (this is a non-strategic language, this is a retargeting setting, the strategy retargeting of all languages is the same).
For more information on the retesting system, please see the platform's tutorial:
1, analog level retesting Analogue-level retracement is simply the price data generated by time node-by-node simulation based on K-line data.
K线中一根柱子不是有高开低收么,构成了一个价格框架,在这个K线代表的时间范围内,价格都在这个价格框架内,所以只要生成的价格在这个K线高开低收框架范围内,这个模拟出来的价格就是合理的。
In the meantime, I'm going to try to make a similar picture:https://www.fmz.comOf course, the actual feedback system is a bit more complicated than the one shown in the diagram, so it is not necessary to go into detail here, but to understand the feedback mechanism at the analog level. Knowing this principle, it is necessary to pay attention to the disadvantages of analogue-level retrieval, although analogue-level retrieval is fast (because the price generated by the analogue is not the real price per second released one by one), but if the strategy fits.Simulated tick change trendsThis is a very good strategy (but in practice, the price may not be this trend, although the price is in the framework of this K-pillar). The k-line used here to generate the analog tick data is called the bottom k-line, and the period of this k-line is called the period of this k-line.Bottom K-line cycleIn the policy settings page, set it as follows:
Set to 1 minute here, which means that K-line data with a cycle of 1 minute is used as the data source for generating the analog tick.
Another point is that for high-frequency strategies, the use of analogue-level feedback is obviously less appropriate. However, for trend strategies, the use of analogue-level feedback can still reflect the performance of the strategy to some extent.
2, real-time level of reassessment Speaking of analogue-level retracement, let's talk about real-time retracement. Simply put, real-time retracement is the actual release of price data per second during retracement. Let the strategy retracement price per second in the market. The disadvantage is that the real disk-level retrieval data is too large to retrieve for a larger time range (usually less than 1 day).The data, reducing the depth data grade (transactional data per pen, discovery depth data in real-disc level retesting also have snapshots per second, so the real-disc level retesting data volume is large), to appropriately increase the retesting range, as shown in the figure:
Where is the source of the inventor's quantitative trading platform feedback system? The feedback system uses data from the FMZ platform's data center by default, which automatically collects market data for the various currencies of the various exchanges set up well and provides it to the feedback system on the platform.
1st, data from FMZ data center by default In previous articles, we have mentioned:https://www.fmz.com/bbs-topic/6857#量化交易平台The platform provides retrospective data that only supports a limited number of trading pairs (all markets, all currencies retrospective data is an astronomical number, all collected unrealistically, the platform collects market data for mainstream exchanges, mainstream currencies).
2, use custom data source data Custom data sources can be set up using the option on the retargeting page. Simply put, if you have your own data from an exchange, you can provide the retargeting system to the FMZ platform for retargeting according to the format requirements of the FMZ platform.
The FMZ API documentation also provides some guidance on custom data sources:https://www.fmz.com/api#自定义数据源
The FMZ library also has a number of programs:
If you're interested, you can find references here.
It's not easy to program and quantify transactions.Learning、Testing、ThinkingI'm not sure. Thinking about the problem is not an empty thought, it is inefficient.Search for informationAnd thenLet's try it.、Thinking and analyzingIf the problem is not resolved, please continue to the above steps.
But usually, when she encounters a problem, she feels:
It's so hard to program, quantify, write strategies. I've been watching for half a day, and I'm still stunned! You didn't come in here to give up! ...and the people
It is very easy to get started on the FMZ platform, first of all, you need to know how to find information. There is a lot of information available in the inventors' Quantified Trading Platform Strategy Square, community and library.
Then there's the hands-on capability, which can be easily tested using a feedback system and debugging tools, not a complete strategy. In fact, if you're completely zero-based, you can even learn the basics of JavaScript programming on FMZ's quantified feedback system.
This is a tutorial website I use to learn JS:https://www.runoob.com/js/js-loop-for.htmlNot only JS, all kinds of IT knowledge can be consulted and learned here. For example, I don't know how to use a regular expression in JS. Of course, check the information first, and then try it yourself.
I saw an example:I would like to test it and even learn how to use FMZ's feedback system.
It's easy to set up an exchange on the retargeting system.
Test the following code:
function IsEmail(str) {
var reg=/^\w+@[a-zA-Z0-9]{2,10}(?:\.[a-z]{2,4}){1,3}$/;
return reg.test(str);
}
function main() {
var strEmailAddress1 = "13512345678"
Log(strEmailAddress1, " 是邮件地址么 ? ", " 回答:", IsEmail(strEmailAddress1))
var strEmailAddress2 = "123456789@qq.com"
Log(strEmailAddress2, " 是邮件地址么 ? ", " 回答:", IsEmail(strEmailAddress2))
}
Look at this - what a great learning tool! For example, if I want to learn how to write the looping logic of JavaScript, I'll try this:
The loop prints each element in an array variable in the order in which it appears in the array:
function main() {
var arr = [{coinName: "BTC", price: 10000}, {coinName: "LTC", price: 100}, {coinName: "ETH", price: 2000}, {coinName: "ETC", price: 500}]
for (var i = 0 ; i < arr.length ; i++) {
Log(arr[i])
}
}
In the moment, it feels like learning is motivated! In fact, on FMZ, it is possible to read JavaScript tutorials and learn the basics of JavaScript manually on the retrieval system. JavaScript syntax is almost mastered, and the next stage requires the actual use of an exchange interface to obtain data testing, and you can also use the FMZ platform to learn the basics of JavaScript.Debugging toolsThis is the first time we have done a real-world interface test.
Then it's more thinking, one against three, testing, verification, comparison analysis etc. This is very quick to learn the basics.
lizhuliliPraise and worship