ccxt / ccxt

A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges
https://docs.ccxt.com
MIT License
32.66k stars 7.5k forks source link

[label: question] Coinbase Pro 1m timeframe no more in real time? #13292

Closed legitalk closed 2 years ago

legitalk commented 2 years ago

I just have a question, when I am calling:

$candles = $coinbasepro->fetch_ohlcv(
    'BTC/USD'
    '1m',
    null,
    10
);

why I am always getting not last 10 candles for last 10 minutes in a 1 minute timeframe, but I am getting last 10 candles approx. 1 - 7 minutes in the past (minus another 10 minutes)? Look like there is some weird cache, or not sure, what's going on.

Notes:

Example:

Time now for all below examples: 14:30

I want to get last 10 candles, so I should receive datetimes like this: 14:30, 14:29, 14:28, 14:27, 14:26, 14:25, 14:24, 14:23, 14:22, 14:21 with OHLCV data (for all pairs)

But pretty often I receive something like this for various assets: 14:26, 14:25, 14:24, 14:23, 14:22, 14:21, 14:20, 14:19, 14:18, 14:17 with OHLCV data (for 1 pair) 14:28, 14:27, 14:26, 14:25, 14:24, 14:23, 14:22, 14:21, 14:20, 14:19 with OHLCV data (for another 1 pair) 14:23, 14:22, 14:21, 14:20, 14:19, 14:18, 14:17, 14:16, 14:15, 14:14 with OHLCV data (for another 1 pair)

Is this because the data are "lately" received from the exchange origin API?

I suppose, when the time is 14:30, I should receive for all assets OHLCV data with datetimes like this: 14:30, 14:29, 14:28, 14:27, 14:26, 14:25, 14:24, 14:23, 14:22, 14:21

Thank you very much.

UPDATE:

Is this because I am not using CCXT Pro, but standard CCXT version?

(should I have in the composer: ccxt/ccxtpro to get real time candles ?)

kroitor commented 2 years ago

@legitalk hi! I've pushed a few clarifications to the Manual here: https://github.com/ccxt/ccxt/commit/ae5edbf6e1b96c08d10804636cdfa6961d0da3ce Hope that answers your question, let us know if not.

legitalk commented 2 years ago

Thank you @kroitor, I really appreciated it.