|
@@ -33,10 +33,10 @@ type TradeGoodsEx struct {
|
|
|
|
|
|
|
|
// TradeAccountEx 交易账户相关字段
|
|
// TradeAccountEx 交易账户相关字段
|
|
|
type TradeAccountEx struct {
|
|
type TradeAccountEx struct {
|
|
|
- TANAME string `json:"taname" xorm:"'TANAME'"` // 资金账号名称
|
|
|
|
|
- USERID int64 `json:"userid" xorm:"'USERID'" form:"userid"` // 用户id
|
|
|
|
|
- USERNAME string `json:"username" xorm:"'USERNAME'"` // 用户名称
|
|
|
|
|
- TaCurrencyid int64 `json:"tacurrencyid" xorm:"'TACURRENCYID'"` // 报价货币ID - taaccount
|
|
|
|
|
|
|
+ TANAME string `json:"taname" xorm:"'TANAME'"` // 资金账号名称
|
|
|
|
|
+ USERID int64 `json:"userid" xorm:"'USERID'" form:"userid" binding:"required"` // 用户id
|
|
|
|
|
+ USERNAME string `json:"username" xorm:"'USERNAME'"` // 用户名称
|
|
|
|
|
+ TaCurrencyid int64 `json:"tacurrencyid" xorm:"'TACURRENCYID'"` // 报价货币ID - taaccount
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// TradePosition 持仓汇总
|
|
// TradePosition 持仓汇总
|
|
@@ -217,6 +217,15 @@ type TradeHolderDetail struct {
|
|
|
FtTradeMode string `json:"-" form:"trademodes"` // 交易模式筛选, 逗号隔开
|
|
FtTradeMode string `json:"-" form:"trademodes"` // 交易模式筛选, 逗号隔开
|
|
|
FtMarketIDs string `json:"-" form:"marketids"` // 市场id, 逗号隔开
|
|
FtMarketIDs string `json:"-" form:"marketids"` // 市场id, 逗号隔开
|
|
|
RISKCONTROLMODE int32 `json:"riskcontrolmode" form:"riskcontrolmode" xorm:"RISKCONTROLMODE"` // 风控方式(52模式) 1:按单风控 2:按账户风控
|
|
RISKCONTROLMODE int32 `json:"riskcontrolmode" form:"riskcontrolmode" xorm:"RISKCONTROLMODE"` // 风控方式(52模式) 1:按单风控 2:按账户风控
|
|
|
|
|
+
|
|
|
|
|
+ TPSL_TPFLAG int32 `json:"tpsl_tpflag" xorm:"TPFLAG"` // 止盈标识 - 0:未设置 1:已设置(10按账户风控)
|
|
|
|
|
+ TPSL_TPPRICE string `json:"tpsl_tpprice" xorm:"TPPRICE"` // 止盈价格(10按账户风控)
|
|
|
|
|
+ TPSL_SLFLAG int32 `json:"tpsl_slflag" xorm:"SLFLAG"` // 止损标识 - 0:未设置 1:已设置(10按账户风控)
|
|
|
|
|
+ TPSL_SLPRICE string `json:"tpsl_slprice" xorm:"SLPRICE"` // 止损价格(10按账户风控)
|
|
|
|
|
+ TPSL_ORDERSTATUS int32 `json:"tpsl_orderstatus" xorm:"TPSL_ORDERSTATUS"` // 止盈止损单状态 - 1:待执行 2:执行中 3:已执行 4:已失效 5:执行失败(10按账户风控)
|
|
|
|
|
+ TPSL_EXECUTETIME string `json:"tpsl_executetime" xorm:"EXECUTETIME"` // 执行时间(10按账户风控)
|
|
|
|
|
+ TPSL_EXECUTEPRICE string `json:"tpsl_executeprice" xorm:"EXECUTEPRICE"` // 执行价格(10按账户风控)
|
|
|
|
|
+ TPSL_EXECUTERETCODE int32 `json:"tpsl_executeretcode" xorm:"EXECUTERETCODE"` // 执行错误代码(10按账户风控)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (r *TradeHolderDetail) calc() {
|
|
func (r *TradeHolderDetail) calc() {
|
|
@@ -293,17 +302,27 @@ SELECT to_char(t.TRADEID) TRADEID,
|
|
|
t.HOLDERCREDIT,
|
|
t.HOLDERCREDIT,
|
|
|
t.RELEASEHOLDERCREDIT,
|
|
t.RELEASEHOLDERCREDIT,
|
|
|
gtmp.*,
|
|
gtmp.*,
|
|
|
- utmp.*
|
|
|
|
|
|
|
+ utmp.*,
|
|
|
|
|
+ tpsl.TPFLAG,
|
|
|
|
|
+ tpsl.TPPRICE,
|
|
|
|
|
+ tpsl.SLFLAG,
|
|
|
|
|
+ tpsl.SLPRICE,
|
|
|
|
|
+ tpsl.ORDERSTATUS TPSL_ORDERSTATUS,
|
|
|
|
|
+ TO_CHAR(tpsl.EXECUTETIME, 'YYYY-MM-DD HH24:MI:SS') EXECUTETIME,
|
|
|
|
|
+ tpsl.EXECUTEPRICE,
|
|
|
|
|
+ tpsl.EXECUTERETCODE
|
|
|
FROM TRADE_HOLDERDETAIL t
|
|
FROM TRADE_HOLDERDETAIL t
|
|
|
INNER JOIN gtmp on t.goodsid=gtmp.goodsid
|
|
INNER JOIN gtmp on t.goodsid=gtmp.goodsid
|
|
|
LEFT JOIN utmp on t.accountid=utmp.accountid
|
|
LEFT JOIN utmp on t.accountid=utmp.accountid
|
|
|
- WHERE 1 = 1 and t.HOLDERQTY > 0
|
|
|
|
|
|
|
+ LEFT JOIN trade_holdertpslorder tpsl on t.tradeid = tpsl.tradeid and t.buyorsell = tpsl.buyorsell
|
|
|
|
|
+ WHERE 1 = 1 and t.HOLDERQTY > 0
|
|
|
`
|
|
`
|
|
|
|
|
|
|
|
sqlId.AndEx("gtmp.riskcontrolmode", r.RISKCONTROLMODE, r.RISKCONTROLMODE > 0)
|
|
sqlId.AndEx("gtmp.riskcontrolmode", r.RISKCONTROLMODE, r.RISKCONTROLMODE > 0)
|
|
|
sqlId.AndEx("utmp.userid", r.USERID, r.USERID > 0)
|
|
sqlId.AndEx("utmp.userid", r.USERID, r.USERID > 0)
|
|
|
sqlId.AndEx("t.goodsid", r.GOODSID, r.GOODSID > 0)
|
|
sqlId.AndEx("t.goodsid", r.GOODSID, r.GOODSID > 0)
|
|
|
sqlId.AndEx("t.BUYORSELL", r.BUYORSELL, r.BUYORSELL != -1)
|
|
sqlId.AndEx("t.BUYORSELL", r.BUYORSELL, r.BUYORSELL != -1)
|
|
|
|
|
+ sqlId.AndEx("t.tradeid", r.TRADEID, r.TRADEID != "")
|
|
|
sqlId.JoinEx(r.FtTradeMode != "", fmt.Sprintf(" and gtmp.trademode in(%v)", r.FtTradeMode))
|
|
sqlId.JoinEx(r.FtTradeMode != "", fmt.Sprintf(" and gtmp.trademode in(%v)", r.FtTradeMode))
|
|
|
sqlId.JoinEx(r.FtMarketIDs != "", fmt.Sprintf(" and gtmp.marketid in(%v)", r.FtMarketIDs))
|
|
sqlId.JoinEx(r.FtMarketIDs != "", fmt.Sprintf(" and gtmp.marketid in(%v)", r.FtMarketIDs))
|
|
|
sqlId.JoinEx(r.FtAccountIDs != "", fmt.Sprintf(" and t.accountid in(%v)", r.FtAccountIDs))
|
|
sqlId.JoinEx(r.FtAccountIDs != "", fmt.Sprintf(" and t.accountid in(%v)", r.FtAccountIDs))
|