Skip to content

Inconsistent return data types #930

@vitaly-t

Description

@vitaly-t

Using the latest 1.0.2, I have started coming across some invalid TypeScript signatures, like the following two...

    /**
     * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Kline-Candlestick-Data
    */
    async futuresCandles(symbol: string, interval: Interval = "30m", params: Dict = {}): Promise<Candle[]> {
        params.symbol = symbol;
        params.interval = interval;
        return await this.publicFuturesRequest('v1/klines', params);
    }

    /**
     * @see https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Kline-Candlestick-Data
    */
    async futuresCandlesticks(symbol: string, interval: Interval = "30m", params: Dict = {}): Promise<Candle[]> {
        params.symbol = symbol;
        params.interval = interval;
        return await this.publicFuturesRequest('v1/klines', params);
    }

Neither of those methods resolve with Candle[], they both resolve with data like this:

[
  [
    1744718400000, '85545.6',
    '85560.0',     '85502.0',
    '85516.2',     '9.836',
    1744718459999, '841315.7610',
    252,           '4.436',
    '379415.8702', '0'
  ],
  [
    1744718460000, '85517.2',
    '85554.9',     '85502.1',
    '85551.4',     '7.689',
    1744718519999, '657637.5901',
    185,           '5.194',
    '444217.0751', '0'
  ],
  [
    1744718520000, '85554.0',
    '85587.9',     '85542.5',
    '85542.5',     '5.833',
    1744718579999, '499120.9303',
    187,           '2.826',
    '241819.0299', '0'
  ]
]

I don't know if there are more methods like these, I've only got started with this library.

UPDATE

Upon closer look, I see that those two functions both do exact same thing, the difference only in the method name. How come? :)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions