From 8a7a7cf470334c61bdad05750e70a78b91822a9c Mon Sep 17 00:00:00 2001 From: Herklos Date: Mon, 8 Jan 2024 22:21:46 +0100 Subject: [PATCH] Add check before restoring best_triplet --- CHANGELOG.md | 4 ++++ README.md | 2 +- triangular_arbitrage/__init__.py | 2 +- triangular_arbitrage/detector.py | 11 ++++++----- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78d8d58..a8d1609 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.3] - 2024-01-08 +### Fixed +- Add `None` check before restoring `best_triplet` + ## [1.0.2] - 2024-01-08 ### Added - `ignored_symbols` param to `run_detection` diff --git a/README.md b/README.md index 8ac712a..035e22d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Triangular illustration

-# Triangular Arbitrage by OctoBot [1.0.2](https://github.com/Drakkar-Software/Triangular-Arbitrage/blob/master/CHANGELOG.md) +# Triangular Arbitrage by OctoBot [1.0.3](https://github.com/Drakkar-Software/Triangular-Arbitrage/blob/master/CHANGELOG.md) [![PyPI](https://img.shields.io/pypi/v/OctoBot-Triangular-Arbitrage.svg)](https://pypi.python.org/pypi/OctoBot-Triangular-Arbitrage/) [![Dockerhub](https://img.shields.io/docker/pulls/drakkarsoftware/octobot-triangular-arbitrage.svg?logo=docker)](https://hub.docker.com/r/drakkarsoftware/octobot-triangular-arbitrage) diff --git a/triangular_arbitrage/__init__.py b/triangular_arbitrage/__init__.py index 381311a..1d0ac9c 100644 --- a/triangular_arbitrage/__init__.py +++ b/triangular_arbitrage/__init__.py @@ -1,2 +1,2 @@ PROJECT_NAME = "OctoBot-Triangular-Arbitrage" -VERSION = "1.0.2" +VERSION = "1.0.3" diff --git a/triangular_arbitrage/detector.py b/triangular_arbitrage/detector.py index a852182..032a765 100644 --- a/triangular_arbitrage/detector.py +++ b/triangular_arbitrage/detector.py @@ -87,11 +87,12 @@ def get_opportunity_symbol(a, b): best_profit = profit best_triplet = [a_to_b, b_to_c, c_to_a] - # restore original symbols for reversed pairs - best_triplet = [ - ShortTicker(symbols.Symbol(f"{triplet.symbol.quote}/{triplet.symbol.base}"), triplet.last_price, reversed=True) - if triplet.reversed else triplet - for triplet in best_triplet] + if best_triplet is not None: + # restore original symbols for reversed pairs + best_triplet = [ + ShortTicker(symbols.Symbol(f"{triplet.symbol.quote}/{triplet.symbol.base}"), triplet.last_price, reversed=True) + if triplet.reversed else triplet + for triplet in best_triplet] return best_triplet, best_profit