web3data.handlers.market

This module contains the address subhandler.

class web3data.handlers.market.MarketHandler(initial_headers: Dict[str, str], chain: web3data.chains.Chains)[source]

Bases: web3data.handlers.base.BaseHandler

The subhandler for market-related queries.

base_wap_latest(base: str, **kwargs) → Dict[source]

Retrieves the latest VWAP & TWAP price for the specified base.

Parameters

base – The pair’s base

Key quote

The currency of the pair. Example: if pair is “eth_usd”, then quote is “usd” (str)

Key timeFormat

Time format to use for the timestamps (Options: milliseconds, ms, iso, iso8611) (str)

Returns

The API response parsed into a dict

exchanges(**kwargs) → Dict[source]

Retrieves information about supported exchange-pairs.

These types of data are supported: - ticker - ohlc (open-high-low-close) - trade - order_book - order_book_update

Key exchange

only return data for the given exchanges (comma separated) (str)

Key pair

only return data for the given pairs (comma separated) (str)

Returns

The API response parsed into a dict

ohlcv(**kwargs) → Dict[source]

Retrieves information about supported exchange-pairs for ohlcv.

Key exchange

Filter by data for the given exchanges (comma separated). (str)

Returns

The API response parsed into a dict

ohlcv_pair_historical(pair: str, **kwargs) → Dict[source]

Retrieves the historical (time series) open-high-low-close for the specified pair.

Note: This endpoint returns a max of 6 months of historical data. In order to get more than 6 months you must use the startDate & endDate parameters to move the time frame window to get the next n days/months of data.

Parameters

pair – The asset pair to look up

Key exchange

The exchange(s) for which to retrieve OHLCV. Example: exchange=bitfinex,bitstamp (str)

Key startDate

Filter by pairs after this date. (int)

Key endDate

Filter by pairs before this date. (int)

Key timeInterval

Time interval to return the historical data in (“days” | “hours” | “minutes”) (str)

Key timeFormat

Time format to use for the timestamps ( “milliseconds” | “ms” | “iso” | “iso8611” ) (str)

Returns

The API response parsed into a dict

ohlcv_pair_latest(pair: str, **kwargs) → Dict[source]

Retrieves the latest open-high-low-close for the specified pair.

Parameters

pair – The asset pair to look up

Key exchange

The exchange(s) for which to retrieve OHLCV. Example: exchange=bitfinex,bitstamp (str)

Returns

The API response parsed into a dict

order_best_bid_historical(pair: str, **kwargs) → Dict[source]

Retrieves historical best bid and offer information for the specified pair.

Parameters

pair – The asset pair to look up

Key exchange

The exchange(s) for which to retrieve order book data. Example: exchange=bitfinex,bitstamp (str)

Key timeFormat

The timestamp format to use for the timestamps: milliseconds/ms or iso/iso8611. (str)

Key startDate

Filter by pairs after this date. (int)

Key endDate

Filter by pairs before this date. (int)

Returns

The API response parsed into a dict

order_best_bid_latest(pair: str, **kwargs) → Dict[source]

Retrieves the latest best bid and offer information for the specified pair and exchange.

Parameters

pair – The asset pair to look up

Key exchange

The exchange(s) for which to retrieve order book data. Example: exchange=bitfinex,bitstamp (str)

Key timeFormat

The timestamp format to use for the timestamps: milliseconds/ms or iso/iso8611. (str)

Returns

The API response parsed into a dict

order_book(pair: str, **kwargs) → Dict[source]

Retrieves the order book data for the specified pair.

Parameters

pair – The asset pair to look up

Key exchange

The exchange(s) for which to retrieve order book data. Example: exchange=bitfinex,bitstamp (str)

Key timestamp

The timestamp at which to return the order book information (closest match, lower or equal to the timestamp specified). (str)

Key timeFormat

The timestamp format to use for the timestamps: milliseconds/ms or iso/iso8611. (str)

Key startDate

Filter by pairs after this date. Formats: milliseconds, iso, or iso8611 (str)

Key endDate

Filter by pairs before this date. Formats: milliseconds, iso, or iso8611. Note: Must be greater than startDate and cannot exceed 10 minutes. (str)

Returns

The API response parsed into a dict

order_book_updates(pair: str, **kwargs) → Dict[source]
Parameters

pair – The asset pair to look up

Key exchange

The exchange(s) for which to retrieve order book data. Example: exchange=bitfinex,bitstamp (str)

Key timeFormat

The timestamp format to use for the timestamps: milliseconds/ms or iso/iso8611. (str)

Key startDate

Filter by pairs after this date. (int)

Key endDate

Filter by pairs before this date. (int)

Returns

The API response parsed into a dict

pairs(**kwargs) → Dict[source]

Retrieves information about supported exchange-pairs. These types of data are supported: - ticker - ohlc (open-high-low-close) - trade - order_book - order_book_update

Key exchange

only return data for the given exchanges (comma separated) (str)

Key pair

only return data for the given pairs (comma separated) (str)

Returns

The API response parsed into a dict

price_pair_historical(pair: str, **kwargs) → Dict[source]

Retrieves the historical prices for the specified asset.

Parameters

pair – The asset pair to look up

Key timeFormat

Time format to use for the timestamps (Options: milliseconds, ms, iso, iso8611) (str)

Key startDate

Filter by prices after this date. (str)

Key endDate

Filter by prices before this date. (str)

Key timeInterval

Time interval to return the historical data in (“days” | “hours” | “minutes”) (str)

Returns

The API response parsed into a dict

price_pair_latest(pair: str, **kwargs) → Dict[source]

Retrieves the latest price for the specified asset.

Parameters

pair – The asset pair to look up

Key timeFormat

