Binance Connector JS
    Preparing search index...

    MarketApi - interface

    MarketApi

    interface MarketApiInterface {
        avgPrice(
            requestParameters: SpotWebsocketAPI.AvgPriceRequest,
        ): Promise<WebsocketApiResponse<SpotWebsocketAPI.AvgPriceResponse>>;
        blockTradesHistorical(
            requestParameters: BlockTradesHistoricalRequest,
        ): Promise<WebsocketApiResponse<BlockTradesHistoricalResponse>>;
        depth(
            requestParameters: SpotWebsocketAPI.DepthRequest,
        ): Promise<WebsocketApiResponse<SpotWebsocketAPI.DepthResponse>>;
        klines(
            requestParameters: SpotWebsocketAPI.KlinesRequest,
        ): Promise<WebsocketApiResponse<SpotWebsocketAPI.KlinesResponse>>;
        referencePrice(
            requestParameters: SpotWebsocketAPI.ReferencePriceRequest,
        ): Promise<WebsocketApiResponse<SpotWebsocketAPI.ReferencePriceResponse>>;
        referencePriceCalculation(
            requestParameters: SpotWebsocketAPI.ReferencePriceCalculationRequest,
        ): Promise<
            WebsocketApiResponse<
                SpotWebsocketAPI.ReferencePriceCalculationResponse,
            >,
        >;
        ticker(
            requestParameters?: SpotWebsocketAPI.TickerRequest,
        ): Promise<WebsocketApiResponse<SpotWebsocketAPI.TickerResponse>>;
        ticker24hr(
            requestParameters?: SpotWebsocketAPI.Ticker24hrRequest,
        ): Promise<WebsocketApiResponse<SpotWebsocketAPI.Ticker24hrResponse>>;
        tickerBook(
            requestParameters?: TickerBookRequest,
        ): Promise<WebsocketApiResponse<TickerBookResponse>>;
        tickerPrice(
            requestParameters?: SpotWebsocketAPI.TickerPriceRequest,
        ): Promise<WebsocketApiResponse<SpotWebsocketAPI.TickerPriceResponse>>;
        tickerTradingDay(
            requestParameters?: SpotWebsocketAPI.TickerTradingDayRequest,
        ): Promise<WebsocketApiResponse<SpotWebsocketAPI.TickerTradingDayResponse>>;
        tradesAggregate(
            requestParameters: TradesAggregateRequest,
        ): Promise<WebsocketApiResponse<TradesAggregateResponse>>;
        tradesHistorical(
            requestParameters: TradesHistoricalRequest,
        ): Promise<WebsocketApiResponse<TradesHistoricalResponse>>;
        tradesRecent(
            requestParameters: TradesRecentRequest,
        ): Promise<WebsocketApiResponse<TradesRecentResponse>>;
        uiKlines(
            requestParameters: SpotWebsocketAPI.UiKlinesRequest,
        ): Promise<WebsocketApiResponse<SpotWebsocketAPI.UiKlinesResponse>>;
    }

    Implemented by

    Index

    Methods

    • Get klines (candlestick bars).

      Klines are uniquely identified by their open & close time.

      If you need access to real-time kline updates, please consider using WebSocket Streams: <symbol>@kline_<interval>

      If you need historical kline data, please consider using data.binance.vision.

      Weight(IP): 2

      Security Type: NONE

      Notes: Data Source:* Database

      Supported kline intervals (case-sensitive):

      Interval interval value
      seconds 1s
      minutes 1m, 3m, 5m, 15m, 30m
      hours 1h, 2h, 4h, 6h, 8h, 12h
      days 1d, 3d
      weeks 1w
      months 1M

      Notes:*

      If startTime and endTime are not sent, the most recent klines are returned. Supported values for timeZone: Hours and minutes (e.g. -1:00, 05:45) Only hours (e.g. 0, 8, 4) Accepted range is strictly [-12:00 to +14:00] inclusive If timeZone provided, kline intervals are interpreted in that timezone instead of UTC. Note that startTime and endTime are always interpreted in UTC, regardless of timeZone.

      Parameters

      Returns Promise<WebsocketApiResponse<SpotWebsocketAPI.KlinesResponse>>

      MarketApiInterface

    • Get rolling window price change statistics with a custom window.

      This request is similar to ticker.24hr but statistics are computed on demand using the arbitrary window you specify.

      Note:* Window size precision is limited to 1 minute. While the closeTime is the current time of the request, openTime always start on a minute boundary. As such, the effective window might be up to 59999 ms wider than the requested windowSize.

      Window computation example

      For example, a request for "windowSize": "7d" might result in the following window:

      {
      "openTime": 1659580020000,
      "closeTime": 1660184865291
      }

      Time of the request – closeTime – is 1660184865291 (August 11, 2022 02:27:45.291). Requested window size should put the openTime 7 days before that – August 4, 02:27:45.291 – but due to limited precision it ends up a bit earlier: 1659580020000 (August 4, 2022 02:27:00), exactly at the start of a minute.

      If you need to continuously monitor trading statistics, please consider using WebSocket Streams: <symbol>@ticker_<window_size> or !ticker_<window-size>@arr

      Weight: Adjusted based on the number of requested symbols:

      Symbols Weight
      1–50 4 per symbol
      51–100 200

      Security Type: NONE

      Notes: Data Source:* Database

      Supported window sizes:

      Unit windowSize value
      minutes 1m, 2m ... 59m
      hours 1h, 2h ... 23h
      days 1d, 2d ... 7d

      Notes:

      Either symbol or symbols must be specified.

      Maximum number of symbols in one request: 200.

      Window size units cannot be combined. E.g., 1d 2h is not supported.

      Parameters

      Returns Promise<WebsocketApiResponse<SpotWebsocketAPI.TickerResponse>>

      MarketApiInterface

    • Get 24-hour rolling window price change statistics.

      If you need to continuously monitor trading statistics, please consider using WebSocket Streams:

      <symbol>@ticker or !ticker@arr

      <symbol>@miniTicker or !miniTicker@arr

      If you need different window sizes,

      use the ticker request.

      Weight: Adjusted based on the number of requested symbols:

      Parameter Symbols Provided Weight
      symbol 1 2
      omitted 80
      symbols 1-20 2
      21-100 40
      101+ 80
      omitted 80

      Security Type: NONE

      Notes: Data Source:* Memory

      Notes:

      symbol and symbols cannot be used together.

      If no symbol is specified, returns information about all symbols currently trading on the exchange.

      Parameters

      Returns Promise<WebsocketApiResponse<SpotWebsocketAPI.Ticker24hrResponse>>

      MarketApiInterface

    • Get the current best price and quantity on the order book.

      If you need access to real-time order book ticker updates, please consider using WebSocket Streams:

      <symbol>@bookTicker

      Weight: Adjusted based on the number of requested symbols:

      Parameter Symbols Provided Weight
      symbol 1 2
      omitted 4
      symbols Any 4

      Security Type: NONE

      Notes: Data Source:* Memory

      Notes:

      symbol and symbols cannot be used together.

      If no symbol is specified, returns information about all symbols currently trading on the exchange.

      Parameters

      Returns Promise<WebsocketApiResponse<TickerBookResponse>>

      MarketApiInterface

    • Get aggregate trades.

      An aggregate trade (aggtrade) represents one or more individual trades.

      Trades that fill at the same time, from the same taker order, with the same price –

      those trades are collected into an aggregate trade with total quantity of the individual trades.

      If you need access to real-time trading activity, please consider using WebSocket Streams:

      <symbol>@aggTrade

      If you need historical aggregate trade data, please consider using data.binance.vision.

      Weight(IP): 4

      Security Type: NONE

      Notes: Data Source:* Database

      • If fromId is specified, return aggtrades with aggregate trade ID >= fromId. Use fromId and limit to page through all aggtrades.
      • If startTime and/or endTime are specified, aggtrades are filtered by execution time (T). fromId cannot be used together with startTime and endTime.
      • If no condition is specified, the most recent aggregate trades are returned.

      Parameters

      Returns Promise<WebsocketApiResponse<TradesAggregateResponse>>

      MarketApiInterface

    • Get klines (candlestick bars) optimized for presentation.

      This request is similar to klines, having the same parameters and response. uiKlines return modified kline data, optimized for presentation of candlestick charts.

      Weight(IP): 2

      Security Type: NONE

      Notes: Data Source:* Database

      • If startTime and endTime are not sent, the most recent klines are returned.
      • Supported values for timeZone:
      • Hours and minutes (e.g. -1:00, 05:45)
      • Only hours (e.g. 0, 8, 4)
      • Accepted range is strictly [-12:00 to +14:00] inclusive
      • If timeZone provided, kline intervals are interpreted in that timezone instead of UTC.
      • Note that startTime and endTime are always interpreted in UTC, regardless of timeZone.

      Parameters

      Returns Promise<WebsocketApiResponse<SpotWebsocketAPI.UiKlinesResponse>>

      MarketApiInterface