This commit is contained in:
discountry
2025-10-03 15:28:16 +08:00
parent d5c4b04746
commit fcb83bd16b
925 changed files with 165721 additions and 4 deletions
@@ -0,0 +1,37 @@
- [Kucoin Fetch Closed Orders Pagination](./examples/py/)
```python
# -*- coding: utf-8 -*-
import os
import sys
import ccxt # noqa: E402
exchange = ccxt.kucoin({
"apiKey": "YOUR_API_KEY",
"secret": "YOUR_SECRET",
"password": "YOUR_PASSWORD"
})
symbol = 'ETH/USDT'
now = exchange.milliseconds()
day = 24 * 3600 * 1000
week = 7 * day
since = now - 365 * day # start one year back
limit = 20
while since < now:
end = min(since + week, now)
params = {'endAt': end}
orders = exchange.fetch_closed_orders(symbol, since, limit, params)
print(exchange.iso8601(since), '-', exchange.iso8601(end), len(orders), 'orders')
if len(orders) == limit:
since = orders[-1]['timestamp']
else:
since += week
```