ermcpOrder.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. package models
  2. import "time"
  3. // 企业风管期货单据相关
  4. // Hedgeouttradeposition 对冲外部持仓头寸表 - 导历史
  5. type Hedgeouttradeposition struct {
  6. Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'" binding:"required"` // 资金账号[外部母账户]
  7. Hedgegoodsid int64 `json:"hedgegoodsid" xorm:"'HEDGEGOODSID'" binding:"required"` // 对冲合约ID
  8. Hedgeaccountcode string `json:"hedgeaccountcode" xorm:"'HEDGEACCOUNTCODE'"` // 对冲账号
  9. Tradedate string `json:"tradedate" xorm:"'TRADEDATE'"` // 交易日(yyyyMMdd)
  10. Marketid int32 `json:"marketid" xorm:"'MARKETID'"` // 市场ID
  11. Ydbuyposition int64 `json:"ydbuyposition" xorm:"'YDBUYPOSITION'"` // 期初买头寸
  12. Curbuyposition int64 `json:"curbuyposition" xorm:"'CURBUYPOSITION'"` // 期末买头寸
  13. Curydbuyposition int64 `json:"curydbuyposition" xorm:"'CURYDBUYPOSITION'"` // 期末上日买头寸
  14. Curtdbuyposition int64 `json:"curtdbuyposition" xorm:"'CURTDBUYPOSITION'"` // 期末今日买头寸
  15. Freydbuyposition int64 `json:"freydbuyposition" xorm:"'FREYDBUYPOSITION'"` // 冻结上日买头寸
  16. Fretdbuyposition int64 `json:"fretdbuyposition" xorm:"'FRETDBUYPOSITION'"` // 冻结今日买头寸
  17. Ydsellposition int64 `json:"ydsellposition" xorm:"'YDSELLPOSITION'"` // 期初卖头寸
  18. Cursellposition int64 `json:"cursellposition" xorm:"'CURSELLPOSITION'"` // 期末卖头寸
  19. Curydsellposition int64 `json:"curydsellposition" xorm:"'CURYDSELLPOSITION'"` // 期末上日卖头寸
  20. Curtdsellposition int64 `json:"curtdsellposition" xorm:"'CURTDSELLPOSITION'"` // 期末今日卖头寸
  21. Freydsellposition int64 `json:"freydsellposition" xorm:"'FREYDSELLPOSITION'"` // 冻结上日卖头寸
  22. Fretdsellposition int64 `json:"fretdsellposition" xorm:"'FRETDSELLPOSITION'"` // 冻结今日卖头寸
  23. }
  24. // TableName is HEDGE_OUTTRADEPOSITION
  25. func (Hedgeouttradeposition) TableName() string {
  26. return "HEDGE_OUTTRADEPOSITION"
  27. }
  28. // Hedgeinnerorderdetail 对冲内部委托单表 - 导历史
  29. type Hedgeinnerorderdetail struct {
  30. Orderid int64 `json:"orderid" xorm:"'ORDERID'" binding:"required"` // 委托单号(107+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
  31. Tradedate string `json:"tradedate" xorm:"'TRADEDATE'"` // 交易日(yyyyMMdd)
  32. Channelbuildtype int32 `json:"channelbuildtype" xorm:"'CHANNELBUILDTYPE'"` // 开平标志 - 0:无 1:建仓 2:平仓
  33. Closetype int32 `json:"closetype" xorm:"'CLOSETYPE'"` // 平仓方式 - 0:无 1:平今 2:平昨
  34. Hedgeflag int32 `json:"hedgeflag" xorm:"'HEDGEFLAG'"` // 投机套保标志 - 0:无 1:投机 2:套保 3:套利
  35. Marketid int32 `json:"marketid" xorm:"'MARKETID'"` // 市场ID
  36. Goodsid int32 `json:"goodsid" xorm:"'GOODSID'"` // 商品ID
  37. Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'"` // 账户ID
  38. Buyorsell int32 `json:"buyorsell" xorm:"'BUYORSELL'"` // 买卖 - 0:买 1:卖
  39. Pricemode int32 `json:"pricemode" xorm:"'PRICEMODE'"` // 取价方式 - 1:市价 2: 限价
  40. Orderprice float64 `json:"orderprice" xorm:"'ORDERPRICE'"` // 委托价格(账户)
  41. Openorderqty int64 `json:"openorderqty" xorm:"'OPENORDERQTY'"` // 委托数量
  42. Opentradeqty int64 `json:"opentradeqty" xorm:"'OPENTRADEQTY'"` // 成交数量
  43. Opencancelqty int64 `json:"opencancelqty" xorm:"'OPENCANCELQTY'"` // 撤单数量
  44. Openfailqty int64 `json:"openfailqty" xorm:"'OPENFAILQTY'"` // 失败数量
  45. Opensuccessqty int64 `json:"opensuccessqty" xorm:"'OPENSUCCESSQTY'"` // 建仓委托成功数量
  46. Closeorderqty int64 `json:"closeorderqty" xorm:"'CLOSEORDERQTY'"` // 委托数量
  47. Closetradeqty int64 `json:"closetradeqty" xorm:"'CLOSETRADEQTY'"` // 成交数量
  48. Closecancelqty int64 `json:"closecancelqty" xorm:"'CLOSECANCELQTY'"` // 撤单数量
  49. Closefailqty int64 `json:"closefailqty" xorm:"'CLOSEFAILQTY'"` // 失败数量
  50. Closesuccessqty int64 `json:"closesuccessqty" xorm:"'CLOSESUCCESSQTY'"` // 委托成功数量
  51. Openfreezemargin float64 `json:"openfreezemargin" xorm:"'OPENFREEZEMARGIN'"` // 冻结保证金(冻结交易金额)
  52. Openunfreezemargin float64 `json:"openunfreezemargin" xorm:"'OPENUNFREEZEMARGIN'"` // 解冻保证金
  53. Openfreezecharge float64 `json:"openfreezecharge" xorm:"'OPENFREEZECHARGE'"` // 建仓冻结手续费(账户)
  54. Openunfreezecharge float64 `json:"openunfreezecharge" xorm:"'OPENUNFREEZECHARGE'"` // 建仓解冻手续费(账户)
  55. Validtype int32 `json:"validtype" xorm:"'VALIDTYPE'"` // 有效类型 - 1当日有效
  56. Validtime time.Time `json:"validtime" xorm:"'VALIDTIME'"` // 有效期限
  57. Channeloperatetype int32 `json:"channeloperatetype" xorm:"'CHANNELOPERATETYPE'"` // 操作类型 - 1:正常委托 2:斩仓委托 3:强平委托
  58. Ordertime time.Time `json:"ordertime" xorm:"'ORDERTIME'"` // 委托时间
  59. Channelordersrc int32 `json:"channelordersrc" xorm:"'CHANNELORDERSRC'"` // 委托来源 - 1:客户端 2:风控服务 3:管理端 4:下单接口平台 5:交易服务 6:跟单服务 7:监控终端
  60. Channelinnerorderstatus int32 `json:"channelinnerorderstatus" xorm:"'CHANNELINNERORDERSTATUS'"` // 委托状态 - 1:委托请求 2:冻结成功 3:委托失败 4:委托部成部失败 5:委托成功 6:全部撤销 7:部成部撤 8:部成部撤部失败 9:全部成交
  61. Operatorid int64 `json:"operatorid" xorm:"'OPERATORID'"` // 登录账号(LoginID)
  62. Updatetime time.Time `json:"updatetime" xorm:"'UPDATETIME'"` // 更新时间
  63. Clientordertime time.Time `json:"clientordertime" xorm:"'CLIENTORDERTIME'"` // 客户端委托时间
  64. Clientticket string `json:"clientticket" xorm:"'CLIENTTICKET'"` // 客户端流水号
  65. UUID string `json:"uuid" xorm:"'UUID'"` // 发起端唯一id
  66. Clienttype int32 `json:"clienttype" xorm:"'CLIENTTYPE'"` // 客户端类型 - 0:保留为未填终端类型 1:PC管理端 2:PC交易端 3:手机客户端_安卓 4:网页客户端 5:微信客户端 6:手机客户端_苹果 7:网上开户客户端 8:无效终端编号 9:报价终端(中江) 10;监控终端
  67. Retcode int32 `json:"retcode" xorm:"'RETCODE'"` // 错误代码
  68. Marginalgorithm int32 `json:"marginalgorithm" xorm:"'MARGINALGORITHM'"` // 保证金收取方式 1:比率 2:固定
  69. Marginvalue float64 `json:"marginvalue" xorm:"'MARGINVALUE'"` // 即市保证金设置值
  70. Openfeealgorithm int32 `json:"openfeealgorithm" xorm:"'OPENFEEALGORITHM'"` // 建仓手续费收取方式 1:比率 2:固定
  71. Openchargevalue float64 `json:"openchargevalue" xorm:"'OPENCHARGEVALUE'"` // 建仓手续费设置值
  72. Closefeealgorithm int32 `json:"closefeealgorithm" xorm:"'CLOSEFEEALGORITHM'"` // 平仓手续费收取方式 1:比率 2:固定
  73. Closechargevalue float64 `json:"closechargevalue" xorm:"'CLOSECHARGEVALUE'"` // 平仓手续费设置值
  74. Accountcurrencyid int32 `json:"accountcurrencyid" xorm:"'ACCOUNTCURRENCYID'"` // 账户币种ID
  75. Goodscurrencyid int32 `json:"goodscurrencyid" xorm:"'GOODSCURRENCYID'"` // 商品币种ID
  76. Margincurrencyid int32 `json:"margincurrencyid" xorm:"'MARGINCURRENCYID'"` // 保证金币种ID 比率时等于账户币种
  77. Marginrate float64 `json:"marginrate" xorm:"'MARGINRATE'"` // 保证金汇率-比率时等于1
  78. Curexchangerate float64 `json:"curexchangerate" xorm:"'CUREXCHANGERATE'"` // 当前汇率
  79. Goodsorderprice float64 `json:"goodsorderprice" xorm:"'GOODSORDERPRICE'"` // 委托价格(商品)
  80. Openfreezemargin2 float64 `json:"openfreezemargin2" xorm:"'OPENFREEZEMARGIN2'"` // 建仓冻结保证金(保证金/商品)
  81. Openfreezecharge2 float64 `json:"openfreezecharge2" xorm:"'OPENFREEZECHARGE2'"` // 建仓冻结手续费(商品)
  82. Openunfreezemargin2 float64 `json:"openunfreezemargin2" xorm:"'OPENUNFREEZEMARGIN2'"` // 建仓解冻保证金(保证金/商品)
  83. Openunfreezecharge2 float64 `json:"openunfreezecharge2" xorm:"'OPENUNFREEZECHARGE2'"` // 建仓解冻手续费(商品)
  84. Parentaccountid int64 `json:"parentaccountid" xorm:"'PARENTACCOUNTID'"` // 所属母账户
  85. Sessionid int64 `json:"sessionid" xorm:"'SESSIONID'"` // 会话ID
  86. }
  87. // TableName is HEDGE_INNERORDERDETAIL
  88. func (Hedgeinnerorderdetail) TableName() string {
  89. return "HEDGE_INNERORDERDETAIL"
  90. }
  91. // Hedgeinnertradedetail 对冲内部成交单表 - 导历史
  92. type Hedgeinnertradedetail struct {
  93. Tradeid int64 `json:"tradeid" xorm:"'TRADEID'" binding:"required"` // 成交单号(108+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
  94. Buyorsell int32 `json:"buyorsell" xorm:"'BUYORSELL'" binding:"required"` // 方向 - 0:买 1:卖
  95. Orderid int64 `json:"orderid" xorm:"'ORDERID'"` // 委托单号
  96. Tradedate string `json:"tradedate" xorm:"'TRADEDATE'"` // 交易日(yyyyMMdd)
  97. Accountid int64 `json:"accountid" xorm:"'ACCOUNTID'"` // 账号ID
  98. Goodsid int32 `json:"goodsid" xorm:"'GOODSID'"` // 商品ID
  99. Marketid int32 `json:"marketid" xorm:"'MARKETID'"` // 市场ID
  100. Tradetime time.Time `json:"tradetime" xorm:"'TRADETIME'"` // 成交时间
  101. Tradeprice float64 `json:"tradeprice" xorm:"'TRADEPRICE'"` // 成交价格
  102. Tradeqty int64 `json:"tradeqty" xorm:"'TRADEQTY'"` // 成交数量
  103. Tradeamount float64 `json:"tradeamount" xorm:"'TRADEAMOUNT'"` // 成交金额(账户)
  104. Closepl float64 `json:"closepl" xorm:"'CLOSEPL'"` // 平仓盈亏(账户)
  105. Opencharge float64 `json:"opencharge" xorm:"'OPENCHARGE'"` // 建仓手续费(账户)
  106. Closecharge float64 `json:"closecharge" xorm:"'CLOSECHARGE'"` // 平仓手续费(账户)
  107. Tradetype int32 `json:"tradetype" xorm:"'TRADETYPE'"` // 成交类别 - 1:正常委托成交 2:风控斩仓成交 3:修正持仓成交 4:管理端斩仓成交
  108. Channelbuildtype int32 `json:"channelbuildtype" xorm:"'CHANNELBUILDTYPE'"` // 委托单据类型 0:无 1:建仓 2:平仓
  109. Closetype int32 `json:"closetype" xorm:"'CLOSETYPE'"` // 平仓方式 - 0:无 1:平今 2:平昨
  110. Hedgeflag int32 `json:"hedgeflag" xorm:"'HEDGEFLAG'"` // 投机套保标志 - 0:无 1:投机 2:套保 3:套利
  111. Openqty int64 `json:"openqty" xorm:"'OPENQTY'"` // 开仓数量(先建后平操作 需要记录)
  112. Closeqty int64 `json:"closeqty" xorm:"'CLOSEQTY'"` // 平仓数量(先建后平操作 需要记录)
  113. Status int32 `json:"status" xorm:"'STATUS'"` // 处理状态 - 1:待处理 2:已处理 3:处理失败
  114. Isreckoned int32 `json:"isreckoned" xorm:"'ISRECKONED'"` // 是否结算 - 0:未结算 1:已结算
  115. Openfeealgorithm int32 `json:"openfeealgorithm" xorm:"'OPENFEEALGORITHM'"` // 建仓手续费收取方式 1:比率 2:固定
  116. Openchargevalue float64 `json:"openchargevalue" xorm:"'OPENCHARGEVALUE'"` // 建仓手续费设置值
  117. Closefeealgorithm int32 `json:"closefeealgorithm" xorm:"'CLOSEFEEALGORITHM'"` // 平仓手续费收取方式 1:比率 2:固定
  118. Closechargevalue float64 `json:"closechargevalue" xorm:"'CLOSECHARGEVALUE'"` // 平仓手续费设置值
  119. Accountcurrencyid int32 `json:"accountcurrencyid" xorm:"'ACCOUNTCURRENCYID'"` // 账户币种ID
  120. Goodscurrencyid int32 `json:"goodscurrencyid" xorm:"'GOODSCURRENCYID'"` // 商品币种ID
  121. Curexchangerate float64 `json:"curexchangerate" xorm:"'CUREXCHANGERATE'"` // 当前汇率
  122. Opencharge2 float64 `json:"opencharge2" xorm:"'OPENCHARGE2'"` // 建仓手续费(商品)
  123. Closecharge2 float64 `json:"closecharge2" xorm:"'CLOSECHARGE2'"` // 平仓手续费(商品)
  124. Closepl2 float64 `json:"closepl2" xorm:"'CLOSEPL2'"` // 平仓盈亏(商品)
  125. Closepl3 float64 `json:"closepl3" xorm:"'CLOSEPL3'"` // 平仓盈亏(账户)(逐笔)
  126. Closepl4 float64 `json:"closepl4" xorm:"'CLOSEPL4'"` // 平仓盈亏(商品)(逐笔)
  127. Extenalopenfeealgorithm int32 `json:"extenalopenfeealgorithm" xorm:"'EXTENALOPENFEEALGORITHM'"` // 建仓手续费收取方式(外部配置) 1:比率 2:固定
  128. Extenalopenchargevalue float64 `json:"extenalopenchargevalue" xorm:"'EXTENALOPENCHARGEVALUE'"` // 建仓手续费设置值
  129. Extenalclosefeealgorithm int32 `json:"extenalclosefeealgorithm" xorm:"'EXTENALCLOSEFEEALGORITHM'"` // 平仓手续费收取方式 1:比率 2:固定
  130. Extenalclosechargevalue float64 `json:"extenalclosechargevalue" xorm:"'EXTENALCLOSECHARGEVALUE'"` // 平仓手续费设置值
  131. Extenalopencharge float64 `json:"extenalopencharge" xorm:"'EXTENALOPENCHARGE'"` // 建仓手续费(商品)(外部)
  132. Extenalclosecharge float64 `json:"extenalclosecharge" xorm:"'EXTENALCLOSECHARGE'"` // 平仓手续费(商品)(外部)
  133. Parentaccountid int64 `json:"parentaccountid" xorm:"'PARENTACCOUNTID'"` // 所属母账户
  134. Relatedouttradeid int64 `json:"relatedouttradeid" xorm:"'RELATEDOUTTRADEID'"` // 关联外部成交单ID
  135. }
  136. // TableName is HEDGE_INNERTRADEDETAIL
  137. func (Hedgeinnertradedetail) TableName() string {
  138. return "HEDGE_INNERTRADEDETAIL"
  139. }