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

Get Spot Account Record pagination by idLessThan doesn't work #51

Open
antipainK opened this issue Feb 20, 2024 · 9 comments
Open

Get Spot Account Record pagination by idLessThan doesn't work #51

antipainK opened this issue Feb 20, 2024 · 9 comments

Comments

@antipainK
Copy link

I'm trying to implement this endpoint:
https://www.bitget.com/api-doc/common/tax/Get-Spot-Account-Record

My test case:

  • if you fetch with limit=20 you get 20 entries
  • if you try with lower limit=10 you get 10 entries
    • if you then fetch with the same parameters, but add iddLessThan you get only 5 entries

It doesn't really matter which of the 10 entries id you choose, you won't get those original 20 entries by pagination with idLessThan.

I can't use this endpoint without this pagination, because we have more than the page limit with the exact same timestamp (more than 500 entries at the exact same time).

@BitgetLimited
Copy link
Owner

BitgetLimited commented Feb 20, 2024

@antipainK Hi, The usage of idLessThan is to query the next page. Assume there are 100 pieces of data, limit = 10,
the first query will get the id of 1-10, and then use idLessThan=10, you will get the data with id of 11~20. So it’s not clear why there are only 5 entries, unless there are only 15 entries of data, 10 entries for the first query and 5 entries for the next query

@antipainK
Copy link
Author

antipainK commented Feb 23, 2024

The parameter name itself is misleading.

idLessThan would indicate that if you pass "idLessThan": 15 you would get ids from 0 to 14.
But that's not the point.

Let me show you my example:

    # start_time = 1704672000000, end_time = 1704758400000

    params_01 = {"startTime": start_time, "endTime": end_time}
    batch_01 = await bitget.private_tax_get_v2_tax_spot_record(params_01)
    ids_01 = [entry.get("id") for entry in batch_01["data"]]

    assert len(ids_01) == 500

    params_02 = {"startTime": start_time, "endTime": end_time, "limit": 250}
    batch_02 = await bitget.private_tax_get_v2_tax_spot_record(params_02)
    ids_02 = [entry.get("id") for entry in batch_02["data"]]

    for i in range(250):
        assert ids_01[i] == ids_02[i]

    params_03 = {"startTime": start_time, "endTime": end_time, "limit": 250, "idLessThan": ids_02[-1]}
    batch_03 = await bitget.private_tax_get_v2_tax_spot_record(params_03)
    ids_03 = [entry.get("id") for entry in batch_03["data"]]

    for i in range(250):
        assert ids_01[250 + i] == ids_03[i]

This test fails at the last assert. The actual length of batch_03 is only 16 entries and they don't match with the next entries from the 500-big batch.
There are clearly 500 or more entries, but either sorting or pagination doesn't work.

@antipainK
Copy link
Author

@BitgetLimited Could you give me an update on this topic? It's quite a serious problem.

@ske7
Copy link

ske7 commented Jun 4, 2024

I confirm, we have a similar issue an it's critical

@kkan
Copy link

kkan commented Jun 6, 2024

@BitgetLimited

Hi,

I've encountered the same issue. Some transactions are missing when there are lots with the same timestamp. Here's an example:

data = api.send(:get, '/api/v2/tax/spot-record', startTime: 1689589112000, endTime: 1692181112000, limit: 150)
data1 = api.send(:get, '/api/v2/tax/spot-record', startTime: 1689589112000, endTime: 1692181112000, limit: 75)
data2 = api.send(:get, '/api/v2/tax/spot-record', startTime: 1689589112000, endTime: 1692181112000, limit: 75, id
LessThan: data1['data'][-1]['id'])

data['data'].size # 129
data1['data'].size # 75
data2['data'].size # 40

(data['data'] - data1['data'] - data2['data']).pluck('ts')
# ["1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270"]

data1['data'].dig(-1, 'ts') # 1690994567270

When transactions with the same timestamp are split into pages, the transactions with that timestamp are missing from the second page.

@joker22008
Copy link

data = api.send(:get, '/api/v2/tax/spot-record', startTime: 1689589112000, endTime: 1692181112000, limit: 150)
data1 = api.send(:get, '/api/v2/tax/spot-record', startTime: 1689589112000, endTime: 1692181112000, limit: 75)
data2 = api.send(:get, '/api/v2/tax/spot-record', startTime: 1689589112000, endTime: 1692181112000, limit: 75, id
LessThan: data1['data'][-1]['id'])

data['data'].size # 129
data1['data'].size # 75
data2['data'].size # 40

(data['data'] - data1['data'] - data2['data']).pluck('ts')

["1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270", "1690994567270"]

data1['data'].dig(-1, 'ts') # 1690994567270****

@joker22008
Copy link


@joker22008
Copy link

#51 (comment)

@joker22008
Copy link

J

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

5 participants