A kind of adaptive spread trading system and method based on FPGA
Technical field
The present invention relates to financial transaction fields, more particularly to a kind of adaptive spread trading system based on FPGA and side
Method.
Background technology
With the high speed development in financial market, the requirement to transaction system and method such as sequencing transaction, quantization transaction
It is higher and higher.Spread trading is made a profit by capturing the minor change of the market price, and traditional transaction system is using pure
The realization method of software, the parsings of data, management and control are CPU entirely to execute completion.In face of fast changing market, transaction
Chance is often transient.Time-consuming in this high concurrent of processing, big bandwidth problem for conventional method, and buying signals is caused to trigger
It is up to hundreds of microseconds to the time delay between transaction completion.
So-called price differential refers to the difference between admission valence and appearance valence.Due to the difference very little, when temporarily signal, to need
To execute scheduled trading strategies at the first time, to order execute requirement of real-time in several microseconds or even nanosecond, while with
The increasingly abundant of blending product, needs the data monitored more and more, traditional spread trading requires dealer in some valence
Position sends an order (buying in or sell some financial product) to market, and price differential is arranged, when the order that dealer sends out
After conclusion of the business, order status monitoring system generates spread trading signal immediately, and notice order management system is according to the valence being previously set
Lattice difference sends order in opposite market direction and (buys in and send seller's order after order strikes a bargain at once, seller's order strikes a bargain
It sends at once afterwards and buys in order).
Invention content
It is insufficient according to prior art, the purpose of the present invention is to provide a kind of adaptive spread trading system based on FPGA
System and method, to realize the high speed processing and real time monitoring of financial market market data, the real-time capture of buying signals, plan of merchandising
Efficient execution slightly, realizes spread trading to high concurrent, the performance requirement of low latency provides skill for the execution of trading strategies
Art guarantee.And by order management system real-time tracing recent quotation, optimal conclusion of the business quotation is obtained, compared to traditional fixation
Price differential realizes the profit maximization of transaction.
To achieve the goals above, the technical solution adopted by the present invention is as follows:
A kind of adaptive spread trading system based on FPGA disclosed by the invention, the system is using the integrated electricity of FPGA
Road, including spread trading module, Ordering Module, network connecting module, market acquisition module and calculation of price module;
Spread trading module (1), the order instruction for receiving client transmission;
Ordering Module (2), for receiving spread trading mould order information in the block and receiving in network connecting module
Order information, and handled;
Network connecting module (3), for receiving treated order order and being sent to exchange simultaneously plus specified data
After receiving the response message that exchange returns, remove specified data transmission to Ordering Module;
Market processing module (4), the quotation information for reading like products in the conclusion of the business order obtained;
Calculation of price module (5), according to the price differential or percentage being arranged when list under the product quotation information of reading and client
Than carrying out comparing calculation, the price of backhand order is calculated, the price newly calculated and other information are exported, and complete backhand and order
The transmission of single command.
In the above-mentioned technical solutions, the order instruction that the spread trading module (1) receives is transmitted by PCIE buses.
In the above-mentioned technical solutions, the Ordering Module (2), is divided into following submodule:
(2a) receives client order, and order information is stored in the BLOCK RAM of FPGA, for receiving the letter that strikes a bargain
Backhand order is sent after breath;
(2b) completion group packet, order form data management and store function, and send the FIX protocol datas that group packet is completed to net
Network link block;
(2c) receives the order information that network connecting module determines, completes the parsing of FIX message.
In the above-mentioned technical solutions, the packet header number that the data of network connecting module (3) addition and removal are TCP/IP
According to.
In the above-mentioned technical solutions, the network connecting module (3) sends data to transaction and receives exchange's data in one's power
Interface be PHY physical layer interfaces.
In the above-mentioned technical solutions, market acquisition module (4) reads quotation information from DDR/QDR.
The adaptive spread trading method based on FPGA that invention additionally discloses a kind of, steps are as follows for the method:
The instruction for sending order is sent to the spread trading module in FPGA by step 1 client, and spread trading module will
The instruction for sending order is sent to Ordering Module, and order information is stored in FPGA;
Step 2 Ordering Module is sent to network connecting module, network connecting module addition after having handled order data
It is sent to exchange after specified data;
It can returning response message after the received order of step 3 transaction;
After network connecting module receives the order information returned in step 4 FPGA, remove specified data, by order information
It sends Ordering Module to be parsed, if after receiving the deal message that exchange returns, market acquisition module will in FPGA
Read the quotation information of like products;
Price processing module in step 5 FPGA according to the product quotation information of reading with it is single under client when be arranged
Price differential or percentage carry out comparing calculation, calculate the price of backhand order, and the price newly calculated and other information are exported, and
Complete the transmission of backhand order order.
In the above-mentioned technical solutions, in the step 1, the transmission order instruction of reception is transmitted by PCIE buses, FPGA
Order information is stored in the BLOCK RAM of FPGA by middle Ordering Module, is ordered for transmission backhand after receiving deal message
It is single.
In the above-mentioned technical solutions, in the step 2, Ordering Module completion group packet, order form data management and storage
Function, and send the FIX protocol datas that group packet is completed to network connecting module, network connecting module addition and the specified number of removal
According to the header data for TCP/IP, the interface for being sent to exchange is PHY physical layer interfaces.
In the above-mentioned technical solutions, in the step 4, market acquisition module reads quotation information from DDR/QDR.
A kind of adaptive spread trading system and method based on FPGA of the present invention, has the advantages that:It utilizes
The high computation capability of FPGA realizes while monitoring the variation of a large amount of financial product market conditions, when Transaction apparatus can arrive
When, can order be sent to market rapidly, obtain the conclusion of the business more preferential than other participants, ensure that the efficient execution of trading strategies.
The method offered using adaptive polo placement backhand list captures the instantaneous variation of market conditions in time, realizes optimal conclusion of the business quotation,
It is effectively improved trading profits.
Description of the drawings
Fig. 1 is a kind of adaptive spread trading system module figure based on FPGA of the present invention;
Fig. 2 is a kind of adaptive spread trading method flow diagram based on FPGA of the present invention;
Fig. 3 is a kind of adaptive spread trading market datagram based on FPGA of the present invention
Fig. 4 is a kind of adaptive spread trading backhand uniline feelings datagram based on FPGA of the present invention
Specific implementation mode
Present invention is further described in detail below in conjunction with the accompanying drawings
The present invention discloses a kind of adaptive spread trading system based on FPGA, and the system uses FPGA integrated circuits,
Including spread trading module, Ordering Module, network connecting module, market acquisition module and calculation of price module, such as Fig. 1 institutes
Show;
Spread trading module (1), the order instruction for receiving client transmission;
Wherein, the order instruction that the spread trading module receives is transmitted by PCIE buses.
Ordering Module (2), for receiving spread trading mould order information in the block and receiving in network connecting module
Order information, and handled;
Wherein, the Ordering Module is divided into following submodule:
(2a) receives client order, and order information is stored in the BLOCK RAM of FPGA, for receiving the letter that strikes a bargain
Backhand order is sent after breath;
(2b) completion group packet, order form data management and store function, and send the FIX protocol datas that group packet is completed to net
Network link block;
(2c) receives the order information that network connecting module determines, completes the parsing of FIX message.
Network connecting module (3), for receiving treated order order and being sent to exchange simultaneously plus specified data
After receiving the response message that exchange returns, remove specified data transmission to Ordering Module;
Wherein, the header data that the data of the network module addition and removal are TCP/IP.The network connecting module
It is PHY physical layer interfaces to send data to transaction and receive the interface of exchange's data in one's power.
Market processing module (4), the quotation information for reading like products in the conclusion of the business order obtained;
Wherein, market acquisition module reads quotation information from DDR/QDR.
Calculation of price module (5), according to the price differential or percentage being arranged when list under the product quotation information of reading and client
Than carrying out comparing calculation, the price of backhand order is calculated, the price newly calculated and other information are exported, and complete backhand and order
The transmission of single command.
Wherein, spread trading is realized using the powerful parallel processing capabilities of FPGA, when the deal message for receiving order can be with
Backhand order is sent simultaneously to exchange, while market acquisition module and calculation of price module, be arranged when being placed an order according to client
Price difference or price differential ratio, be dynamically determined backhand order price in conjunction with Vehicles Collected from Market market.
The adaptive spread trading method based on FPGA that invention additionally discloses a kind of, it is characterised in that:The method step
It is as follows:
The instruction for sending order is sent to the spread trading module in FPGA by step 1 client, and spread trading module will
The instruction for sending order is sent to Ordering Module, and order information is stored in FPGA;
Wherein, the transmission order instruction of reception is transmitted by PCIE buses, and Ordering Module is by order information in FPGA
It is stored in the BLOCK RAM of FPGA, for sending backhand order after receiving deal message.
Step 2 Ordering Module is sent to network connecting module, network connecting module addition after having handled order data
It is sent to exchange after specified data;
Wherein, Ordering Module completion group packet, order form data management and store function, and the FIX that group packet is completed is assisted
Discuss data transmission specifies data for the header data of TCP/IP to network connecting module, network connecting module addition and removal, hair
It is PHY physical layer interfaces to send the interface to exchange.
It can returning response message after the received order of step 3 transaction;
After network connecting module receives the order information returned in step 4 FPGA, remove specified data, by order information
It sends Ordering Module to be parsed, if after receiving the deal message that exchange returns, market acquisition module will in FPGA
Read the quotation information of like products;
Wherein, market acquisition module reads quotation information from DDR/QDR.
Price processing module in step 5 FPGA according to the product quotation information of reading with it is single under client when be arranged
Price differential or percentage carry out comparing calculation, calculate the price of backhand order, and the price newly calculated and other information are exported, and
Complete the transmission of backhand order order.
Specifically as shown in Fig. 2, receiving the market that exchange sends by High_speed NIC, the data packets such as order, FPGA will
Data packet is parsed according to agreement, obtains Vehicles Collected from Market market data, order status etc..
Financial product is selected to select financial product, fluctuating situation according to product price is arranged price differential, then in rational valence
Position sends out admission order (buy in or sell), and order management system is to the transmitted corresponding instruction of transaction, if order is handed over
Easily received, begins to continue monitoring order status, once find that order has conclusion of the business to note that order management system.
It is placed an order in the opposite direction according to scheduled price differential according to the direction (buy or sell) of admission.By scanning market row
Feelings obtain recent quotation, if Vehicles Collected from Market quotation is than more excellent, the report of adjust automatically backhand list of scheduled backhand list quotation
Valence.
Market data as shown in Figure 3 show the quotation of current portions order and the size (quantity) of order, dealer
As soon as sending out the order bought in 9.99 this price, order management system sends out this order to exchange, and monitors in real time
The state of order.Once the order strikes a bargain, then next backhand list at once, because admission is to buy in order (doing more), then backhand
Order is necessarily seller's order (closing a position), and the size of backhand list depends on buying in the size that order has struck a bargain, order quotation root
Calculated plus specified price difference according to buying rate, buying rate is 9.99 in this example, if the price differential set as 3, backhand list
Quotation is 10.02, if backhand list strikes a bargain, this transaction is not with regard to 0.03 (considering transaction procedure expense etc.) of making a profit.If admission
It is to sell and (do sky), dealer sells in 10.01 price, price differential 5, then after 10.01 seller's order strikes a bargain, exists at once
9.96 price, which is sent out, corresponding buys in order to close a position.
As shown in figure 3, when order of the user under 9.99 prices strikes a bargain, according to the price differential 3 of setting, plan 10.02
Lower backhand list, but market conditions are higher than scheduled 10.02 as shown in figure 4, optimal lower single price should be 10.03 at this time
0.01, by the real time scan of market conditions data, as long as backhand list not yet strikes a bargain completely, so that it may adjust the report that places an order with timely
Valence obtains more preferably concluded price.Do more for buying in, the quotation of backhand list is not less than set price (buying rate+price differential), report
The valence the high, and the profit obtained is higher;And sky is done for selling, the quotation of backhand list is not higher than set price (selling price-valence
Difference), quotation is lower, and profit is higher.It can effectively amplify profit by this adaptive quotation, reduce risk.
The part not illustrated in specification is the prior art or common knowledge.Present embodiment is merely to illustrate the hair
It is bright, rather than limit the scope of the invention, the modifications such as equivalent replacement that those skilled in the art make the present invention are recognized
To be fallen into invention claims institute protection domain.