100%

Trade

Trades

People on the HcNet can make offers to buy or sell assets. When an offer is fully or partially fulfilled, a trade happens.

Trades can be filtered for specific orderbook, defined by an asset pair: base and counter.

This endpoint can also be used in streaming mode, making it possible to listen for new trades as they occur on the Hashcash network. 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 /trades?base_asset_type={base_asset_type}&base_asset_code={base_asset_code}&base_asset_issuer={base_asset_issuer}&counter_asset_type={counter_asset_type}&counter_asset_code={counter_asset_code}&counter_asset_issuer={counter_asset_issuer}

Arguments

Name Notes Description Example
base_asset_type optional, string Type of base asset native
base_asset_code optional, string Code of base asset, not required if type is native USD
base_asset_issuer optional, string Issuer of base asset, not required if type is native ‘GA2HGBJIJKI6O4XEM7CZWY5PS6GKSXL6D34ERAJYQSPYA6X6AI7HYW36’
counter_asset_type optional, string Type of counter asset credit_alphanum4
counter_asset_code optional, string Code of counter asset, not required if type is native BTC
counter_asset_issuer optional, string Issuer of counter asset, not required if type is native ‘GD6VWBXI6NY3AOOR55RLVQ4MNIDSXE5JSAVXUTF35FRRI72LYPI3WL6Z’
offer_id optional, string filter for by a specific offer id 283606
?cursor optional, any, default null A paging token, specifying where to start returning records from. 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

The list of trades. base and counter in the records will match the asset pair filter order. If an asset pair is not specified, the order is arbitrary.

Example Streaming Event
  • {
  • _links:
  • { self: { href: '' },
  • base:
  • { href:
  • '/accounts/GDJNMHET4DTS7HUHU7IG5DB274OSMHUYA7TRRKOD6ZABHPUW5YWJ4SUD' },
  • counter:
  • { href: '/accounts/GCALYDRCCJEUPMV24TAX2N2N3IBX7NUUYZNM7I5FQS5GIEQ4A7EVKUOP' },
  • operation: { href: '/operations/47261068505915393' }
  • },
  • id: '47261068505915393-0',
  • paging_token: '47261068505915393-0',
  • ledger_close_time: '2018-09-11T19:42:04Z',
  • offer_id: '734529',
  • base_account: 'GDJNMHET4DTS7HUHU7IG5DB274OSMHUYA7TRRKOD6ZABHPUW5YWJ4SUD',
  • base_amount: '0.0175999',
  • base_asset_type: 'credit_alphanum4',
  • base_asset_code: 'BOC',
  • base_asset_issuer: 'GCTS32RGWRH6RJM62UVZ4UT5ZN5L6B2D3LPGO6Z2NM2EOGVQA7TA6SKO',
  • counter_account: 'GCALYDRCCJEUPMV24TAX2N2N3IBX7NUUYZNM7I5FQS5GIEQ4A7EVKUOP',
  • counter_amount: '0.0199998',
  • counter_asset_type: 'credit_alphanum4',
  • counter_asset_code: 'ABC',
  • counter_asset_issuer: 'GCTS32RGWRH6RJM62UVZ4UT5ZN5L6B2D3LPGO6Z2NM2EOGVQA7TA6SKO',
  • base_is_seller: true,
  • price: { n: 2840909, d: 2500000 }
  • }

curl "https://network.paybito.com/trades?base_asset_type=native&counter_asset_code=BTCHCX&counter_asset_issuer=GA2UAQA75KMZUA6OM44C2ITX7L2AIGTFRPGQGURWOMJKV55V2TTSORBJ&counter_asset_type=credit_alphanum12&limit=2&order=desc"

{

"_links" : {

"self" : {

"href" : "/trades?base_asset_type=native\u0026counter_asset_code=BTCHCX\u0026counter_asset_issuer=GA2UAQA75KMZUA6OM44C2ITX7L2AIGTFRPGQGURWOMJKV55V2TTSORBJ\u0026counter_asset_type=credit_alphanum12\u0026cursor=\u0026limit=2\u0026order=desc"

},

"next" : {

"href" : "/trades?base_asset_type=native\u0026counter_asset_code=BTCHCX\u0026counter_asset_issuer=GA2UAQA75KMZUA6OM44C2ITX7L2AIGTFRPGQGURWOMJKV55V2TTSORBJ\u0026counter_asset_type=credit_alphanum12\u0026cursor=\u0026limit=2\u0026order=desc"

},

"prev" : {

"href" : "/trades?base_asset_type=native\u0026counter_asset_code=BTCHCX\u0026counter_asset_issuer=GA2UAQA75KMZUA6OM44C2ITX7L2AIGTFRPGQGURWOMJKV55V2TTSORBJ\u0026counter_asset_type=credit_alphanum12\u0026cursor=\u0026limit=2\u0026order=asc"

}

},

"_embedded" : {

"records" : []

}

}

+
Chat Now
Welcome to HashCash Support