github.com/InjectiveLabs/sdk-go@v1.53.0/examples/exchange/spot/5_Orders/example.go (about) 1 package main 2 3 import ( 4 "context" 5 "encoding/json" 6 "fmt" 7 8 "github.com/InjectiveLabs/sdk-go/client/common" 9 exchangeclient "github.com/InjectiveLabs/sdk-go/client/exchange" 10 spotExchangePB "github.com/InjectiveLabs/sdk-go/exchange/spot_exchange_rpc/pb" 11 ) 12 13 func main() { 14 // network := common.LoadNetwork("mainnet", "k8s") 15 network := common.LoadNetwork("mainnet", "lb") 16 exchangeClient, err := exchangeclient.NewExchangeClient(network) 17 if err != nil { 18 panic(err) 19 } 20 21 ctx := context.Background() 22 marketId := "0xa508cb32923323679f29a032c70342c147c17d0145625922b0ef22e955c844c0" 23 skip := uint64(0) 24 limit := int32(10) 25 26 req := spotExchangePB.OrdersRequest{ 27 MarketId: marketId, 28 Skip: skip, 29 Limit: limit, 30 } 31 32 res, err := exchangeClient.GetSpotOrders(ctx, &req) 33 if err != nil { 34 fmt.Println(err) 35 } 36 37 str, _ := json.MarshalIndent(res, "", " ") 38 fmt.Print(string(str)) 39 }