Skip to main content

GetLimitOrder

Retrieves a specific limit order by its resource name.

Provides access to limit order metadata and optionally fetches live ledger data when populate_ledger_data is true.

Method Options​

Authorisation specification of the GetLimitOrder method.

TypeMETHOD_TYPE_READ
Access LevelMETHOD_ACCESS_LEVEL_AUTHORISED
Roles
  • ROLE_TRADING_ADMIN
  • ROLE_TRADING_VIEWER
  • ROLE_TRADING_LIMIT_ORDER_ADMIN
  • ROLE_TRADING_LIMIT_ORDER_VIEWER

Parameters​

Request and response parameter message overview:

Input: GetLimitOrderRequest Message​

FieldTypeRequiredDescription
Name

string

True

The resource name of the limit order to retrieve. Format: limit_orders/{ULIDv2}.

LiveLedgerData

bool

False

When true, fetches live ledger data including fill status. When false, returns only stored metadata.

Returns: LimitOrder Message​

Code Examples​

Select supported SDK in the language of your choice for a full example of how to invoke the this method:

package main

import (
"context"
"log"

limit_orderv1 "github.com/meshtrade/api/go/trading/limit_order/v1"
)

func main() {
ctx := context.Background()

// Default configuration is used and credentials come from MESH_API_CREDENTIALS
// environment variable or default discovery methods. Zero config required
// unless you want custom configuration.
service, err := limit_orderv1.NewLimitOrderService()
if err != nil {
log.Fatalf("Failed to create service: %v", err)
}
defer service.Close()

// Get a limit order by its resource name
// Replace with an actual limit order resource name from your system
orderName := "limit_orders/01HQVBZ9F8X2T3K4M5N6P7Q8R9"

// Example 1: Get without live ledger data (faster, but status will be UNSPECIFIED)
request := &limit_orderv1.GetLimitOrderRequest{
Name: orderName,
LiveLedgerData: false,
}

limitOrder, err := service.GetLimitOrder(ctx, request)
if err != nil {
log.Fatalf("GetLimitOrder failed: %v", err)
}

log.Printf("āœ“ Limit order retrieved (cached data):")
log.Printf(" Resource name: %s", limitOrder.Name)
log.Printf(" Number: %s", limitOrder.Number)
log.Printf(" Account: %s", limitOrder.Account)
log.Printf(" External reference: %s", limitOrder.ExternalReference)
log.Printf(" Side: %s", limitOrder.Side)
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{
Name: orderName,
LiveLedgerData: true,
}

limitOrderWithStatus, err := service.GetLimitOrder(ctx, requestWithLiveData)
if err != nil {
log.Fatalf("GetLimitOrder with live data failed: %v", err)
}

log.Printf("\nāœ“ Limit order retrieved (with live ledger data):")
log.Printf(" Resource name: %s", limitOrderWithStatus.Name)
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)
}

Advanced Configuration​

For advanced client configuration options (custom endpoints, TLS settings, timeouts), see the SDK Configuration Guide.

Other Methods​