Cepat menerapkan alat perdagangan kuantitatif semi otomatis
Dalam perdagangan berjangka komoditas, arbitrage intertemporary adalah metode perdagangan yang umum. Jenis arbitrage ini tidak bebas risiko. Ketika arah satu sisi spread terus berkembang, posisi arbitrage akan berada dalam keadaan kehilangan terapung. Namun, selama posisi arbitrage dikendalikan dengan benar, itu masih sangat operasional dan layak.
Dalam artikel ini, kami mencoba beralih ke strategi perdagangan lain, alih-alih membangun strategi perdagangan otomatis sepenuhnya, kami menyadari alat perdagangan kuantitatif semi-otomatis interaktif untuk memudahkan arbitrase intertemporary dalam perdagangan berjangka komoditas.
Platform pengembangan kami akan menggunakan platform FMZ Quant. Fokus artikel ini adalah bagaimana membangun strategi semi otomatis dengan fungsi interaktif.
Arbitrage intertemporal adalah konsep yang sangat sederhana.
# Strategy Design
The strategy framework is as follows:
Fungsi utama
Sementara (benar) {
If(exchange.IO(
If the CTP protocol is connected properly, then we need to set up the trading contract and then get the market quote. After obtaining the quotes, we can use the FMZ Quant platform build-in "line drawing" library to draw the difference.
Fungsi utama
Sementara (benar) {
If(exchange.IO(
LogStatus ((_D(),
Get the market data, calculate the difference, and draw the graph to record. let it simply reflects the recent fluctuations in the price difference.
Use the function of "line drawing" library ```$.PlotLine```
![Quickly implement a semi-automatic quantitative trading tool](/upload/asset/6e286fea238b8266dd13.png)
# Interactive part
On the strategy editing page, you can add interactive controls directly to the strategy:
![Quickly implement a semi-automatic quantitative trading tool](/upload/asset/6e9b91112616d444b964.png)
Use the function ```GetCommand``` in the strategy code to capture the command that was sent to the robot after the above strategy control was triggered.
After the command is captured, different commands can be processed differently.
The trading part of the code can be packaged using the "Commodity Futures Trading Class Library" function. First, use ```var q = $.NewTaskQueue()``` to generate the transaction control object ```q``` (declared as a global variable).
var cmd = GetCommand()
jika (cmd) {
jika (cmd ==