[TOC]
What is the biggest difficulty for beginners to learn quantitative trading, programmatic trading?
With the development of AI technology, these problems can be solved to some extent.Chat GPTWith a brand new upgrade to the FMZ platform's strategy editor and the addition of Chat GPT, which has significantly improved quantitative productivity, let's explore together.New features in the FMZ Strategy Editor!
Although Chat GPT is now very powerful and has a very high level of understanding of the questions posed by humans, the answers it provides are still very much the same.Completeness of the problem description、Accuracy of descriptionThe Chat GPT is very sensitive, and if the scenario or the content of the problem described is not accurate, the Chat GPT will not be able to give a perfect answer.
Next, we use the Chat GPT feature of the FMZ Platform Policy Editor to solve a code design problem, log into the FMZ Platform and edit a policy page.
Use the right-click menu to select the ChatGPT option in the space and click, which can be calledChat GPT
orChatGPT is invoked using the K-terminal。
If I were a beginner in quantitative trading, I would have a requirement: to use a minute K-line to synthesize an arbitrary period K-line data set. As a beginner, I am not very good at programming and would not have written such an algorithm.The K-line data bucket is used to synthesize arbitrary cycles of K-line data buckets using a minute K-lineThe GPT probably doesn't give you a 100% available answer, and you need to try to describe the problem as perfectly as possible. In this need example, I'm constantly adjusting my question, asking many times before I get the answer I want.
在FMZ平台上调用exchange.GetRecords(60)函数可以获取一分钟K线数据,数据结构是:
[{
Time : 毫秒时间戳, // 周期的起始时间
Open : 1000,
High : 1500,
Low : 900,
Close : 1200,
Volume : 1000000
}, ...]
请设计一个算法,使用一分钟K线数据合成任意分钟的K线数据,对于可以整除60分钟的周期,需要从整点的0分开始统计,使用Javascript语言实现,
这个算法单独写成一个函数,测试在function main()函数中测试,使用$.PlotRecords(KLineData, "name")画图。
After calling ChatGPT, you can fill in the above optimized query content.
ChatGPT is now live.
Let it finish writing.
SometimesChat GPT
It's wrapped in code with the ``` symbol, which is the markdown for the wrapped content of the code. So we've deleted the first and last lines.$.PlotRecords(KLineData, "name")
Drawing diagrams, so the strategy is to refer to the drawing line library to draw the diagram, drawing diagrams are to verify if the K-line data from the code synthesis given by Chat GPT is correct.
The template class library, which is no longer discussed here, can be consulted in FMZ's API documentation.Address of the drawing line library
Chat GPT
The given code is directly retrievable, and I set the default K-line cycle of the retrieval system to 5 minutes to compare the K-line data drawn by the Chat GPT algorithm against the K-line data drawn by the Chat GPT algorithm.
Initially, it seems that the algorithm given by ChatGPT is correct to synthesize 5 minute K lines using 1 minute K line.
/*
合成任意分钟的K线数据
@param {Array} records - 一分钟K线数据
@param {Number} period - 合成的周期,单位为分钟
@return {Array} - 合成后的K线数据
*/
function composeKLineData(records, period) {
var result = [];
var index = 0;
var open = records[0].Open;
var high = records[0].High;
var low = records[0].Low;
var close = records[0].Close;
var volume = records[0].Volume;
var time = records[0].Time - records[0].Time % (period * 60 * 1000);
for (var i = 1; i < records.length; i++) {
var record = records[i];
if (record.Time < time + period * 60 * 1000) {
high = Math.max(high, record.High);
low = Math.min(low, record.Low);
close = record.Close;
volume += record.Volume;
} else {
result[index] = {
Time: time,
Open: open,
High: high,
Low: low,
Close: close,
Volume: volume
};
index++;
open = record.Open;
high = record.High;
low = record.Low;
close = record.Close;
volume = record.Volume;
time = record.Time - record.Time % (period * 60 * 1000);
}
}
result[index] = {
Time: time,
Open: open,
High: high,
Low: low,
Close: close,
Volume: volume
};
return result;
}
function main() {
var records = exchange.GetRecords(60);
var kLineData = composeKLineData(records, 5); // 合成5分钟K线数据
$.PlotRecords(kLineData, "KLineData");
}
ChatGPT integrated with FMZ not only helps you write code, but also helps you interpret code.composeKLineData
Functions, right-click on the pop-up menu:
Even ChatGPT can give optimization suggestions, optimizing code.
The FMZ editor is updated with a new feature called ChatGPT. It is more optimized, improves the user experience of writing online programs, and adds many convenient features.
Right-click on the space or select the code, and a menu pops up.
It shows a combination of shortcuts for various functions.
Rename Symbol, change the name of the local variable.
It's just changing the diagram above.main
Variable name in functionrecords
。
Change All Occurrences, select a variable name, a word, and edit all the same content in the text.
Format Selection, to format the selected code.
Format Document, all code is formatted.
Go to Definition, jump to the definition. Go to References, jump to references. Go to Symbol..., jump to variable name, function name etc.
Peek Definition, definition preview. View the definition of the selected code without leaving the current line. Peek References, a reference preview, allows you to quickly jump to see where other lines of code refer to the current line of code without leaving the current line of code, in order to better understand the logic and structure of the code.
xuzijie 666
gaoyongfaI'm going to post a comment.
btc_KevinThis is 666.
17732164739It's good, dreams are hard.
Inventors quantify - small dreamsThank you for supporting inventors quantify.