Sorting and query algorithm for line drawing list

Through the sorting and query algorithm based on the principle of time priority for futures prices and combined with cloud computing, the problem that the auxiliary software for drawing orders cannot adjust the stop loss points in time is solved, and the stable automatic triggering of drawing orders and reasonable use of resources is realized, which improves trading flexibility and risk control.

CN120258926APending Publication Date: 2025-07-04SHANGHAI WENHUA FINANCIAL INFORMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410111671.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-26
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The existing line drawing auxiliary software cannot adjust the stop loss point in time, resulting in insufficient risk control, and users need to keep an eye on the market and cannot capture trading opportunities in time.

Method used

The sorting algorithm based on the principle of futures price priority time priority is adopted, and the line drawing orders are placed in the linked list, and the trigger conditions are judged through the query algorithm. Combined with cloud-based high-performance computing, the automatic triggering of line drawing orders and reasonable use of resources is realized.

Benefits of technology

It realizes stable automatic triggering of line drawing orders, reduces business processing delays, and improves transaction flexibility and risk control capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120258926A_ABST
    Figure CN120258926A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of line drawing lists, and discloses a line drawing list sorting and query algorithm, the sorting algorithm is based on a futures price priority time priority principle, and the sorting algorithm specifically comprises the following steps: determining comparison condition information of a line drawing list, then putting the line drawing list into a corresponding linked list according to the comparison condition information, inserting a queue tail of a target node of the price into the linked list according to the size relationship between the price of the line drawing list and the standard price; the query algorithm is used for scanning a market information queue and judging and triggering the line drawing list, and specifically comprises the following steps: traversing the market information queue by a thread, if a new market information exists, finding a storage framework of the line drawing list according to a contract code of the market information, executing price comparison in the linked list, and if the new market information exists, executing price comparison; when a triggering condition is met, triggering operation is executed, and the triggered line drawing list is deleted; a line drawing instruction is combined with a sorting algorithm, so that a trigger condition can be positioned more quickly during line drawing, resources are used reasonably, and business processing delay is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of drawing orders, and particularly to a sorting and querying algorithm for drawing orders. Background Art

[0002] A drawing order, also known as a conditional drawing order, is that an investor envisions buying or selling an underlying asset, sets corresponding conditions in advance, and the software or server monitors in real time whether the set conditions are met. Once the set conditions are met, the order placement strategy will be triggered to assist the customer in automatic entrustment. Its essence is to monitor in real time and automatically entrust according to the pre-set trigger conditions, and place orders according to the set buy and sell instructions.

[0003] Existing drawing order auxiliary software requires customers to keep watching the market. When the market price touches or crosses the price at the drawn line position, orders are placed according to the set buy and sell instructions. This may ignore market changes, fail to adjust the stop-loss point in time, resulting in insufficient risk control, and missing some trading opportunities due to the fixed trading points. Summary of the Invention

[0004] The purpose of the present invention is to solve the above-mentioned disadvantages existing in the prior art, and provide a sorting and querying algorithm for drawing orders.

[0005] The sorting algorithm is based on the principle of futures price priority and time priority, and specifically includes:

[0006] Determine the comparison condition information of the drawing order, then put the drawing order into the corresponding linked list according to the comparison condition information, and insert the target node of the price into the tail of the queue in the linked list according to the size relationship between the price of the drawing order and the reference price.

[0007] The query algorithm is used to scan the market queue and judge the triggering of the drawing order, and specifically includes:

[0008] A thread traverses the market queue. If there is a new market, find the storage structure of the drawing order according to the contract code of the market, perform price comparison in the linked list, and execute the triggering operation and delete the triggered drawing order when the triggering condition is met.

[0009] Further, in the sorting algorithm, first create linked list one and linked list two. The specific operation of putting the drawing order into the corresponding linked list according to the comparison condition information includes:

[0010] If the comparison condition is greater than or equal to the reference price, put the drawing order into linked list one;

[0011] If the comparison condition is less than the reference price, put the drawing order into linked list two.

[0012] Preferably, the sorting algorithm further includes:

[0013] When putting the drawing order into the corresponding linked list, if no node meeting the price condition is found, a new node is created and added to the end of the linked list.

[0014] More preferably, the sorting algorithm further includes:

[0015] Before putting the drawing order into the corresponding linked list, it is judged whether the linked list is empty. If the linked list is empty, a node with the reference price is created in the linked list, and the reference price node is used as the head node.

[0016] Furthermore, the query algorithm further includes:

[0017] There is a market quotation queue in each thread. When the thread receives new market quotation, the market quotation information of the market quotation is added to the market quotation queue.