Time format to use for the timestamps (Options: milliseconds, ms, iso, iso8611) (str)

Returns

The API response parsed into a dict

price_pairs() → Dict[source]

Retrieves the assets for which latest prices are available.

Returns

The API response parsed into a dict

rankings(**kwargs) → Dict[source]

Retrieves the top ranked assets by a specific metric.

Key direction

The sort order in which assets are ranked ascending or descending. (str)

Key sortType

The metric used to rank the assets. Options: changeInPrice, currentPrice, liquidMarketCap, marketCap, tokenVelocity, tradeVolume, transactionVolume, uniqueAddresses (str)

Key timeInterval

The time interval in which to return the historical data days or hours. (str)

Key type

The type(s) of assets to include in the rankings: erc20|, erc721, erc777, erc884, erc998. Note: leaving this parameter empty means all tokens will be included. (str)

Key page

The page number to return. (int)

Key size

The number of records per page. (int)

Returns

The API response parsed into a dict

ticker_bid_ask_historical(pair: str, **kwargs) → Dict[source]

Retrieves the historical ticker, bid/ask/mid/last, for the specified pair.

Note: This endpoint returns a max of 6 months of historical data. In order to get more than 6 months you must use the startDate & endDate parameters to move the time frame window to get the next n days/months of data.

Parameters

pair – The asset pair to look up

Key exchange

The exchange(s) for which to retrieve market tickers. Example: exchange=bitfinex,bitstamp (str)

Key startDate

Filter by ticker pairs after this date. (int)

Key endDate

Filter by ticker pairs before this date. (int)

Returns

The API response parsed into a dict

ticker_bid_ask_latest(pair: str, **kwargs) → Dict[source]

Retrieves the latest market ticker Bid/Ask/Mid/Last for the specified pair.

Parameters

pair – The asset pair to look up

Key exchange

The exchange(s) for which to retrieve market tickers. Example: exchange=bitfinex,bitstamp (str)

Returns

The API response parsed into a dict

ticker_pairs(**kwargs) → Dict[source]

Retrieves the list of all available market tickers.

Key exchange

Only return data for the given exchanges (comma separated). (str)

Returns

The API response parsed into a dict

token_price_historical(address: str, **kwargs) → Dict[source]
Parameters

address – The token’s smart contract address

Key currency

The additional currency (other than ETH and USD) for which to return price info. (str)

Key timeFormat

The time format to use for the timestamps: milliseconds/ms or iso/iso861. (str)

Key timeInterval

The time interval to return the historical data in: by day (d), by hour (h), or by minute (m). (str)

Key startDate

Filter by prices after this date. Note that the interval can not exceed 6 months (d), 30 days (h) or 24 hours (m). (int)

Key endDate

Filter by prices before this date. Note that the interval can not exceed 6 months (d), 30 days (h) or 24 hours (m). (int)

Returns

The API response parsed into a dict

token_price_latest(address: str, **kwargs) → Dict[source]

Retrieves the latest price (and other market information) for the specified token.

Parameters

address – The token’s smart contract address

Key currency

The additional currency (other than ETH and USD) for which to return price info. (str)

Returns

The API response parsed into a dict

token_rankings_historical(**kwargs) → Dict[source]

Retrieves the top ranked tokens by a specific metric, with a lookback window.

Useful for viewing token trends.

Key direction

The sort order in which tokens are ranked (ascending or descending). (str)

Key sortType

The metric used to rank the tokens (changeInPrice, currentPrice, marketCap, tokenVelocity, transactionVolume & uniqueAddresses). (str)

Key topN

Number denominating top ranking tokens to return. Example: If given “5”, results with return top 5 token rankings for past timeframe, where there are 5 results per day. (str)

Returns

The API response parsed into a dict

token_rankings_latest(**kwargs) → Dict[source]

Retrieves the top ranked tokens by a specific metric.

Key direction

The sort order in which tokens are ranked (ascending or descending). (str)

Key sortType

The metric used to rank the tokens (changeInPrice, currentPrice, marketCap, tokenVelocity, transactionVolume & uniqueAddresses). (str)

Key timeInterval

The time interval to return the historical data in: by day (days) or by hour (hours). (str)

Key type

The type(s) of tokens to include in the rankings (erc20, erc721, erc777, erc884, erc998) (str)

Key page

The page number to return. (int)

Key size

Number of records per page (int)

Returns

The API response parsed into a dict

trade_pairs_historical(pair: str, **kwargs) → Dict[source]

Retrieves the historical (time series) trade data for the specified pair.

Note: This endpoint returns a max of 6 months of historical data. In order to get more than 6 months you must use the startDate & endDate parameters to move the time frame window to get the next n days/months of data.

Parameters

pair – The asset pair to look up

Key exchange

The exchange(s) for which to retrieve market trades. (str)

Key startDate

Filter by trades after this date. (int)

Key endDate

Filter by trades before this date. (int)

Returns

The API response parsed into a dict

trades(**kwargs) → Dict[source]

Retrieves the list of all available market trade data sets.

Key exchange

Only return data for the given exchanges (comma separated). (str)

Returns

The API response parsed into a dict

uniswap_liqudity(pair: str, **kwargs) → Dict[source]

Retrieves the Uniswap-specific ether and token balance pairs over time.

Note: This endpoint returns a max of 6 months of historical data. In order to get more than 6 months you must use the startDate & endDate parameters to move the time frame window to get the next n days/months of data.

Parameters

pair – The asset pair to look up

Key timeFormat

The timestamp format to use for the timestamps: milliseconds/ms or iso/iso8611. (str)

Key startDate

Filter to liquidity changes after this date (int)

Key endDate

Filter to liquidity changes before this date (int)

Returns

The API response parsed into a dict