根据交易所接口文档 对重复组取值赋值,返回成交回报
来源:互联网 发布:实对称矩阵必可对角化 编辑:程序博客网 时间:2024/05/08 03:06
如上海交易所的综合业务中,股票期权组合拆分业务,柜台发到交易所的委托oiw..reqresp表中reqtext字段值为
9=19635=D11=0300000001522=148=CNSJC54=B38=1198= 555=2602=10000071624=L203= 685=1602=10000072624=S203= 685=1453=4448=A431800010452=5448=888452=500448=20403452=1448=0000 452=4001
按照市场参与者接口规格说明书,对这类委托的处理交易所需要返回成交回报也要有‘555字段值’个重复组,重复组内容为
602LegSecurityID合约编码、624LegSide合约方向、203CoveredOrUncovered备兑标签、685LegOrderQty申报数量;
先说结果,返回到oiw..execreport成交表的execreporttext字段内容为
9=27335=811=030000001048=CNSJC 17=20403154=B32=1198=2016110200000001555=2602=10000071624=L203=685=1602=10000072624=S203=685=18541=20160518-16:38:27.00042=20160518-16:38:27.000522=1453=4448=A431800010452=5448=888452=500448=20403452=1448=0000452=4001
这其中对重复组的判断和赋值处理如下:
function GetGroupLegesValue2(Hash: THashedStringList):string; //902var i:Integer; // bufferList下标 j,n : Integer; //重复组内组数 ipos : Integer; tmp:string;begin Result := ''; tmp := Hash.Values['555']; //2 if tmp='' then Exit; n := StrToInt(tmp); if n = 0 then Exit; Result := '555='+ IntToStr(n) + SOH; i := Hash.IndexOfName('555'); for j := 1 to n*4 do begin tmp := Hash.Strings[i + j]; if Pos(LeftStr(tmp,4),'602=624=203=685=') > 0 then Result := Result + tmp + SOH; end;end;
成交回报写到回报表oiw..execreport的方法如下:
function PostCJHB_OML(wt : PTReqResp;cjsl : Integer):Boolean; //期权组合、分拆、转备兑var FPTExecReport : PTExecReport; FPTExecReportText : PTExecReportText; sql, sExecReportText: string; i : Integer; tmp : string;begin if not Simulator.cjconn.Connected then begin Simulator.cjconn.ConnectionString := gconfig.DestConnnectString; Simulator.cjconn.Open; end; New(FPTExecReport); New(FPTExecReportText); Inc(wt.FEntrustXW.d_maxCJBH); FPTExecReport.ExecNum := wt.FEntrustXW.d_maxCJBH; FPTExecReport.BcastType := '7M'; FPTExecReport.SetID := '300'; FPTExecReport.SeqNum := FPTExecReport.ExecNum; FPTExecReport.RecordTimeStamp := LeftStr(wt.recordtimestamp,8) +'-'+TimeToStr(Time())+ '.000'; //拼接FPTResptext FPTExecReportText.clordid := wt.reff; FPTExecReportText.securityid := wt.securityid; FPTExecReportText.execid := wt.FPTReqtext.reportseat + IntToStr(FPTExecReport.ExecNum); FPTExecReportText.side := wt.FPTReqtext.side; FPTExecReportText.lastqty := IntToStr(cjsl); //FPTExecReportText.orderid := wt.FPTResptext.orderid; 没有orderid字段,但有SecondaryOrderID字段 if wt.FPTReqtext.SecondaryOrderID = '' then //组合指令时为空 begin tmp := IntToStr(wt.localrespnum); tmp := rightstr('0000000' + tmp, 8); //前补0凑8位 FPTExecReportText.SecondaryOrderID := FormatDateTime('yyyymmdd', now)+ tmp; end else begin FPTExecReportText.SecondaryOrderID := wt.FPTReqtext.SecondaryOrderID;// 拆分指令时为组合编号 end; FPTExecReportText.GroupLeges := wt.FPTReqtext.GroupLeges; FPTExecReportText.transacttime := FPTExecReport.RecordTimeStamp; FPTExecReportText.origtime := wt.FPTResptext.transacttime; FPTExecReportText.OwnerType := wt.FPTReqtext.OwnerType; FPTExecReportText.stockholder := wt.FPTReqtext.stockholder; FPTExecReportText.reportseat := wt.FPTReqtext.reportseat; FPTExecReportText.branchCode := wt.FPTReqtext.branchCode; MakeCJText_OML(FPTExecReportText,sExecReportText); FPTExecReport.ExecReportText := sExecReportText; sql := 'insert into ' + wt.FEntrustXW.vc_HBLJ + ' (execnum,bcasttype,setid,seqnum,recordtimestamp,execreporttext) '; sql := sql + 'select ' + IntToStr(FPTExecReport.ExecNum) + ', ' + QuotedStr(FPTExecReport.BcastType) + ', ' + QuotedStr(FPTExecReport.SetID) + ', ' + IntToStr(FPTExecReport.SeqNum) + ', ' + QuotedStr(FPTExecReport.RecordTimeStamp) + ', ' + QuotedStr(FPTExecReport.ExecReportText); Simulator.WTQuery.InsertCommitSQL(sql); //ExecQuery2(Simulator.cjconn,sql); StatInfo.IncStat(wt.pbu, 'cj', 1); Simulator.AddLog(2,wt.pbu + ':' + wt.reff +'成交'+inttostr(cjsl)); //加日志 result := true;end;
其中报文打包函数MakeCJText_OML(FPTExecReportText,sExecReportText)为:
function MakeCJText_OML(ExecReportText:PTExecReportText;var sExecReportText:string):Boolean;var fixPkg : TFixPackage;begin fixPkg := TFixPackage.Create(); fixPkg.BeginPkg; fixPkg.MsgType := '8'; fixPkg.ClOrdID := ExecReportText.clordid; fixPkg.SecurityID := ExecReportText.SecurityID; fixPkg.ExecID := ExecReportText.ExecID; fixPkg.Side := ExecReportText.Side; //B,C,D fixPkg.LastQty := ExecReportText.LastQty; fixPkg.SecondaryOrderID := ExecReportText.SecondaryOrderID; //这个字段在调用前要特别处理 pitodo fixPkg.setGroupLegesValue(ExecReportText.GroupLeges); //合约重复组 602LegSecurityID合约编码C8 //624LegSide合约方向,L为权利仓,S为义务仓C1 //685LegOrderQty申报数量(张)N10 fixPkg.AddValue(Const_TransactTimeOnly,ExecReportText.transacttime,TC,21); fixPkg.OrigTime := ExecReportText.origtime; fixPkg.OwnerType := ExecReportText.OwnerType; fixPkg.NoPartyIDs := 4; fixPkg.stockholderid:= ExecReportText.stockholder; fixPkg.stockholderidSubCode := '888'; fixPkg.SetReportSeat(ExecReportText.reportseat); fixPkg.SetBranchCode(ExecReportText.branchCode); fixPkg.EndPkg; sExecReportText := fixPkg.Buffer; fixPkg.Free; Result := True;end;
0 0
- 根据交易所接口文档 对重复组取值赋值,返回成交回报
- 成交回报分析器2.0
- 上海交易所模拟成交存储过程
- 期货交易所接口系统哪家强
- 根据接口文档撸代码的心得
- 对Go的接口赋值的理解
- 根据一个接口返回该接口的所有实现类
- 食品新闻接口文档及返回示例
- 引用作为函数返回值(对函数赋值)
- Sql 根据名称剔除重复数据、根据id返回最新的
- 如何根据请求报文跟返回报文写webservice接口
- 对人施恩,勿望回报
- 如何删除重复的型号获取最新成交价格?
- 调用接口,解析返回的的string类型xml文档
- 根据身份证自动赋值
- 有关对webservice返回的XML文档的改进
- 链接.. '(null)' 的 .接口'STREAM' 返回了对列 '[!BulkInsert]
- mojo 接口返回键值对的json格式
- bzoj 4195: [Noi2015]程序自动分析 (并查集+离散化)
- 省份城市三级联动
- CTS测试-com.android.cts.appsecurity.AdoptableHostTest -testPrimaryStorage
- 光传感器~考虑因素
- momentJS时间加减处理
- 根据交易所接口文档 对重复组取值赋值,返回成交回报
- nginx常用命令
- colorAccent,colorPrimary,colorPrimaryDark……图解
- POJ2688Cleaning Robot bfs+dfs
- ndnSIM中LCD的简单实现
- loushang 2016(基于spring3.2)的定时任务配置---spring task
- java内部类的使用
- POJ 2955 Brackets(括号最大匹配,区间DP)
- java web 听器快速入门 快速回顾