zhou.xiaoning 2 роки тому
батько
коміт
66e7a23512
4 змінених файлів з 162 додано та 4 видалено
  1. 5 0
      models/common.go
  2. 3 1
      models/ori.go
  3. 142 3
      pb/mtp2.pb.go
  4. 12 0
      pb/mtp2.proto

+ 5 - 0
models/common.go

@@ -2,6 +2,7 @@ package models
 
 import (
 	"bytes"
+	"encoding/base64"
 	"encoding/json"
 	"errors"
 	"fmt"
@@ -1409,6 +1410,10 @@ func GetTodayAccountConfigInfo(accountid int) (rsp GetTodayAccountConfigInfoRsp,
 	if err = db.GetEngine().In("ACCOUNTID", []int{0, accountid}).Find(&todayAccountMargins); err != nil {
 		return
 	}
+	for i := range todayAccountMargins {
+		item := &todayAccountMargins[i]
+		item.INFOCONTENT = base64.StdEncoding.EncodeToString([]byte(item.INFOCONTENT))
+	}
 
 	todayAccountTradefees := make([]Todayaccounttradefee, 0)
 	if err = db.GetEngine().In("ACCOUNTID", []int{0, accountid}).Find(&todayAccountTradefees); err != nil {

+ 3 - 1
models/ori.go

@@ -1,6 +1,8 @@
 package models
 
-import "time"
+import (
+	"time"
+)
 
 // Wrtradeorderdetail 仓单贸易委托表 - 导历史
 type Wrtradeorderdetail struct {

+ 142 - 3
pb/mtp2.pb.go

@@ -2481,6 +2481,110 @@ func (x *RedisTradeHolderDetailEx) GetQuoteMinUnit() uint32 {
 	return 0
 }
 
+//保证金信息
+type MarginInfoStruct struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	AccountID           *uint64  `protobuf:"varint,1,opt,name=AccountID" json:"AccountID,omitempty"`                     // 资金账号
+	GoodsID             *uint32  `protobuf:"varint,2,opt,name=GoodsID" json:"GoodsID,omitempty"`                         // 商品id
+	MarginAlgorithm     *uint32  `protobuf:"varint,3,opt,name=MarginAlgorithm" json:"MarginAlgorithm,omitempty"`         // 保证金计算方式
+	MarketMarginValue   *float64 `protobuf:"fixed64,4,opt,name=MarketMarginValue" json:"MarketMarginValue,omitempty"`    // 即市保证金值
+	ReckonMarginValue   *float64 `protobuf:"fixed64,5,opt,name=ReckonMarginValue" json:"ReckonMarginValue,omitempty"`    // 结算保证金值
+	LockMarginValue     *float64 `protobuf:"fixed64,6,opt,name=LockMarginValue" json:"LockMarginValue,omitempty"`        // 锁仓保证金
+	RealMarginValue     *float64 `protobuf:"fixed64,7,opt,name=RealMarginValue" json:"RealMarginValue,omitempty"`        // 实付比例
+	RealMarginAlgorithm *uint32  `protobuf:"varint,8,opt,name=RealMarginAlgorithm" json:"RealMarginAlgorithm,omitempty"` // 实付保证金计算方式
+}
+
+func (x *MarginInfoStruct) Reset() {
+	*x = MarginInfoStruct{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_mtp2_proto_msgTypes[15]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *MarginInfoStruct) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*MarginInfoStruct) ProtoMessage() {}
+
+func (x *MarginInfoStruct) ProtoReflect() protoreflect.Message {
+	mi := &file_mtp2_proto_msgTypes[15]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use MarginInfoStruct.ProtoReflect.Descriptor instead.
+func (*MarginInfoStruct) Descriptor() ([]byte, []int) {
+	return file_mtp2_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *MarginInfoStruct) GetAccountID() uint64 {
+	if x != nil && x.AccountID != nil {
+		return *x.AccountID
+	}
+	return 0
+}
+
+func (x *MarginInfoStruct) GetGoodsID() uint32 {
+	if x != nil && x.GoodsID != nil {
+		return *x.GoodsID
+	}
+	return 0
+}
+
+func (x *MarginInfoStruct) GetMarginAlgorithm() uint32 {
+	if x != nil && x.MarginAlgorithm != nil {
+		return *x.MarginAlgorithm
+	}
+	return 0
+}
+
+func (x *MarginInfoStruct) GetMarketMarginValue() float64 {
+	if x != nil && x.MarketMarginValue != nil {
+		return *x.MarketMarginValue
+	}
+	return 0
+}
+
+func (x *MarginInfoStruct) GetReckonMarginValue() float64 {
+	if x != nil && x.ReckonMarginValue != nil {
+		return *x.ReckonMarginValue
+	}
+	return 0
+}
+
+func (x *MarginInfoStruct) GetLockMarginValue() float64 {
+	if x != nil && x.LockMarginValue != nil {
+		return *x.LockMarginValue
+	}
+	return 0
+}
+
+func (x *MarginInfoStruct) GetRealMarginValue() float64 {
+	if x != nil && x.RealMarginValue != nil {
+		return *x.RealMarginValue
+	}
+	return 0
+}
+
+func (x *MarginInfoStruct) GetRealMarginAlgorithm() uint32 {
+	if x != nil && x.RealMarginAlgorithm != nil {
+		return *x.RealMarginAlgorithm
+	}
+	return 0
+}
+
 var File_mtp2_proto protoreflect.FileDescriptor
 
 var file_mtp2_proto_rawDesc = []byte{
@@ -3025,7 +3129,29 @@ var file_mtp2_proto_rawDesc = []byte{
 	0x6c, 0x61, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x44, 0x65, 0x63, 0x69,
 	0x6d, 0x61, 0x6c, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x51, 0x75, 0x6f, 0x74,
 	0x65, 0x4d, 0x69, 0x6e, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c,
-	0x51, 0x75, 0x6f, 0x74, 0x65, 0x4d, 0x69, 0x6e, 0x55, 0x6e, 0x69, 0x74,
+	0x51, 0x75, 0x6f, 0x74, 0x65, 0x4d, 0x69, 0x6e, 0x55, 0x6e, 0x69, 0x74, 0x22, 0xd6, 0x02, 0x0a,
+	0x10, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x53, 0x74, 0x72, 0x75, 0x63,
+	0x74, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x01,
+	0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x12,
+	0x18, 0x0a, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d,
+	0x52, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x44, 0x12, 0x28, 0x0a, 0x0f, 0x4d, 0x61, 0x72,
+	0x67, 0x69, 0x6e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x03, 0x20, 0x01,
+	0x28, 0x0d, 0x52, 0x0f, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69,
+	0x74, 0x68, 0x6d, 0x12, 0x2c, 0x0a, 0x11, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x72,
+	0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x11,
+	0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75,
+	0x65, 0x12, 0x2c, 0x0a, 0x11, 0x52, 0x65, 0x63, 0x6b, 0x6f, 0x6e, 0x4d, 0x61, 0x72, 0x67, 0x69,
+	0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x11, 0x52, 0x65,
+	0x63, 0x6b, 0x6f, 0x6e, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12,
+	0x28, 0x0a, 0x0f, 0x4c, 0x6f, 0x63, 0x6b, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c,
+	0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0f, 0x4c, 0x6f, 0x63, 0x6b, 0x4d, 0x61,
+	0x72, 0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x52, 0x65, 0x61,
+	0x6c, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01,
+	0x28, 0x01, 0x52, 0x0f, 0x52, 0x65, 0x61, 0x6c, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x56, 0x61,
+	0x6c, 0x75, 0x65, 0x12, 0x30, 0x0a, 0x13, 0x52, 0x65, 0x61, 0x6c, 0x4d, 0x61, 0x72, 0x67, 0x69,
+	0x6e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d,
+	0x52, 0x13, 0x52, 0x65, 0x61, 0x6c, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x41, 0x6c, 0x67, 0x6f,
+	0x72, 0x69, 0x74, 0x68, 0x6d,
 }
 
 var (
@@ -3040,7 +3166,7 @@ func file_mtp2_proto_rawDescGZIP() []byte {
 	return file_mtp2_proto_rawDescData
 }
 
-var file_mtp2_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
+var file_mtp2_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
 var file_mtp2_proto_goTypes = []interface{}{
 	(*TradeRule)(nil),                // 0: pb.TradeRule
 	(*TradeRuleInfoStruct)(nil),      // 1: pb.TradeRuleInfoStruct
@@ -3057,6 +3183,7 @@ var file_mtp2_proto_goTypes = []interface{}{
 	(*Ermcp2AreaExposure)(nil),       // 12: pb.Ermcp2AreaExposure
 	(*TradeHolderDetailEx)(nil),      // 13: pb.TradeHolderDetailEx
 	(*RedisTradeHolderDetailEx)(nil), // 14: pb.RedisTradeHolderDetailEx
+	(*MarginInfoStruct)(nil),         // 15: pb.MarginInfoStruct
 }
 var file_mtp2_proto_depIdxs = []int32{
 	0,  // 0: pb.TradeRuleInfoStruct.TradeRules:type_name -> pb.TradeRule
@@ -3270,6 +3397,18 @@ func file_mtp2_proto_init() {
 				return nil
 			}
 		}
+		file_mtp2_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*MarginInfoStruct); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
 	}
 	type x struct{}
 	out := protoimpl.TypeBuilder{
@@ -3277,7 +3416,7 @@ func file_mtp2_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_mtp2_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   15,
+			NumMessages:   16,
 			NumExtensions: 0,
 			NumServices:   0,
 		},

+ 12 - 0
pb/mtp2.proto

@@ -311,4 +311,16 @@ message RedisTradeHolderDetailEx
   optional double AgreeUnit = 8; //合约单位
   optional uint32 DecimalPlace = 9; //小数位位数
   optional uint32 QuoteMinUnit = 10; //行情最小变动单位
+}
+
+//保证金信息
+message MarginInfoStruct{
+    optional uint64 AccountID = 1;                // 资金账号
+    optional uint32 GoodsID = 2;                  // 商品id 
+    optional uint32 MarginAlgorithm = 3;          // 保证金计算方式
+    optional double MarketMarginValue = 4;        // 即市保证金值
+    optional double ReckonMarginValue = 5;        // 结算保证金值
+    optional double LockMarginValue = 6;          // 锁仓保证金
+    optional double RealMarginValue = 7;          // 实付比例
+    optional uint32 RealMarginAlgorithm = 8;      // 实付保证金计算方式
 }