diff --git a/docs/docs/api-reference/trading/limit_order/v1/service/cancel-limit-order/example.go b/docs/docs/api-reference/trading/limit_order/v1/service/cancel-limit-order/example.go index 61e11e53..61d29e81 100644 --- a/docs/docs/api-reference/trading/limit_order/v1/service/cancel-limit-order/example.go +++ b/docs/docs/api-reference/trading/limit_order/v1/service/cancel-limit-order/example.go @@ -36,7 +36,7 @@ func main() { // Response contains the cancellation status log.Printf("āœ“ Limit order cancellation initiated:") log.Printf(" Order name: %s", orderName) - log.Printf(" Status: %s", response.Status) + log.Printf(" State: %s", response.State) // Monitor the order until cancellation is complete log.Printf("\nšŸ“” Monitoring order until cancellation is complete...") @@ -58,13 +58,13 @@ monitorOrder: log.Fatalf("Stream error: %v", err) } - log.Printf(" Status: %s", update.Status) + log.Printf(" State: %s", update.State) - switch update.Status { - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_CANCELLATION_IN_PROGRESS: + switch update.State { + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_CANCELLATION_IN_PROGRESS: log.Printf(" ā³ Order cancellation in progress...") - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_CANCELLED: + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_CANCELLED: log.Printf(" āœ“ Order successfully cancelled on ledger!") break monitorOrder } diff --git a/docs/docs/api-reference/trading/limit_order/v1/service/create-limit-order/example.go b/docs/docs/api-reference/trading/limit_order/v1/service/create-limit-order/example.go index 1fe825ae..8ad69db7 100644 --- a/docs/docs/api-reference/trading/limit_order/v1/service/create-limit-order/example.go +++ b/docs/docs/api-reference/trading/limit_order/v1/service/create-limit-order/example.go @@ -92,16 +92,16 @@ monitorOrder: log.Fatalf("Stream error: %v", err) } - log.Printf(" Status: %s", update.Status) + log.Printf(" State: %s", update.State) - switch update.Status { - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS: + switch update.State { + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS: log.Printf(" ā³ Order submission in progress...") - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_SUBMISSION_FAILED: + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_SUBMISSION_FAILED: log.Fatalf(" āŒ Order submission failed") - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_OPEN: + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_OPEN: log.Printf(" āœ“ Order is now open on the ledger and available for matching!") break monitorOrder } diff --git a/docs/docs/api-reference/trading/limit_order/v1/service/get-limit-order/example.go b/docs/docs/api-reference/trading/limit_order/v1/service/get-limit-order/example.go index 5cc7d949..55877ab3 100644 --- a/docs/docs/api-reference/trading/limit_order/v1/service/get-limit-order/example.go +++ b/docs/docs/api-reference/trading/limit_order/v1/service/get-limit-order/example.go @@ -39,7 +39,7 @@ func main() { log.Printf(" Account: %s", limitOrder.Account) log.Printf(" External reference: %s", limitOrder.ExternalReference) log.Printf(" Side: %s", limitOrder.Side) - log.Printf(" Status: %s (UNSPECIFIED when live_ledger_data=false)", limitOrder.Status) + log.Printf(" State: %s (UNSPECIFIED when live_ledger_data=false)", limitOrder.State) // Example 2: Get with live ledger data (queries the ledger for current status) requestWithLiveData := &limit_orderv1.GetLimitOrderRequest{ @@ -54,7 +54,7 @@ func main() { log.Printf("\nāœ“ Limit order retrieved (with live ledger data):") log.Printf(" Resource name: %s", limitOrderWithStatus.Name) - log.Printf(" Status: %s", limitOrderWithStatus.Status) + log.Printf(" State: %s", limitOrderWithStatus.State) log.Printf(" Limit price: %s %s", limitOrderWithStatus.LimitPrice.Value.Value, limitOrderWithStatus.LimitPrice.Token.Code) log.Printf(" Quantity: %s %s", limitOrderWithStatus.Quantity.Value.Value, limitOrderWithStatus.Quantity.Token.Code) } diff --git a/docs/docs/api-reference/trading/limit_order/v1/service/list-limit-orders/example.go b/docs/docs/api-reference/trading/limit_order/v1/service/list-limit-orders/example.go index 62c13d31..cf8b1243 100644 --- a/docs/docs/api-reference/trading/limit_order/v1/service/list-limit-orders/example.go +++ b/docs/docs/api-reference/trading/limit_order/v1/service/list-limit-orders/example.go @@ -41,6 +41,6 @@ func main() { log.Printf(" Side: %s", order.Side) log.Printf(" Limit price: %s %s", order.LimitPrice.Value.Value, order.LimitPrice.Token.Code) log.Printf(" Quantity: %s %s", order.Quantity.Value.Value, order.Quantity.Token.Code) - log.Printf(" Status: %s", order.Status) + log.Printf(" State: %s", order.State) } } diff --git a/docs/docs/api-reference/trading/limit_order/v1/service/monitor-limit-order/example.go b/docs/docs/api-reference/trading/limit_order/v1/service/monitor-limit-order/example.go index fbbb1884..a5217ebb 100644 --- a/docs/docs/api-reference/trading/limit_order/v1/service/monitor-limit-order/example.go +++ b/docs/docs/api-reference/trading/limit_order/v1/service/monitor-limit-order/example.go @@ -60,7 +60,7 @@ monitorOrder: } // Process each order update as it arrives - log.Printf("\nšŸ“” Status update received: %s", limitOrder.Status) + log.Printf("\nšŸ“” State update received: %s", limitOrder.State) log.Printf(" Resource name: %s", limitOrder.Name) log.Printf(" Account: %s", limitOrder.Account) log.Printf(" External ref: %s", limitOrder.ExternalReference) @@ -69,34 +69,34 @@ monitorOrder: log.Printf(" Quantity: %s %s", limitOrder.Quantity.Value.Value, limitOrder.Quantity.Token.Code) // Handle order state transitions - switch limitOrder.Status { - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS: + switch limitOrder.State { + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS: log.Printf(" ā³ Order submission in progress...") - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_SUBMISSION_FAILED: + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_SUBMISSION_FAILED: log.Printf(" āŒ Order submission failed") break monitorOrder - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_OPEN: + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_OPEN: log.Printf(" āœ“ Order open on ledger and available for matching") // Order is active - continue monitoring for fills - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_COMPLETE_IN_PROGRESS: + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_COMPLETE_IN_PROGRESS: log.Printf(" ā³ Order completion in progress...") - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_COMPLETE: + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_COMPLETE: log.Printf(" šŸŽ‰ Order completed (fully filled)!") break monitorOrder - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_CANCELLATION_IN_PROGRESS: + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_CANCELLATION_IN_PROGRESS: log.Printf(" ā³ Order cancellation in progress...") - case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_CANCELLED: + case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_CANCELLED: log.Printf(" āŒ Order cancelled") break monitorOrder default: - log.Printf(" āš ļø Unexpected order status: %v", limitOrder.Status) + log.Printf(" āš ļø Unexpected order state: %v", limitOrder.State) } } diff --git a/docs/docs/api-reference/trading/limit_order/v1/service/search-limit-orders/example.go b/docs/docs/api-reference/trading/limit_order/v1/service/search-limit-orders/example.go index 96be49dd..8f473baa 100644 --- a/docs/docs/api-reference/trading/limit_order/v1/service/search-limit-orders/example.go +++ b/docs/docs/api-reference/trading/limit_order/v1/service/search-limit-orders/example.go @@ -46,7 +46,7 @@ func main() { log.Printf(" Account: %s", order.Account) log.Printf(" External ref: %s", order.ExternalReference) log.Printf(" Side: %s", order.Side) - log.Printf(" Status: %s", order.Status) + log.Printf(" State: %s", order.State) log.Printf(" Limit price: %s %s", order.LimitPrice.Value.Value, order.LimitPrice.Token.Code) log.Printf(" Quantity: %s %s", order.Quantity.Value.Value, order.Quantity.Token.Code) } diff --git a/go/trading/limit_order/v1/limit_order.pb.go b/go/trading/limit_order/v1/limit_order.pb.go index bd470b07..4451d5bd 100644 --- a/go/trading/limit_order/v1/limit_order.pb.go +++ b/go/trading/limit_order/v1/limit_order.pb.go @@ -76,32 +76,31 @@ func (LimitOrderSide) EnumDescriptor() ([]byte, []int) { return file_meshtrade_trading_limit_order_v1_limit_order_proto_rawDescGZIP(), []int{0} } -// LimitOrderStatus represents the current state of a limit order. -// Populated only when live_ledger_data=true in requests. -type LimitOrderStatus int32 +// LimitOrderState represents the current life-cycle state of a limit order. +type LimitOrderState int32 const ( // Unspecified status. - LimitOrderStatus_LIMIT_ORDER_STATUS_UNSPECIFIED LimitOrderStatus = 0 + LimitOrderState_LIMIT_ORDER_STATUS_UNSPECIFIED LimitOrderState = 0 // Submission transaction in progress. - LimitOrderStatus_LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS LimitOrderStatus = 1 + LimitOrderState_LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS LimitOrderState = 1 // Submission failed. - LimitOrderStatus_LIMIT_ORDER_STATUS_SUBMISSION_FAILED LimitOrderStatus = 2 + LimitOrderState_LIMIT_ORDER_STATUS_SUBMISSION_FAILED LimitOrderState = 2 // Order is open on the ledger. - LimitOrderStatus_LIMIT_ORDER_STATUS_OPEN LimitOrderStatus = 3 + LimitOrderState_LIMIT_ORDER_STATUS_OPEN LimitOrderState = 3 // Completion in progress. - LimitOrderStatus_LIMIT_ORDER_STATUS_COMPLETE_IN_PROGRESS LimitOrderStatus = 4 + LimitOrderState_LIMIT_ORDER_STATUS_COMPLETE_IN_PROGRESS LimitOrderState = 4 // Order completed (fully filled). - LimitOrderStatus_LIMIT_ORDER_STATUS_COMPLETE LimitOrderStatus = 5 + LimitOrderState_LIMIT_ORDER_STATUS_COMPLETE LimitOrderState = 5 // Cancellation in progress. - LimitOrderStatus_LIMIT_ORDER_STATUS_CANCELLATION_IN_PROGRESS LimitOrderStatus = 6 + LimitOrderState_LIMIT_ORDER_STATUS_CANCELLATION_IN_PROGRESS LimitOrderState = 6 // Order cancelled. - LimitOrderStatus_LIMIT_ORDER_STATUS_CANCELLED LimitOrderStatus = 7 + LimitOrderState_LIMIT_ORDER_STATUS_CANCELLED LimitOrderState = 7 ) -// Enum value maps for LimitOrderStatus. +// Enum value maps for LimitOrderState. var ( - LimitOrderStatus_name = map[int32]string{ + LimitOrderState_name = map[int32]string{ 0: "LIMIT_ORDER_STATUS_UNSPECIFIED", 1: "LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS", 2: "LIMIT_ORDER_STATUS_SUBMISSION_FAILED", @@ -111,7 +110,7 @@ var ( 6: "LIMIT_ORDER_STATUS_CANCELLATION_IN_PROGRESS", 7: "LIMIT_ORDER_STATUS_CANCELLED", } - LimitOrderStatus_value = map[string]int32{ + LimitOrderState_value = map[string]int32{ "LIMIT_ORDER_STATUS_UNSPECIFIED": 0, "LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS": 1, "LIMIT_ORDER_STATUS_SUBMISSION_FAILED": 2, @@ -123,30 +122,30 @@ var ( } ) -func (x LimitOrderStatus) Enum() *LimitOrderStatus { - p := new(LimitOrderStatus) +func (x LimitOrderState) Enum() *LimitOrderState { + p := new(LimitOrderState) *p = x return p } -func (x LimitOrderStatus) String() string { +func (x LimitOrderState) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (LimitOrderStatus) Descriptor() protoreflect.EnumDescriptor { +func (LimitOrderState) Descriptor() protoreflect.EnumDescriptor { return file_meshtrade_trading_limit_order_v1_limit_order_proto_enumTypes[1].Descriptor() } -func (LimitOrderStatus) Type() protoreflect.EnumType { +func (LimitOrderState) Type() protoreflect.EnumType { return &file_meshtrade_trading_limit_order_v1_limit_order_proto_enumTypes[1] } -func (x LimitOrderStatus) Number() protoreflect.EnumNumber { +func (x LimitOrderState) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use LimitOrderStatus.Descriptor instead. -func (LimitOrderStatus) EnumDescriptor() ([]byte, []int) { +// Deprecated: Use LimitOrderState.Descriptor instead. +func (LimitOrderState) EnumDescriptor() ([]byte, []int) { return file_meshtrade_trading_limit_order_v1_limit_order_proto_rawDescGZIP(), []int{1} } @@ -203,9 +202,8 @@ type LimitOrder struct { // // Only populated when live_ledger_data=true in request. FilledQuantity *v1.Amount `protobuf:"bytes,11,opt,name=filled_quantity,json=filledQuantity,proto3" json:"filled_quantity,omitempty"` - // Order status from live ledger data. - // Only populated when live_ledger_data=true in request. - Status LimitOrderStatus `protobuf:"varint,12,opt,name=status,proto3,enum=meshtrade.trading.limit_order.v1.LimitOrderStatus" json:"status,omitempty"` + // Limit Order life cycle state. + State LimitOrderState `protobuf:"varint,12,opt,name=state,proto3,enum=meshtrade.trading.limit_order.v1.LimitOrderState" json:"state,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -310,18 +308,18 @@ func (x *LimitOrder) GetFilledQuantity() *v1.Amount { return nil } -func (x *LimitOrder) GetStatus() LimitOrderStatus { +func (x *LimitOrder) GetState() LimitOrderState { if x != nil { - return x.Status + return x.State } - return LimitOrderStatus_LIMIT_ORDER_STATUS_UNSPECIFIED + return LimitOrderState_LIMIT_ORDER_STATUS_UNSPECIFIED } var File_meshtrade_trading_limit_order_v1_limit_order_proto protoreflect.FileDescriptor const file_meshtrade_trading_limit_order_v1_limit_order_proto_rawDesc = "" + "\n" + - "2meshtrade/trading/limit_order/v1/limit_order.proto\x12 meshtrade.trading.limit_order.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1emeshtrade/type/v1/amount.proto\"\xc9\a\n" + + "2meshtrade/trading/limit_order/v1/limit_order.proto\x12 meshtrade.trading.limit_order.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1emeshtrade/type/v1/amount.proto\"\xc6\a\n" + "\n" + "LimitOrder\x12\xc8\x01\n" + "\x04name\x18\x01 \x01(\tB\xb3\x01\xbaH\xaf\x01\xba\x01\xab\x01\n" + @@ -338,13 +336,13 @@ const file_meshtrade_trading_limit_order_v1_limit_order_proto_rawDesc = "" + "\n" + "fill_price\x18\n" + " \x01(\v2\x19.meshtrade.type.v1.AmountR\tfillPrice\x12B\n" + - "\x0ffilled_quantity\x18\v \x01(\v2\x19.meshtrade.type.v1.AmountR\x0efilledQuantity\x12J\n" + - "\x06status\x18\f \x01(\x0e22.meshtrade.trading.limit_order.v1.LimitOrderStatusR\x06statusJ\x04\b\x04\x10\x05R\fdisplay_name*g\n" + + "\x0ffilled_quantity\x18\v \x01(\v2\x19.meshtrade.type.v1.AmountR\x0efilledQuantity\x12G\n" + + "\x05state\x18\f \x01(\x0e21.meshtrade.trading.limit_order.v1.LimitOrderStateR\x05stateJ\x04\b\x04\x10\x05R\fdisplay_name*g\n" + "\x0eLimitOrderSide\x12 \n" + "\x1cLIMIT_ORDER_SIDE_UNSPECIFIED\x10\x00\x12\x18\n" + "\x14LIMIT_ORDER_SIDE_BUY\x10\x01\x12\x19\n" + - "\x15LIMIT_ORDER_SIDE_SELL\x10\x02*\xcd\x02\n" + - "\x10LimitOrderStatus\x12\"\n" + + "\x15LIMIT_ORDER_SIDE_SELL\x10\x02*\xcc\x02\n" + + "\x0fLimitOrderState\x12\"\n" + "\x1eLIMIT_ORDER_STATUS_UNSPECIFIED\x10\x00\x12-\n" + ")LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS\x10\x01\x12(\n" + "$LIMIT_ORDER_STATUS_SUBMISSION_FAILED\x10\x02\x12\x1b\n" + @@ -370,10 +368,10 @@ func file_meshtrade_trading_limit_order_v1_limit_order_proto_rawDescGZIP() []byt var file_meshtrade_trading_limit_order_v1_limit_order_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_meshtrade_trading_limit_order_v1_limit_order_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_meshtrade_trading_limit_order_v1_limit_order_proto_goTypes = []any{ - (LimitOrderSide)(0), // 0: meshtrade.trading.limit_order.v1.LimitOrderSide - (LimitOrderStatus)(0), // 1: meshtrade.trading.limit_order.v1.LimitOrderStatus - (*LimitOrder)(nil), // 2: meshtrade.trading.limit_order.v1.LimitOrder - (*v1.Amount)(nil), // 3: meshtrade.type.v1.Amount + (LimitOrderSide)(0), // 0: meshtrade.trading.limit_order.v1.LimitOrderSide + (LimitOrderState)(0), // 1: meshtrade.trading.limit_order.v1.LimitOrderState + (*LimitOrder)(nil), // 2: meshtrade.trading.limit_order.v1.LimitOrder + (*v1.Amount)(nil), // 3: meshtrade.type.v1.Amount } var file_meshtrade_trading_limit_order_v1_limit_order_proto_depIdxs = []int32{ 0, // 0: meshtrade.trading.limit_order.v1.LimitOrder.side:type_name -> meshtrade.trading.limit_order.v1.LimitOrderSide @@ -381,7 +379,7 @@ var file_meshtrade_trading_limit_order_v1_limit_order_proto_depIdxs = []int32{ 3, // 2: meshtrade.trading.limit_order.v1.LimitOrder.quantity:type_name -> meshtrade.type.v1.Amount 3, // 3: meshtrade.trading.limit_order.v1.LimitOrder.fill_price:type_name -> meshtrade.type.v1.Amount 3, // 4: meshtrade.trading.limit_order.v1.LimitOrder.filled_quantity:type_name -> meshtrade.type.v1.Amount - 1, // 5: meshtrade.trading.limit_order.v1.LimitOrder.status:type_name -> meshtrade.trading.limit_order.v1.LimitOrderStatus + 1, // 5: meshtrade.trading.limit_order.v1.LimitOrder.state:type_name -> meshtrade.trading.limit_order.v1.LimitOrderState 6, // [6:6] is the sub-list for method output_type 6, // [6:6] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name diff --git a/go/trading/limit_order/v1/service.pb.go b/go/trading/limit_order/v1/service.pb.go index 3a655ccb..e8e5d8a9 100644 --- a/go/trading/limit_order/v1/service.pb.go +++ b/go/trading/limit_order/v1/service.pb.go @@ -446,9 +446,15 @@ type MonitorLimitOrderRequest struct { // // *MonitorLimitOrderRequest_Name // *MonitorLimitOrderRequest_ExternalReference - Identifier isMonitorLimitOrderRequest_Identifier `protobuf_oneof:"identifier"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + Identifier isMonitorLimitOrderRequest_Identifier `protobuf_oneof:"identifier"` + // When true, fetches live ledger data for order. + // When false, returns only stored metadata. + // Note: The streaming does not stream based on ledger events such as fill amount changes, + // only limit order state changes triggers a stream update. If this is set to true + // then live ledger data will populated with the updated limit order state. + LiveLedgerData bool `protobuf:"varint,3,opt,name=live_ledger_data,json=liveLedgerData,proto3" json:"live_ledger_data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *MonitorLimitOrderRequest) Reset() { @@ -506,6 +512,13 @@ func (x *MonitorLimitOrderRequest) GetExternalReference() string { return "" } +func (x *MonitorLimitOrderRequest) GetLiveLedgerData() bool { + if x != nil { + return x.LiveLedgerData + } + return false +} + type isMonitorLimitOrderRequest_Identifier interface { isMonitorLimitOrderRequest_Identifier() } @@ -550,10 +563,11 @@ const file_meshtrade_trading_limit_order_v1_service_proto_rawDesc = "" + "\aaccount\x18\x02 \x01(\tB8\xbaH5r321^accounts/[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$R\aaccount\x12(\n" + "\x10live_ledger_data\x18\x03 \x01(\bR\x0eliveLedgerData\"l\n" + "\x19SearchLimitOrdersResponse\x12O\n" + - "\flimit_orders\x18\x01 \x03(\v2,.meshtrade.trading.limit_order.v1.LimitOrderR\vlimitOrders\"\xb0\x01\n" + + "\flimit_orders\x18\x01 \x03(\v2,.meshtrade.trading.limit_order.v1.LimitOrderR\vlimitOrders\"\xda\x01\n" + "\x18MonitorLimitOrderRequest\x12U\n" + "\x04name\x18\x01 \x01(\tB?\xbaH