Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetchOHLCV: missing last elapsed time unit (on phemex - kline) #22829

Open
egabosh opened this issue Jun 17, 2024 · 4 comments
Open

fetchOHLCV: missing last elapsed time unit (on phemex - kline) #22829

egabosh opened this issue Jun 17, 2024 · 4 comments
Assignees

Comments

@egabosh
Copy link

egabosh commented Jun 17, 2024

Operating System

Debian 12

Programming Languages

Python

CCXT Version

4.3.46

Description

Moin,

missing last elapsed time unit when using fetchOHLCV on Phemex.
In this example from 15m resolution but it is on every resolution - tested with 5m 4h, 1d, 1w
Output:

CCXT Version: 4.3.46

fetch Request: phemex GET https://api.phemex.com/exchange/public/md/v2/kline/list?symbol=BTCUSDT&resolution=900&limit=2000&from=1718634600&to=1718637717 RequestHeaders: {'User-Agent': 'python-requests/2.28.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive'} RequestBody: None

fetch Response: phemex GET https://api.phemex.com/exchange/public/md/v2/kline/list?symbol=BTCUSDT&resolution=900&limit=2000&from=1718634600&to=1718637717 200 ResponseHeaders: {'Content-Type': 'application/json', 'Content-Length': '346', 'Connection': 'keep-alive', 'Date': 'Mon, 17 Jun 2024 15:21:57 GMT', 'x-phemex-request-tracing': '69aadf06-0dd3-4bab-ac1d-62abea33da1a', 'X-RateLimit-Remaining': '299', 'X-RateLimit-Capacity': '300', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '0', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'X-Frame-Options': 'DENY', 'Referrer-Policy': 'no-referrer', 'X-Cache': 'Miss from cloudfront', 'Via': '1.1 6080b2713e502211e152f21f5c59c5a6.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'FRA53-C1', 'X-Amz-Cf-Id': 'fdtiYKaT-7aU00kFYV0AQLqIpWgy9tHiylUFgkdBwAn0XIQazlrQRQ=='} ResponseBody: {"code":0,"msg":"OK","data":{"total":-1,"rows":[[1718634600,900,"65536.3","65536.3","65735.3","65488.9","65704.8","41.359","2715697.6547","BTCUSDT"],[1718635500,900,"65704.8","65704.9","65769","65351.9","65436.9","52.761","3457075.4932","BTCUSDT"],[1718636400,900,"65436.9","65437","65699","65415.4","65518.3","54.732","3590275.473","BTCUSDT"]]}}
[[1718634600000, 65536.3, 65735.3, 65488.9, 65704.8, 41.359], [1718635500000, 65704.9, 65769.0, 65351.9, 65436.9, 52.761], [1718636400000, 65437.0, 65699.0, 65415.4, 65518.3, 54.732]]

I ran the command at "Mon, 17 Jun 2024 15:21:57 GMT". Last printed OHLCV interval was at 1718636400000 (Mon, 17 Jun 2024 15:00:00 GMT). So I'm missing the interval from 15:15:00. Later then 15:30 there was printed the 15:15 interval but not the until 15:30.

This does not happen on Binance. Looks like a bug at Phemex?
Would it be possible to build a workaround for CCXT or is there a way to contact Phemex to fix this?

Thank you for your great work btw.!

Code

print(exchange.fetchOHLCV(symbol='BTC/USDT:USDT', timeframe='15m', since=1718634600000))
@carlosmiei carlosmiei self-assigned this Jun 17, 2024
@carlosmiei
Copy link
Collaborator

Hello @egabosh,

Thanks for reporting it, we will take a look and let you know

@carlosmiei
Copy link
Collaborator

@egabosh Weird, as you can see in the verbose mode the request seems ok (to refers to the latest timestamp) so it should include all candles

phemex.fetchOHLCV (BTC/USDT:USDT, 15m, 1718634600000)
fetch Request:
 phemex GET https://api.phemex.com/exchange/public/md/v2/kline/list?symbol=BTCUSDT&resolution=900&limit=2000&from=1718634600&to=1718717115

@egabosh
Copy link
Author

egabosh commented Jun 18, 2024

@carlosmiei Thanks for having a look on it. Yes I saw this. So as mentioned it looks like a bug at Phemex.
Can you reproduce it?
Would it be possible to build a workaround for CCXT or is there a way to contact Phemex to fix this?

@egabosh
Copy link
Author

egabosh commented Jun 20, 2024

Opened an issue at Phemex too but I don't know if this is the right place for it:
phemex/phemex-python-api#11
If you have an better idea please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants