CN113065957B - Futures trading system - Google Patents
Futures trading system Download PDFInfo
- Publication number
- CN113065957B CN113065957B CN202110181968.9A CN202110181968A CN113065957B CN 113065957 B CN113065957 B CN 113065957B CN 202110181968 A CN202110181968 A CN 202110181968A CN 113065957 B CN113065957 B CN 113065957B
- 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.)
- Active
Links
- 238000012545 processing Methods 0.000 claims abstract description 115
- 238000000034 method Methods 0.000 claims abstract description 30
- 230000008569 process Effects 0.000 claims abstract description 23
- 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 8
- 238000013475 authorization Methods 0.000 claims description 6
- 238000004891 communication Methods 0.000 claims description 5
- 238000004364 calculation method Methods 0.000 claims description 4
- 230000003993 interaction Effects 0.000 claims description 4
- 230000002688 persistence 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
- 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 6
- 238000010586 diagram Methods 0.000 description 5
- 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
- 208000033830 Hot Flashes Diseases 0.000 description 1
- 206010060800 Hot flush Diseases 0.000 description 1
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000004458 analytical method Methods 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
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012856 packing Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
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 proposal is as follows: the problem of slow data processing in a financial futures transaction system is solved through a reasonable user data processing thread model, main and auxiliary business separation processing and a locking-free processing strategy of multi-user multi-seat data. In addition, the transmission of data among different processes in the system adopts a shared memory mode, and a data transmission mode of TCP or UDP is not used any more, so that the time delay of data packet transmission among different processes is reduced. And simultaneously, 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 service and auxiliary service according to the user is combined, so that the processing speed of main service data is improved, 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 a futures trading technology, in particular to a fast financial futures trading system.
Background
With the full 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 hot flashes that investors pursue on the transaction system speed.
However, the pursuit of low latency is challenging due to the large data volume of financial data. In addition, when the financial software processes data, frequent inter-process communication, thread switching and access of shared resources also add a technical barrier to 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 invention aims to solve the problems and provide a futures trading system which shortens the delay and improves the system performance on the basis of meeting 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 disc reporting module, a shared memory, a memory database updating module and a query module, wherein:
The application program interface module consists of a request thread and a callback thread, the request thread is connected with the core processing module through a TCP for data interaction, the request thread is configured to directly send a transaction instruction to the core processing module for processing through writing the TCP by a user when a transaction demand exists, the callback thread is configured to receive the data returned by the core processing module and analyze the data and return the data to an upper layer application, the application program interface module is also connected with the query module through the TCP for query service, the data is divided into a transaction type request and a query type request according to different user instructions of a user service type, the transaction type request is directly sent to the core processing module, and the query type request is 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 rights, receiving and processing user data, forwarding the data to the exchange, receiving return data from the 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 the user data and realizing the distribution of other services by landing the data in the file stream;
The query module is realized by a query front-end thread and a query core thread, wherein the query front-end 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 perform authority verification first, search by using the data sent by the user as a condition after verification, and the searched data is forwarded to the application program interface module through the query front-end thread.
According to an embodiment of the futures trading system of the present invention, the TCP connection between the application program 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.
According to an embodiment of the futures trading system of the present invention, callback threads are 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, distributing authorization codes, distributing business thread addresses and balancing loads;
the business thread is used for processing the uplink transaction request of the user, and reporting the transaction center through the transaction center application program interface after checking the processing of the user according to the transaction center rule;
the transaction response processing thread is configured to process data returned by the transaction.
The disc reporting module is used for forwarding data of the core processing module to the exchange and receiving callback data of the exchange;
According to an embodiment of the futures trading system of the present invention, the login thread is further configured to verify the user password when the user connects to the core processing module to initiate login, establish a mapping relationship for each user after verification, assign a global unique identifier, route and find all the request messages of the client by the unique identifier, and assign an authorization code and a service thread address to the user based on the load balancing policy.
According to an embodiment of the futures trading system of the present invention, the number of business threads is assigned to each user in the configuration file before the system is started, the number of business threads is determined by the number configured by 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 each uplink business request or downlink exchange response is processed by a business thread, the subject and sequence number of the processing flow are recorded in the shared memory, and when the core processing module is restarted, business processing is performed again from the shared memory according to the sequencing sequence, so as to recover the memory state of the fault front.
According to an embodiment of the futures trading system of the present invention, the trading response processing thread is further configured to parse each data packet in turn according to a polling mode after receiving the data packet returned by the exchange response request, calculate the result of holding funds in the warehouse at the same time, store the calculation result in the buffer area for use by the business thread, the business thread simply performs addition and subtraction on only part of the fields to obtain the final result, and the trading response processing thread 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 the address of the required data is positioned according to the unique identification of the user when the user data is processed; and each user has an independent service processing thread, after the service thread processes the data, the processing result is stored in a shared memory, and the processing result is waited for other modules to process the data and is sent to the disk reporting module.
According to one embodiment of the futures trading system, the newspaper disk module reduces the overhead of inter-process communication through threaded processing, and dynamically expands the number of seats of a connection exchange by initializing the number of seats in data so as to meet the exchange flow control limit 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 newspaper 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 mark is marked on the port; when receiving the UDP message of the current user, the service thread firstly verifies the UDP address of the opposite end of the user, if the user passes the verification, the service thread receives the message, otherwise, an alarm is triggered and a system manager is notified.
According to one embodiment of the futures trading system, the system performs special processing on the report request and the withdrawal request messages, and by ensuring that key service messages are strictly aligned with 8 bytes in memory, the operations of serialization and deserialization when the messages are transmitted through a network are avoided, and 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 a financial futures transaction system and reduce system delay through a reasonable design of a user data processing thread model, main and auxiliary business separation processing and a locking-free processing strategy of multi-user multi-seat data. In addition, the transmission of the data among different processes in the system adopts a shared memory mode, and a data transmission mode of TCP or UDP is not used any more, so that the time delay of the transmission of the data packet among different processes is effectively reduced. And simultaneously, 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 service and auxiliary service according to the user is combined, so that the processing speed of main service data is improved, 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 invention will be better understood after reading the detailed description of embodiments of the present disclosure in conjunction with the following drawings. In the drawings, the components are not necessarily to scale and components having similar related features or characteristics 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 shows a schematic diagram of a system thread model in the futures trading system of the present embodiment.
Fig. 3 shows a schematic diagram of the structure of the shared memory in the futures trading system according to the embodiment.
Fig. 4 shows a schematic diagram of the transaction response process in the futures transaction system of the present embodiment.
Detailed Description
The invention is described in detail below with reference to the drawings and the specific embodiments. It is noted that the aspects described below in connection with the drawings and the specific embodiments are merely exemplary and should not be construed as limiting the scope of the invention in any way.
Fig. 1 shows a 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 disk reporting module, a shared memory, a memory database updating module and a query module.
The application program interface module consists of a request thread and a callback thread, and performs data interaction with the core processing module through TCP connection, and for performance consideration, the TCP connection supports read-write separation, 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 layer application. And simultaneously, the callback thread is also used for TCP heartbeat detection and transceiving operation.
Fig. 2 illustrates the model principle of a request thread and a callback thread.
The request thread is used for packing and writing data of user input data, and when transaction needs exist, the user input data is packed 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 analysis of the package, receiving data returned by the core processing module, analyzing and returning the data to the upper layer application.
The application program interface module establishes TCP connection with the query module for query service, and the user instructions are divided into transaction type requests and query type requests according to different 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 transaction type request instruction directly writes the TCP connection established between the application program interface module and the core processing module, and sends the data to the core processing module.
The query class request instruction directly writes the TCP connection established between the application program interface module and the query module, and sends the data to the query module.
The separation of the transaction type request instruction and the query type request instruction ensures that the processing performance of the transaction type instruction is not influenced by the query type instruction. That is, the separation of the request thread and the callback thread relieves the pressure of single-thread data processing 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 rights, receiving and processing user data, forwarding the data to the exchange, receiving return data from the exchange and forwarding the return data to the application program interface module.
Referring to fig. 2, the core processing module is implemented by three threads, namely 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 allocation, business thread address allocation and load balancing. Specifically, when a user is connected to the core processing module to initiate login, a login thread of the core processing module checks a user password, a mapping relation is established for each user after checking, a global unique ID is allocated, route searching is carried out on all subsequent request messages of the client by the unique ID, and authorization codes and service thread addresses are allocated to the user based on a load balancing strategy.
The business thread is used for processing the uplink transaction request of the user, and reporting the transaction center through the transaction center API after processing according to the transaction center rule. Specifically, the service thread is configured to process uplink transaction request data of a user, firstly, check the uplink transaction request data according to the exchange rules, and report the data to the exchange through an application program interface of the exchange after the uplink transaction request data passes the check. Before the system is started, each user is assigned with a service thread number 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 is independently assigned with one service thread, so that the problem of multi-thread sharing resource competition is avoided, and the processing speed of core services is improved; multiple users may also be assigned the same business thread, but this can affect performance.
The system simultaneously supports the sequencing inversion function: when processing each uplink business request or the response of a downlink exchange, the business thread records the theme and the serial number of the flow in the shared memory. When the core processing module is restarted, firstly, service processing is carried out again from the shared memory according to the sequencing sequence, and the memory state of the fault front-end is recovered.
Wherein the transaction response processing thread is configured to process data returned by the exchange. Fig. 4 is a schematic diagram of the working principle of a transaction response processing thread, specifically, after the transaction response processing thread receives a data packet returned by an exchange response request (namely, an exchange response flow in the drawing), each data packet is sequentially analyzed according to a polling mode, a result of holding funds in a warehouse is calculated, and the calculation result is stored in a data buffer area to be used by a service thread. The business thread only needs to carry out simple addition and subtraction on part of fields to obtain a final result, and meanwhile, the transaction response processing thread also returns response information to the 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 into other threads for processing, so that the performance of the business thread is ensured. Meanwhile, in the core processing module, all data are stored by adopting a memory, and other forms of data streams such as file streams and the like do not exist.
The threading design in the core processing module fully utilizes physical resources on the premise of not damaging the system performance, solves the problem of resource waste when a high-frequency client monopolizes one server, and can greatly reduce the client transaction cost.
Referring to fig. 3, the shared memory is used for storing service data, the whole shared memory is divided into different areas according to different users, each user has an independent storage area, and each area is not intersected. Each storage area is an independent memory database, and the memory database comprises a plurality of business data tables for storing different business data of users, wherein the business data of the users are filled by the data contents of business request packets initiated by the users and business response packets returned by exchanges. When user data is processed, the address of the required data is quickly positioned according to the unique identification of the user, and a direct address access method is realized. Meanwhile, each user also has an independent service processing thread, so that the shared memory is free from competition of multiple threads on shared resources, a locking-free multithreading processing mode is achieved, and the performance of the system is effectively improved. Only one business thread performs writing operation and one process performs reading operation in the independent storage area. The design of dividing users, threads and storage spaces avoids the use of thread locks, reduces the time loss caused by competing shared resources and improves the system performance.
After the service thread processes the data, the processing result is stored in a shared memory, and the processing result is waited for other modules to process the data. And meanwhile, the data is sent to a newspaper disk module, and the newspaper disk module further processes the data. The transaction response processing thread receives transaction return data from the disc reporting module, writes the data into the shared memory area, and returns the result to the application program interface of the client.
The disc reporting module is used for forwarding data of the core processing module to the exchange and receiving callback data of the exchange. Newspaper discs are divided into two types, and for the medium-cost institute, the upper period and the energy exchange, the newspaper discs exist in a thread form in the core processing module, namely, a plurality of seats correspond to a plurality of newspaper discs. For the universities and Zheng Shang houses, which are limited by that the exchange API does not support a multithreading model, a main seat newspaper board exists in a core processing module in the form of a thread, and for auxiliary seats, the main seat newspaper board exists in the form of independent processes, namely, one auxiliary seat corresponds to one independent process, and the independent processes and the core processing module conduct data interaction through a shared memory. The threading processing of the newspaper boards reduces the expenditure brought by inter-process communication.
The newspaper disc module dynamically expands the number of seats connected with the exchange by initializing the number of 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 the newspaper thread in the newspaper module reports the user data to the exchange, a OrderLocalSysID is added to each request as a unique identifier of the request, and this field may be used as a key to index when processing the report or executing the revocation instruction.
The newspaper disc module also supports clients to adopt UDP newspaper modes. Unlike traditional UDP newspaper style designs, the user does not know the pre-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 comprising IP and port number for the user, and binds the address with the user. When the core processing module receives a transaction request from the port, firstly, the transmitting address and the port number of the source end are checked. If the verification fails, discarding the order and sending a warning, so that abnormal attack behaviors can be avoided.
The memory data updating module is used for realizing the persistence of the user data and realizing the distribution of other services by landing the data in the file stream. The memory database updating module monitors the data in the shared memory through the memory table updating thread, and the data change is to synchronize the changed data into the corresponding record of the memory database in a table form, and simultaneously, the changed data is also sent to other modules in a data flow mode, so that the module needing the data is received through subscribing the corresponding theme. The updating module of the memory database not only provides convenience for the storage of user data, but also satisfies the sharing of data among different services and the persistence of the data.
The query module is divided into a query front-end thread and a query core thread, wherein the query front-end thread is used for receiving a user query request, analyzing a data packet and sending the analyzed data to the query core thread. The inquiring core thread is configured to firstly check the authority, search by using the data sent by the user as the condition after checking, and forward the searched data to the application program interface module through the inquiring front thread. The data of the query core 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 and appreciated by those 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 (disk) as used herein include Compact Disc (CD), laser disc, optical disc, digital Versatile Disc (DVD), floppy disk and blu-ray disc where disks (disk) usually reproduce data magnetically, while discs (disk) 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 (10)
1. The futures trading system is characterized by comprising an application program interface module, a core processing module, a disc reporting module, a shared memory, a memory database updating module and a query module, wherein:
The application program interface module consists of a request thread and a callback thread, the request thread is connected with the core processing module through a TCP for data interaction, the request thread is configured to directly send a transaction instruction to the core processing module for processing through writing the TCP by a user when a transaction demand exists, the callback thread is configured to receive the data returned by the core processing module and analyze the data and return the data to an upper layer application, the application program interface module is also connected with the query module through the TCP for query service, the data is divided into a transaction type request and a query type request according to different user instructions of a user service type, the transaction type request is directly sent to the core processing module, and the query type request is 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 rights, receiving and processing user data, forwarding the data to the exchange, receiving return data from the 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 the user data and realizing the distribution of other services by landing the data in the file stream;
the query module is realized by a query front-end thread and a query core thread, wherein the query front-end 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 perform authority verification first, the data sent by a user is used as a condition for searching after verification, and the searched data is forwarded to the application program interface module through the query front-end thread;
The core processing module is realized by a login thread, a plurality of business threads and a transaction response processing thread, wherein:
The login thread is used for client login authentication, distributing authorization codes, distributing business thread addresses and balancing loads;
the business thread is used for processing the uplink transaction request of the user, and reporting the transaction center through the transaction center application program interface after checking the processing of the user according to the transaction center rule;
The transaction response processing thread is configured to process data returned by the transaction exchange;
the disc reporting module is used for forwarding data of the core processing module to the exchange and receiving callback data of the exchange;
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 front-end is recovered.
2. The futures trading system of claim 1, wherein a TCP connection between the application program interface module and the core processing module supports read-write separation, wherein a request thread is responsible for writing data and a callback thread is responsible for reading data.
3. The futures trading system of claim 1, wherein callback threads are also used for TCP heartbeat detection and transceiving operations.
4. The futures trading system of claim 1, wherein the login thread is further configured such that when a user connects to the core processing module to initiate login, the login thread verifies the user password, establishes a mapping relationship for each user after verification, assigns a globally unique identifier, and subsequently routes all request messages of the client from the unique identifier, and assigns an authorization code, a service thread address to the user based on a load balancing policy.
5. The futures trading system of claim 1, wherein the system assigns a number of business threads to each user in the configuration file prior to start-up, the number of business threads being determined by the number of configuration file configurations, one business thread being assigned individually to each user or group of users.
6. The futures trading system according to claim 1, wherein the trading response processing thread is further configured to, after receiving the data packet returned by the exchange response request, parse each data packet in turn according to a polling mode, calculate the result of holding funds in the warehouse, store the calculation result in the buffer area for use by the business thread, and the business thread performs simple addition and subtraction on only part of the fields to obtain a final result, and meanwhile, the trading response processing thread returns a response message to the corresponding application program interface.
7. The futures trading system according to 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 the user data is positioned to the address of the required data according to the unique identification of the user when being processed; and each user has an independent service processing thread, after the service thread processes the data, the processing result is stored in a shared memory, and the processing result is waited for other modules to process the data and is sent to the disk reporting module.
8. The futures trading system of claim 1, wherein the newspaper disk module reduces overhead of inter-process communication by threading, and dynamically expands the number of seats of the connection exchange by initializing the number of seats in the data so as to meet exchange flow control restrictions according to business requirements.
9. The futures trading system of claim 1, wherein the core processing module supports both UDP and TCP hybrid newspaper 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 marks a UDP address of a user opposite end for the port; in order to prevent other people from maliciously forging the newspaper of the user, when the business thread receives the UDP message of the current user, firstly, the user opposite end UDP address is checked, if the user opposite end UDP address passes the check, the message is accepted, otherwise, an alarm is triggered and a system manager is notified.
10. The futures trading system according to claim 1, wherein the system performs special processing on the report request and the withdrawal request messages to ensure that critical service messages are strictly aligned in 8 bytes in memory, so as to avoid the operations of serialization and deserialization when the messages are transmitted through a 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 CN113065957A (en) | 2021-07-02 |
CN113065957B true 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) |
Families Citing this family (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 |
CN115345746B (en) * | 2022-10-17 | 2023-01-24 | 深圳华锐分布式技术股份有限公司 | Security transaction method, device, equipment and medium |
CN117692519B (en) * | 2024-01-30 | 2024-04-19 | 深圳华云信息系统科技股份有限公司 | Futures request sending method, device, equipment and storage medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050171811A1 (en) * | 2000-09-26 | 2005-08-04 | Bottomline Technologies (De) Inc. | Electronic financial transaction system |
-
2021
- 2021-02-09 CN CN202110181968.9A patent/CN113065957B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
Also Published As
Publication number | Publication date |
---|---|
CN113065957A (en) | 2021-07-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113065957B (en) | Futures trading system | |
US9239868B2 (en) | Virtual session management and reestablishment | |
US10089153B2 (en) | Synchronizing load balancing state information | |
US10097466B2 (en) | Data distribution method and splitter | |
US9461939B2 (en) | Processing concurrency in a network device | |
US9925492B2 (en) | Remote transactional memory | |
US8612561B2 (en) | Virtual network storage system, network storage device and virtual method | |
US7272674B1 (en) | System and method for storage device active path coordination among hosts | |
US6952734B1 (en) | Method for recovery of paths between storage area network nodes with probationary period and desperation repair | |
CN103226598B (en) | Access method and apparatus and the data base management system of data base | |
US20080028086A1 (en) | Method and Apparatus for Preserving Isolation of Web Applications when Executing Fragmented Requests | |
US20110134928A1 (en) | Transmitting a packet | |
US8949297B2 (en) | Content switch management | |
US20070260714A1 (en) | Asynchronous interconnect protocol for a clustered dbms | |
JP2005134961A (en) | Storage device and its access control method | |
US20230116772A1 (en) | Io processing method for raid system, and related apparatus | |
WO2014206129A1 (en) | Computing device and method for executing database operation command | |
US20050267967A1 (en) | Facilitating the tracing/monitoring of a plurality of event sets via a single network interface | |
US20190007213A1 (en) | Access control and security for synchronous input/output links | |
CN111581234A (en) | RAC multi-node database query method, device and system | |
CN103634269B (en) | A single sign-on system and a method | |
US20220210086A1 (en) | Managing network state for high flow availability within distributed network platform | |
US20160352736A1 (en) | Service-based message access layer frame and implementation method thereof | |
US20060117103A1 (en) | Method and system for authenticating a requestor without providing a key | |
US8539135B2 (en) | Route lookup method for reducing overall connection latencies in SAS expanders |
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 |