Summary Reports

The SDK can be used to generate order summary reports. The API is pretty simple:

const rows = await sdk.reports.getSummary({
    chainId: 1, 
    start: new Date(Date.now()-86400000), 
    end: new Date()
});

The chainId reflects swap requests placed on a particular chain. The start and end dates are simply javascript Date objects. The rows returned is an array of arrays where the first array contains the header fields. Here is an example:

 [
  [
    'order_id',
    'status',
    'txn_hash',
    'date_time',
    'wallet',
    'token_in_symbol',
    'token_in_spot_usd',
    'token_in_amount',
    'token_out_symbol',
    'token_out_spot_usd',
    'token_out_amount',
    'fee_token_symbol',
    'fee_token_spot_usd',
    'gas_fee_amount',
    'dexible_fee_amount'
  ],
  [
    63,
    'COMPLETED',
    '0x420c2b24a9ca5a7c01cd7f892d40ae0b13e5ca415a09733d9dc38280c8b997f8',
    '2021-12-09T18:35:58.000Z',
    '0x165eb78ce7a9a5ff1842b7b0e67b027ae6299775',
    'DAI',
    0,
    2388.49236,
    'WETH',
    0,
    9.646563937096968,
    'WETH',
    0,
    0.110737049,
    0.003363969483991109
  ]
]

These fields can be used to reformat into csv or any other output as needed.

Last updated