From 0ac4599240c2f51b1c5b2f4ef3a05112e1dbe039 Mon Sep 17 00:00:00 2001 From: Arjan Gijsberts Date: Sat, 13 Jan 2024 23:09:57 +0100 Subject: [PATCH] Set predicted funding rate to None in OKX if nextFundingRate is empty. --- CHANGES.md | 3 +++ cryptofeed/exchanges/okx.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 5466d50e5..b6eda98fb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,8 @@ ## Changelog +### 2.4.1 + * Bugfix: Handle empty nextFundingRate in OKX + ### 2.4.0 (2024-01-07) * Update: Fix tests * Update: Okcoin moved to v5 API used by OKX diff --git a/cryptofeed/exchanges/okx.py b/cryptofeed/exchanges/okx.py index e8dda514d..ffb4dc1ce 100644 --- a/cryptofeed/exchanges/okx.py +++ b/cryptofeed/exchanges/okx.py @@ -266,7 +266,7 @@ async def _funding(self, msg: dict, timestamp: float): Decimal(update['fundingRate']), None, self.timestamp_normalize(int(update['fundingTime'])), - predicted_rate=Decimal(update['nextFundingRate']), + predicted_rate=Decimal(update['nextFundingRate']) if update['nextFundingRate'] != '' else None, raw=update ) await self.callback(FUNDING, f, timestamp)