| As the prosperity of the financial markets, the rapid development of the Internet information technology and the participation of more and more users, the market has put forward higher requirements and expectations on the way of futures trading. Trading online voluntarily has become a popular way of futures trading. As programming trading can overcome the defects of manual operations to make users obtain benifits, it had been widely used. For the collaboration between users and the scalability of the system, we design and implement a programming trading system based on the sharing of the trading strategy signals. The system contains trading/analysis client, the history quotation server and the trading strategy signal server group. The main work of this paper includes the part of processing of quotation information and the part of forwarding of trading strategy signals.In the part of processing of quotation information, we divide the Memcached servers into two cache clusters which work together to reduce the time of reading from database. By making the SQLite memory database as a cache layer between the real cache memory and the local database we reduce the time of occupating the data structure in memory and has the ability of sorting data and deleting duplicated data. We implement the drawing of the K-line graph of the quotation.The part of signals distribution contains multiple servers which use socket connection pool and the communication protocol based on JSON to communicate. Signal forwarding server uses the MINA architecture to keep TCP connections with users to forward signals. Logging and load balancing server uses load balancing algorithm to select a signal forwarding server for the user. For preventing the accumulation of connections in a refresh cycle, we introduce a load-balance factor. The process of logging is based on the idea of single sign-on. After the verification, the user will get a ticket which will make the user signs on different signal forwarding server without repeating the whole verification process. The signal centralized distribution server distributes the signals through the message oriented middleware. In the signal database access server we design and implememt a thread pool with multi-queue and a database connection pool to speed up the accessing speed.We take experiments on the client and the server respectively. The result and analysis of the experiments show the effectiveness of our work. |