Trade For Account

Trades for Account

This endpoint represents all trades that affect a given account.

This endpoint can also be used in streaming mode, making it possible to listen for new trades that affect the given account as they occur on the HC Net. If called in streaming mode aurora will start at the earliest known trade unless a cursor is set. In that case it will start from the cursor. You can also set cursor value to now to only stream trades created since your request time.

Request:-

GET /accounts/{account_id}/trades{?cursor,limit,order}

Arguments

Name Notes Description Example
account_id required, string ID of an account GBYTR4MC5JAX4ALGUBJD7EIKZVM7CUGWKXIUJMRSMK573XH2O7VAK3SR
?cursor optional, any, default null A paging token, specifying where to start returning records from. When streaming this can be set to nowto stream object created since your request time. 12884905984
?order optional, string, default asc The order in which to return rows, “asc” or “desc”. asc
?limit optional, number, default: 10 Maximum number of records to return. 200

Response

This endpoint responds with a list of trades that changed a given account’s state. See the trade resource for reference.

Example Streaming Event
  • {
  • _links:
  • { self: { href: '' },
  • base: { href:
  • '/accounts/GDICGE2CFCNM3ZWRUVOWDJB2RAO667UE7WOSJJ2Z3IMISUA7CJZCE3KO' },
  • counter: { href: '/accounts/GBILENMVJPVPEPXUPUPRBUEAME5OUQWAHIGZAX7TQX65NIQW3G3DGUYX' },
  • operation: { href: '/operations/47274327069954049'
  • } },
  • id: '47274327069954049-0',
  • paging_token: '47274327069954049-0',
  • ledger_close_time: '2018-09-12T00:00:34Z',
  • offer_id: '711437',
  • base_account: 'GDICGE2CFCNM3ZWRUVOWDJB2RAO667UE7WOSJJ2Z3IMISUA7CJZCE3KO',
  • base_amount: '13.0000000',
  • base_asset_type: 'native',
  • counter_account: 'GBILENMVJPVPEPXUPUPRBUEAME5OUQWAHIGZAX7TQX65NIQW3G3DGUYX',
  • counter_amount: '13.0000000',
  • counter_asset_type: 'credit_alphanum4',
  • counter_asset_code: 'CNY',
  • counter_asset_issuer: 'GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX',
  • base_is_seller: true,
  • price: { n: 1, d: 1 }
  • }

curl "https://network.paybito.com/accounts/GB55ZCH6WXZLJRUP3J36NHZSMIPNW24LZNGAOOLMFTJTIRZCCSUTY7XW/trades?limit=1"

{

"_links" : {

"self" : {

"href" : "/accounts/GB55ZCH6WXZLJRUP3J36NHZSMIPNW24LZNGAOOLMFTJTIRZCCSUTY7XW/trades?cursor=\u0026limit=1\u0026order=asc"

},

"next" : {

"href" : "/accounts/GB55ZCH6WXZLJRUP3J36NHZSMIPNW24LZNGAOOLMFTJTIRZCCSUTY7XW/trades?cursor=489570437173249-0\u0026limit=1\u0026order=asc"

},

"prev" : {

"href" : "/accounts/GB55ZCH6WXZLJRUP3J36NHZSMIPNW24LZNGAOOLMFTJTIRZCCSUTY7XW/trades?cursor=489570437173249-0\u0026limit=1\u0026order=desc"

}

},

"_embedded" : {

"records" : [

{

"_links" : {

"self" : {

"href" : ""

},

"base" : {

"href" : "/accounts/GB55ZCH6WXZLJRUP3J36NHZSMIPNW24LZNGAOOLMFTJTIRZCCSUTY7XW"

},

"counter" : {

"href" : "/accounts/GC5GGY6HZHBLIQWM6XKCT4ELWKJHWV37FIGD5PTJQCO7TBMZ6A6NQIMO"

},

"operation" : {

"href" : "/operations/489570437173249"

}

},

"id" : "489570437173249-0",

"paging_token" : "489570437173249-0",

"ledger_close_time" : "2018-12-26T06:00:01Z",

"offer_id" : "4",

"base_offer_id" : "8",

"base_account" : "GB55ZCH6WXZLJRUP3J36NHZSMIPNW24LZNGAOOLMFTJTIRZCCSUTY7XW",

"base_amount" : "100.0000000",

"base_asset_type" : "credit_alphanum12",

"base_asset_code" : "USDBTC",

"base_asset_issuer" : "GB55ZCH6WXZLJRUP3J36NHZSMIPNW24LZNGAOOLMFTJTIRZCCSUTY7XW",

"counter_offer_id" : "4611686044197195777",

"counter_account" : "GC5GGY6HZHBLIQWM6XKCT4ELWKJHWV37FIGD5PTJQCO7TBMZ6A6NQIMO",

"counter_amount" : "1.0000000",

"counter_asset_type" : "credit_alphanum12",

"base_is_seller" : true,

"price" :{

"n" : 1,

"d" : 100

}

}

]

}

}