
fix协议实战
文章平均质量分 93
用于证券交易所的fix协议封装处理
hxpjava1
毕业于武汉理工大学计算机系,12年开发架构经验,擅长java,k8s
展开
-
fix协议封装挑战
最近在做金融项目,用到了fix协议,是么是fix协议我就不多说了,由我一个人去封装这个庞然大物,当然很多没用到的我们暂时没封装进去。下面是我的思路。msg由个基类BaseMsgcomponent由个基类BaseGrpTag类用来封装一个字段,信息包括字段id,数据类型,字段值,是否必须下面是Logon msg的一个例子:package cs.mina.codec.msg;原创 2013-12-02 17:04:22 · 7757 阅读 · 1 评论 -
fix协议封装挑战-mina服务器的编解码器
废话不多,直接贴代码package cs.mina.codec;import java.nio.charset.Charset;import org.apache.mina.core.session.IoSession;import org.apache.mina.filter.codec.ProtocolCodecFactory;import org.apache.mina.fi原创 2013-12-03 11:19:35 · 1927 阅读 · 0 评论 -
fix协议封装挑战-将一个消息实体编码为协议字符串
消息实体如下:package cs.test;import java.text.SimpleDateFormat;import java.util.Date;import cs.mina.SeqenceNum;import cs.mina.codec.msg.BaseMsg;import cs.mina.codec.msg.DisclosureInstructionGrp;im原创 2013-12-03 11:31:24 · 2024 阅读 · 1 评论 -
fix协议封装挑战-将消息字符串解析为实体
这个是真正的有挑战的,我的方法还是递归解析。举个例子:比如下面返回消息:响应:8=FIXT.1.1_9=239_35=8_49=HKEXCO_56=CO99999901_34=3_52=20131129-07:07:01.327_1128=9_11=13_14=0_17=20701315_150=0_151=4000_1093=2_1090=1_453=1_448=1122_447=原创 2013-12-03 11:58:49 · 3616 阅读 · 2 评论 -
fix协议封装挑战-数据有效性校验
数据校验要校验每个字段还有头和尾。校验包过数据类型校验,特殊值校验。数据类型校验统一写,特殊值校验写在每个消息实体里。数据校验采用递归的方式,减少代码编写难度。Tag类(类型校验没写完,有些特殊类型暂时没写):package cs.mina.codec.msg;import java.util.HashSet;import java.util.Set;import c原创 2013-12-03 12:33:42 · 1462 阅读 · 0 评论 -
fix协议封装挑战-测试代码
初步测试工具采用香港证券交易所的一个离线测试工具,测试数据包正确性。工具名称叫做OCG Simulator 1.2.1。测试代码比如:TC_QM_03测试案例:package cs.test;import java.text.SimpleDateFormat;import java.util.Date;import cs.mina.SeqenceNum;import c原创 2013-12-03 12:38:02 · 2022 阅读 · 0 评论 -
Fix协议封装挑战-消息处理
消息处理还没正式开始写,有待完善:处理器工厂如下:package cs.mina.client.handler;import java.util.HashMap;import java.util.Map;/* *@author(huangxiaoping) *@date 2013-10-11 */public class ClientHandlerFactory { p原创 2013-12-03 12:40:11 · 1285 阅读 · 0 评论 -
fix协议封装挑战-工具类
MsgUtil: /* * @headerAndBody 包含消息头+消息体,包含SOH,不包含checksum域 */ public static String checkSum(String headerAndBody) { byte[] headerAndBodyBytes = headerAndBody.getBytes();原创 2013-12-03 12:43:20 · 1355 阅读 · 0 评论 -
fix协议介绍-常用资源
最终要的资料就是规范了:http://old.fixprotocol.org/FIXimate3.0/latestEP/ 这个是最新规范的web版,消息结构http://www.fixtradingcommunity.org/pg/resources/fiximate这个不是最新版的当然可以把规范下下来:到http://www.fixtradingcommu原创 2013-12-03 12:49:20 · 2865 阅读 · 0 评论 -
fix协议介绍2-登入消息
Logon消息结构:ield or ComponentField NameFIXML nameReq'dCommentsDepr.ComponentStandardHeaderBaseHeaderMsgType = A原创 2013-12-03 12:56:25 · 2984 阅读 · 0 评论 -
写一个开源的fix金融信息交换,客户端和服务器
本人发起一个fix客户端和服务器端工具包开发计划,想参加的回复本文原创 2013-12-03 13:13:11 · 2190 阅读 · 5 评论 -
fix协议介绍3-登出消息
FIX.5.0SP2_EP168 MessageLogout[type '5']The logout message initiates or confirms the termination of a FIX session. Disconnection without the exchange of logout messages should be interprete原创 2013-12-12 14:53:08 · 1258 阅读 · 0 评论 -
fix协议介绍4-心跳
FIX.5.0SP2 MessageHeartbeat [type '0']The Heartbeat monitors the status of the communication link and identifies when the last of a string of messages was not received.Added FIX.2.7原创 2013-12-13 11:33:27 · 1439 阅读 · 0 评论 -
fix协议介绍5-测试消息
FIX.5.0SP2 MessageTestRequest [type '1']The test request message forces a heartbeat from the opposing application. The test request message checks sequence numbers or verifies communication原创 2013-12-13 11:35:38 · 1706 阅读 · 0 评论 -
fix协议介绍6-重发消息
FIX.5.0SP2 MessageResendRequest [type '2']The resend request is sent by the receiving application to initiate the retransmission of messages. This function is utilized if a sequence number g原创 2013-12-13 11:37:24 · 1635 阅读 · 0 评论 -
fix协议介绍7-序列号重置
FIX.5.0SP2 MessageSequenceReset [type '4']The sequence reset message is used by the sending application to reset the incoming sequence number on the opposing side.Added FIX.2.7E原创 2013-12-13 11:39:21 · 2302 阅读 · 0 评论 -
fix协议介绍8-Reject消息
FIX.5.0SP2 MessageReject [type '3']The reject message should be issued when a message is received but cannot be properly processed due to a session-level rule violation. An example of when a原创 2013-12-13 12:32:12 · 1622 阅读 · 0 评论 -
fix协议介绍9-下单(NewOrderSingle)
FIX.5.0SP2 MessageNewOrderSingle [type 'D']The new order message type is used by institutions wishing to electronically submit securities and forex orders to a broker for execution.T原创 2013-12-13 12:34:55 · 3794 阅读 · 0 评论 -
Fix协议介绍10-取消订单请求(OrderCancelRequest)
FIX.5.0SP2 MessageOrderCancelRequest [type 'F']The order cancel request message requests the cancellation of all of the remaining quantity of an existing order. Note that the Order Cancel/原创 2013-12-13 12:37:42 · 2639 阅读 · 0 评论 -
fix协议介绍11-修改订单(OrderCacelReplaceRequest)
FIX.5.0SP2 MessageOrderCancelReplaceRequest [type 'G']The order cancel/replace request is used to change the parameters of an existing order.Do not use this message to cancel the rem原创 2013-12-13 12:40:12 · 2181 阅读 · 0 评论 -
fix协议介绍12-取消订单被拒(OrderCacelReject)
FIX.5.0SP2 MessageOrderCancelReject [type '9']The order cancel reject message is issued by the broker upon receipt of a cancel request or cancel/replace request message which cannot be hon原创 2013-12-13 12:43:07 · 1843 阅读 · 0 评论 -
fix协议介绍14-批量取消订单(OrderMassCancelRequest)
FIX.5.0SP2 MessageOrderMassCancelRequest [type 'q']The order mass cancel request message requests the cancellation of all of the remaining quantity of a group of orders matching criteria s原创 2013-12-13 20:04:07 · 1372 阅读 · 0 评论 -
fix协议介绍15-批量取消订单执行报告(OrderMassCancelReport)
FIX.5.0SP2 MessageOrderMassCancelReport [type 'r']The Order Mass Cancel Report is used to acknowledge an Order Mass Cancel Request. Note that each affected order that is canceled is acknow原创 2013-12-13 20:06:28 · 1332 阅读 · 0 评论 -
fix协议介绍16-查询叮当(quote)
FIX.5.0SP2 MessageQuote [type 'S']The Quote message is used as the response to a Quote Request or a Quote Response message in both indicative, tradeable, and restricted tradeable quoting m原创 2013-12-13 20:11:04 · 1808 阅读 · 0 评论 -
fix协议介绍17-查询订单状态报告(QuoteStateReport)
FIX.5.0SP2 MessageQuoteStatusReport [type 'AI']The quote status report message is used:• as the response to a Quote Status Request message• as a response to a Quote Cancel mess原创 2013-12-13 20:14:15 · 2019 阅读 · 0 评论 -
fix协议介绍18-取消查询订单(QuoteCancel)
FIX.5.0SP2 MessageQuoteCancel [type 'Z']The Quote Cancel message is used by an originator of quotes to cancel quotes.The Quote Cancel message supports cancellation of:• All quo原创 2013-12-13 20:17:02 · 1322 阅读 · 0 评论 -
fix协议介绍19-交易报告(TradeCaptureReport )
FIX.5.0SP2 MessageTradeCaptureReport [type 'AE']The Trade Capture Report message can be:• Used to report trades between counterparties.• Used to report trades to a trade matchi原创 2013-12-13 20:24:38 · 2180 阅读 · 0 评论 -
fix协议介绍20-TradeCaptureReportAck
FIX.5.0SP2 MessageTradeCaptureReportAck [type 'AR']The Trade Capture Report Ack message can be:• Used to acknowledge trade capture reports received from a counterparty• Used to原创 2013-12-13 20:27:11 · 1933 阅读 · 0 评论 -
Fix协议介绍21-party信息查询(PartyEntitlementsRequest )
FIX.5.0SP2_EP168 MessagePartyEntitlementsRequest [type 'CU']The PartyEntitlementsRequest message is used to request for entitlement information for one or more party(-ies), specific party原创 2013-12-13 20:30:47 · 1519 阅读 · 0 评论 -
Fix协议介绍22-party信息查询报告(PartyEntitlementsReport)
FIX.5.0SP2_EP168 MessagePartyEntitlementsReport [type 'CV']The PartyEntitlementsReport is used to report entitlements for one or more parties, party role(s), or specific instrument(s).原创 2013-12-13 20:32:37 · 1183 阅读 · 0 评论 -
fix协议封装挑战-BusinessMessageRejectMessageHandler
package cs.mina.client.handler;import java.util.Calendar;import java.util.Date;import java.util.GregorianCalendar;import org.apache.log4j.Logger;import org.apache.mina.core.session.IoSession;i原创 2017-07-11 09:15:48 · 759 阅读 · 0 评论 -
fix协议封装挑战-ClientHandlerFactory&ClientMessageHandler
package cs.mina.client.handler;import java.util.HashMap;import java.util.Map;/* *@author(huangxiaoping) *@date 2013-10-11 */public class ClientHandlerFactory { private static Map handlerMap=原创 2017-07-11 09:17:54 · 476 阅读 · 0 评论 -
fix协议封装挑战-DbFail
package cs.mina.client.handler;import java.io.Serializable;import java.util.concurrent.locks.Lock;import java.util.concurrent.locks.ReentrantLock;import cs.mina.codec.msg.BaseMsg;import cs.util原创 2017-07-11 09:20:06 · 488 阅读 · 0 评论 -
fix协议封装挑战-DbFailExecuteThreadHandler
package cs.mina.client.handler;import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date;import java.util.GregorianCalendar;import java.util.List;import java.util.concur原创 2017-07-11 09:21:56 · 593 阅读 · 0 评论