Trades

Trades

Get list of trades

  • Typescript Core SDK

📚SDK REFERENCE

  • listTrades

Request

Get the last 5 trades made with ETH on XpansionChain:

const getListTrades = async (partyATokenType: string, pageSize: number) => {
  const response = await client.listTrades({
    partyATokenType,
    pageSize,
  });
  return response;
};
getListTrades('ETH', 5)
  .then((result) => {
    console.log(result);
  })
  .catch((e) => {
    console.log(e);
  });

Example response

{
  result: [
    {
      transaction_id: 56408, // Sequential ID of this trade within XpansionChain
      status: 'success', // Status of this trade
      a: {  // Buy object
        order_id: 1581, // The ID of the order involved in the trade
        token_type: 'ETH', // The type of the token that this trade sold
        sold: '10000000000000000' // The amount of that order\'s asset this trade sold in wei
      },
      b: { // Sell object
        order_id: 1579, // The ID of the order involved in the trade
        token_type: 'ERC721', // The type of the token that this trade sold
        token_id: '1507', // The ID of the token that this trade sold
        token_address: '0x72ec08386b4bbf0c344238b1bb892b2b279f1dcf', // The contract address of the token that this trade sold
        sold: '1'  // The amount of that order\'s asset this trade sold
      },
      timestamp: '2022-09-29T10:33:26.39022Z' // Time this trade occurred
    },
    // Other trades returned
    ...
  ],
  cursor: 'eyJ0cmFuc2FjdGlvbl9pZCI6NTY0MDgsInN0YXR1cyI6InN1Y2Nlc3MiLCJwYXJ0eV9hX29yZGVyX2lkIjoxNTYzLCJwYXJ0eV9hX2V0aGVyX2tleSI6IjB4MGEyMDU3NDRkYTMzZWY4Y2Y2NjY0OWM1OGFhYmFmZGZiY2E3NGFkMSIsInBhcnR5X2Ffc29sZF90b2tlbl90eXBlIjoiRVRIIiwicGFydHlfYV9zb2xkX3Rva2VuX2lkIjoiIiwicGFydHlfYV9zb2xkX3Rva2VuX2FkZHJlc3MiOiIiLCJwYXJ0eV9hX3NvbGRfcXVhbnRpdHkiOiIxMDAwMDAwMDAwMDAwMCIsInBhcnR5X2Jfb3JkZXJfaWQiOjExNzMsInBhcnR5X2JfZXRoZXJfa2V5IjoiMHg2YzQ0MzUxMGNmNmE0YTU2MzQxZDRjZTFhZWEzYjQzOTlhMTRmYmM3IiwicGFydHlfYl9zb2xkX3Rva2VuX3R5cGUiOiJFUkM3MjEiLCJwYXJ0eV9iX3NvbGRfdG9rZW5faWQiOiIxMCIsInBhcnR5X2Jfc29sZF90b2tlbl9hZGRyZXNzIjoiMHhiYzkxYTYxYzU2MWQ1ZDVlYzMxNmE0N2NlMjU1OGJiNjk0ZDUxNmQ1IiwicGFydHlfYl9zb2xkX3F1YW50aXR5IjoiMSIsImNyZWF0ZWRfYXQiOiIyMDIyLTA5LTI5VDEwOjMzOjI2LjM5MDIyWiJ9',
  // Remaining results
  remaining: 1
}

  • Kotlin (JVM) Core SDK

📚SDK REFERENCE

  • listTrades

  • Swift Core SDK

📚SDK REFERENCE

  • listTrades

  • Golang Core SDK

📚SDK REFERENCE

  • ListTrades

  • C# Core SDK

📚SDK REFERENCE

  • ListTrades

Get details about a trade

  • Typescript Core SDK

📚SDK REFERENCE

  • getTrade

Request

Get details about the trade with ID 56408:

const getTrade = async (id: string) => {
  const response = await client.getTrade({
    id,
  });
  return response;
};
getTrade('56715')
  .then((result) => {
    console.log(result);
  })
  .catch((e) => {
    console.log(e);
  });

Example response

{
      transaction_id: 56408, // Sequential ID of this trade within XpansionChain 
      status: 'success', // Status of this trade
      a: {  // Buy object
        order_id: 1581, // The ID of the order involved in the trade
        token_type: 'ETH', // The type of the token that this trade sold
        sold: '10000000000000000' // The amount of that order\'s asset this trade sold in wei
      },
      b: { // Sell object
        order_id: 1579, // The ID of the order involved in the trade
        token_type: 'ERC721', // The type of the token that this trade sold
        token_id: '1507', // The ID of the token that this trade sold
        token_address: '0x72ec08386b4bbf0c344238b1bb892b2b279f1dcf', // The contract address of the token that this trade sold
        sold: '1'  // The amount of that order\'s asset this trade sold
      },
      timestamp: '2022-09-29T10:33:26.39022Z' // Time this trade occurred
    }

  • Kotlin (JVM) Core SDK

📚SDK REFERENCE

  • getTrade

  • Swift Core SDK

📚SDK REFERENCE

  • getTrade

  • Golang Core SDK

📚SDK REFERENCE

  • GetTrade

  • C# Core SDK

📚SDK REFERENCE

  • GetTrade

Last updated