Cryptocurrency Quantitative Trading for Beginners - Taking You Closer to Cryptocurrency Quantitative (8-1)

in okx •  last year 

In the previous article, we designed a multi-species contract spread monitoring strategy together. In this article, we will continue to improve this idea. Let's see if this idea is feasible, and run it with the OKEX V5 simulation bot to verify the strategy design. These processes are also required to be experienced in the process of cryptocurrency programmatic tradings and quantitative tradings. I hope that beginners can accumulate valuable experience.

Spoiler alert, the strategy is running, and I am a little excited!

28d33189dc5ca7a584747.png

28d5e7ed9a3250c356d0c.png

The overall design of the strategy is implemented in the simplest way. Although the details are not too demanding, you can still learn some tips from the code. The overall strategy code is less than 400 lines, so it will not be boring to read and understand. Of course, this is just a test DEMO, it takes a while to test it. So what I want to say is: the current strategy is only successful in opening positions, and various situations such as closing a position need to be tested and verified. BUGs in program design are inevitable, so testing and DEBUG are very important!

Back to the strategy design, based on the code in the previous article, the strategy is added:

Data persistence design (use _G function to save data and restore data after restart)
Added grid data structure for each monitored CFD pair (used to control hedging opening and closing positions)
Implemented a simple hedging function to hedge open and close positions
Added a total equity acquisition function to calculate floating profit and loss
Added status bar data output display.
The above are the added functions. In order to simplify the design, the strategy is only designed for positive hedging (short long-term contracts, long near-term contracts). At present, the perpetual contract (near-term) has a negative fee rate, which just can long for the perpetual contract to see if it can increase the rate profits.

Let the strategy run for a while ~

After testing for about 3 days, the spread fluctuation is still feasible.

28e6dbd6d7484928303dc.png

1.png

2.png

Here we can see the profits of some funding rates.

3.png

To be continued...

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!