[0018] Furthermore,

[0019] According to the sorting and query algorithm of the drawing order according to claim 2, it is characterized in that, in the query algorithm, the price comparison in the linked list is sequentially executed in the first linked list and the second linked list, specifically including:

[0020] Judge whether there is a node meeting the trigger condition in the first linked list,

[0021] If the latest price of the market quotation is greater than or equal to the comparison price in the node, other condition judgments and the trigger operation are performed on the drawing orders in the drawing order queue of the node; if the latest price of the market quotation is less than the comparison price in the node, the traversal operation is exited;

[0022] Judge whether there is a node meeting the trigger condition in the second linked list,

[0023] If the latest price of the market quotation is less than or equal to the comparison price in the node, other condition judgments and the trigger operation are performed on the drawing orders in the drawing order queue of the node; if the latest price of the market quotation is greater than the comparison price in the node, the traversal operation is exited.

[0024] Preferably, during the traversal process, the triggered drawing order is deleted from the drawing order queue of the node, and if the queue in the node is empty, the node is deleted.

[0025] Furthermore, combining the sorting and query algorithm with the instruction drawing specifically includes:

[0026] Step S1: Add an instruction drawing operation to the front-end market quotation interface, and send the drawing order information generated by the instruction drawing to the cloud;

[0027] Step S2: The program in the cloud finds the storage structure of the drawing order according to the contract code of the drawing order, and saves the drawing order information to the linked list according to the comparison conditions;

[0028] Step S3: The cloud program determines whether the drawing order meets the trigger condition according to the market change. After executing the trigger operation, the cloud sends a trigger notification to the front-end and sends a commission to the trading back-end;

[0029] Step S4: After the front-end receives the trigger notification and the information returned by the trading back-end, it generates a position and deletes the drawing line.

[0030] Preferably, the instruction drawing further includes:

[0031] The front-end modifies the comparison condition of the drawing order by dragging, sends the modification information of the drawing order to the cloud, and the cloud program finds the storage structure of the drawing order according to the contract code of the modified drawing order, and then performs deletion and re-addition operations.

[0032] Compared with the prior art, the beneficial effects of the present invention are:

[0033] (1) Upload the instruction drawing line to the cloud for 7*24 hours operation. The cloud is highly performant and stable, making the instruction drawing line more stable;

[0034] (2) Adopt the sorting algorithm of the present invention, combine the drawing instruction with the sorting algorithm, and can locate the trigger condition faster when drawing the line, use resources more reasonably, and reduce the business processing delay;

[0035] (3) Users can modify the comparison condition of the drawing order by dragging at the front-end, which is more flexible. Description of the Drawings

[0036] The drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention, and do not constitute a limitation to the present invention. In the drawings:

[0037] Figure 1 is a flowchart of the sorting algorithm of a drawing order of the present invention;

[0038] Figure 2 is a flowchart of the query part in the sorting algorithm of a drawing order of the present invention;

[0039] Figure 3 is a combined flowchart of the sorting algorithm of a drawing order and the instruction drawing of the present invention; Detailed implementation manners

[0040] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.

[0041] Those skilled in the art of the present technology can understand that unless specifically stated otherwise, the singular forms "a", "an", "the" and "said" used herein may also include the plural forms. It should be further understood that the term "comprising" used in the specification of the present invention means the presence of the described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0042] The specific embodiments are as follows:

[0043] Embodiment 1

[0044] A sorting and querying algorithm for a drawing order provided in this embodiment, wherein,

[0045] The sorting algorithm is based on the principle of futures price priority and time priority. As Figure 1 shown, it specifically includes:

[0046] Determine the comparison condition information of the drawing order, then put the drawing order into the corresponding linked list according to the comparison condition information, and insert the target node of the price into the tail of the queue in the linked list according to the size relationship between the price of the drawing order and the reference price;

[0047] The query algorithm is used to scan the market queue and determine whether to trigger the drawing order. As Figure 2 shown, it specifically includes:

[0048] A thread traverses the market queue. If there is a new market, find the storage structure of the drawing order according to the contract code of the market, perform a price comparison in the linked list, and perform a trigger operation and delete the triggered drawing order when the trigger condition is met.

[0049] Specifically, as Figure 1 shown, in the sorting algorithm, first create linked list one and linked list two. The step of putting the drawing order into the corresponding linked list according to the comparison condition information specifically includes:

[0050] If the comparison condition is greater than or equal to the reference price, the drawn order is placed into the first linked list;

[0051] If the comparison condition is less than the reference price, the drawn order is placed into the second linked list.

