gateio / gateapi-python

247 stars 92 forks source link

Getting order history #101

Closed JevgenijsKonevs closed 2 years ago

JevgenijsKonevs commented 2 years ago

Hello, Trying to request all orders ( buy / sell ) for the specific currency pair (ex. BTC_USDT), by using list_my_trades(). I am receiving an empty array in case I am passing only currency_pair, but if I add order_id argument to this request, then I am receiving correct response with data.

Examples :

currency_pair = 'BTC_USDT'
....
api_response = spot_api_instance.list_my_trades(currency_pair)

Output :
[]
currency_pair = 'BTC_USDT'
order_id='1254353' 
....
api_response = spot_api_instance.list_my_trades(currency_pair, order_id=order_id)

Output :
[
{some_data : ...}
]

My goal is to receive all history of orders just by currency_pair

revilwang commented 2 years ago

Are your trades recent? Trades 7 days ago can only be retrieved with time range parameter _from and to specified.

JevgenijsKonevs commented 2 years ago

I would like to receive the trades that were made for the past year, is it possible to get this data ?

revilwang commented 2 years ago

Data range between _from and to cannot be too long. You need to calculate your desired beginning time and use a for loop range to slide your time window to retrieve older data

JevgenijsKonevs commented 2 years ago

Thank you for your tip. that was very useful