kucoin-api-docs icon indicating copy to clipboard operation
kucoin-api-docs copied to clipboard

api/v1/orders

Open Mreyna3 opened this issue 3 years ago • 14 comments

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

Mreyna3 avatar Apr 19 '22 19:04 Mreyna3

I am able to get open(active) orders, cancelled orders, but not filled orders for some reason.

phillijw avatar Apr 28 '22 21:04 phillijw

Same problem here, and same issue with "fills" API

Tigzy avatar Apr 29 '22 14:04 Tigzy

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: @.***>

LOGOLFGODORD avatar Apr 29 '22 16:04 LOGOLFGODORD

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

progressivehed avatar May 06 '22 11:05 progressivehed

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

Tigzy avatar May 06 '22 11:05 Tigzy

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

progressivehed avatar May 12 '22 17:05 progressivehed

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?

Shadowstep33 avatar Sep 28 '22 15:09 Shadowstep33

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

Tigzy avatar Sep 28 '22 15:09 Tigzy

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.

Shadowstep33 avatar Sep 28 '22 16:09 Shadowstep33

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

Shadowstep33 avatar Sep 28 '22 16:09 Shadowstep33

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

Shadowstep33 avatar Sep 28 '22 16:09 Shadowstep33

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.

Tigzy avatar Sep 28 '22 17:09 Tigzy

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 !

Shadowstep33 avatar Sep 28 '22 17:09 Shadowstep33

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.

Shadowstep33 avatar Sep 28 '22 17:09 Shadowstep33