package models import ( "mtp2_if/db" "time" ) // Tradeposition 持仓头寸表 - 导历史 type Tradeposition struct { Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'" binding:"required"` // 账号Id Goodsid int32 `json:"goodsid" xorm:"'GOODSID'" binding:"required"` // 商品Id Holdertype int32 `json:"holdertype" xorm:"'HOLDERTYPE'" binding:"required"` // 持仓类别 - 1:单边持仓 2:双边持仓 Buypositionqty int64 `json:"buypositionqty" xorm:"'BUYPOSITIONQTY'"` // 买期初持仓数量 Buyholderamount float64 `json:"buyholderamount" xorm:"'BUYHOLDERAMOUNT'"` // 买期初持仓总金额[商品币种] Buycurpositionqty int64 `json:"buycurpositionqty" xorm:"'BUYCURPOSITIONQTY'"` // 买当前持仓总数量 Buycurholderamount float64 `json:"buycurholderamount" xorm:"'BUYCURHOLDERAMOUNT'"` // 买当前持仓总金额[商品币种] Buyfrozenqty int64 `json:"buyfrozenqty" xorm:"'BUYFROZENQTY'"` // 买持仓冻结数量 Buyotherfrozenqty int64 `json:"buyotherfrozenqty" xorm:"'BUYOTHERFROZENQTY'"` // 买持仓其他冻结数量(交割冻结) Buyopenreqqty int64 `json:"buyopenreqqty" xorm:"'BUYOPENREQQTY'"` // 买开仓申请数量(用于比较最大持仓数量) Buyopentotalqty int64 `json:"buyopentotalqty" xorm:"'BUYOPENTOTALQTY'"` // 买开仓总数量 Buyclosetotalqty int64 `json:"buyclosetotalqty" xorm:"'BUYCLOSETOTALQTY'"` // 买平仓总数量 Sellpositionqty int64 `json:"sellpositionqty" xorm:"'SELLPOSITIONQTY'"` // 卖期初持仓数量 Sellholderamount float64 `json:"sellholderamount" xorm:"'SELLHOLDERAMOUNT'"` // 卖期初持仓总金额[商品币种] Sellcurpositionqty int64 `json:"sellcurpositionqty" xorm:"'SELLCURPOSITIONQTY'"` // 卖当前持仓数量 Sellcurholderamount float64 `json:"sellcurholderamount" xorm:"'SELLCURHOLDERAMOUNT'"` // 卖当前持仓总金额[商品币种] Sellfrozenqty int64 `json:"sellfrozenqty" xorm:"'SELLFROZENQTY'"` // 卖持仓冻结 Sellotherfrozenqty int64 `json:"sellotherfrozenqty" xorm:"'SELLOTHERFROZENQTY'"` // 卖持仓其他冻结(交割冻结) Sellopenreqqty int64 `json:"sellopenreqqty" xorm:"'SELLOPENREQQTY'"` // 卖开仓申请数量(用于比较最大持仓数量) Sellopentotalqty int64 `json:"sellopentotalqty" xorm:"'SELLOPENTOTALQTY'"` // 卖开仓总数量 Sellclosetotalqty int64 `json:"sellclosetotalqty" xorm:"'SELLCLOSETOTALQTY'"` // 卖平仓总数量 Usedmargin float64 `json:"usedmargin" xorm:"'USEDMARGIN'"` // 占用保证金[商品币种] Tradeproperty int32 `json:"tradeproperty" xorm:"'TRADEPROPERTY'"` // 交易属性 Buytnqty int64 `json:"buytnqty" xorm:"'BUYTNQTY'"` // 买T+N冻结总量 Buytnusedqty int64 `json:"buytnusedqty" xorm:"'BUYTNUSEDQTY'"` // 买T+N使用量(可以使用T+N的冻结数量) Selltnqty int64 `json:"selltnqty" xorm:"'SELLTNQTY'"` // 卖T+N冻结总量 Selltnusedqty int64 `json:"selltnusedqty" xorm:"'SELLTNUSEDQTY'"` // 卖T+N使用量(可以使用T+N的冻结数量) Buycurtdposition int64 `json:"buycurtdposition" xorm:"'BUYCURTDPOSITION'"` // 买期末今日头寸 Buyfretdposition int64 `json:"buyfretdposition" xorm:"'BUYFRETDPOSITION'"` // 买冻结今日头寸 Sellcurtdposition int64 `json:"sellcurtdposition" xorm:"'SELLCURTDPOSITION'"` // 卖期末今日头寸 Sellfretdposition int64 `json:"sellfretdposition" xorm:"'SELLFRETDPOSITION'"` // 卖冻结今日头寸 } // TableName is TRADEPOSITION func (Tradeposition) TableName() string { return "TRADEPOSITION" } // Tradeorderdetail 交易委托单表 - 导历史 type Tradeorderdetail struct { Orderid int64 `json:"orderid" xorm:"'ORDERID'" binding:"required"` // 委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx) Tradedate string `json:"tradedate" xorm:"'TRADEDATE'" binding:"required"` // 交易日(yyyyMMdd) Buildtype int32 `json:"buildtype" xorm:"'BUILDTYPE'" binding:"required"` // 委托单据类型 - 1:建仓 2:平仓 3:先平后建 Preorderid int64 `json:"preorderid" xorm:"'PREORDERID'"` // 关联预埋单号(止盈止损单时填写) Cancelorderid int64 `json:"cancelorderid" xorm:"'CANCELORDERID'"` // 撤单单号(撤单时填写) Relatedid int64 `json:"relatedid" xorm:"'RELATEDID'"` // 关联单号(交割单) Marketid int32 `json:"marketid" xorm:"'MARKETID'" binding:"required"` // 市场ID Goodsid int32 `json:"goodsid" xorm:"'GOODSID'" binding:"required"` // 商品ID Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'" binding:"required"` // 账户ID[报价币种] Memberuserid int64 `json:"memberuserid" xorm:"'MEMBERUSERID'" binding:"required"` // 所属会员UserID Buyorsell int32 `json:"buyorsell" xorm:"'BUYORSELL'" binding:"required"` // 买卖 - 0:买 1:卖 Pricemode int32 `json:"pricemode" xorm:"'PRICEMODE'" binding:"required"` // 取价方式 - 1:市价 2: 限价 Orderprice float64 `json:"orderprice" xorm:"'ORDERPRICE'"` // 委托价格 Marketmaxsub float64 `json:"marketmaxsub" xorm:"'MARKETMAXSUB'"` // 市价最大偏移范围 Orderqty int64 `json:"orderqty" xorm:"'ORDERQTY'" binding:"required"` // 委托数量 Tradeqty int64 `json:"tradeqty" xorm:"'TRADEQTY'"` // 成交数量 Cancelqty int64 `json:"cancelqty" xorm:"'CANCELQTY'"` // 撤单数量 Openqty int64 `json:"openqty" xorm:"'OPENQTY'"` // 开仓数量(先建后平操作,需要记录) Closeqty int64 `json:"closeqty" xorm:"'CLOSEQTY'"` // 平仓数量(先建后平操作 需要记录) Opentradeqty int64 `json:"opentradeqty" xorm:"'OPENTRADEQTY'"` // 开仓成交数量(先建后平操作,需要记录) Closetradeqty int64 `json:"closetradeqty" xorm:"'CLOSETRADEQTY'"` // 平仓成交数量(先建后平操作,需要记录) Freezemargin float64 `json:"freezemargin" xorm:"'FREEZEMARGIN'"` // 冻结保证金(冻结交易金额) Unfreezemargin float64 `json:"unfreezemargin" xorm:"'UNFREEZEMARGIN'"` // 解冻保证金 Freezecharge float64 `json:"freezecharge" xorm:"'FREEZECHARGE'"` // 冻结手续费 Unfreezecharge float64 `json:"unfreezecharge" xorm:"'UNFREEZECHARGE'"` // 解冻手续费 Openfreezecharge float64 `json:"openfreezecharge" xorm:"'OPENFREEZECHARGE'"` // 开仓冻结手续费(先建后平操作,需要记录) Closefreezecharge float64 `json:"closefreezecharge" xorm:"'CLOSEFREEZECHARGE'"` // 平仓冻结手续费(先建后平操作,需要记录) Openunfreezecharge float64 `json:"openunfreezecharge" xorm:"'OPENUNFREEZECHARGE'"` // 开仓解冻手续费(先建后平操作,需要记录) Closeunfreezecharge float64 `json:"closeunfreezecharge" xorm:"'CLOSEUNFREEZECHARGE'"` // 平仓解冻手续费(先建后平操作,需要记录) Validtype int32 `json:"validtype" xorm:"'VALIDTYPE'" binding:"required"` // 有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效 5指定时间有效 Validtime time.Time `json:"validtime" xorm:"'VALIDTIME'"` // 有效期限 Volumetype int32 `json:"volumetype" xorm:"'VOLUMETYPE'"` // 当时间有效类型为 “立即执行否则取消 IOC” 时,需要此项 - 0:任意量 1:最小量(暂时不支持) 2:全部量 Operatetype int32 `json:"operatetype" xorm:"'OPERATETYPE'" binding:"required"` // 操作类型 - 1:正常下单 2:斩仓 3:转单 4:结算撤单 5:系统卖出(适用于先平后建的卖出) 6:行情源报价 7:(结算)到期强平 8:(结算)协议转让 9:系统对冲单 10:(结算)到期无效 11:交割协议转让 12:交割协议平仓 13:交割成交(所有权) 14:管理端强行平仓 15:管理端协议转让 Ordertime time.Time `json:"ordertime" xorm:"'ORDERTIME'" binding:"required"` // 委托时间 Ordersrc int32 `json:"ordersrc" xorm:"'ORDERSRC'"` // 委托来源 - 1:客户端 2:管理端 3:风控服务 4:交割服务 5:交易服务 6:交易日结 7:商品强平 8:管理端商品退市强平 9:交易接口 10:交割服务商被动(受托竞价) 11:预埋触发 Orderstatus int32 `json:"orderstatus" xorm:"'ORDERSTATUS'"` // 委托状态 - 1: 委托请求 2:待冻结 3:委托成功 4: 委托失败 5:配对成功 6: 已撤销 7:部分成交 8:已成交 9:部成部撤 10:成交失败 11:已拒绝 12:经过摘牌(先摘后挂专用-先摘后挂已摘过) 13:冻结成功(通道交易专用) 14:通道已撤 15:通道部成部撤 16:成交失败违约(荷兰式竞拍专用) Operatorid int64 `json:"operatorid" xorm:"'OPERATORID'"` // 登录账号(LoginID) Updatetime time.Time `json:"updatetime" xorm:"'UPDATETIME'"` // 更新时间 Clientordertime time.Time `json:"clientordertime" xorm:"'CLIENTORDERTIME'"` // 客户端委托时间 Clientticket string `json:"clientticket" xorm:"'CLIENTTICKET'"` // 客户端流水号 UUID string `json:"uuid" xorm:"'UUID'"` // 发起端唯一id Clienttype int32 `json:"clienttype" xorm:"'CLIENTTYPE'"` // 客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端 6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江) Retcode int32 `json:"retcode" xorm:"'RETCODE'"` // 错误代码 Tradeproperty int32 `json:"tradeproperty" xorm:"'TRADEPROPERTY'"` // 交易属性 Listingselecttype int32 `json:"listingselecttype" xorm:"'LISTINGSELECTTYPE'"` // 挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂 Delistingtype int32 `json:"delistingtype" xorm:"'DELISTINGTYPE'"` // 摘牌类型 - 1:价格最优 2:点选成交 Marginalgorithm int32 `json:"marginalgorithm" xorm:"'MARGINALGORITHM'"` // 保证金收取方式 1:比率 2:固定 Marginvalue float64 `json:"marginvalue" xorm:"'MARGINVALUE'"` // 即市保证金设置值 Openfeealgorithm int32 `json:"openfeealgorithm" xorm:"'OPENFEEALGORITHM'"` // 建仓手续费收取方式 1:比率 2:固定 Openmemberchargevalue float64 `json:"openmemberchargevalue" xorm:"'OPENMEMBERCHARGEVALUE'"` // 建仓会员手续费设置值 Openexchagechargevalue float64 `json:"openexchagechargevalue" xorm:"'OPENEXCHAGECHARGEVALUE'"` // 建仓交易所手续费设置值 Closefeealgorithm int32 `json:"closefeealgorithm" xorm:"'CLOSEFEEALGORITHM'"` // 平仓手续费收取方式 1:比率 2:固定 Closememberchargevalue float64 `json:"closememberchargevalue" xorm:"'CLOSEMEMBERCHARGEVALUE'"` // 平仓会员手续费设置值 Closeexchagechargevalue float64 `json:"closeexchagechargevalue" xorm:"'CLOSEEXCHAGECHARGEVALUE'"` // 平仓交易所手续费设置值 Optiontype int32 `json:"optiontype" xorm:"'OPTIONTYPE'"` // 期权类型 - 1:认购(看涨) 2:认沽(看跌) Premium float64 `json:"premium" xorm:"'PREMIUM'"` // 权利金 Ispreexercise int32 `json:"ispreexercise" xorm:"'ISPREEXERCISE'"` // 是否预申报- 0:否 1:是 Preexerciseprice float64 `json:"preexerciseprice" xorm:"'PREEXERCISEPRICE'"` // 预申报价格 Isconfirmexercise int32 `json:"isconfirmexercise" xorm:"'ISCONFIRMEXERCISE'"` // 是否确认行权- 0:否 1:是 Quoteid int64 `json:"quoteid" xorm:"'QUOTEID'"` // 报价单ID Gcaccountid int64 `json:"gcaccountid" xorm:"'GCACCOUNTID'"` // 账户ID[合约币种] Sessionid int64 `json:"sessionid" xorm:"'SESSIONID'"` // 会话ID } // TableName is TRADE_ORDERDETAIL func (Tradeorderdetail) TableName() string { return "TRADE_ORDERDETAIL" } // Histradeorderdetail 历史交易委托单表 type Histradeorderdetail struct { Orderid string `json:"orderid" xorm:"'ORDERID'" binding:"required"` // 委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx) Tradedate string `json:"tradedate" xorm:"'TRADEDATE'" binding:"required"` // 交易日(yyyyMMdd) Buildtype int32 `json:"buildtype" xorm:"'BUILDTYPE'" binding:"required"` // 委托单据类型 - 1:建仓 2:平仓 3:先平后建 Preorderid string `json:"preorderid" xorm:"'PREORDERID'"` // 关联预埋单号(止盈止损单时填写) Cancelorderid string `json:"cancelorderid" xorm:"'CANCELORDERID'"` // 撤单单号(撤单时填写) Relatedid string `json:"relatedid" xorm:"'RELATEDID'"` // 关联单号(交割单) Marketid int32 `json:"marketid" xorm:"'MARKETID'" binding:"required"` // 市场ID Goodsid int32 `json:"goodsid" xorm:"'GOODSID'" binding:"required"` // 商品ID Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'" binding:"required"` // 账户ID[报价币种] Memberuserid int64 `json:"memberuserid" xorm:"'MEMBERUSERID'" binding:"required"` // 所属会员UserID Buyorsell int32 `json:"buyorsell" xorm:"'BUYORSELL'" binding:"required"` // 买卖 - 0:买 1:卖 Pricemode int32 `json:"pricemode" xorm:"'PRICEMODE'" binding:"required"` // 取价方式 - 1:市价 2: 限价 Orderprice float64 `json:"orderprice" xorm:"'ORDERPRICE'"` // 委托价格 Marketmaxsub float64 `json:"marketmaxsub" xorm:"'MARKETMAXSUB'"` // 市价最大偏移范围 Orderqty float64 `json:"orderqty" xorm:"'ORDERQTY'" binding:"required"` // 委托数量 Tradeqty float64 `json:"tradeqty" xorm:"'TRADEQTY'"` // 成交数量 Cancelqty float64 `json:"cancelqty" xorm:"'CANCELQTY'"` // 撤单数量 Openqty float64 `json:"openqty" xorm:"'OPENQTY'"` // 开仓数量(先建后平操作,需要记录) Closeqty float64 `json:"closeqty" xorm:"'CLOSEQTY'"` // 平仓数量(先建后平操作 需要记录) Opentradeqty float64 `json:"opentradeqty" xorm:"'OPENTRADEQTY'"` // 开仓成交数量(先建后平操作,需要记录) Closetradeqty float64 `json:"closetradeqty" xorm:"'CLOSETRADEQTY'"` // 平仓成交数量(先建后平操作,需要记录) Freezemargin float64 `json:"freezemargin" xorm:"'FREEZEMARGIN'"` // 冻结保证金(冻结交易金额) Unfreezemargin float64 `json:"unfreezemargin" xorm:"'UNFREEZEMARGIN'"` // 解冻保证金 Freezecharge float64 `json:"freezecharge" xorm:"'FREEZECHARGE'"` // 冻结手续费 Unfreezecharge float64 `json:"unfreezecharge" xorm:"'UNFREEZECHARGE'"` // 解冻手续费 Openfreezecharge float64 `json:"openfreezecharge" xorm:"'OPENFREEZECHARGE'"` // 开仓冻结手续费(先建后平操作,需要记录) Closefreezecharge float64 `json:"closefreezecharge" xorm:"'CLOSEFREEZECHARGE'"` // 平仓冻结手续费(先建后平操作,需要记录) Openunfreezecharge float64 `json:"openunfreezecharge" xorm:"'OPENUNFREEZECHARGE'"` // 开仓解冻手续费(先建后平操作,需要记录) Closeunfreezecharge float64 `json:"closeunfreezecharge" xorm:"'CLOSEUNFREEZECHARGE'"` // 平仓解冻手续费(先建后平操作,需要记录) Validtype int32 `json:"validtype" xorm:"'VALIDTYPE'" binding:"required"` // 有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效 5指定时间有效 Validtime time.Time `json:"validtime" xorm:"'VALIDTIME'"` // 有效期限 Volumetype int32 `json:"volumetype" xorm:"'VOLUMETYPE'"` // 当时间有效类型为 “立即执行否则取消 IOC” 时,需要此项 - 0:任意量 1:最小量(暂时不支持) 2:全部量 Operatetype int32 `json:"operatetype" xorm:"'OPERATETYPE'" binding:"required"` // 操作类型 - 1:正常下单 2:斩仓 3:转单 4:结算撤单 5:系统卖出(适用于先平后建的卖出) 6:行情源报价 7:(结算)到期强平 8:(结算)协议转让 9:系统对冲单 10:(结算)到期无效 11:交割协议转让 12:交割协议平仓 13:交割成交(所有权) 14:管理端强行平仓 15:管理端协议转让 Ordertime time.Time `json:"ordertime" xorm:"'ORDERTIME'" binding:"required"` // 委托时间 Ordersrc int32 `json:"ordersrc" xorm:"'ORDERSRC'"` // 委托来源 - 1:客户端 2:管理端 3:风控服务 4:交割服务 5:交易服务 6:交易日结 7:商品强平 8:管理端商品退市强平 9:交易接口 10:交割服务商被动(受托竞价) 11:预埋触发 Orderstatus int32 `json:"orderstatus" xorm:"'ORDERSTATUS'"` // 委托状态 - 1: 委托请求 2:待冻结 3:委托成功 4: 委托失败 5:配对成功 6: 已撤销 7:部分成交 8:已成交 9:部成部撤 10:成交失败 11:已拒绝 12:经过摘牌(先摘后挂专用-先摘后挂已摘过) 13:冻结成功(通道交易专用) 14:通道已撤 15:通道部成部撤 16:成交失败违约(荷兰式竞拍专用) Operatorid int64 `json:"operatorid" xorm:"'OPERATORID'"` // 登录账号(LoginID) Updatetime time.Time `json:"updatetime" xorm:"'UPDATETIME'"` // 更新时间 Clientordertime time.Time `json:"clientordertime" xorm:"'CLIENTORDERTIME'"` // 客户端委托时间 Clientticket string `json:"clientticket" xorm:"'CLIENTTICKET'"` // 客户端流水号 UUID string `json:"uuid" xorm:"'UUID'"` // 发起端唯一id Clienttype int32 `json:"clienttype" xorm:"'CLIENTTYPE'"` // 客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端 6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江) Retcode int32 `json:"retcode" xorm:"'RETCODE'"` // 错误代码 Tradeproperty int32 `json:"tradeproperty" xorm:"'TRADEPROPERTY'"` // 交易属性 Listingselecttype int32 `json:"listingselecttype" xorm:"'LISTINGSELECTTYPE'"` // 挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂 Delistingtype int32 `json:"delistingtype" xorm:"'DELISTINGTYPE'"` // 摘牌类型 - 1:价格最优 2:点选成交 Marginalgorithm int32 `json:"marginalgorithm" xorm:"'MARGINALGORITHM'"` // 保证金收取方式 1:比率 2:固定 Marginvalue float64 `json:"marginvalue" xorm:"'MARGINVALUE'"` // 即市保证金设置值 Openfeealgorithm int32 `json:"openfeealgorithm" xorm:"'OPENFEEALGORITHM'"` // 建仓手续费收取方式 1:比率 2:固定 Openmemberchargevalue float64 `json:"openmemberchargevalue" xorm:"'OPENMEMBERCHARGEVALUE'"` // 建仓会员手续费设置值 Openexchagechargevalue float64 `json:"openexchagechargevalue" xorm:"'OPENEXCHAGECHARGEVALUE'"` // 建仓交易所手续费设置值 Closefeealgorithm int32 `json:"closefeealgorithm" xorm:"'CLOSEFEEALGORITHM'"` // 平仓手续费收取方式 1:比率 2:固定 Closememberchargevalue float64 `json:"closememberchargevalue" xorm:"'CLOSEMEMBERCHARGEVALUE'"` // 平仓会员手续费设置值 Closeexchagechargevalue float64 `json:"closeexchagechargevalue" xorm:"'CLOSEEXCHAGECHARGEVALUE'"` // 平仓交易所手续费设置值 Optiontype int32 `json:"optiontype" xorm:"'OPTIONTYPE'"` // 期权类型 - 1:认购(看涨) 2:认沽(看跌) Premium float64 `json:"premium" xorm:"'PREMIUM'"` // 权利金 Ispreexercise int32 `json:"ispreexercise" xorm:"'ISPREEXERCISE'"` // 是否预申报- 0:否 1:是 Preexerciseprice float64 `json:"preexerciseprice" xorm:"'PREEXERCISEPRICE'"` // 预申报价格 Isconfirmexercise int32 `json:"isconfirmexercise" xorm:"'ISCONFIRMEXERCISE'"` // 是否确认行权- 0:否 1:是 Quoteid int64 `json:"quoteid" xorm:"'QUOTEID'"` // 报价单ID Gcaccountid int64 `json:"gcaccountid" xorm:"'GCACCOUNTID'"` // 账户ID[合约币种] Sessionid int64 `json:"sessionid" xorm:"'SESSIONID'"` // 会话ID Histradedate string `json:"histradedate" xorm:"'HISTRADEDATE'" binding:"required"` // 历史交易日 Isvaliddata int32 `json:"isvaliddata" xorm:"'ISVALIDDATA'"` // 是否有效 - 0:无效 1:有效 } // TableName is HIS_TRADE_ORDERDETAIL func (Histradeorderdetail) TableName() string { return "HIS_TRADE_ORDERDETAIL" } // Tradequotedetailnew 报价商报价表 - 导历史 type Tradequotedetailnew struct { Quoterid int64 `json:"quoterid" xorm:"'QUOTERID'" binding:"required"` // 报价商ID Goodsid int32 `json:"goodsid" xorm:"'GOODSID'" binding:"required"` // 商品ID Buyorsell int32 `json:"buyorsell" xorm:"'BUYORSELL'" binding:"required"` // 买卖方向 - 0:买 1:卖 Tradedate string `json:"tradedate" xorm:"'TRADEDATE'"` // 交易日(yyyyMMdd) Quotetime time.Time `json:"quotetime" xorm:"'QUOTETIME'"` // 报价时间 Orderid int64 `json:"orderid" xorm:"'ORDERID'"` // 委托单ID(使用委托单规则生成) Quoteid int64 `json:"quoteid" xorm:"'QUOTEID'"` // 报价单ID(自动报价) Price float64 `json:"price" xorm:"'PRICE'"` // 价格 Qty int64 `json:"qty" xorm:"'QTY'"` // 数量 Curqty int64 `json:"curqty" xorm:"'CURQTY'"` // 当前量 Move float64 `json:"move" xorm:"'MOVE'"` // 点差 整数 可零正负 Limitprice float64 `json:"limitprice" xorm:"'LIMITPRICE'"` // 最高买价/最低卖价 Quotesource int32 `json:"quotesource" xorm:"'QUOTESOURCE'"` // 报价来源 - 0:外部行情 1:管理端手动报价2:自动报价服务报价 3:交易接口 Quoteeffectivesecond int64 `json:"quoteeffectivesecond" xorm:"'QUOTEEFFECTIVESECOND'"` // 行情有效时间(秒) Expireddate time.Time `json:"expireddate" xorm:"'EXPIREDDATE'"` // 有效时间(根据秒算出实际时间) Freezeamount float64 `json:"freezeamount" xorm:"'FREEZEAMOUNT'"` // 剩余冻结资金(所有权) Freezestatus int32 `json:"freezestatus" xorm:"'FREEZESTATUS'"` // 冻结状态(所有权) - 1:无冻结 2:已冻结 3:已解冻 Pricetype int32 `json:"pricetype" xorm:"'PRICETYPE'"` // 报价类型 - 1:不报价 2:手工报价 Qtytype int32 `json:"qtytype" xorm:"'QTYTYPE'"` // 报量类型 - 1:随机量 2:手工报量 3:延用量 Isvalid int32 `json:"isvalid" xorm:"'ISVALID'"` // 是否撤销 - 0:未撤销 1:已撤销 Marketid int32 `json:"marketid" xorm:"'MARKETID'"` // 市场ID Tradeproperty int32 `json:"tradeproperty" xorm:"'TRADEPROPERTY'"` // 交易属性 - 1:收益权(可做空) 2:所有权(不可做空) 3:期权 4:现货 5:参考行情 Freezeprice float64 `json:"freezeprice" xorm:"'FREEZEPRICE'"` // 冻结资金价格 Serialnumber string `json:"serialnumber" xorm:"'SERIALNUMBER'"` // 外部流水号 Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'"` // 报价资金账号 } // TableName is TRADE_QUOTEDETAILNEW func (Tradequotedetailnew) TableName() string { return "TRADE_QUOTEDETAILNEW" } // Tradetradedetail 交易成交单表 - 导历史 type Tradetradedetail struct { Tradeid string `json:"tradeid" xorm:"'TRADEID'" binding:"required"` // 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx) Buyorsell int32 `json:"buyorsell" xorm:"'BUYORSELL'" binding:"required"` // 方向 - 0:买 1:卖 Orderid string `json:"orderid" xorm:"'ORDERID'" binding:"required"` // 委托单号 Tradedate string `json:"tradedate" xorm:"'TRADEDATE'" binding:"required"` // 交易日(yyyyMMdd) Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'" binding:"required"` // 账户ID[报价币种] Goodsid int32 `json:"goodsid" xorm:"'GOODSID'" binding:"required"` // 商品ID Marketid int32 `json:"marketid" xorm:"'MARKETID'" binding:"required"` // 市场ID Memberuserid int64 `json:"memberuserid" xorm:"'MEMBERUSERID'" binding:"required"` // 会员id 个人投资者 需要填写 Matchaccountid int64 `json:"matchaccountid" xorm:"'MATCHACCOUNTID'"` // 对手账号id Tradetime time.Time `json:"tradetime" xorm:"'TRADETIME'" binding:"required"` // 成交时间 Tradeprice float64 `json:"tradeprice" xorm:"'TRADEPRICE'" binding:"required"` // 成交价格 Tradeamount float64 `json:"tradeamount" xorm:"'TRADEAMOUNT'" binding:"required"` // 成交金额[账户币种,用于所有权] Closepl float64 `json:"closepl" xorm:"'CLOSEPL'"` // 平仓盈亏 Intclosepl int64 `json:"intclosepl" xorm:"'INTCLOSEPL'"` // 整型盈亏(用于交易结算试算平衡-收益权) Opencharge float64 `json:"opencharge" xorm:"'OPENCHARGE'"` // 建仓手续费(支付总手续费=(交易所比率+会员比率)*成交金额) Closecharge float64 `json:"closecharge" xorm:"'CLOSECHARGE'"` // 平仓手续费(支付总手续费=(交易所比率+会员比率)*成交金额) Tradetype int32 `json:"tradetype" xorm:"'TRADETYPE'"` // 成交类别 - 1:正常委托成交 2:定向做市成交(接单) 3:交割协议平仓成交 4:交割减仓成交 5:到期强平成交 6:风控斩仓成交 7:协议平仓(管理端)成交 8:仓单转持仓成交 9: 交割协议转让成交 10:受托竞价成交(接单) 11:协议转让成交 12:系统强行平仓 13:期权违约平仓 Buildtype int32 `json:"buildtype" xorm:"'BUILDTYPE'"` // 委托单据类型 1:建仓 2:平仓 3:先平后建 Tradeqty float64 `json:"tradeqty" xorm:"'TRADEQTY'" binding:"required"` // 成交数量 Openqty float64 `json:"openqty" xorm:"'OPENQTY'"` // 开仓数量(先建后平操作 需要记录) Closeqty float64 `json:"closeqty" xorm:"'CLOSEQTY'"` // 平仓数量(先建后平操作 需要记录) Status int32 `json:"status" xorm:"'STATUS'"` // 处理状态 - 1:待处理 2:已处理 3:处理失败 Isreckoned int32 `json:"isreckoned" xorm:"'ISRECKONED'"` // 是否结算 - 0:未结算 1:已结算 Tradeproperty int32 `json:"tradeproperty" xorm:"'TRADEPROPERTY'"` // 交易属性 Openfeealgorithm int32 `json:"openfeealgorithm" xorm:"'OPENFEEALGORITHM'"` // 建仓手续费收取方式 1:比率 2:固定 Openmemberchargevalue float64 `json:"openmemberchargevalue" xorm:"'OPENMEMBERCHARGEVALUE'"` // 建仓会员手续费设置值 Openexchagechargevalue float64 `json:"openexchagechargevalue" xorm:"'OPENEXCHAGECHARGEVALUE'"` // 建仓交易所手续费设置值 Closefeealgorithm int32 `json:"closefeealgorithm" xorm:"'CLOSEFEEALGORITHM'"` // 平仓手续费收取方式 1:比率 2:固定 Closememberchargevalue float64 `json:"closememberchargevalue" xorm:"'CLOSEMEMBERCHARGEVALUE'"` // 平仓会员手续费设置值 Closeexchagechargevalue float64 `json:"closeexchagechargevalue" xorm:"'CLOSEEXCHAGECHARGEVALUE'"` // 平仓交易所手续费设置值 Optiontype int32 `json:"optiontype" xorm:"'OPTIONTYPE'"` // 期权类型 - 1:认购(看涨) 2:认沽(看跌) Premium float64 `json:"premium" xorm:"'PREMIUM'"` // 权利金 - [持仓单的权利金] Ispreexercise int32 `json:"ispreexercise" xorm:"'ISPREEXERCISE'"` // 是否预申报- 0:否 1:是 Preexerciseprice float64 `json:"preexerciseprice" xorm:"'PREEXERCISEPRICE'"` // 预申报价格 Isconfirmexercise int32 `json:"isconfirmexercise" xorm:"'ISCONFIRMEXERCISE'"` // 是否确认行权- 0:否 1:是 Ismain int32 `json:"ismain" xorm:"'ISMAIN'"` // 是否主单 - 0:不是 1:是 Performanceplanid int64 `json:"performanceplanid" xorm:"'PERFORMANCEPLANID'"` // 履约计划ID[期权] Performancestatus int32 `json:"performancestatus" xorm:"'PERFORMANCESTATUS'"` // 履约状态[期权] - 0:无履约 1:未履约 2:履约中 3:履约完成 Creditamount float64 `json:"creditamount" xorm:"'CREDITAMOUNT'"` // 授信金额 Gcaccountid int64 `json:"gcaccountid" xorm:"'GCACCOUNTID'"` // 账户ID[合约币种] Closepl2 float64 `json:"closepl2" xorm:"'CLOSEPL2'"` // 平仓盈亏[逐笔] Relatedouttradeid int64 `json:"relatedouttradeid" xorm:"'RELATEDOUTTRADEID'"` // 关联外部成交单ID InitFeeValue float64 `json:"initfeevalue" xorm:"'INITFEEVALUE'"` // 应收手续费(50) } // TableName is TRADE_TRADEDETAIL func (Tradetradedetail) TableName() string { return "TRADE_TRADEDETAIL" } // Histradetradedetail 历史交易成交单表 type Histradetradedetail struct { Tradeid string `json:"tradeid" xorm:"'TRADEID'" binding:"required"` // 成交单号(101+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx) Buyorsell int32 `json:"buyorsell" xorm:"'BUYORSELL'" binding:"required"` // 方向 - 0:买 1:卖 Orderid string `json:"orderid" xorm:"'ORDERID'" binding:"required"` // 委托单号 Tradedate string `json:"tradedate" xorm:"'TRADEDATE'" binding:"required"` // 交易日(yyyyMMdd) Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'" binding:"required"` // 账户ID[报价币种] Goodsid int32 `json:"goodsid" xorm:"'GOODSID'" binding:"required"` // 商品ID Marketid int32 `json:"marketid" xorm:"'MARKETID'" binding:"required"` // 市场ID Memberuserid int64 `json:"memberuserid" xorm:"'MEMBERUSERID'" binding:"required"` // 会员id 个人投资者 需要填写 Matchaccountid int64 `json:"matchaccountid" xorm:"'MATCHACCOUNTID'"` // 对手账号id Tradetime time.Time `json:"tradetime" xorm:"'TRADETIME'" binding:"required"` // 成交时间 Tradeprice float64 `json:"tradeprice" xorm:"'TRADEPRICE'" binding:"required"` // 成交价格 Tradeamount float64 `json:"tradeamount" xorm:"'TRADEAMOUNT'" binding:"required"` // 成交金额[账户币种,用于所有权] Closepl float64 `json:"closepl" xorm:"'CLOSEPL'"` // 平仓盈亏 Intclosepl int64 `json:"intclosepl" xorm:"'INTCLOSEPL'"` // 整型盈亏(用于交易结算试算平衡-收益权) Opencharge float64 `json:"opencharge" xorm:"'OPENCHARGE'"` // 建仓手续费(支付总手续费=(交易所比率+会员比率)*成交金额) Closecharge float64 `json:"closecharge" xorm:"'CLOSECHARGE'"` // 平仓手续费(支付总手续费=(交易所比率+会员比率)*成交金额) Tradetype int32 `json:"tradetype" xorm:"'TRADETYPE'"` // 成交类别 - 1:正常委托成交 2:定向做市成交(接单) 3:交割协议平仓成交 4:交割减仓成交 5:到期强平成交 6:风控斩仓成交 7:协议平仓(管理端)成交 8:仓单转持仓成交 9: 交割协议转让成交 10:受托竞价成交(接单) 11:协议转让成交 12:系统强行平仓 13:期权违约平仓 Buildtype int32 `json:"buildtype" xorm:"'BUILDTYPE'"` // 委托单据类型 1:建仓 2:平仓 3:先平后建 Tradeqty float64 `json:"tradeqty" xorm:"'TRADEQTY'" binding:"required"` // 成交数量 Openqty float64 `json:"openqty" xorm:"'OPENQTY'"` // 开仓数量(先建后平操作 需要记录) Closeqty float64 `json:"closeqty" xorm:"'CLOSEQTY'"` // 平仓数量(先建后平操作 需要记录) Status int32 `json:"status" xorm:"'STATUS'"` // 处理状态 - 1:待处理 2:已处理 3:处理失败 Isreckoned int32 `json:"isreckoned" xorm:"'ISRECKONED'"` // 是否结算 - 0:未结算 1:已结算 Tradeproperty int32 `json:"tradeproperty" xorm:"'TRADEPROPERTY'"` // 交易属性 Openfeealgorithm int32 `json:"openfeealgorithm" xorm:"'OPENFEEALGORITHM'"` // 建仓手续费收取方式 1:比率 2:固定 Openmemberchargevalue float64 `json:"openmemberchargevalue" xorm:"'OPENMEMBERCHARGEVALUE'"` // 建仓会员手续费设置值 Openexchagechargevalue float64 `json:"openexchagechargevalue" xorm:"'OPENEXCHAGECHARGEVALUE'"` // 建仓交易所手续费设置值 Closefeealgorithm int32 `json:"closefeealgorithm" xorm:"'CLOSEFEEALGORITHM'"` // 平仓手续费收取方式 1:比率 2:固定 Closememberchargevalue float64 `json:"closememberchargevalue" xorm:"'CLOSEMEMBERCHARGEVALUE'"` // 平仓会员手续费设置值 Closeexchagechargevalue float64 `json:"closeexchagechargevalue" xorm:"'CLOSEEXCHAGECHARGEVALUE'"` // 平仓交易所手续费设置值 Optiontype int32 `json:"optiontype" xorm:"'OPTIONTYPE'"` // 期权类型 - 1:认购(看涨) 2:认沽(看跌) Premium float64 `json:"premium" xorm:"'PREMIUM'"` // 权利金 - [持仓单的权利金] Ispreexercise int32 `json:"ispreexercise" xorm:"'ISPREEXERCISE'"` // 是否预申报- 0:否 1:是 Preexerciseprice float64 `json:"preexerciseprice" xorm:"'PREEXERCISEPRICE'"` // 预申报价格 Isconfirmexercise int32 `json:"isconfirmexercise" xorm:"'ISCONFIRMEXERCISE'"` // 是否确认行权- 0:否 1:是 Ismain int32 `json:"ismain" xorm:"'ISMAIN'"` // 是否主单 - 0:不是 1:是 Performanceplanid int64 `json:"performanceplanid" xorm:"'PERFORMANCEPLANID'"` // 履约计划ID[期权] Performancestatus int32 `json:"performancestatus" xorm:"'PERFORMANCESTATUS'"` // 履约状态[期权] - 0:无履约 1:未履约 2:履约中 3:履约完成 Creditamount float64 `json:"creditamount" xorm:"'CREDITAMOUNT'"` // 授信金额 Gcaccountid int64 `json:"gcaccountid" xorm:"'GCACCOUNTID'"` // 账户ID[合约币种] Closepl2 float64 `json:"closepl2" xorm:"'CLOSEPL2'"` // 平仓盈亏[逐笔] Relatedouttradeid int64 `json:"relatedouttradeid" xorm:"'RELATEDOUTTRADEID'"` // 关联外部成交单ID Histradedate string `json:"histradedate" xorm:"'HISTRADEDATE'" binding:"required"` // 历史交易日 Isvaliddata int32 `json:"isvaliddata" xorm:"'ISVALIDDATA'"` // 是否有效 - 0:无效 1:有效 InitFeeValue float64 `json:"initfeevalue" xorm:"'INITFEEVALUE'"` // 应收手续费(50) } // TableName is HIS_TRADE_TRADEDETAIL func (Histradetradedetail) TableName() string { return "HIS_TRADE_TRADEDETAIL" } // Tradegoodspickup 交易合约提货单表 type Tradegoodspickup struct { Takeorderid int64 `json:"takeorderid" xorm:"'TAKEORDERID'" binding:"required"` // 提货单号(905+Unix秒时间戳(10位)+xxxxxx) Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'"` // 账户ID Goodsid int64 `json:"goodsid" xorm:"'GOODSID'"` // 商品ID Userid int64 `json:"userid" xorm:"'USERID'"` // 用户ID Qty float64 `json:"qty" xorm:"'QTY'"` // 提货数量 Reqtime time.Time `json:"reqtime" xorm:"'REQTIME'"` // 更新时间 Recivername string `json:"recivername" xorm:"'RECIVERNAME'"` // 提货人姓名 Cardtypeid int32 `json:"cardtypeid" xorm:"'CARDTYPEID'"` // 提货人证件类型 Cardnum string `json:"cardnum" xorm:"'CARDNUM'"` // 提货人证件号码 Phonenum string `json:"phonenum" xorm:"'PHONENUM'"` // 提货人联系方式 Takemode int32 `json:"takemode" xorm:"'TAKEMODE'"` // 提货方式 - 2:自提 3:配送 Address string `json:"address" xorm:"'ADDRESS'"` // 提货人详细地址 Takeremark string `json:"takeremark" xorm:"'TAKEREMARK'"` // 提货备注 Takeorderstatus int32 `json:"takeorderstatus" xorm:"'TAKEORDERSTATUS'"` // 提货状态 - 1:待发货 2:已发货 3:已收货 Auditer int32 `json:"auditer" xorm:"'AUDITER'"` // 审核人 Audittime time.Time `json:"audittime" xorm:"'AUDITTIME'"` // 审核时间 Checkremark string `json:"checkremark" xorm:"'CHECKREMARK'"` // 审核备注 Tradedate string `json:"tradedate" xorm:"'TRADEDATE'"` // 交易日(yyyyMMdd) Marketid int32 `json:"marketid" xorm:"'MARKETID'"` // 市场ID Handlestatus int32 `json:"handlestatus" xorm:"'HANDLESTATUS'"` // 处理状态 Amount float64 `json:"amount" xorm:"'AMOUNT'"` // 提货金额 Countryid int32 `json:"countryid" xorm:"'COUNTRYID'"` // 国家 Provinceid int32 `json:"provinceid" xorm:"'PROVINCEID'"` // 省 Cityid int32 `json:"cityid" xorm:"'CITYID'"` // 市 Districtid int32 `json:"districtid" xorm:"'DISTRICTID'"` // 地区 } // TableName is TRADE_GOODSPICKUP func (Tradegoodspickup) TableName() string { return "TRADE_GOODSPICKUP" } // GetTradePositions 获取指定资金账户的持仓信息 func GetTradePositions(accountID int, marketID int) ([]Tradeposition, error) { tradePositions := make([]Tradeposition, 0) session := db.GetEngine().Table("TRADEPOSITION T").Where("T.ACCOUNTID = ?", accountID) if marketID != 0 { session = session.And("T.GOODSID in (SELECT G.GOODSID FROM GOODS G WHERE G.MARKETID = ?)", marketID) } if err := session.Find(&tradePositions); err != nil { return nil, err } return tradePositions, nil }