From bbaee2e83858f4f0b6e6e0d720b7edc6f930dcd3 Mon Sep 17 00:00:00 2001 From: agijsberts Date: Mon, 15 Jan 2024 01:43:01 +0100 Subject: [PATCH] Set predicted funding rate to None in OKX if nextFundingRate is empty. (#1003) --- 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)