[0052] Secondly, the sorting algorithm further includes:

[0053] When placing the drawn order into the corresponding linked list, if no node meeting the price condition is found, a new node is created and added to the end of the linked list.

[0054] When the price of the head node is greater than the comparison price, a new node is inserted at the head of the list. The code reference is as follows:

[0055]

[0056]

[0057]

[0058] In addition, the sorting algorithm further includes:

[0059] Before placing the drawn order into the corresponding linked list, it is judged whether the linked list is empty. If the linked list is empty, a node with the reference price is created in the linked list, and the reference price node is used as the head node.

[0060] Specifically, the code reference for inserting a new node at the head of the list is as follows:

[0061]

[0062] Furthermore, as Figure 2 shown, the query part in the sorting algorithm further includes:

[0063] There is a market quotation queue in each thread. When the thread receives new market quotations, the market quotation information of the market quotation is added to the market quotation queue.

[0064] Specifically, in the query algorithm, the price comparison in the linked list is executed in the first linked list and the second linked list in sequence, specifically including:

[0065] Judge whether there is a node meeting the trigger condition in the first linked list,

[0066] If the latest price of the market quotation is greater than or equal to the comparison price in the node, other condition judgments and trigger operations are performed on the drawn orders in the drawn order queue of the node; if the latest price of the market quotation is less than the comparison price in the node, the traversal operation is exited;

[0067] Determine whether there is a node that meets the trigger condition in the second linked list.

[0068] If the latest price of the market is less than or equal to the comparison price in the node, perform other condition judgments and the trigger operation on the draw order in the draw order queue of the node; if the latest price of the market is greater than the comparison price in the node, exit the traversal operation.

[0069] The specific code is as follows:

[0070]

[0071]

[0072]

[0073]

[0074]

[0075]

[0076]

[0077] Among them, during the traversal process, the triggered draw order is deleted from the draw order queue of the node, and if the queue in the node is empty, the node is deleted.

[0078] Furthermore, combine the sorting and query algorithm with the instruction drawing, as Figure 3 shown, specifically including:

[0079] Step S1: Add an instruction drawing operation to the front-end market interface, and send the draw order information generated by the instruction drawing to the cloud.

[0080] Step S2: The program in the cloud finds the storage structure of the draw order according to the contract code of the draw order, and saves the draw order information to the linked list according to the comparison conditions.

[0081] Step S3: The cloud program determines whether the draw order meets the trigger condition according to the market change. After executing the trigger operation, the cloud sends a trigger notification to the front-end and sends a commission to the trading background.

[0082] Step S4: After the front-end receives the trigger notification and the information returned by the trading background, generate a position and delete the drawing.

[0083] In addition, the instruction drawing also includes:

[0084] The front end modifies the comparison conditions of the line-drawing order by dragging, and sends the modification information of the line-drawing order to the cloud. The cloud program finds the storage structure of the line-drawing order according to the contract code of the modified line-drawing order, and then performs deletion and re-addition operations.

[0085] The reference front-end code implementation is as follows:

[0086]

[0087]

[0088]

[0089]

[0090]

[0091] The working principle or process of the one provided in this embodiment is as follows:

[0092] I. Sorting

[0093] (1) Create Linked List One and Linked List Two, and then place the line-drawing orders into the corresponding linked lists according to the comparison condition information.

[0094] (2) If the comparison condition is greater than or equal to the benchmark price, place the line-drawing order into Linked List One; if the comparison condition is less than or equal to the benchmark price, place the line-drawing order into Linked List Two.

[0095] (3) Judge whether Linked List One and Linked List Two are empty. If they are empty, create a new node with the benchmark price in the linked list and use the new node as the head node.

[0096] (4) If they are not empty, judge whether the target price node in the linked list already exists. If it exists, add the line-drawing order to the end of the target node queue; if it does not exist, create a target node with this price, and add the line-drawing order to the end of the target node queue.

[0097] II. Query

[0098] (1) There is a market quotation queue in each thread. After receiving the market quotation, the market quotation information will be added to the market quotation queue.

[0099] (2) The thread will scan the market quotation queue. If there is new market quotation, it will execute the judgment on whether it can be triggered.

[0100] (3) In the triggering process, the storage structure of the line-drawing order will be found according to the contract code of the market quotation, and then price comparison will be performed in Linked List One and Linked List Two.

[0101] (4) If the latest price of the market is greater than or equal to the comparison price in the node, other condition judgments and trigger operations are performed on the draw orders in the draw order queue in the node, and it is judged whether the draw orders in the node queue meet all trigger conditions; if the latest price of the market is less than the comparison price in the node, the traversal operation is exited.

