All trades

Documentation for the /trades endpoint used to fetch all trade history of a wallet on Bebop.

GET /history/v2/trades endpoint will return all trades made on Bebop for the specified wallet, including all trade details: tokens traded, amounts, USD amounts at the time of the trade, gas fee amounts in USD at the time of the trade.

Request Parameters

Parameter
Description
Examples

wallet_address

Wallet address of the user

wallet_address=0xcaBD7845e4E51069E87a62d0A29064782134124C

start

Start timestamp (as UNIX time, in nanoseconds)

start=1680303600000000000

end

End timestamp (as UNIX time, in nanoseconds)

end=1704067200000000000

size

The number of trade objects that will be returned.

size=100

source

Partner source name

source=valued_partner

Please note that when using source parameter, source-auth will be required in headers.

Returns

The response will be returned as a dictionary that maps results to an array of trade objects.

Additionally, a nextAvailableTimestamp object will be returned which can be an instance of the following types:

  • null - if there are no additional trades to be returned within the start - end period.

  • unix timestamp (nanosecond) - if there are additional trades in the start - end period than what has already been returned. In this case, either increase the size parameter and re-request the data, or replace the current start timestamp with the returned nextAvailableTimestamp .

Lastly, the request will return a metadata object which contains the current timestamp (timestamp), as well as the number of results returned.

Response structure:

Field
Description

results

Array of trade objects (see below).

nextAvailableTimestamp

  • Unix timestamp (in nanoseconds) - if there are more trades available in the requested period than what has been returned.

  • null - if all existing trades were returned.

metadata

  • timestamp - current timestamp

  • results - int representing the number of trade objects returned

Trade object structure:

Field
Description

chain_id

Chain ID where the trade occurred

txHash

Transaction hash of the trade

status

Status of the trade (CONFIRMED, FAILED)

type

Trade type (121, 12M, M21, 12MPercentages, M21Percentages)

taker

Wallet address of the sender of the transaction (address that sends the sellTokens)

receiver

Wallet address of the receiver of the transaction (address that receives the buyTokens)

sellTokens

Sell tokens mapping of the token ticker to token info (amount, amountUsd, contractAddress)

buyTokens

Buy tokens mapping of the token ticker to token info (amount, amountUsd, contractAddress)

volumeUsd

Volume of the trade in USD (excluding gas fees)

gasFeeUsd

Gas fee amount in USD

timestamp

Time and date when the trade occurred

Request

https://api.bebop.xyz/history/v2/trades?start=1680303600000000000&end=1704067200000000000&size=100&wallet_address=0xcabd7845e4e51069e87a62d0a29064782134124c

Response

```json
{
    "results": [
        {
            "chain_id": 137,
            "txHash": "0xe3b9b5798e03413eb1914e65b012c982ab64d08b12c5d032931738cbe114cdc5",
            "status": "CONFIRMED",
            "type": "121",
            "taker": "0xcaBD7845e4E51069E87a62d0A29064782134124C",
            "receiver": "0xcaBD7845e4E51069E87a62d0A29064782134124C",
            "sellTokens": {
                "0x172370d5Cd63279eFa6d502DAB29171933a610AF": {
                    "amount": "2774753357733124037",
                    "amountUsd": 1.8963885360241788,
                    "symbol": "CRV"
                }
            },
            "buyTokens": {
                "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174": {
                    "amount": "1876313",
                    "amountUsd": 1.8754474147959113,
                    "symbol": "USDC"
                }
            },
            "volumeUsd": 1.8963885360241788,
            "gasFeeUsd": 0.019316817146176876,
            "timestamp": "2023-06-28 16:09:22"
        },
        {
            "chain_id": 137,
            "txHash": "0x2bab046979e29e106797257cac3f1bd32e207515cfda48f2a6e11212388069c1",
            "status": "CONFIRMED",
            "type": "121",
            "taker": "0xcaBD7845e4E51069E87a62d0A29064782134124C",
            "receiver": "0xcaBD7845e4E51069E87a62d0A29064782134124C",
            "sellTokens": {
                "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063": {
                    "amount": "1930704745851605785",
                    "amountUsd": 1.934566155343309,
                    "symbol": "DAI"
                }
            },
            "buyTokens": {
                "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174": {
                    "amount": "1889516",
                    "amountUsd": 1.8934065939187268,
                    "symbol": "USDC"
                }
            },
            "volumeUsd": 1.934566155343309,
            "gasFeeUsd": 0.04719348984382014,
            "timestamp": "2023-06-28 15:01:28"
        },
        ...
```

Last updated