瀏覽代碼

Proto

- update up to v1.36.5
- add RL Turn message
Alexey Kim 4 月之前
父節點
當前提交
f78af20aa6
共有 6 個文件被更改,包括 177 次插入22 次删除
  1. 1 1
      go.mod
  2. 2 2
      go.sum
  3. 155 17
      probability.pb.go
  4. 13 0
      proto/probability.proto
  5. 5 1
      proto/probability_pb2.py
  6. 1 1
      strategy.go

+ 1 - 1
go.mod

@@ -2,4 +2,4 @@ module git.beejay.kim/Gshopper/sentio
 
 go 1.22.2
 
-require google.golang.org/protobuf v1.36.3
+require google.golang.org/protobuf v1.36.5

+ 2 - 2
go.sum

@@ -2,5 +2,5 @@ github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
 github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU=
-google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
+google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
+google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=

+ 155 - 17
probability.pb.go

@@ -21,6 +21,61 @@ const (
 	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
 )
 
+type Action int32
+
+const (
+	Action_DOUBLE_SELL Action = 0
+	Action_SELL        Action = 1
+	Action_HOLD        Action = 2
+	Action_BUY         Action = 3
+	Action_DOUBLE_BUY  Action = 4
+)
+
+// Enum value maps for Action.
+var (
+	Action_name = map[int32]string{
+		0: "DOUBLE_SELL",
+		1: "SELL",
+		2: "HOLD",
+		3: "BUY",
+		4: "DOUBLE_BUY",
+	}
+	Action_value = map[string]int32{
+		"DOUBLE_SELL": 0,
+		"SELL":        1,
+		"HOLD":        2,
+		"BUY":         3,
+		"DOUBLE_BUY":  4,
+	}
+)
+
+func (x Action) Enum() *Action {
+	p := new(Action)
+	*p = x
+	return p
+}
+
+func (x Action) String() string {
+	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Action) Descriptor() protoreflect.EnumDescriptor {
+	return file_proto_probability_proto_enumTypes[0].Descriptor()
+}
+
+func (Action) Type() protoreflect.EnumType {
+	return &file_proto_probability_proto_enumTypes[0]
+}
+
+func (x Action) Number() protoreflect.EnumNumber {
+	return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use Action.Descriptor instead.
+func (Action) EnumDescriptor() ([]byte, []int) {
+	return file_proto_probability_proto_rawDescGZIP(), []int{0}
+}
+
 type Probability struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -68,6 +123,61 @@ func (x *Probability) GetStamps() []*Probability_Stamp {
 	return nil
 }
 
+type Turn struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Time   *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"`
+	Action Action                 `protobuf:"varint,2,opt,name=action,proto3,enum=sentio.Action" json:"action,omitempty"`
+}
+
+func (x *Turn) Reset() {
+	*x = Turn{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_proto_probability_proto_msgTypes[1]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *Turn) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Turn) ProtoMessage() {}
+
+func (x *Turn) ProtoReflect() protoreflect.Message {
+	mi := &file_proto_probability_proto_msgTypes[1]
+	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 Turn.ProtoReflect.Descriptor instead.
+func (*Turn) Descriptor() ([]byte, []int) {
+	return file_proto_probability_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *Turn) GetTime() *timestamppb.Timestamp {
+	if x != nil {
+		return x.Time
+	}
+	return nil
+}
+
+func (x *Turn) GetAction() Action {
+	if x != nil {
+		return x.Action
+	}
+	return Action_DOUBLE_SELL
+}
+
 type Probability_Stamp struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -80,7 +190,7 @@ type Probability_Stamp struct {
 func (x *Probability_Stamp) Reset() {
 	*x = Probability_Stamp{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_proto_probability_proto_msgTypes[1]
+		mi := &file_proto_probability_proto_msgTypes[2]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -93,7 +203,7 @@ func (x *Probability_Stamp) String() string {
 func (*Probability_Stamp) ProtoMessage() {}
 
 func (x *Probability_Stamp) ProtoReflect() protoreflect.Message {
-	mi := &file_proto_probability_proto_msgTypes[1]
+	mi := &file_proto_probability_proto_msgTypes[2]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -139,8 +249,18 @@ var file_proto_probability_proto_rawDesc = []byte{
 	0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,
 	0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x14,
 	0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x76,
-	0x61, 0x6c, 0x75, 0x65, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6f,
-	0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x61, 0x6c, 0x75, 0x65, 0x22, 0x5e, 0x0a, 0x04, 0x54, 0x75, 0x72, 0x6e, 0x12, 0x2e, 0x0a, 0x04,
+	0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f,
+	0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d,
+	0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x06,
+	0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x73,
+	0x65, 0x6e, 0x74, 0x69, 0x6f, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63,
+	0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x46, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0f,
+	0x0a, 0x0b, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x5f, 0x53, 0x45, 0x4c, 0x4c, 0x10, 0x00, 0x12,
+	0x08, 0x0a, 0x04, 0x53, 0x45, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x4f, 0x4c,
+	0x44, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x42, 0x55, 0x59, 0x10, 0x03, 0x12, 0x0e, 0x0a, 0x0a,
+	0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x5f, 0x42, 0x55, 0x59, 0x10, 0x04, 0x42, 0x0a, 0x5a, 0x08,
+	0x2e, 0x2f, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -155,20 +275,25 @@ func file_proto_probability_proto_rawDescGZIP() []byte {
 	return file_proto_probability_proto_rawDescData
 }
 
-var file_proto_probability_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_proto_probability_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
+var file_proto_probability_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
 var file_proto_probability_proto_goTypes = []interface{}{
-	(*Probability)(nil),           // 0: sentio.Probability
-	(*Probability_Stamp)(nil),     // 1: sentio.Probability.Stamp
-	(*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp
+	(Action)(0),                   // 0: sentio.Action
+	(*Probability)(nil),           // 1: sentio.Probability
+	(*Turn)(nil),                  // 2: sentio.Turn
+	(*Probability_Stamp)(nil),     // 3: sentio.Probability.Stamp
+	(*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp
 }
 var file_proto_probability_proto_depIdxs = []int32{
-	1, // 0: sentio.Probability.stamps:type_name -> sentio.Probability.Stamp
-	2, // 1: sentio.Probability.Stamp.time:type_name -> google.protobuf.Timestamp
-	2, // [2:2] is the sub-list for method output_type
-	2, // [2:2] is the sub-list for method input_type
-	2, // [2:2] is the sub-list for extension type_name
-	2, // [2:2] is the sub-list for extension extendee
-	0, // [0:2] is the sub-list for field type_name
+	3, // 0: sentio.Probability.stamps:type_name -> sentio.Probability.Stamp
+	4, // 1: sentio.Turn.time:type_name -> google.protobuf.Timestamp
+	0, // 2: sentio.Turn.action:type_name -> sentio.Action
+	4, // 3: sentio.Probability.Stamp.time:type_name -> google.protobuf.Timestamp
+	4, // [4:4] is the sub-list for method output_type
+	4, // [4:4] is the sub-list for method input_type
+	4, // [4:4] is the sub-list for extension type_name
+	4, // [4:4] is the sub-list for extension extendee
+	0, // [0:4] is the sub-list for field type_name
 }
 
 func init() { file_proto_probability_proto_init() }
@@ -190,6 +315,18 @@ func file_proto_probability_proto_init() {
 			}
 		}
 		file_proto_probability_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*Turn); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_proto_probability_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
 			switch v := v.(*Probability_Stamp); i {
 			case 0:
 				return &v.state
@@ -207,13 +344,14 @@ func file_proto_probability_proto_init() {
 		File: protoimpl.DescBuilder{
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_proto_probability_proto_rawDesc,
-			NumEnums:      0,
-			NumMessages:   2,
+			NumEnums:      1,
+			NumMessages:   3,
 			NumExtensions: 0,
 			NumServices:   0,
 		},
 		GoTypes:           file_proto_probability_proto_goTypes,
 		DependencyIndexes: file_proto_probability_proto_depIdxs,
+		EnumInfos:         file_proto_probability_proto_enumTypes,
 		MessageInfos:      file_proto_probability_proto_msgTypes,
 	}.Build()
 	File_proto_probability_proto = out.File

+ 13 - 0
proto/probability.proto

@@ -12,3 +12,16 @@ message Probability {
     float value = 2 [json_name = "value"];
   }
 }
+
+enum Action {
+    DOUBLE_SELL = 0;
+    SELL = 1;
+    HOLD = 2;
+    BUY = 3;
+    DOUBLE_BUY = 4;
+}
+
+message Turn {
+  google.protobuf.Timestamp time = 1 [json_name = "time"];
+  Action action = 2 [json_name = "action"];
+}

+ 5 - 1
proto/probability_pb2.py

@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
 from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
 
 
-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17proto/probability.proto\x12\x06sentio\x1a\x1fgoogle/protobuf/timestamp.proto\"\x8f\x01\n\x0bProbability\x12\x31\n\x06stamps\x18\n \x03(\x0b\x32\x19.sentio.Probability.StampR\x06stamps\x1aM\n\x05Stamp\x12.\n\x04time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x04time\x12\x14\n\x05value\x18\x02 \x01(\x02R\x05valueB\nZ\x08./sentiob\x06proto3')
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17proto/probability.proto\x12\x06sentio\x1a\x1fgoogle/protobuf/timestamp.proto\"\x8f\x01\n\x0bProbability\x12\x31\n\x06stamps\x18\n \x03(\x0b\x32\x19.sentio.Probability.StampR\x06stamps\x1aM\n\x05Stamp\x12.\n\x04time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x04time\x12\x14\n\x05value\x18\x02 \x01(\x02R\x05value\"^\n\x04Turn\x12.\n\x04time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x04time\x12&\n\x06\x61\x63tion\x18\x02 \x01(\x0e\x32\x0e.sentio.ActionR\x06\x61\x63tion*F\n\x06\x41\x63tion\x12\x0f\n\x0b\x44OUBLE_SELL\x10\x00\x12\x08\n\x04SELL\x10\x01\x12\x08\n\x04HOLD\x10\x02\x12\x07\n\x03\x42UY\x10\x03\x12\x0e\n\nDOUBLE_BUY\x10\x04\x42\nZ\x08./sentiob\x06proto3')
 
 _globals = globals()
 _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -23,8 +23,12 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.probability_pb2', _gl
 if _descriptor._USE_C_DESCRIPTORS == False:
   _globals['DESCRIPTOR']._options = None
   _globals['DESCRIPTOR']._serialized_options = b'Z\010./sentio'
+  _globals['_ACTION']._serialized_start=310
+  _globals['_ACTION']._serialized_end=380
   _globals['_PROBABILITY']._serialized_start=69
   _globals['_PROBABILITY']._serialized_end=212
   _globals['_PROBABILITY_STAMP']._serialized_start=135
   _globals['_PROBABILITY_STAMP']._serialized_end=212
+  _globals['_TURN']._serialized_start=214
+  _globals['_TURN']._serialized_end=308
 # @@protoc_insertion_point(module_scope)

+ 1 - 1
strategy.go

@@ -9,5 +9,5 @@ type Strategy interface {
 	PositionProbabilities() map[Side]float32
 	Interval() uint8
 
-	Handle(market Market, probability *Probability) error
+	Handle(market Market, turn *Turn) error
 }