The financial derivatives transaction system
Technical field
The present invention relates to a kind of financial derivatives transaction system; Be applied to the financial derivatives trading range; Trade variety is contained security, futures, fund and other spin-offs; Basic transaction, arbitrage deal, and the strategy transaction of various spin-offs are provided, business such as union hedging transaction, sequencing transaction, risk control, clearance, secondary account management.
Background technology
In recent years, along with the continuous increase of financial derivatives trade variety, the continual renovation of investment way, the selection that the investor faces is more and more.And along with the trading volume in financial market constantly achieves new and high, investor's idea has also experienced the process of moving towards risk investment, blue chip investment from conservative investment.Present investor, through the experience and tempering in financial market decades, investment way turns to multiple investment way to advance side by side from the most basic originally cash in banks, satisfy that self is short, in, long-term different investment demands.
Equally, along with being gradually improved of investor's the renewal of ideas and financial market, maturing, investor's idea also slowly turns to rational investment by original impulsive style, and the initial stage of founding in the financial market, rushing on like a swarm of hornets often appears in the investor, the psychology that blindly pursues high.But along with the maturing degree in market strengthens, the investor also begins to turn to rational investment.For example adopt multiple quantification investment means to carry out preliminary analysis, the monitoring of following the trail of mid-term and get a profit, only damage control.Adopt the relevant knowledge of Financial Engineering to carry out the investment portfolio structure, for example conservative tracking index investment portfolio mode and investment diversification array mode in the hope of evading non-systematic risk, are obtained bigger profit.
Therefore, high-end user is needed a their demand of can satisfying, the system that intelligent degree is high badly.
Summary of the invention
The objective of the invention is to overcome the deficiency that prior art exists, a kind of financial derivatives transaction system is provided.
The object of the invention is realized through following technical scheme:
The financial derivatives transaction system, characteristics are: comprise transaction data base, trading server, gateway, offer server, strategic server, management server, transaction client, administrative client, market database, market server and market collector;
Said transaction data base, storage client's entrusted information, conclusion of the business information, fund hold position library information and master data, all trust of client, query requests are through transaction data base;
Said trading server is handled client's transaction, query requests instruction, accepts the request from gateway; Distinguishing different requests handles respectively; Transaction request is sent to the offer server, and query requests is directly obtained from transaction data base, and strategy request is sent to strategic server;
Said gateway provides customer authentication, instruction to transmit and market are subscribed to propelling movement, and gateway is accepted the instruction from the transaction client, is transmitted to trading server and handles; Gateway is accepted the data sent here from the market server push, is pushed to the transaction client according to the subscription information of transaction client;
Said offer server; With third party's futures business platform and the communication of third party's spot transaction platform; By the offer server consignment trade request is forwarded to third party's futures business platform and third party's spot transaction platform, is forwarded to corresponding exchange by third party's futures business platform and third party's spot transaction platform then;
Said strategic server; The server of operation trading strategies; Acceptance is accepted to offer the strategy use from the market data of market server from the operation of the policy instructions control strategy of trading server, and connection trading server confession strategy calls fund, the transaction data of holding position, entrust, strike a bargain;
Said management server is the middleware of management end managing transaction database;
Said transaction client provides existing arbitrage of phase, strides the phase arbitrage, stock makes up, the transaction of stock trend, the transaction of futures trend, strategy transaction, Transaction Information query function, offers the program that the client uses;
Said administrative client provides clearance accounting checking, tactful importing, risk monitoring and control, account management, basic data maintenance, transaction initiation function;
Said market database provides the database of timesharing market, by the market collector market data is write to the market database;
Said market server; To market data sampling and propelling movement, securities market data is from the market of exchange, and forward quotations are from the propelling data of transaction platform; After sampling new market at every turn; The market server is pushed to gateway, strategic server, market collector with market, and the market server connects the market database, offers the client that needs;
Said market collector writes to the market database with market by the time frequency, supplies the transaction client to use.
Further, above-mentioned financial derivatives transaction system, said system constructing is divided into three layers, i.e. general-purpose library, operation layer and presentation layer on .NET Framework; Said general-purpose library comprises:
Object contract module, the standard of definition and realization business datum and message, business datum is the elementary cell of business processing, defines good business datum and possesses following condition: realize the IBizData interface, this interface shows current to liking a business datum; Statement ByteHelperAttribute characteristic, the coding that this property states business datum will be used helps class; Coding help type succession is from this general type abstract class of ByteHelper < T >, and coding helps class with business datum and the decoupling zero of coding/decoding function; Message is the elementary cell of communications, defines good message and realizes the ITransferData interface, and system is built-in to provide two to realize class, is respectively: RequestData < T >, represent a service request; ResponseData < T >, the response of a service request of expression; In addition, also define the function of business processing, message coding in this assembly;
The data definition module comprises one group of predefined business datum and respective coding and helps class;
Network communication module; Self-defining communication function is provided, and self-defining communications framework is used in the communication between the module, and framework is realized based on Socket; Through asynchronous Socket event argument; Framework utilizes IO to accomplish the asynchronous read and write function that port provides, and through the asynchronous event notice, communications status is in time fed back to upper component; The communication service end comprises connecting to be controlled: through configuration, the maximum number of connections that the specified services end allows after accepting a connection, finds available idle link slot, will connect and set up related with link slot; Connect cleaning: the operating position of each connection of communication service end monitoring, and periodic cleaning is in the connection of idle condition, the release resource for a long time; Object container: each connects all corresponding two asynchronous Socket event argument objects and one and receives buffer memory, through object pool, creates a big container small object is concentrated in together;
Data transmission module; The communication function of the businessization of providing; On the basis of network service, data transfer components provides the OO communication function of businessization, comprises handling receiving data: solve the data adhesion phenomenon in the Socket transmission course; The data-switching that receives is become message, realize decoding function; Add timeout treatment: when response was not received in the request of sending for a long time, it was unusual to dish out; Add request contexts information: before sending data, write a RequestID value, receive after the data,, between request and response, set up related through the RequestID value; Add synchronized transmission/receiving function: packing bottom incident: the incident of communication layers is packaged into understandable incident;
Configuration Manager; Realize self-defining configuration management function; The configuration management assembly is expanded the built-in configuration management function of .NET Framework; Comprise general type support: add general type configuration element collection class ConfigElementCollection < T >, remove the needs of the various configuration element set of definition from; Polymorphism is supported: combine ConfigPolymorphicElementCollection < T>class and ConfigElementTypeAttribute characteristic to provide support; Unified visit is supported: help class through ConfigHelper, provide the unified access mode of configuration information;
Data access module provides the access of database function;
Logger module provides log recording function, presets one group and realizes class, directly uses, and log helps a type completion through LogHelper, helps class that synchronous and asynchronous dual mode is provided;
The general purpose core core module; The encapsulation of common function is provided, the basic function of frequent use is put together, comprising: provide one group to dissimilar Object; String, IEnumerable < T>extended method, Windows API, realization weak reference incident, collection class that packed part is commonly used;
The file access module provides the business object access to file function;
The abnormality processing module provides the abnormality processing function, and what be used for that Unified Treatment system operational process takes place is unusual, through different Exception Types are set up processing policy, handles the unusual of different severity levels.
Further, above-mentioned financial derivatives transaction system, said transaction data base is the Oracle core database.
Further, above-mentioned financial derivatives transaction system, said management server is the WCF server.
Again further, above-mentioned financial derivatives transaction system, said market database is oracle database or SQL Server database.
Substantive distinguishing features and obvious improvement that technical scheme of the present invention is outstanding are mainly reflected in:
System adopts multi-layer C/S framework based on .NET 4.0 platforms, uses ORACLE on the database design, adopts the nested technology of storing process, has accelerated system's background process speed.The serializing mechanism of system default has been abandoned by system, and adopts self-defining coded system, directly business datum and Byte array is changed each other, new traffic data type expansion demand is provided supported flexibly; Native system directly uses Socket, carries out the transmission of data at bottom with asynchronous mode, and the total system support uses the mode of " asynchronous+event notice " to carry out professional processing, to improve whole handling capacity; And client encapsulates in order to simplify the operation on this basis, supports simultaneously to call in a synchronous manner, according to the different service demand, selects one of this dual mode freely or mixes use.Aspect business processing, system uses consistent tupe to deal with all requests, i.e. " asynchronous+distribution ".System adopts concurrent mode to handle all service request, after called side is initiated a request, need not wait-for-response, but system will notify called side with incident, whole process unblock in the response time spent.Take the layout strategy that walks abreast, service request all in the system all walk abreast, and can not influence each other each other, have improved the resistance to overturning of system greatly.
Description of drawings
Below in conjunction with accompanying drawing technical scheme of the present invention is described further:
Fig. 1: the configuration diagram of system of the present invention;
Fig. 2: the technological layering structural representation of system.
Embodiment
As shown in Figure 1; The financial derivatives transaction system comprises transaction data base 5, trading server 9, gateway 10, offer server 11, strategic server 8, management server 6, transaction client 7, administrative client 4, market database 2, market server 3 and market collector 1;
Transaction data base 5 is the Oracle core database, storage client's entrusted information, conclusion of the business information, fund hold position library information and master data, and all trust of client, query requests are through transaction data base 5;
Trading server 9 is handled client's transaction, query requests instruction, accepts the request from gateway 10; Distinguishing different requests handles respectively; Transaction request is sent to offer server 11, and query requests is directly obtained from transaction data base 5, and strategy request is sent to strategic server 8;
Gateway 10 provides customer authentication, instruction to transmit and market are subscribed to propelling movement, and the instruction that gateway 10 is accepted from transaction client 7 is transmitted to trading server 9 and handles; Gateway 10 is accepted to push the data of coming from market server 3, is pushed to transaction client 7 according to the subscription information of transaction client 7;
Offer server 11; With third party's futures business platform 12 and 14 communications of third party's spot transaction platform; By offer server 11 the consignment trade request is forwarded to third party's futures business platform 12 and third party's spot transaction platform 14; Then be forwarded to third party futures exchange 13 by third party's futures business platform 12, third party's spot transaction platform 14 is forwarded to third party's spot transaction institute 15;
Strategic server 8; The server of operation trading strategies; Acceptance is accepted to offer the strategy use from the market data of market server 3 from the operation of the policy instructions control strategy of trading server 9, and connection trading server 9 confession strategies call fund, the transaction data of holding position, entrust, strike a bargain;
Management server 6 is the WCF server, is the middleware of management end managing transaction database 5;
Transaction client 7 provides existing arbitrage of phase, strides the phase arbitrage, stock makes up, the transaction of stock trend, the transaction of futures trend, strategy transaction, Transaction Information query function, offers the program that the client uses;
Administrative client 4 provides clearance accounting checking, tactful importing, risk monitoring and control, account management, basic data maintenance, transaction initiation function;
Market database 2 is oracle database or SQL Server database, and the database of timesharing market is provided, and by market collector 1 the market data is write to market database 2;
Market server 3; To the market data sampling and push, securities market data from third party futures exchange 13 and third party's spot transaction 15 DBF satellite market, forward quotations are from the propelling data of transaction platform; After sampling new market at every turn; Market server 3 is pushed to gateway 10, strategic server 8, market collector 1 with market, and market server 3 connects market database 2, offers the client that needs;
Market collector 1 writes to market database 2 with market by the time frequency, supplies transaction client 7 to use.
Financial derivatives transaction system, system constructing are divided into three layers on .NET Framework, as shown in Figure 2, i.e. general-purpose library (Common Libraries) A, operation layer (Business Layer) B and presentation layer (Presentation Layer) C; General-purpose library A is by sharing between each module, and operation layer B and presentation layer C are exclusive respectively by each module; General-purpose library comprises:
Object contract modules A 3 has defined and has realized the standard of business datum and message.Business datum is the elementary cell of business processing.The good business datum of definition should possess following condition: realize the IBizData interface: this interface shows current to liking a business datum; Statement ByteHelperAttribute characteristic: the coding that this property states business datum will be used helps class.Coding helps type succession from this general type abstract class of ByteHelper < T >.Coding helps a type meaning that exists to be business datum and its coding/decoding function decoupling zero.Message is the elementary cell of communications.The good message of definition must realize the ITransferData interface.System is built-in to provide two to realize class, is respectively: RequestData < T >: represent a service request; ResponseData < T >: the response of a service request of expression.In addition, also defined relevant function such as business processing, message coding in this assembly.The object contract is that the data communication and the processing of total system laid a solid foundation.Because the existence of object contract, make the process objectification (need not again in the face of the basic structure such as the Byte array) more of business processing, be very useful for improving system development efficient.
Data definition modules A 4 comprises one group of predefined business datum and respective coding and helps class;
Network communication module A10 realizes self-defining communication function.In order to pursue higher communication efficiency, self-defining communications framework is used in the communication between each module of native system.This framework realizes that based on Socket its core concept is " asynchronous+event notice ".Through SocketAsyncEventArgs (asynchronous Socket event argument), this framework makes full use of IO and accomplishes the asynchronous read and write function that port provides, and on this basis, through the asynchronous event notice, communications status is in time fed back to upper component.The communication service end is owing to need tackle a plurality of communication customer ends simultaneously; More and performance-relevant design have been increased; Comprise: connect control: through configuration, the maximum number of connections that the specified services end allows avoids the rapid expansion of linking number possibly cause the phenomenon of server failing to take place.After accepting a connection, can find available idle link slot, will connect with link slot and set up related (at this moment, link slot will become occupied state); Connect cleaning: the communication service end can be monitored the operating position of each connection, and periodic cleaning those be in the connection of idle condition for a long time, discharge relevant resource; Object container: each connects all corresponding two SocketAsyncEventArgs objects, and (one is used to send data; One is used to receive data) and a reception buffer memory; Through the object pool technology; Create a big container and these small objects are concentrated in together (distributing the continuous memory headroom of a monoblock), to improve the internal memory service efficiency.
Data transmission module A5, the communication function of realization businessization.On the basis of network service, data transfer components provides professionalization, OO communication function.This assembly is to using the bottom details that the developer has hidden communication; Make it can be absorbed in professional processing; Mainly comprise: handle receiving data: solve " data adhesion " phenomenon in the Socket transmission course, the data-switching that receives is become message, realize decoding function; Add timeout treatment: when response was not received in the request of sending for a long time, unusual (TimeoutException) dished out; Add request contexts information: before sending data, write a RequestID value, receive after the data,, between request and response, set up related through the RequestID value; Add synchronized transmission/receiving function: because the whole asynchronous system that adopts of network service layer is bad to the experience of exploitation, therefore; Here utilize request contexts information; Convert asynchronous procedure to synchronizing process, exempted application and development directly in the face of the worries of asynchronous operation, the simplified code flow process.Certainly, also still can directly use the programming mode of " asynchronous transmission+event notice "; Packing bottom incident: the incident of communication layers is packaged into more understandable incident.
Configuration Manager A9 realizes self-defining configuration management function.The configuration management assembly is expanded the built-in configuration management function of .NET Framework, comprising: general type support: add general type configuration element collection class ConfigElementCollection < T >, remove the needs of the various configuration element set of definition from; Polymorphism is supported: because built-in configuration management function is not supported the polymorphism of configuration element, combine ConfigPolymorphicElementCollection < T>class and ConfigElementTypeAttribute characteristic to provide support here; Unified visit is supported: help class through ConfigHelper, provide the unified more access mode easily of configuration information.
Data access module A1 provides the access of database function.
Logger module A2 realizes log recording function.This assembly has preset one group and has realized class, can directly use.Log helps class to accomplish through LogHelper.This help class provides synchronous and asynchronous dual mode, can adopt flexibly according to business characteristic.
General purpose core core module A6 realizes the encapsulation of common function.Basic function to frequent use is put together; Mainly comprise: provide one group to dissimilar (Object; String; IEnumerable < T>or the like) extended method, Windows API, realization weak reference incident, some collection class that packed part is commonly used are like CachePool (cache pool).
File access modules A 8 provides the business object access to file function.
Abnormality processing modules A 7 realizes the abnormality processing function.What be used for that Unified Treatment system operational process takes place is unusual.The multithreading such as asynchronous, parallel because native system has been widely used, and under multi-thread environment, unusual catching not is the easy incident (ignoring when often being moved by .NET) of part, therefore, has and must carry out unified standard to exception handling procedure.Through different Exception Types being set up a cover processing policy (ignore, dish out again, log off), system can handle the unusual of different severity levels flexibly, thereby reaches the balance of correctness, robustness, reliability etc.
Communication data treatment scheme of the present invention is: initiate service request from client, through encoding, being transferred to server end, decode, distribute, handle, encode, transmit and get back to client successively, response results is obtained in decoding again.In the whole process, can select synchronously or asynchronous system except the client initiation request, other all is to accomplish with asynchronous system.3 needs explanations are arranged: 1) client's receiving course is asynchronous or synchronous, and (synchronized transmission then receives synchronously, and asynchronous transmission then utilizes incident to notify by sending the request mode decision; 2) after server end receives request; Have the process of a distribution; What promptly real processing was asked is that each business processing class of having registered is accomplished, and so just is very beneficial for the expansion (only need the new business processing type of definition, be registered to server again and get final product) of type of service; 3) basic functions such as coding, decoding, transmission are provided by the framework unification, and the business function implementor need not participate in, but writes service logic with OO mode purely.
System adopts multi-layer C/S framework based on .NET 4.0 platforms, uses ORACLE on the database design, adopts the nested technology of storing process, has accelerated system's background process speed.In order to reduce the content-length behind the coding, improve the speed of coding and decoding, native system has been abandoned the serializing mechanism of system default, and adopts self-defining coded system, directly business datum and Byte array is changed (by the IBizData interface definition) each other.This mode provides flexibly and has supported (as long as realize the IBizData interface, and in configuration file, carry out the type registration get final product) to new traffic data type expansion demand.In order to improve transfer efficiency, native system directly uses Socket, carries out the transmission of data with asynchronous mode at bottom.The total system support uses the mode (this is the default behavior of server end) of " asynchronous+event notice " to carry out professional processing, to improve whole handling capacity.And client encapsulates in order to simplify the operation on this basis, supports simultaneously to call in a synchronous manner, according to the different service demand, is free to select one of this dual mode or mixes use.Aspect business processing, system uses consistent tupe to deal with all requests, i.e. " asynchronous+distribution ".For handling capacity and the System Operation efficient that improves system, system's (comprising server end and client) adopts concurrent mode to handle all service request.After called side is initiated a request, need not wait-for-response, but system will notify called side with incident in the response time spent, and whole process is unblock.This is very important for server end, is the key that improves entire throughput.In order to improve the stability of system, taked parallel layout strategy.Service request all in the system all walk abreast, and can not influence each other each other, and this has just improved the resistance to overturning of system greatly.
Compare with existing trading platform system, system of the present invention highlights following advantage:
1. the communication framework of fast and stable: the WCF framework that transmission speed is more general than .NET is fast more than 3 times, and can compress and encryption data, can the client of stable operation more than 500 through strict pressure test.
2. market adopt to subscribe to, the propelling movement mode: all market push to client and in 0.3 second, can accomplish from sampling, and the stock price index futures market especially can be at 0.1 second with interior arrival client;
3. the offer service of stability and high efficiency: the offer server can stablize with each counter system dock, quick declaration form, and can connect a plurality of futures and sales counter from stock simultaneously;
4. asynchronous process: system adopts the asynchronous process mode, reduces the queue waiting time of handling, and service request need not wait for that the processing of front finishes, but carries out through starting an asynchronous procedure, has improved system handles efficient;
5. serializing processing mode: serializing is handled with reference to the general object serializing mode (XmlSerializer, DataContractSerializer etc.) that provides of .NET itself; Through rational demand analysis and mass data analysis; Develop self-defining serializing to the market demand and handled, omitted the switch process of intermediate form (for example XML), but according to the direct allocation space of traffic data type; Accelerate the efficient of coding and decoding, thereby promoted network transmission performance; Greatly improved transactions velocity.
What need understand is: the above only is a preferred implementation of the present invention; For those skilled in the art; Under the prerequisite that does not break away from the principle of the invention, can also make some improvement and retouching, these improvement and retouching also should be regarded as protection scope of the present invention.