github.com/InjectiveLabs/sdk-go@v1.53.0/examples/exchange/derivatives/14_SubaccountOrdersList/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 derivativeExchangePB "github.com/InjectiveLabs/sdk-go/exchange/derivative_exchange_rpc/pb" 11 ) 12 13 func main() { 14 // network := common.LoadNetwork("mainnet", "k8s") 15 network := common.LoadNetwork("testnet", "lb") 16 exchangeClient, err := exchangeclient.NewExchangeClient(network) 17 if err != nil { 18 panic(err) 19 } 20 21 ctx := context.Background() 22 marketId := "0x4ca0f92fc28be0c9761326016b5a1a2177dd6375558365116b5bdda9abc229ce" 23 subaccountId := "0xaf79152ac5df276d9a8e1e2e22822f9713474902000000000000000000000000" 24 skip := uint64(0) 25 limit := int32(10) 26 27 req := derivativeExchangePB.SubaccountOrdersListRequest{ 28 MarketId: marketId, 29 SubaccountId: subaccountId, 30 Skip: skip, 31 Limit: limit, 32 } 33 34 res, err := exchangeClient.GetSubaccountDerivativeOrdersList(ctx, &req) 35 if err != nil { 36 panic(err) 37 } 38 39 str, _ := json.MarshalIndent(res, "", " ") 40 fmt.Print(string(str)) 41 }