Skip to content

Commit b7c8f5e

Browse files
LawrenceMarsmanBRBussyclaude
authored
Limit Order: Rename status to state and add live_ledger_data to MonitorLimitOrderRequest (#130)
* Limit Order state * generated code updates * proto field * gen * Update docs examples to use LimitOrderState instead of LimitOrderStatus Aligns documentation Go examples with the proto rename of status → state and LimitOrderStatus → LimitOrderState. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Bernard Bussy <bernard.r.bussy@gmail.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent e606dcc commit b7c8f5e

File tree

11 files changed

+94
-75
lines changed

11 files changed

+94
-75
lines changed

docs/docs/api-reference/trading/limit_order/v1/service/cancel-limit-order/example.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func main() {
3636
// Response contains the cancellation status
3737
log.Printf("✓ Limit order cancellation initiated:")
3838
log.Printf(" Order name: %s", orderName)
39-
log.Printf(" Status: %s", response.Status)
39+
log.Printf(" State: %s", response.State)
4040

4141
// Monitor the order until cancellation is complete
4242
log.Printf("\n📡 Monitoring order until cancellation is complete...")
@@ -58,13 +58,13 @@ monitorOrder:
5858
log.Fatalf("Stream error: %v", err)
5959
}
6060

61-
log.Printf(" Status: %s", update.Status)
61+
log.Printf(" State: %s", update.State)
6262

63-
switch update.Status {
64-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_CANCELLATION_IN_PROGRESS:
63+
switch update.State {
64+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_CANCELLATION_IN_PROGRESS:
6565
log.Printf(" ⏳ Order cancellation in progress...")
6666

67-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_CANCELLED:
67+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_CANCELLED:
6868
log.Printf(" ✓ Order successfully cancelled on ledger!")
6969
break monitorOrder
7070
}

docs/docs/api-reference/trading/limit_order/v1/service/create-limit-order/example.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ monitorOrder:
9292
log.Fatalf("Stream error: %v", err)
9393
}
9494

95-
log.Printf(" Status: %s", update.Status)
95+
log.Printf(" State: %s", update.State)
9696

97-
switch update.Status {
98-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS:
97+
switch update.State {
98+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS:
9999
log.Printf(" ⏳ Order submission in progress...")
100100

101-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_SUBMISSION_FAILED:
101+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_SUBMISSION_FAILED:
102102
log.Fatalf(" ❌ Order submission failed")
103103

104-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_OPEN:
104+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_OPEN:
105105
log.Printf(" ✓ Order is now open on the ledger and available for matching!")
106106
break monitorOrder
107107
}

docs/docs/api-reference/trading/limit_order/v1/service/get-limit-order/example.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func main() {
3939
log.Printf(" Account: %s", limitOrder.Account)
4040
log.Printf(" External reference: %s", limitOrder.ExternalReference)
4141
log.Printf(" Side: %s", limitOrder.Side)
42-
log.Printf(" Status: %s (UNSPECIFIED when live_ledger_data=false)", limitOrder.Status)
42+
log.Printf(" State: %s (UNSPECIFIED when live_ledger_data=false)", limitOrder.State)
4343

4444
// Example 2: Get with live ledger data (queries the ledger for current status)
4545
requestWithLiveData := &limit_orderv1.GetLimitOrderRequest{
@@ -54,7 +54,7 @@ func main() {
5454

5555
log.Printf("\n✓ Limit order retrieved (with live ledger data):")
5656
log.Printf(" Resource name: %s", limitOrderWithStatus.Name)
57-
log.Printf(" Status: %s", limitOrderWithStatus.Status)
57+
log.Printf(" State: %s", limitOrderWithStatus.State)
5858
log.Printf(" Limit price: %s %s", limitOrderWithStatus.LimitPrice.Value.Value, limitOrderWithStatus.LimitPrice.Token.Code)
5959
log.Printf(" Quantity: %s %s", limitOrderWithStatus.Quantity.Value.Value, limitOrderWithStatus.Quantity.Token.Code)
6060
}

docs/docs/api-reference/trading/limit_order/v1/service/list-limit-orders/example.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ func main() {
4141
log.Printf(" Side: %s", order.Side)
4242
log.Printf(" Limit price: %s %s", order.LimitPrice.Value.Value, order.LimitPrice.Token.Code)
4343
log.Printf(" Quantity: %s %s", order.Quantity.Value.Value, order.Quantity.Token.Code)
44-
log.Printf(" Status: %s", order.Status)
44+
log.Printf(" State: %s", order.State)
4545
}
4646
}

docs/docs/api-reference/trading/limit_order/v1/service/monitor-limit-order/example.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ monitorOrder:
6060
}
6161

6262
// Process each order update as it arrives
63-
log.Printf("\n📡 Status update received: %s", limitOrder.Status)
63+
log.Printf("\n📡 State update received: %s", limitOrder.State)
6464
log.Printf(" Resource name: %s", limitOrder.Name)
6565
log.Printf(" Account: %s", limitOrder.Account)
6666
log.Printf(" External ref: %s", limitOrder.ExternalReference)
@@ -69,34 +69,34 @@ monitorOrder:
6969
log.Printf(" Quantity: %s %s", limitOrder.Quantity.Value.Value, limitOrder.Quantity.Token.Code)
7070

7171
// Handle order state transitions
72-
switch limitOrder.Status {
73-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS:
72+
switch limitOrder.State {
73+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_SUBMISSION_IN_PROGRESS:
7474
log.Printf(" ⏳ Order submission in progress...")
7575

76-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_SUBMISSION_FAILED:
76+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_SUBMISSION_FAILED:
7777
log.Printf(" ❌ Order submission failed")
7878
break monitorOrder
7979

80-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_OPEN:
80+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_OPEN:
8181
log.Printf(" ✓ Order open on ledger and available for matching")
8282
// Order is active - continue monitoring for fills
8383

84-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_COMPLETE_IN_PROGRESS:
84+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_COMPLETE_IN_PROGRESS:
8585
log.Printf(" ⏳ Order completion in progress...")
8686

87-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_COMPLETE:
87+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_COMPLETE:
8888
log.Printf(" 🎉 Order completed (fully filled)!")
8989
break monitorOrder
9090

91-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_CANCELLATION_IN_PROGRESS:
91+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_CANCELLATION_IN_PROGRESS:
9292
log.Printf(" ⏳ Order cancellation in progress...")
9393

94-
case limit_orderv1.LimitOrderStatus_LIMIT_ORDER_STATUS_CANCELLED:
94+
case limit_orderv1.LimitOrderState_LIMIT_ORDER_STATUS_CANCELLED:
9595
log.Printf(" ❌ Order cancelled")
9696
break monitorOrder
9797

9898
default:
99-
log.Printf(" ⚠️ Unexpected order status: %v", limitOrder.Status)
99+
log.Printf(" ⚠️ Unexpected order state: %v", limitOrder.State)
100100
}
101101
}
102102

docs/docs/api-reference/trading/limit_order/v1/service/search-limit-orders/example.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func main() {
4646
log.Printf(" Account: %s", order.Account)
4747
log.Printf(" External ref: %s", order.ExternalReference)
4848
log.Printf(" Side: %s", order.Side)
49-
log.Printf(" Status: %s", order.Status)
49+
log.Printf(" State: %s", order.State)
5050
log.Printf(" Limit price: %s %s", order.LimitPrice.Value.Value, order.LimitPrice.Token.Code)
5151
log.Printf(" Quantity: %s %s", order.Quantity.Value.Value, order.Quantity.Token.Code)
5252
}

go/trading/limit_order/v1/limit_order.pb.go

Lines changed: 36 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/trading/limit_order/v1/service.pb.go

Lines changed: 19 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/meshtrade/trading/limit_order/v1/limit_order.proto

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,9 @@ message LimitOrder {
131131
meshtrade.type.v1.Amount filled_quantity = 11;
132132

133133
/*
134-
Order status from live ledger data.
135-
Only populated when live_ledger_data=true in request.
134+
Limit Order life cycle state.
136135
*/
137-
LimitOrderStatus status = 12;
136+
LimitOrderState state = 12;
138137
}
139138

140139
/*
@@ -152,10 +151,9 @@ enum LimitOrderSide {
152151
}
153152

154153
/*
155-
LimitOrderStatus represents the current state of a limit order.
156-
Populated only when live_ledger_data=true in requests.
154+
LimitOrderState represents the current life-cycle state of a limit order.
157155
*/
158-
enum LimitOrderStatus {
156+
enum LimitOrderState {
159157
// Unspecified status.
160158
LIMIT_ORDER_STATUS_UNSPECIFIED = 0;
161159

proto/meshtrade/trading/limit_order/v1/service.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,4 +295,13 @@ message MonitorLimitOrderRequest {
295295
*/
296296
string external_reference = 2;
297297
}
298+
299+
/*
300+
When true, fetches live ledger data for order.
301+
When false, returns only stored metadata.
302+
Note: The streaming does not stream based on ledger events such as fill amount changes,
303+
only limit order state changes triggers a stream update. If this is set to true
304+
then live ledger data will populated with the updated limit order state.
305+
*/
306+
bool live_ledger_data = 3;
298307
}

0 commit comments

Comments
 (0)