kucoin-api-docs
kucoin-api-docs copied to clipboard
api/v1/orders
When I hit the following endpoint api/v1/orders, I am getting an empty response and no error to explain why no orders are being returned. I am getting returned the following error: {"currentPage":1,"pageSize":50,"totalNum":0,"totalPage":0,"items":[]}
Full URL: https://api.kucoin.com/api/v1/orders?currentPage=1&pageSize=50&tradeType=TRADE
I am able to get open(active) orders, cancelled orders, but not filled orders for some reason.
Same problem here, and same issue with "fills" API
you guys can all use your own network branching from Microsoft and your wifi !!!!
On Fri, Apr 29, 2022 at 10:43 AM Tigzy @.***> wrote:
Same problem here, and same issue with "fills" API
— Reply to this email directly, view it on GitHub https://github.com/Kucoin/kucoin-api-docs/issues/383#issuecomment-1113405849, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYXI3ITB3YQZC74RLGBYVW3VHPYSDANCNFSM5TZZSBGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
When I hit the following endpoint api/v1/orders, I am getting an empty response and no error to explain why no orders are being returned. I am getting returned the following error: {"currentPage":1,"pageSize":50,"totalNum":0,"totalPage":0,"items":[]}
Full URL: https://api.kucoin.com/api/v1/orders?currentPage=1&pageSize=50&tradeType=TRADE
Hello
Please check your current active order list. Also remove unnessary parameters and try again
Actually I found the issue:
- If you specify no time range it returns empty.
- If you specify start time, but no end time, it returns empty.
- You have to specify both start and end, and end must be <= start + 7 days. Also, if you are looping for history, start at a given time (a year back for example) and increment your sliding Windows even if there's no result until you reach "now" date
Ok. I guess we should check this issue for your account. Please provide technical info via this Form
Then Inform Admins on API Telegram Group
You have to specify both start and end, and end must be <= start + 7 days.
So if I wanted to get the last say 90 days of orders... is that possible or do I need to build in timeframe adjustment into pagination?
So if I wanted to get the last say 90 days of orders... is that possible or do I need to build in timeframe adjustment into pagination?
In that case you need to send something like this (convert to timestamp in your language) : start = now - 90 days end = now
when I tried that I was getting something like "INVALID TIME RANGE" but I've made some more findings so I'll give it one more go. I have like 30 orders visible on KC itself but the api call seems determined to only give me back one order.
So using this:
startAt: moment().subtract(60, "day").unix() * 1000,
endAt: moment().unix() * 1000,
I get this:
code: '400100'
msg: 'validation.queryOrder.timeRangeInvalid'
I can't find any documentation about the actual supported time frames other than in support issues people saying it's 7 days. I tried implementing a time paginator wherein:
if(!params.startAt || moment.unix(params.startAt / 1000).isAfter(maxTimeWindow)){
if(!params.startAt) params.startAt = moment().subtract(7, "day").unix() * 1000
else params.startAt = moment.unix(params.startAt / 1000).subtract(7, "day").unix() * 1000
and it "works" insofar as it properly changes timestamps of query. It doesn't work in that it returns 0 items (though says there's a totalNum of X (sometimes, > 0)) even though items is still an empty array
RE: totalNum this is the response I'm talking about
{
currentPage: 3,
pageSize: 50,
totalNum: 8,
totalPage: 1,
items: [
],
}
Maybe an important note, i'm using v1
You are right, I even wrote it earlier :| 'You have to specify both start and end, and end must be <= start + 7 days.' So yes, you need a sliding window of no more than 7 days.
Yes, actually I realize now that
and end
is probably immensely important. And it was. This seems to have fixed my issue. The other issue is that when I was adjusting the time sliding window, I was also incrementing page. Wrong-o. Make sure to reset your page to 1 😎 Thanks for the help @Tigzy !
Actually, quite possible just the page incrementor is what was going wild given I was getting totalNum back as I'd expect, just with empty items. The joys.