The resource loading... loading...

Explore the new features of the FMZ Strategy Editor: How ChatGPT dramatically improves your quantitative productivity

Author: Inventors quantify - small dreams, Created: 2023-04-01 13:07:53, Updated: 2024-11-29 18:56:44

[TOC]

img

Explore the new features of the FMZ Strategy Editor

What is the biggest difficulty for beginners to learn quantitative trading, programmatic trading?

  • Lack of basic knowledge: including basic concepts, market rules, trading knowledge, strategic thinking, etc.
  • Weak programming fundamentals: including logical expressions, program design writing, program debugging and error sorting.
  • Logical thinking weakness: The process of thinking is prone to confusion, and the more you think, the more confused it becomes.
  • Difficulty in self-learning: Problems cannot be solved, and the direction of the problem search may not even be clear.

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

Code design with Chat GPT

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 descriptionAccuracy 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.

1, How to call ChatGPT

img

Use the right-click menu to select the ChatGPT option in the space and click, which can be calledChat GPTorChatGPT is invoked using the K-terminal

2. How to ask questions

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.

img

ChatGPT is now live.

img

Let it finish writing.

img

SometimesChat GPTIt'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 GPTThe 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.

img

3, retest test Chat GPT provided code

回测系统画图 ChatGPT给出的算法画图

Initially, it seems that the algorithm given by ChatGPT is correct to synthesize 5 minute K lines using 1 minute K line.

4, full code written by ChatGPT

/*
合成任意分钟的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");
}

Interpret code with Chat GPT

ChatGPT integrated with FMZ not only helps you write code, but also helps you interpret code.composeKLineDataFunctions, right-click on the pop-up menu:

img

img

Use Chat GPT to make suggestions and optimize code

Even ChatGPT can give optimization suggestions, optimizing code.

img


Other features added to the editor

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.

See shortcut key combinations

Right-click on the space or select the code, and a menu pops up.

img

It shows a combination of shortcuts for various functions.

img


Change the name of the volume

Rename Symbol, change the name of the local variable.

img

img

It's just changing the diagram above.mainVariable name in functionrecords


Modify all the same content

Change All Occurrences, select a variable name, a word, and edit all the same content in the text.

img

img


Formatting (code embellishment, auto-alignment formatting)

Format Selection, to format the selected code.

Format Document, all code is formatted.

img


Jump to definition, reference

Go to Definition, jump to the definition. Go to References, jump to references. Go to Symbol..., jump to variable name, function name etc.

img


Define the preview, reference the preview

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.

img


Related

More

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.