Financial derivatives transaction system
Technical field
The present invention relates to a kind of financial derivatives transaction system, be applied to financial derivatives trading range, trade variety is contained security, futures, fund and other spin-offs, provide basic transaction, arbitrage deal and the strategy transaction of various spin-offs, the 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 continuous renewal of investment way, the selection that 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 from the process of conservative investment direction risk investment, blue chip investment.Present investor, through the experience and tempering in financial market decades, investment way, from the most basic originally cash in banks, turns to multiple investment way to advance side by side, meet 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 in financial market initial stage of founding, rushing on like a swarm of hornets often appears in investor, the psychology blindly pursuing high.But along with the development degree in market strengthens, investor also starts to turn to rational investment.For example adopt multiple quantification investment means to carry out preliminary analysis, follow the trail of mid-term and get a profit and monitor, stop loss control.Adopt the relevant knowledge of Financial Engineering to carry out investment portfolio structure, for example conservative tracking Index Portfolio Selection mode and investment diversification array mode, to evading non-systematic risk, obtain larger profit.
Therefore, high-end user is needed a their demand of can meeting, the system that intelligent degree is high badly.
Summary of the invention
The object of the invention is to overcome the deficiency that prior art exists, a kind of financial derivatives transaction system is provided.
Object of the present invention is achieved through the following technical solutions:
Financial derivatives transaction system, feature is: comprise transaction data base, trading server, gateway, offer server, strategic server, management server, transaction client, administrative client, market database, quotation service device and market collector;
Described 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, inquiry request are through transaction data base;
Described trading server, processes client's transaction, inquiry request instruction, accepts the request from gateway, distinguishing different requests processes respectively, transaction request is sent to offer server, and inquiry request is directly obtained from transaction data base, and strategy request is sent to strategic server;
Described gateway, provides customer authentication, instruction forwarding and market to subscribe to and pushes, and gateway is accepted the instruction from transaction client, is transmitted to trading server processing; Gateway is accepted to push from quotation service device the data of coming, and is pushed to transaction client according to the subscription information of transaction client;
Described offer server, with third party's futures business platform and the communication of third party's spot transaction platform, by offer server, consignment trade request is forwarded to third party's futures business platform and third party's spot transaction platform, is then forwarded to corresponding exchange by third party's futures business platform and third party's spot transaction platform;
Described strategic server, the server of operation trading strategies, accept the operation from the policy instructions control strategy of trading server, accept to offer strategy use from the market data of quotation service device, connection trading server confession strategy calls fund, the transaction data of holding position, entrust, strike a bargain;
Described management server is the middleware of management end managing transaction database;
Described transaction client, provide existing arbitrage of phase, across phase arbitrage, stock build, stock trend trading, futures trend trading, strategy transaction, Transaction Information query function, offer the program that client uses;
Described administrative client, provides clearance accounting checking, tactful importing, risk monitoring and control, account management, basic data maintenance, transaction initiation function;
Described market database, provides the database of timesharing market, by market collector, market data is write to market database;
Described quotation service device, to market data sampling propelling movement, securities market data is from the market of exchange, forward quotations are from the propelling data of transaction platform, sample after new market at every turn, market are pushed to gateway, strategic server, market collector by quotation service device, and quotation service device connects market database, offers the client needing;
Described market collector, writes to market database by market by time frequency, for transaction client.
Further, above-mentioned financial derivatives transaction system, described system constructing, on .NET Framework, is divided into three layers, i.e. general-purpose library, operation layer and presentation layer; Described general-purpose library comprises:
Object contract module, defines and realizes the specification of business datum and message, and business datum is the elementary cell of business processing, defines good business datum and possesses following condition: realize IBizData interface, this interface show current to as if a business datum; Statement ByteHelperAttribute characteristic, the coding that this property states business datum will be used helps class; Coding helps class to inherit from this general type abstract class of ByteHelper<T>, and coding helps class by business datum and the decoupling zero of coding/decoding function; Message is the elementary cell of communications, defines good message and realizes ITransferData interface, and system is built-in provides two to realize class, respectively: RequestData<T>, represents a service request; ResponseData<T>, represents the response of a service request; In addition in this assembly, also define, the function of business processing, message coding;
Data definition module, comprises one group of predefined business datum and corresponding coding helps class;
Network communication module, self-defining communication function is provided, communication between module is used self-defining communications framework, framework is realized based on Socket, by asynchronous Socket event argument, the asynchronous read and write function that framework utilizes IO completing port to provide, notifies by asynchronous event, and communications status is fed back to upper component in time; Communication service end comprises connecting to be controlled: by configuration, the maximum number of connections that specified services end allows, after accepting a connection, finds available idle link slot, will connect and set up associated with link slot; Connect cleaning: communication service end is monitored the service condition of each connection, and the periodic cleaning connection in idle condition for a long time, releasing resource; Object container: each connection corresponding two asynchronous Socket event argument objects and one receive buffer memory, by object pool, create a large container small object concentrated in together;
Data transmission module, the communication function of business is provided, on the basis of network service, data transfer components provides the OO communication function of business, comprise processing and receive data: solve the data adhesion phenomenon in Socket transmitting procedure, the data-switching receiving is become to message, realize decoding function; Add timeout treatment: in the time that response is not received in the request of sending for a long time, throw exception; Add request contexts information: before sending data, write a RequestID value, after receiving data, by RequestID value, between request and response, set up associated; Add synchronized transmission/receiving function: packaging bottom event: the event of communication layers is packaged into understandable event;
Configuration Manager, realize self-defining configuration management function, 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: provide support in conjunction with ConfigPolymorphicElementCollection<TGreatT. GreaT.GT class and ConfigElementTypeAttribute characteristic; Unified access is supported: help class by ConfigHelper, the access mode unified to configuration information is provided;
Data access module, provides the access function of database;
Logger module, provides log recording function, realizes class for preset one group, directly uses, and log helps class to complete by LogHelper, helps class to provide synchronous and asynchronous two kinds of modes;
General purpose core core module, the encapsulation of common function is provided, basic function to frequent use is put together, comprise: provide one group for dissimilar Object, String, IEnumerable<T> extended method, Windows API that packed part is conventional, realizes weak reference event, collection class;
File access module, provides business object access to file function;
Abnormality processing module, provides abnormality processing function, and what occur for unified disposal system operational process is abnormal, by different Exception Types are set up to processing policy, processes the abnormal of different severity levels.
Further, above-mentioned financial derivatives transaction system, described transaction data base is Oracle core database.
Further, above-mentioned financial derivatives transaction system, described management server is WCF server.
Again further, above-mentioned financial derivatives transaction system, described market database is oracle database or SQL Server database.
The substantive distinguishing features that technical solution of the present invention is outstanding and significant progressive being mainly reflected in:
System, based on .NET 4.0 platforms, adopts multi-layer C/S framework, uses ORACLE in database design, adopts storing process Nesting Technique, has accelerated system background process speed.System has been abandoned the serializing mechanism of system default, and adopts self-defining coded system, directly business datum and Byte array is changed mutually, and new traffic data type expansion demand is provided flexibly and supported; Native system directly uses Socket, carries out the transmission of data at bottom in asynchronous mode, and whole system support is used the mode of " asynchronous+event notice " to carry out the processing of business, to improve overall handling capacity; And client is in order to simplify the operation, encapsulate on this basis, support to call in a synchronous manner simultaneously, according to different business demands, select freely one of these two kinds of modes or mix to use.Aspect business processing, system is used consistent tupe to deal with all requests, i.e. " asynchronous+distribution ".System adopts concurrent mode to process all service request, and called side is initiated after a request, need not wait-for-response, and system will be notified called side with event, whole process unblock in the time that response is available.Take parallel layout strategy, service request all in system all walk abreast, and can not influence each other each other, have greatly improved the resistance to overturning of system.
Brief description of the drawings
Below in conjunction with accompanying drawing, technical solution of the present invention is described further:
Fig. 1: the configuration diagram of system of the present invention;
Fig. 2: the technology layering structural representation of system.
Embodiment
As shown in Figure 1, 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, quotation service device 3 and market collector 1;
Transaction data base 5, is 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, inquiry request are through transaction data base 5;
Trading server 9, processes client's transaction, inquiry request instruction, accepts the request from gateway 10, distinguishing different requests processes respectively, transaction request is sent to offer server 11, and inquiry request is directly obtained from transaction data base 5, and strategy request is sent to strategic server 8;
Gateway 10, provides customer authentication, instruction forwarding and market to subscribe to and pushes, and gateway 10 is accepted the instruction from transaction client 7, is transmitted to trading server 9 and processes; Gateway 10 is accepted to push from quotation service device 3 the data of coming, and 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, 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, accept the operation from the policy instructions control strategy of trading server 9, accept to offer strategy use from the market data of quotation service device 3, connection trading server 9 confession strategies call fund, the transaction data of holding position, entrust, strike a bargain;
Management server 6, is WCF server, is the middleware of management end managing transaction database 5;
Transaction client 7, provide existing arbitrage of phase, across phase arbitrage, stock build, stock trend trading, futures trend trading, strategy transaction, Transaction Information query function, offer the program that 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, market data is write to market database 2;
Quotation service device 3, to market data sampling propelling movement, 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, sample after new market at every turn, market are pushed to gateway 10, strategic server 8, market collector 1 by quotation service device 3, and quotation service device 3 connects market database 2, offers the client needing;
Market collector 1, writes to market database 2 by market by time frequency, for transaction client 7.
Financial derivatives transaction system, system constructing, on .NET Framework, is divided into three layers, 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 modules, and operation layer B and presentation layer C are exclusive respectively by modules; General-purpose library comprises:
Object contract modules A 3, has defined and has realized the specification of business datum and message.Business datum is the elementary cell of business processing.A good business datum of definition should possess following condition: realize 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 class to inherit from this general type abstract class of ByteHelper<T>.The meaning that coding helps class to exist is business datum and its coding/decoding function decoupling zero.Message is the elementary cell of communications.The good message of definition must realize ITransferData interface.System is built-in provides two to realize class, respectively: RequestData<T>: represent a service request; ResponseData<T>: represent the response of a service request.In addition, in this assembly, also defined the relevant function such as business processing, message coding.Object contract is that data communication and the processing of whole system laid a solid foundation.Because the existence of object contract, the process that makes business processing is objectification (need not again in the face of the basic structure such as Byte array) more, is highly profitable for improving system development efficiency.
Data definition modules A 4, comprises one group of predefined business datum and corresponding coding helps class;
Network communication module A10, realizes self-defining communication function.In order to pursue higher communication efficiency, the communication between native system modules is used self-defining communications framework.This framework is realized based on Socket, and its core concept is " asynchronous+event notice ".By the asynchronous Socket event argument of SocketAsyncEventArgs(), this framework makes full use of the asynchronous read and write function that IO completing port provides, and on this basis, notifies by asynchronous event, and communications status is fed back to upper component in time.Communication service end is because needs are tackled multiple communication customer ends simultaneously, increase more and performance-relevant design, comprise: connect and control: by configuration, the maximum number of connections that specified services end allows, avoids linking number sharply to expand and may cause the phenomenon of server failing to occur.After accepting a connection, can find available idle link slot, will connect with link slot and set up associated (now, link slot will become occupied state); Connect cleaning: communication service end can be monitored the service condition of each connection, and those connections in idle condition for a long time of periodic cleaning, discharges relevant resource; Object container: each connection corresponding two SocketAsyncEventArgs objects (one for sending data, one for receiving data) and a reception buffer memory, by object pool technology, create a large container and these small objects are concentrated in together to (distributing the continuous memory headroom of a monoblock), to improve internal memory service efficiency.
Data transmission module A5, realizes the communication function of business.On the basis of network service, data transfer components provides business, OO communication function.This assembly has been hidden the bottom details of communication to application developer, make it can be absorbed in the processing of business, mainly comprise: process and receive data: solve " data adhesion " phenomenon in Socket transmitting procedure, the data-switching receiving is become to message, realize decoding function; Add timeout treatment: in the time that response is not received in the request of sending for a long time, throw exception (TimeoutException); Add request contexts information: before sending data, write a RequestID value, after receiving data, by RequestID value, between request and response, set up associated; Add synchronized transmission/receiving function: because network service layer entirety adopts asynchronous system, 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, simplified code flow process.Certainly, also still can directly use the programming mode of " asynchronous transmission+event notice "; Packaging bottom event: the event of communication layers is packaged into more understandable event.
Configuration Manager A9, realizes self-defining configuration management function.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: because built-in configuration management function is not supported the polymorphism of configuration element, here in conjunction with ConfigPolymorphicElementCollection<TGreatT. GreaT.GT class and ConfigElementTypeAttribute characteristic to provide support; Unified access is supported: help class by ConfigHelper, provide the more unified access mode easily of configuration information.
Data access module A1, provides the access function of database.
Logger module A2, realizes log recording function.This assembly is preset one group realize class, can directly use.Log helps class to complete by LogHelper.This help class provides synchronous and asynchronous two kinds of modes, 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 for dissimilar (Object, String, IEnumerable<T> etc.) the conventional Windows API of extended method, packed part, realize weak reference event, some collection class, as CachePool(cache pool).
File access modules A 8, provides business object access to file function.
Abnormality processing modules A 7, realizes abnormality processing function.What occur for unified disposal system operational process is abnormal.Because native system has been widely used the multithreadings such as asynchronous, parallel, and under multi-thread environment, abnormal catching not is that part is easy to event (ignoring while often operation by .NET), therefore, has and must carry out unified specification to exception handling procedure.By different Exception Types being set up to a set of processing policy (ignore, again dish out, log off), system can be processed the abnormal of different severity levels flexibly, thereby reaches the balance of correctness, robustness, reliability etc.
Communication data treatment scheme of the present invention is: from client initiating business request, successively through encoding, being transferred to server end, then decode, distribute, process, encode, transmit and get back to client, then response results is obtained in decoding.In whole process, initiate request can select synchronous or asynchronous system except client, other is all to complete with asynchronous system.Have the explanation of 3 needs: 1) client's receiving course is asynchronous or synchronous, be determined by the mode sending request (synchronized transmission synchronously receives, and asynchronous transmission utilizes event to notify; 2) server end receives after request, have the process of a distribution, real processing request is that each chartered business processing class completes, and is so just very beneficial for the expansion (only need the new business processing type of definition, then be registered to server) of type of service; 3) basic function such as coding, decoding, transmission is provided by unified frame, and business function implementor need not participate in, but purely writes service logic in OO mode.
System, based on .NET 4.0 platforms, adopts multi-layer C/S framework, uses ORACLE in database design, adopts storing process Nesting Technique, has accelerated system background process speed.In order to reduce the content-length after 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 to (by IBizData interface definition) mutually.The manner provides flexibly new traffic data type expansion demand supports (as long as realize IBizData interface, and in configuration file, carrying out type registration).In order to improve transfer efficiency, native system directly uses Socket, carries out the transmission of data at bottom in asynchronous mode.Whole system support is used the mode (this is the default behavior of server end) of " asynchronous+event notice " to carry out the processing of business, to improve overall handling capacity.And client is in order to simplify the operation, encapsulate on this basis, support to call in a synchronous manner simultaneously, according to different business demands, be free to select one of these two kinds of modes or mix use.Aspect business processing, system is used consistent tupe to deal with all requests, i.e. " asynchronous+distribution ".In order to improve handling capacity and the System Operation efficiency of system, system (comprising server end and client) adopts concurrent mode to process all service request.Called side is initiated after a request, need not wait-for-response, and system will be notified called side with event in the time that response is available, 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, take parallel layout strategy.Service request all in 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, through 500 above clients of strict pressure test energy stable operation.
2. market adopt subscribe to, propelling movement mode: all market push to client and can complete in 0.3 second from sampling, stock price index futures market especially can be in 0.1 second arrival client;
3. the offer service of stability and high efficiency: offer server can stablize with each counter system dock, quick declaration form, and can connect multiple futures and sales counter from stock simultaneously;
4. asynchronous process: system adopts asynchronous process mode, reduces the queue waiting time of processing, and service request does not need to wait for that processing above finishes, but carries out by starting an asynchronous procedure, has improved system treatment effeciency;
5. serializing processing mode: the general object serializing mode (XmlSerializer, DataContractSerializer etc.) providing with reference to .NET itself is provided in serializing, by rational demand analysis and mass data analysis, develop self-defining serializing processing for the market demand, omit the switch process of intermediate form (for example XML), but according to the direct allocation space of traffic data type, accelerate the efficiency of coding and decoding, thereby promoted network transmission performance; Greatly improve transactions velocity.
It is to be understood that: the above is only the preferred embodiment of the present invention; for those skilled in the art; under the premise without departing from the principles of the invention, can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.