The FMEX bankruptcy pits a lot of people, but recently came up with a restart scheme and set up rules similar to the original mining for debt relief.https://www.fmz.com/bbs-topic/5834There is also room for optimization of sort mining. Although one should not step into the same pit twice, those with credit at FMEX may want to refer to the specific real-time strategy that can run on the FMZ quantification platform.
Defined as an order unlock cycle every 5 minutes of the day, each cycle allocates the trade to 1/288 of the order unlock margin for the day. Within each cycle, a randomly selected time point is taken to snapshot the ordering of the order, where:
The total return of a user's order unlock in a transaction pair on that day is the sum of the return of the user's allowance for each cycle order unlock in that transaction.
The total benefits of first-order unlocking are:
where i denotes one of the positions, 30 positions on both sides, a is the order volume, R is the unlocked return amount, and V is the total number of orders already placed.
Unlike transaction unlocking, pending orders have no cost, where R only takes into account relative size and can be executed without taking into account the absolute amount of USDT billing. If we decide on the total pending order quantity, the problem becomes how to allocate the order to different locations to maximize the yield G. Simply finding the location of the smallest pending order quantity, all hanging, is obviously not optimal.
In the end, our optimization goals and constraints are:
where M is the total number of suspended units. This is a secondary convex optimization problem that contains inequalities, satisfies the KTT condition, and is solved as an integer. Using the corresponding packet and convex optimization solver should be able to directly derive the result, returning the optimal number of suspended units for each position. But this is obviously not the answer we want, we need to simplify the problem and get specific steps for solving.
Considering only the case of the two classes, the current number of pending orders is 10, 20 ((referred to as the first class, second class respectively), their unlock limit is R, the total number of strategic pending orders is 30, how to allocate the funds to maximize the unlock limit?
Option one:
Find the smallest hanging position, hang all of them, and the total gain is G=30/ ((30+10) = 0.75R. This is also the easiest solution to think of.
Option two:
The first unit is assigned to the first row, the first row is assigned 10+1, and the second unit is assigned to the first row... and so on until the cumulative distribution of the first row is 10 yuan, at which point one can be randomly selected, and when the first row is more than 20, it can be assigned to the second row. The final result is that the first row is assigned 20 yuan, the second row is assigned 10 yuan, and their final list is 30.
Option three:
If the first row is assigned a, the second row is 30 - a, the equation can be directly listed as 0 (the process is not listed, similar to the article on transaction unlocking), and the final result is calculated with the formula:
G = 15 / 25 + 15 / 35 = 1.0286R, which is better than the solution 2, since it is derived directly from the formula, this is the optimal solution, the reader can verify it.
The result may be different from what is expected, and the solution 2 makes it clear that the allocation of each unit is the best in the current situation, and not the best overall. This is often the case, the local best is not necessarily the best overall, because before the allocation, the amount of the order has already been invested, and the overall efficiency needs to be taken into account.
The first step is to measure the efficiency. The derivative can be used to reflect the contribution of each a to G, which takes into account the cumulative costs rather than the benefits of a single allocation. The greater the value, the greater the overall contribution to the final benefit, obviously, depending on the image of the function, a = 1, from having to zero, the highest efficiency, then gradually decreases.
The same simple example above, for example, calculates their efficiency after allocating funds, listing tables:
Funding | 1 | 2 |
---|---|---|
1 | 0.0826 | 0.0454 |
2 | 0.069 | 0.0413 |
3 | 0.0592 | 0.0378 |
4 | 0.051 | 0.0347 |
5 | 0.0444 | 0.032 |
… | … | … |
|12 | 0.0207 |0.0195| |13 | 0.0189 |0.0184| |14 | 0.0174 |0.0173| |15 | 0.016 |0.0163| |16 | 0.0148 |0.0154| |17 | 0.0137 |0.0146| |18 | 0.0128 |0.0139|
According to the table, the 1st unit is assigned to the 1st, the 2nd unit is assigned to the 1st... the 5th unit is assigned to the 2nd... and so on, the last unit is assigned to the 1st unit is 15 yuan, the 2nd unit is 15 yuan, which happens to be the best we can calculate according to the equation.
If we have a large total number of hanging orders, and each unit is allocated too low in efficiency, we can divide the funds into 100 pieces, allocating one at a time, and the algorithm is very efficient because it is just a simple ordering of operations. Specific to the execution level, there is room for optimization, such as dividing our orders into 100 pieces, so that each adjustment only requires a re-allocation of the order, without removing all.
This article was originally published on FMZ's Quantitative Platform, with a footnote:https://www.fmz.com/bbs-topic-new/5843