Skip to content

Commit

Permalink
Handle null next_funding_time and estimated_rate in HuobiSwap funding (
Browse files Browse the repository at this point in the history
  • Loading branch information
agijsberts authored Jan 15, 2024
1 parent 84040e6 commit a2ef81e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### 2.4.1
* Bugfix: Handle empty nextFundingRate in OKX
* Bugfix: Handle null next_funding_time and estimated_rate in HuobiSwap funding

### 2.4.0 (2024-01-07)
* Update: Fix tests
Expand Down
6 changes: 3 additions & 3 deletions cryptofeed/exchanges/huobi_swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async def _funding(self, pairs):
data = await self.http_conn.read(endpoint)
data = json.loads(data, parse_float=Decimal)
received = time.time()
update = (data['data']['funding_rate'], self.timestamp_normalize(int(data['data']['next_funding_time'])))
update = (data['data']['funding_rate'], self.timestamp_normalize(int(data['data']['funding_time'])))
if pair in self.funding_updates and self.funding_updates[pair] == update:
await asyncio.sleep(1)
continue
Expand All @@ -97,9 +97,9 @@ async def _funding(self, pairs):
self.exchange_symbol_to_std_symbol(pair),
None,
Decimal(data['data']['funding_rate']),
self.timestamp_normalize(int(data['data']['next_funding_time'])),
self.timestamp_normalize(int(data['data']['next_funding_time'])) if data['data']['next_funding_time'] else None,
self.timestamp_normalize(int(data['data']['funding_time'])),
predicted_rate=Decimal(data['data']['estimated_rate']),
predicted_rate=Decimal(data['data']['estimated_rate']) if data['data']['estimated_rate'] is not None else None,
raw=data
)
await self.callback(FUNDING, f, received)
Expand Down

0 comments on commit a2ef81e

Please sign in to comment.