gateio / gateapi-python

256 stars 96 forks source link

Full Futures Position Close History #43

Closed dextervip closed 3 years ago

dextervip commented 3 years ago

Hello,

Is there any way to get a full paginated list of closed position history? I am using futures list position close history method however it has a limit of 100 entries, I couldn't find any kind of pagination.

Regards

revilwang commented 3 years ago

This API provides only the latest 100 at most for now. I'll report back the issue to API implementation

dextervip commented 3 years ago

@revilwang, thank you! Also I am not sure If is this possible but adding the final balance amount on every close position would be helpfull. Like bybit and bitmex API, so that we can track the exact performance at that moment for investment return methods such as TWR.

revilwang commented 3 years ago

OK, this one will also be added. I'll leave this issue open until the request is fulfilled.

revilwang commented 3 years ago

One more thing, could you please provide the detailed bybit and bitmex API link?

dextervip commented 3 years ago

@revilwang Sure, here go: https://bybit-exchange.github.io/docs/inverse/#t-walletrecords https://github.com/BitMEX/api-connectors/blob/master/auto-generated/python/docs/UserApi.md#user_get_wallet_history

Actually, they return it as wallet history which includes closed positions, transfers in/out, and others. I haven't seen a similar method here or Am I wrong?

revilwang commented 3 years ago

I think this API will help you: https://github.com/gateio/gateapi-python/blob/master/docs/FuturesApi.md#list_futures_account_book

API reference https://www.gateio.pro/docs/apiv4/en/index.html#query-account-book has a better formatting

It returns the history of you futures account change. type field denotes how it is changed.

dextervip commented 3 years ago

@revilwang Oh, It looks like to solve my issue. I will take a look, thanks!

revilwang commented 3 years ago

A new field offset has been added. https://github.com/gateio/gateapi-python/blob/master/docs/FuturesApi.md#list_position_close

You can now use limit-offset way to retrieve older position close history

dextervip commented 3 years ago

@revilwang that's great! About the account book list, what's the default sorting for no params? Looks like it starts from the recent entries. Am I correct?

revilwang commented 3 years ago

Yes. Sortings are all recent first

dextervip commented 3 years ago

@revilwang thank you. It's all good. I think this issue is solved, it may be closed.