JKorf / HTX.Net

A C# .netstandard client library for the Huobi REST and Websocket Spot and Swap API focusing on clear usage and models
https://jkorf.github.io/HTX.Net/
MIT License
73 stars 53 forks source link

How do I get historical trades? #74

Closed tobijuthomas closed 2 years ago

tobijuthomas commented 3 years ago

Below call always giving me the last 61 days result. I am not able to get the trades which is older than 61 days even if we provide specific startTime and endTime.

            var dateFrom = DateTime.UtcNow.AddDays(-120);
            var callResult = await client.GetUserTradesAsync(symbol: "btcusdt", startTime: dateFrom);

Is this the correct way or Am I doing something wrong?

JKorf commented 2 years ago

https://huobiapi.github.io/docs/spot/v1/en/#search-match-results Seems like you should be able to get info on the last 120 days, though only 48 hours at a time. If it's still not working, can you provide some trace logging?

tobijuthomas commented 2 years ago

Thank you for your reply

Please find the logs below. I have trades executed between 2021-11-30 and 2021-12-02

2021-12-14 22:01:48:810 | Debug | Huobi | [39] Creating request for https://api.huobi.pro/v1/order/matchresults 2021-12-14 22:01:48:811 | Debug | Huobi | [39] Sending GET signed request to https://api.huobi.pro/v1/order/matchresults?AccessKeyId=xxxxxxxx-xxxxxxxx-xxxxxxxxxx-xxxxx&end-date=2021-12-02&SignatureMethod=HmacSHA256&SignatureVersion=2&start-date=2021-11-30&Timestamp=2021-12-14T16%3A31%3A48&Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2021-12-14 22:01:49:035 | Debug | Huobi | [39] Response received in 222ms: {"status":"ok","data":[]}

llerrowa commented 2 years ago

I've have PR which addresses this here - https://github.com/JKorf/Huobi.Net/pull/80