Open GurovNik opened 1 year ago
I am seeing the same problem, but it does not appear to be a problem with the library, but the API itself.
My attempted call to get the 1 day kline,
console.log( marketApi.klines( "KOINUSDT", "1d", {startTime: 1671926400000, limit: 1} ) );
Returns:
[
[
1676505600000,
'0.5389',
'0.5389',
'0.4901',
'0.4987',
'23355.63',
1676592000000,
'11724.4131'
]
]
When I use curl, I get the same thing:
curl -H "Content-Type: application/json" -H "X-MEXC-APIKEY: XXXXXXXXXXXXXXXX" https://api.mexc.com/api/v3/klines\?symbol=KOINUSDT\&interval=1d\&limit=1\&startTime=1671926400000 | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 91 100 91 0 0 382 0 --:--:-- --:--:-- --:--:-- 382
[
[
1676505600000,
"0.5389",
"0.5389",
"0.4901",
"0.4983",
"23800.63",
1676592000000,
"11946.1738"
]
]
I have tried passing in startTime
as a string as well as the names start_time
and StartTime
. No combination is working.
It would appear that the API is not either documented incorrectly or not respecting the startTime
and endTime
parameters.
For the time being, I can get the information I need by cranking up the limit and iterating through the results, but that is neither efficient for my script, nor MEXC's API server.
I have a similar problem on Python
spot.klines('PRAREUSDT', '1d', {'limit': 1})
but the function returns empty array when I pass start and end time.
I have tried many things to get a proper response but no luck
There is no documentation about format of values in options{}. So fucntions pay no attention to start and end times wich i pass to it, so I cant use the lib any more def klines( self, symbol: builtins.str, interval: builtins.str, options: typing.Any = None, ) -> typing.Any: '''Kline/Candlestick Data.