[0102] (5) If the latest price of the market is less than the comparison price in the node, the traversal operation is exited. The traversal operation in Linked List Two is similar.

[0103] (6) The draw orders triggered during the traversal are deleted from the draw order queue of the node.

[0104] (7) If the queue in the node is empty, the node is deleted.

[0105] The instruction drawing of this system solves the pain point that users need to keep watching the market all the time. The instruction drawing can be uploaded to the cloud for 7*24-hour operation. The cloud machines have good performance and stable network, which can make the instruction drawing execute more stably. At the same time, the combination of the sorting algorithm and the drawing instruction can make the computer resources be used more reasonably and reduce the latency of business processing.

[0106] Finally, it should be noted that the above are only the preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions falling within the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements should also be regarded as the protection scope of the present invention.

[0107] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

Claims

1. A sorting and querying algorithm for drawing orders, characterized in that the sorting algorithm is based on the principle of futures price priority and time priority, and specifically includes: Determine the comparison condition information of the drawing order, then put the drawing order into the corresponding linked list according to the comparison condition information, and insert the target node of the price into the queue tail of the linked list according to the size relationship between the price of the drawing order and the reference price; The query algorithm is used to scan the market queue and judge the triggering of the drawing order, and specifically includes: The thread traverses the market queue. If there is a new market, find the storage structure of the drawing order according to the contract code of the market, perform price comparison in the linked list, and perform the triggering operation and delete the triggered drawing order when the triggering condition is met.

2. The sorting and querying algorithm of the line-drawing list according to claim 1, characterized in that In the sorting algorithm, first create linked list one and linked list two. The specific process of putting the drawing order into the corresponding linked list according to the comparison condition information includes: If the comparison condition is greater than or equal to the reference price, put the drawing order into linked list one; If the comparison condition is less than the reference price, put the drawing order into linked list two.

3. The sorting and querying algorithm for the line-drawing list according to claim 1, wherein The sorting algorithm further includes: When putting the drawing order into the corresponding linked list, if no node meeting the price condition is found, create a new node and add it to the tail of the linked list.

4. The sorting and querying algorithm of the line-drawing list according to claim 1, characterized in that The sorting algorithm further includes: Before putting the drawing order into the corresponding linked list, judge whether the linked list is empty. If the linked list is empty, create a node with the reference price in the linked list and use the reference price node as the head node.

5. The sorting and querying algorithm of the line-drawing list according to claim 1, characterized in that, The query algorithm further includes: There is a market queue in each thread. When the thread receives a new market, add the market information of the market to the market queue.

6. The sorting and querying algorithm for the line-drawing list according to claim 2, wherein In the query algorithm, the price comparison in the linked list is executed in linked list one and linked list two in sequence, and specifically includes: Judge whether there is a node meeting the triggering condition in linked list one, If the latest price of the market is greater than or equal to the comparison price in the node, perform other condition judgments and the triggering operation on the drawing orders in the drawing order queue of the node; if the latest price of the market is less than the comparison price in the node, exit the traversal operation; Judge whether there is a node meeting the triggering condition in linked list two, If the latest price of the market is less than or equal to the comparison price in the node, perform other condition judgments and the triggering operation on the drawing orders in the drawing order queue of the node; if the latest price of the market is greater than the comparison price in the node, exit the traversal operation.

7. The sorting and querying algorithm for the line-drawing list according to claim 6, characterized in that, During the traversal process, the triggered drawing order is deleted from the drawing order queue of the node. If the queue in the node is empty, delete the node.

8. The sorting and querying algorithm for the line drawing list according to claim 1, characterized in that, Combine the sorting and querying algorithm with instruction drawing, and specifically include: Step S1: Add an instruction drawing operation to the front-end market interface, and send the drawing order information generated by the instruction drawing to the cloud; Step S2: The program in the cloud locates the storage structure of the drawing order according to the contract code of the drawing order, and saves the drawing order information to the linked list according to the comparison conditions; Step S3: The cloud program determines whether the drawing order meets the trigger condition according to the market changes. After executing the trigger operation, the cloud sends a trigger notification to the front end and sends a commission to the trading back end; Step S4: After the front end receives the trigger notification and the information returned by the trading back end, it generates positions and deletes the drawing.

9. The sorting and querying algorithm for the line-drawing list according to claim 7, characterized in that, The instruction drawing also includes: The front end modifies the comparison conditions of the drawing order by dragging, sends the modified information of the drawing order to the cloud, and the cloud program locates the storage structure of the drawing order according to the contract code of the modified drawing order, and then performs deletion and re-adding operations.