Repository: ccxt/ccxt
Pull request: fix(hyperliquid): set default limit to 5000
fix ccxt/ccxt#23243

@carlosmiei The source data would sort by timestamp ascending order. Hdyt we cut the data by the limit first and call parseOHLCVS in hyperliquid? In this PR, I increase the default limit to 5000.

eg.
```
# the limit is 100
[
  // 4900 OHLCV
  // cut from here
  // the latest 100 OHLCV
]
```

Problem statement:
Hyperliquid fetch_ohlcv limit issue
### Operating System

N/A

### Programming Languages

Python

### CCXT Version

4.3.67

### Description

Hello,

The Hyperliquid api returns the most recent 5000 candles. However, in ccxt `hyperliquid.py` the default limit is set to 500, which makes it output the first 500 of the most recent 5000. I'm not sure if that is expected behaviour? It makes it difficult to fetch the last 100 candles for example. First I'd have to know the Hyperliquid API limit of 5000 and pass that to fetch_ohlcv, and then I'd have to grab the last 100 candles. A better way would be to raise the `hyperliquid.py` limit to 5000, or to change how the default 'limit' behaves and make it show the latest 500 cancles instead of the first.. although that could maybe have unwanted consequences in other use-cases.

thanks

### Code


```
e = ccxt.hyperliquid()
candles = await e.fetch_ohlcv('PURR/USDC', '1h')
print(datetime.fromtimestamp(candles[-1][0] / 1000, UTC).strftime('%Y-%m-%d %H:%M:%S'), candles[-1])
candles = await e.fetch_ohlcv('PURR/USDC', '1h', limit=5000)
print(datetime.fromtimestamp(candles[-1][0] / 1000, UTC).strftime('%Y-%m-%d %H:%M:%S'), candles[-1])
await e.close()
```

```
2024-05-06 23:00:00 [1715036400000, 0.10898, 0.11004, 0.10896, 0.10897, 187805.0]
2024-07-28 22:00:00 [1722204000000, 0.19948, 0.19948, 0.19947, 0.19948, 30982.0]
```

Hints from issue discussion:
@gaardiolor Thanks for the report. I think they update documentation and api quickly  https://web.archive.org/web/20240321075443/https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills (didn't mention a couple of months ago), the data was cut. The limit probably worked before.

Anyway, we'll update asap.

Commit message: fix(hyperliquid): set default limit to 5000

Patch to review:
diff --git a/ts/src/hyperliquid.ts b/ts/src/hyperliquid.ts
index 43d8a3f0df2a4..92859c21ef7f8 100644
--- a/ts/src/hyperliquid.ts
+++ b/ts/src/hyperliquid.ts
@@ -848,7 +848,8 @@ export default class hyperliquid extends Exchange {
             since = 0;
         }
         if (limit === undefined) {
-            limit = 500;
+            // Only the most recent 5000 candles are available
+            limit = 5000;
         }
         params = this.omit (params, [ 'until' ]);
         const request: Dict = {


Code review comments:
diff_hunk: @@ -848,7 +848,8 @@ export default class hyperliquid extends Exchange {
             since = 0;
         }
         if (limit === undefined) {
-            limit = 500;
+            // Only the most recent 5000 candles are available
+            limit = 5000;
path: ts/src/hyperliquid.ts
text: @user1:
@author if the request does not accept `limit` why should we define it here?

@author:
No, we can remove it.