CN113065957A - Futures trading system - Google Patents
Futures trading system Download PDFInfo
- Publication number
- CN113065957A CN113065957A CN202110181968.9A CN202110181968A CN113065957A CN 113065957 A CN113065957 A CN 113065957A CN 202110181968 A CN202110181968 A CN 202110181968A CN 113065957 A CN113065957 A CN 113065957A
- Authority
- CN
- China
- Prior art keywords
- data
- thread
- user
- module
- processing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000012545 processing Methods 0.000 claims abstract description 116
- 238000000034 method Methods 0.000 claims abstract description 30
- 230000008569 process Effects 0.000 claims abstract description 24
- 238000000926 separation method Methods 0.000 claims abstract description 7
- 230000004044 response Effects 0.000 claims description 26
- 238000012795 verification Methods 0.000 claims description 14
- 238000013475 authorization Methods 0.000 claims description 6
- 238000004364 calculation method Methods 0.000 claims description 6
- 238000004891 communication Methods 0.000 claims description 5
- 230000003993 interaction Effects 0.000 claims description 4
- 238000012163 sequencing technique Methods 0.000 claims description 4
- 238000001514 detection method Methods 0.000 claims description 3
- 238000013507 mapping Methods 0.000 claims description 3
- 230000002688 persistence Effects 0.000 claims description 3
- 230000001960 triggered effect Effects 0.000 claims description 2
- 238000005242 forging Methods 0.000 claims 1
- 230000005540 biological transmission Effects 0.000 abstract description 6
- 238000013461 design Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 238000004422 calculation algorithm Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000004888 barrier function Effects 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- PCHJSUWPFVWCPO-UHFFFAOYSA-N gold Chemical compound [Au] PCHJSUWPFVWCPO-UHFFFAOYSA-N 0.000 description 1
- 239000010931 gold Substances 0.000 description 1
- 229910052737 gold Inorganic materials 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Engineering & Computer Science (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
The invention discloses a futures trading system, which shortens delay and improves system performance on the basis of meeting all business requirements. The technical scheme is as follows: the problem of slow data processing in the financial futures trading system is solved through a reasonable user data processing thread model, main and auxiliary service separation processing and a lock-free processing strategy of multi-user multi-position data. In addition, the data transmission between different processes in the system adopts a shared memory mode, a data transmission mode of TCP or UDP is not used, and the time delay of the data packet transmission between different processes is reduced. Meanwhile, an independent service thread is provided for each user to process the uplink data of the user, and the processing mode of dividing independent storage space and separating main and auxiliary services according to the user is combined, so that the processing speed of the main service data is increased, the problem of multi-thread resource competition is solved, and the negative influence of locking on the system performance is avoided.
Description
Technical Field
The invention relates to futures trading technology, in particular to an extremely fast financial futures trading system.
Background
With the full-scale opening of the Chinese financial market and the prevalence of programmed transactions, more and more investors participate in the investment field of financial derivatives, thereby raising the enthusiasm of the investors for the speed pursuit of the transaction system.
However, due to the large data volume of financial data, the goal of low delay is very challenging. In addition, when the financial software processes data, frequent inter-process communication, thread switching and access of shared resources also increase a technical barrier for low latency.
Disclosure of Invention
The following presents a simplified summary of one or more aspects in order to provide a basic understanding of such aspects. This summary is not an extensive overview of all contemplated aspects, and is intended to neither identify key or critical elements of all aspects nor delineate the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description that is presented later.
The present invention is directed to solve the above problems, and provides a futures trading system, which reduces delay and improves system performance on the basis of satisfying all business requirements.
The technical scheme of the invention is as follows: the invention discloses a futures trading system, which comprises an application program interface module, a core processing module, a report module, a shared memory, a memory database updating module and a query module, wherein:
the application program interface module is composed of a request thread and a callback thread, performs data interaction with the core processing module through TCP connection, is configured to enable a user to directly send a transaction instruction to the core processing module for processing by writing TCP when a transaction requirement exists, is configured to receive data returned by the core processing module, analyze the data and return the data to an upper layer application, and is also configured to establish TCP connection with the query module for query service, and is divided into transaction type requests and query type requests according to different user instructions of user service types, wherein the transaction type requests are directly sent to the core processing module, and the query type requests are sent to the query module;
the core processing module is used for establishing TCP connection with the application program interface module, distributing computing resources and storage resources for users, authenticating user authority, receiving and processing user data, forwarding the data to a trading exchange, receiving return data from the trading exchange and forwarding the return data to the application program interface module;
the shared memory is used for storing service data;
the memory data updating module is used for realizing the persistence of user data and the distribution of other services in a file stream through data falling to the ground;
the query module is realized by a query preposed thread and a query core thread, wherein the query preposed thread is configured to receive a user query request and analyze a data packet, the analyzed data is sent to the query core thread, the query core thread is configured to firstly carry out authority verification, retrieval is carried out by using the data sent by the user as a condition after the verification, and the retrieved data is forwarded to the application program interface module through the query preposed thread.
According to an embodiment of the futures trading system of the present invention, the TCP connection between the application interface module and the core processing module supports read-write separation, where the request thread is responsible for writing data and the callback thread is responsible for reading data.
In an embodiment of the futures trading system according to the present invention, the callback thread is also used for TCP heartbeat detection and transceiving operations.
According to an embodiment of the futures trading system of the present invention, the core processing module is implemented by a login thread, a plurality of business threads and a trading response processing thread, wherein:
the login thread is used for client login authentication, authorization code distribution, business thread address distribution and load balance;
the business thread is used for processing the user uplink transaction request, and reporting the transaction order through the transaction order application program interface after the processing including verification is carried out according to the transaction order rule;
the transaction response processing thread is configured to process data returned by the exchange.
The report module is used for forwarding the data of the core processing module to the exchange and receiving the callback data of the exchange;
according to an embodiment of the futures trading system of the present invention, the login thread is further configured such that when a user connects to the core processing module to initiate login, the login thread verifies a user password, establishes a mapping relationship for each user after verification, allocates a global unique identifier, performs route lookup for all subsequent request messages of the client from the unique identifier, and allocates an authorization code and a service thread address to the user based on a load balancing policy.
According to an embodiment of the futures trading system of the present invention, before the system is started, the number of business threads is assigned to each user in the configuration file, the number of business threads is determined by the number configured in the configuration file, and each user or a group of users is individually assigned a business thread.
According to an embodiment of the futures trading system of the present invention, when a service thread processes each uplink service request or downlink exchange response, the theme and sequence number of the processing flow are recorded in the shared memory, and when the core processing module is restarted, the service processing is performed again from the shared memory according to the sequencing order, so as to recover the memory state with the advanced fault.
According to an embodiment of the futures trading system of the present invention, the trading response processing thread is further configured to, after receiving the data packets returned by the exchange response request, sequentially parse each data packet according to a polling manner, simultaneously calculate the result of the fund taken in a position, store the calculation result in the buffer for use by the service thread, the service thread performs simple addition and subtraction calculation only on a part of the fields to obtain the final result, and simultaneously the trading response processing thread also returns the response message to the corresponding application program interface.
According to one embodiment of the futures trading system, the shared memory is divided into different areas according to different users, each user has an independent storage area, each area is not crossed, and when user data is processed, the address of the required data is positioned according to the unique identification of the user; and each user has an independent service processing thread, and after the service thread processes the data, the processing result is stored in a shared memory, and waits for other modules to process the data, and simultaneously sends the data to the reporting module.
According to an embodiment of the futures trading system of the present invention, the report module reduces overhead of inter-process communication through threaded processing, and dynamically expands the number of seats connected to the exchange by initializing the number of seats in the data, so as to satisfy flow control restriction of the exchange according to business requirements.
According to an embodiment of the futures trading system of the present invention, the core processing module supports both UDP and TCP hybrid billing modes: when a user logs in a core processing mode through a request thread and passes authentication, if the user selects a UDP (user Datagram protocol) reporting mode, the login thread selects an idle port in an address pool to be allocated to the user, and a UDP (user Datagram protocol) address identifier of a user opposite end is marked on the port; when the service thread receives the UDP message of the current user, the UDP address of the opposite end of the user is verified, if the verification is passed, the message is received, otherwise, an alarm is triggered and a system manager is notified.
According to an embodiment of the futures trading system, the system performs special processing on the report request message and the report removing request message, and strictly aligns 8 bytes in the memory of the key service message, so that the operations of serialization and deserialization are avoided when the message is transmitted through a network, and the service processing delay is reduced.
Compared with the prior art, the invention has the following beneficial effects: the invention can effectively solve the problem of slow data processing in the financial futures trading system and reduce the system delay by designing a reasonable user data processing thread model, main and auxiliary service separation processing and a lock-free processing strategy of multi-user multi-position data. In addition, the data transmission between different processes in the system adopts a shared memory mode, and a data transmission mode of TCP or UDP is not used, so that the time delay of the data packet transmission between different processes is effectively reduced. Meanwhile, an independent service thread is provided for each user to process the uplink data of the user, and the processing mode of dividing independent storage space and separating main and auxiliary services according to the user is combined, so that the processing speed of the main service data is increased, the problem of multi-thread resource competition is solved, and the negative influence of locking on the system performance is avoided.
Drawings
The above features and advantages of the present disclosure will be better understood upon reading the detailed description of embodiments of the disclosure in conjunction with the following drawings. In the drawings, components are not necessarily drawn to scale, and components having similar relative characteristics or features may have the same or similar reference numerals.
Fig. 1 shows a system architecture diagram of an embodiment of the futures trading system of the present invention.
Fig. 2 is a schematic diagram showing a system thread model in the futures trading system according to the present embodiment.
Fig. 3 is a schematic diagram illustrating the structure of the shared memory in the futures trading system according to this embodiment.
Fig. 4 shows a schematic diagram of transaction response processing in the futures trading system of the present embodiment.
Detailed Description
The invention is described in detail below with reference to the figures and specific embodiments. It is noted that the aspects described below in connection with the figures and the specific embodiments are only exemplary and should not be construed as imposing any limitation on the scope of the present invention.
Fig. 1 shows the system architecture of an embodiment of the futures trading system of the present invention. Referring to fig. 1, the futures trading system of the present embodiment includes: the system comprises an application program interface module, a core processing module, a report module, a shared memory, a memory database updating module and an inquiry module.
The application program interface module consists of a request thread and a callback thread, performs data interaction with the core processing module through TCP connection, and supports read-write separation for performance consideration, wherein the request thread is responsible for writing data, and when a transaction demand exists, a user directly sends a transaction instruction to the core processing module through the write TCP for processing; the callback thread is responsible for reading data, receiving the data returned by the core processing module and returning the data to the upper application. Meanwhile, the callback thread is also used for TCP heartbeat detection and transceiving operation.
FIG. 2 illustrates the model principles of a request thread and a callback thread.
The request thread is used for packaging and writing data input by a user, and when a transaction is required, the data input by the user is packaged by the application program interface module and then directly sends a transaction instruction to the core processing module for processing through TCP connection.
The callback thread is used for reading operation and analyzing the packet, receiving data returned by the core processing module, analyzing and returning the data to the upper layer application.
The application program interface module also establishes TCP connection with the query module for query service, and the user command is divided into a transaction request and a query request according to different user service types, wherein the transaction request is directly sent to the core processing module, and the query request is sent to the query module.
The transaction request instruction directly writes a TCP connection established between the application program interface module and the core processing module, and sends data to the core processing module.
The query request instruction directly writes a TCP connection established between the application program interface module and the query module, and sends data to the query module.
The separation of the transaction request instruction and the query request instruction ensures that the processing performance of the transaction instruction is not affected by the query instruction. That is, the separation of the request thread and the callback thread reduces the pressure of single thread processing data, and improves the performance of the system.
The core processing module is used for establishing TCP connection with the application program interface module, distributing computing resources and storage resources for users, authenticating user authority, receiving and processing user data, forwarding the data to a trading exchange, receiving return data from the trading exchange and forwarding the return data to the application program interface module.
Referring also to fig. 2, the core processing module is implemented by three threads, which are a login thread, a plurality of service threads, and a transaction response processing thread.
The login thread is used for client login authentication, authorization code distribution, business thread address distribution and load balancing. Specifically, when a user connects to a core processing module to initiate login, a login thread of the core processing module verifies a user password, a mapping relation is established for each user after verification, a global unique ID is allocated, all subsequent request messages of the client are subjected to route searching through the unique ID, and an authorization code and a service thread address are allocated to the user based on a load balancing strategy.
The business thread is used for processing the user uplink transaction request, and reporting to the exchange through the exchange API after processing according to the exchange rule. Specifically, the business thread is configured to process user uplink transaction request data, firstly, the data is verified according to a trading exchange rule, and after the data is verified, the data is reported to the trading exchange through an application program interface of the trading exchange. Before the system is started, a service thread number is assigned to each user in a configuration file, the number of the service threads is determined by the number configured by the configuration file, and each user or a group of users independently allocates one service thread, so that the problem of multi-thread shared resource competition is avoided, and the processing speed of core services is improved; multiple users may also be assigned the same business thread, but performance is affected.
The system simultaneously supports the sequencing inversion function: when the service thread processes each uplink service request or responds to a downlink exchange, the theme and the serial number of the flow are recorded in the shared memory. When the core processing module is restarted, firstly, the service processing is carried out again from the shared memory according to the sequencing sequence, and the memory state of the fault preposition is recovered.
Wherein the transaction response processing thread is configured to process data returned by the transaction. Fig. 4 is a working principle of the transaction response processing thread, and specifically, after receiving data packets (i.e., the illustrated transaction response flow) returned by the exchange response request, the transaction response processing thread analyzes each data packet in turn in a polling manner, calculates a result of fund taken-in-place, and stores the calculated result in a data buffer for use by the service thread. The business thread only needs to carry out simple addition and subtraction calculation on partial fields to obtain a final result, and meanwhile, the transaction response processing thread also returns a response message to a corresponding application program interface. The transaction response processing thread reduces the burden of the business thread through the processing, and the calculation of the non-main business data is put to other threads for processing, so that the performance of the business thread is guaranteed. Meanwhile, in the core processing module, all data are stored by adopting a memory, and data streams in other forms such as file streams do not exist.
The threading design in the core processing module makes full use of physical resources on the premise of not damaging the system performance, and solves the problem of resource waste when a high-frequency client monopolizes one server, so that the transaction cost of the client can be greatly reduced.
Referring to fig. 3, the shared memory is used to store service data, the entire shared memory is divided into different areas according to different users, each user has an independent storage area, and each area is not crossed. Each storage area is an independent memory database, the memory database comprises a plurality of service data tables and is used for storing different service data of users, and the service data of the users are filled by the data content of service request packets initiated by the users and service response packets returned by the transaction. When processing user data, quickly positioning the address of the needed data according to the unique identification of the user, and realizing the direct address access method. Meanwhile, each user also has an independent service processing thread, so that for the shared memory, no competition of multithreading for shared resources exists, a lock-free multithreading processing mode is achieved, and the performance of the system is effectively improved. The independent storage area only has one business thread for writing operation and one process for reading operation. The design of the sub-users, the sub-threads and the sub-storage spaces avoids the use of thread locks, reduces the time loss caused by the competition of shared resources, and improves the system performance.
After the business thread processes the data, the processing result is stored in a shared memory to wait for other modules to process the data. Meanwhile, the data is sent to a reporting module, and the reporting module further processes the data. The transaction response processing thread receives the data returned by the exchange from the reporting module, writes the data into the shared memory area, and returns the result to the application program interface of the client.
The report module is used for transmitting the data of the core processing module to the exchange and receiving the callback data of the exchange. The reporting module is divided into two types, and for the gold institute, the current date and the energy exchange, the reporting module exists in the core processing module in a thread form, namely, a plurality of seats correspond to a plurality of reports. For the large business place and the zheng business place, the API is limited not to support the multithreading model, one master seat report exists in the core processing module in the form of one thread, for the auxiliary seats, the master seat report exists in the form of an independent process, namely, one auxiliary seat corresponds to one independent process, and the independent processes and the core processing module carry out data interaction through a shared memory. And the report is processed in a threading way, so that the overhead caused by interprocess communication is reduced.
The number of seats connected with the exchange is dynamically expanded by the report module through initializing the number of the seats in the data so as to meet the flow control limit of the exchange according to the service requirement.
Referring to fig. 2, before reporting user data to the exchange, the reporting thread in the reporting module adds an orderllocalsysid as a unique identifier of each request, and the field can be used as a key (key) for indexing when processing the report or executing the withdrawal instruction.
The report module also supports the client to adopt a UDP report mode. Different from the traditional UDP form design, the user does not know the preposed UDP address before logging in. Only after the user successfully logs in and authenticates through the TCP connection, the core processing module dynamically provides a UDP report address including an IP and a port number for the user and binds the address with the user. When the core processing module receives a transaction request from the port, the sending address and the port number of the source end are checked first. If the verification fails, the order is abandoned and an alarm is sent, so that abnormal attack behavior can be avoided.
The memory data updating module is used for the persistence of user data and the distribution of other services through the falling of data to a file stream. The memory database updating module monitors data in the shared memory through a memory table updating thread, and when the data change is that the changed data is synchronized into a corresponding record of the memory database in a table form, the changed data is sent to other modules in a data flow mode, so that the modules needing the data receive the data by subscribing corresponding subjects. The updating module of the memory database not only provides convenience for storing user data, but also meets the requirements of sharing data among different services and persisting the data.
The query module is divided into a query front thread and a query core thread, wherein the query front thread is used for receiving a user query request, analyzing a data packet and sending the analyzed data to the query core thread. The query core thread is configured to firstly carry out authority verification, retrieve by using data sent by a user as a condition after verification, and forward the retrieved data to the application program interface module through the query preposed thread. The data for querying the kernel thread is reconstructed according to the received memory change information.
While, for purposes of simplicity of explanation, the methodologies are shown and described as a series of acts, it is to be understood and appreciated that the methodologies are not limited by the order of acts, as some acts may, in accordance with one or more embodiments, occur in different orders and/or concurrently with other acts from that shown and described herein or not shown and described herein, as would be understood by one skilled in the art.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The various illustrative logical blocks, modules, and circuits described in connection with the embodiments disclosed herein may be implemented or performed with a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In the alternative, the processor and the storage medium may reside as discrete components in a user terminal.
In one or more exemplary embodiments, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software as a computer program product, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. Any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a web site, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk (disk) and disc (disc), as used herein, includes Compact Disc (CD), laser disc, optical disc, Digital Versatile Disc (DVD), floppy disk and blu-ray disc where disks (disks) usually reproduce data magnetically, while discs (discs) reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
The previous description of the disclosure is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other variations without departing from the spirit or scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (12)
1. A futures trading system is characterized in that the system comprises an application program interface module, a core processing module, a report module, a shared memory, a memory database updating module and a query module, wherein:
the application program interface module is composed of a request thread and a callback thread, performs data interaction with the core processing module through TCP connection, is configured to enable a user to directly send a transaction instruction to the core processing module for processing by writing TCP when a transaction requirement exists, is configured to receive data returned by the core processing module, analyze the data and return the data to an upper layer application, and is also configured to establish TCP connection with the query module for query service, and is divided into transaction type requests and query type requests according to different user instructions of user service types, wherein the transaction type requests are directly sent to the core processing module, and the query type requests are sent to the query module;
the core processing module is used for establishing TCP connection with the application program interface module, distributing computing resources and storage resources for users, authenticating user authority, receiving and processing user data, forwarding the data to a trading exchange, receiving return data from the trading exchange and forwarding the return data to the application program interface module;
the shared memory is used for storing service data;
the memory data updating module is used for realizing the persistence of user data and the distribution of other services in a file stream through data falling to the ground;
the query module is realized by a query preposed thread and a query core thread, wherein the query preposed thread is configured to receive a user query request and analyze a data packet, the analyzed data is sent to the query core thread, the query core thread is configured to firstly carry out authority verification, retrieval is carried out by using the data sent by the user as a condition after the verification, and the retrieved data is forwarded to the application program interface module through the query preposed thread.
2. The futures trading system of claim 1, wherein a TCP connection between the application interface module and the core processing module supports read-write separation, wherein the request thread is responsible for writing data and the callback thread is responsible for reading data.
3. The futures trading system of claim 1, wherein the callback thread is also used for TCP heartbeat detection and transceiving operations.
4. The futures trading system of claim 1, wherein the core processing module is implemented by one login thread, several business threads and one trade response processing thread, wherein:
the login thread is used for client login authentication, authorization code distribution, business thread address distribution and load balance;
the business thread is used for processing the user uplink transaction request, and reporting the transaction order through the transaction order application program interface after the processing including verification is carried out according to the transaction order rule;
the transaction response processing thread is configured to process data returned by the exchange.
The report module is used for transmitting the data of the core processing module to the exchange and receiving the callback data of the exchange.
5. The futures trading system of claim 4, wherein the login thread is further configured to verify a user password by the login thread when a user connects to the core processing module to initiate login, establish a mapping relationship for each user after verification, allocate a global unique identifier, perform route lookup for all subsequent request messages of the client from the unique identifier, and allocate an authorization code and a service thread address to the user based on a load balancing policy.
6. Futures trading system according to claim 4, characterized in that before system startup, each user is assigned a number of business threads in the profile, the number of business threads being determined by the number of profiles, each user or a group of users being individually assigned a business thread.
7. The futures trading system of claim 4, wherein when processing each uplink service request or downlink exchange response, the service thread records the processing flow topic and sequence number in the shared memory, and when the core processing module is restarted, the service processing is performed again from the shared memory according to the sequencing order, so as to recover the memory state with the failure.
8. The futures trading system of claim 4, wherein the trade response processing thread is further configured to, after receiving the data packets returned by the exchange response request, sequentially parse each data packet according to a polling manner, simultaneously calculate the result of the fund taken-in-place, store the calculation result in the buffer for use by the service thread, the service thread performs simple addition and subtraction calculation only on a part of the fields to obtain the final result, and simultaneously the trade response processing thread returns the response message to the corresponding application program interface.
9. The futures trading system of claim 1, wherein the shared memory is divided into different areas according to different users, each user has an independent storage area, each area is not crossed, and when processing user data, the address of the required data is located according to the unique identifier of the user; and each user has an independent service processing thread, and after the service thread processes the data, the processing result is stored in a shared memory, and waits for other modules to process the data, and simultaneously sends the data to the reporting module.
10. The futures trading system of claim 1, wherein the reporting module reduces overhead of inter-process communication through threading processing, and dynamically expands the number of seats connected to the exchange by initializing the number of seats in data, so as to meet flow control limit of the exchange according to business requirements.
11. The futures trading system of claim 1, wherein the core processing module supports both UDP and TCP hybrid ticketing modes: when a user logs in a core processing mode through a request thread, after authentication is passed, if the user selects a UDP report mode, the login thread selects an idle port in an address pool to be allocated to the user, and a user opposite end UDP address identifier is marked on the port; in order to prevent other people from maliciously forging the report of the user, when the business thread receives the UDP message of the current user, the business thread firstly verifies the UDP address of the opposite end of the user, if the verification is passed, the message is received, otherwise, an alarm is triggered and a system manager is notified.
12. The futures trading system of claim 1, wherein the system performs special processing on the report request and the report withdrawal request messages to ensure that the critical service messages are strictly aligned with 8 bytes in the memory, so as to avoid the operations of serialization and deserialization when the messages are transmitted through the network and reduce service processing delay.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110181968.9A CN113065957B (en) | 2021-02-09 | 2021-02-09 | Futures trading system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110181968.9A CN113065957B (en) | 2021-02-09 | 2021-02-09 | Futures trading system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113065957A true CN113065957A (en) | 2021-07-02 |
CN113065957B CN113065957B (en) | 2024-05-28 |
Family
ID=76558777
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110181968.9A Active CN113065957B (en) | 2021-02-09 | 2021-02-09 | Futures trading system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113065957B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114372886A (en) * | 2022-01-13 | 2022-04-19 | 上海金融期货信息技术有限公司 | Financial futures fund management system |
CN114418760A (en) * | 2022-01-19 | 2022-04-29 | 上海金融期货信息技术有限公司 | Mechanism sub-account system |
CN115345746A (en) * | 2022-10-17 | 2022-11-15 | 深圳华锐分布式技术股份有限公司 | Security transaction method, device, equipment and medium |
CN117692519A (en) * | 2024-01-30 | 2024-03-12 | 深圳华云信息系统科技股份有限公司 | Futures request sending method, device, equipment and storage medium |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050171811A1 (en) * | 2000-09-26 | 2005-08-04 | Bottomline Technologies (De) Inc. | Electronic financial transaction system |
CN1655161A (en) * | 2005-03-07 | 2005-08-17 | 福建榕基软件开发有限公司 | Business delivery certification system |
CN103078865A (en) * | 2013-01-11 | 2013-05-01 | 北京汉邦高科数字技术股份有限公司 | Network server communication model based on transmission control protocol (TCP) |
CN103247003A (en) * | 2013-05-15 | 2013-08-14 | 上海大智慧股份有限公司 | Distributed program trading system oriented to event processing |
CN103995755A (en) * | 2014-06-03 | 2014-08-20 | 北京乐动卓越信息技术有限公司 | Server optimizing method based on mobile terminal and server system |
CN107888670A (en) * | 2017-10-31 | 2018-04-06 | 百城联盟(北京)文化传媒有限公司 | A kind of intelligent Community information kiosk platform based on Internet of Things |
CN109495540A (en) * | 2018-10-15 | 2019-03-19 | 深圳市金证科技股份有限公司 | A kind of method, apparatus of data processing, terminal device and storage medium |
CN110390596A (en) * | 2019-07-30 | 2019-10-29 | 上海金融期货信息技术有限公司 | A kind of financial futures trading system |
CN112116466A (en) * | 2020-06-11 | 2020-12-22 | 上海金融期货信息技术有限公司 | Unified platform system for stock futures financial data exchange |
CN112116444A (en) * | 2020-06-11 | 2020-12-22 | 上海金融期货信息技术有限公司 | Butt joint system of bank financial service system and financial futures data exchange platform |
-
2021
- 2021-02-09 CN CN202110181968.9A patent/CN113065957B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050171811A1 (en) * | 2000-09-26 | 2005-08-04 | Bottomline Technologies (De) Inc. | Electronic financial transaction system |
CN1655161A (en) * | 2005-03-07 | 2005-08-17 | 福建榕基软件开发有限公司 | Business delivery certification system |
CN103078865A (en) * | 2013-01-11 | 2013-05-01 | 北京汉邦高科数字技术股份有限公司 | Network server communication model based on transmission control protocol (TCP) |
CN103247003A (en) * | 2013-05-15 | 2013-08-14 | 上海大智慧股份有限公司 | Distributed program trading system oriented to event processing |
CN103995755A (en) * | 2014-06-03 | 2014-08-20 | 北京乐动卓越信息技术有限公司 | Server optimizing method based on mobile terminal and server system |
CN107888670A (en) * | 2017-10-31 | 2018-04-06 | 百城联盟(北京)文化传媒有限公司 | A kind of intelligent Community information kiosk platform based on Internet of Things |
CN109495540A (en) * | 2018-10-15 | 2019-03-19 | 深圳市金证科技股份有限公司 | A kind of method, apparatus of data processing, terminal device and storage medium |
CN110390596A (en) * | 2019-07-30 | 2019-10-29 | 上海金融期货信息技术有限公司 | A kind of financial futures trading system |
CN112116466A (en) * | 2020-06-11 | 2020-12-22 | 上海金融期货信息技术有限公司 | Unified platform system for stock futures financial data exchange |
CN112116444A (en) * | 2020-06-11 | 2020-12-22 | 上海金融期货信息技术有限公司 | Butt joint system of bank financial service system and financial futures data exchange platform |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114372886A (en) * | 2022-01-13 | 2022-04-19 | 上海金融期货信息技术有限公司 | Financial futures fund management system |
CN114418760A (en) * | 2022-01-19 | 2022-04-29 | 上海金融期货信息技术有限公司 | Mechanism sub-account system |
CN115345746A (en) * | 2022-10-17 | 2022-11-15 | 深圳华锐分布式技术股份有限公司 | Security transaction method, device, equipment and medium |
CN117692519A (en) * | 2024-01-30 | 2024-03-12 | 深圳华云信息系统科技股份有限公司 | Futures request sending method, device, equipment and storage medium |
CN117692519B (en) * | 2024-01-30 | 2024-04-19 | 深圳华云信息系统科技股份有限公司 | Futures request sending method, device, equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113065957B (en) | 2024-05-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113065957B (en) | Futures trading system | |
US9925492B2 (en) | Remote transactional memory | |
US10691187B2 (en) | Persistent reservations for virtual disk using multiple targets | |
US9239868B2 (en) | Virtual session management and reestablishment | |
CN108268208B (en) | RDMA (remote direct memory Access) -based distributed memory file system | |
US7801997B2 (en) | Asynchronous interconnect protocol for a clustered DBMS | |
US9461939B2 (en) | Processing concurrency in a network device | |
US8832216B2 (en) | Method and system for conditional remote direct memory access write | |
WO2018140882A1 (en) | Highly available web-based database interface system | |
CN103226598B (en) | Access method and apparatus and the data base management system of data base | |
US9304825B2 (en) | Processing, on multiple processors, data flows received through a single socket | |
US7499966B2 (en) | Web server architecture for improved performance | |
US20230116772A1 (en) | Io processing method for raid system, and related apparatus | |
WO2014206129A1 (en) | Computing device and method for executing database operation command | |
US10592446B2 (en) | Synchronous input/output command | |
US20230098190A1 (en) | Data processing method, apparatus, device and medium based on distributed storage | |
US10700869B2 (en) | Access control and security for synchronous input/output links | |
US20160019100A1 (en) | Method, Apparatus, and Chip for Implementing Mutually-Exclusive Operation of Multiple Threads | |
JP2014038637A (en) | Method and apparatus for cluster data processing | |
US9672099B2 (en) | Error detection and recovery for synchronous input/output operations | |
US8539135B2 (en) | Route lookup method for reducing overall connection latencies in SAS expanders | |
US20040193811A1 (en) | Shared receive queues | |
US8782161B2 (en) | Method and system for offloading computation flexibly to a communication adapter | |
CN114331445A (en) | API (application programming interface), method, storage medium and electronic equipment for accessing massive users | |
US20080027944A1 (en) | Globally unique instance identification |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |