Skip to content

Commit 8a7a7cf

Browse files
committed
Add check before restoring best_triplet
1 parent 4c5c258 commit 8a7a7cf

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.0.3] - 2024-01-08
8+
### Fixed
9+
- Add `None` check before restoring `best_triplet`
10+
711
## [1.0.2] - 2024-01-08
812
### Added
913
- `ignored_symbols` param to `run_detection`

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img src="illustration.jpeg" width="250px" height="250px" alt="Triangular illustration">
33
</p>
44

5-
# Triangular Arbitrage by OctoBot [1.0.2](https://github.com/Drakkar-Software/Triangular-Arbitrage/blob/master/CHANGELOG.md)
5+
# Triangular Arbitrage by OctoBot [1.0.3](https://github.com/Drakkar-Software/Triangular-Arbitrage/blob/master/CHANGELOG.md)
66
[![PyPI](https://img.shields.io/pypi/v/OctoBot-Triangular-Arbitrage.svg)](https://pypi.python.org/pypi/OctoBot-Triangular-Arbitrage/)
77
[![Dockerhub](https://img.shields.io/docker/pulls/drakkarsoftware/octobot-triangular-arbitrage.svg?logo=docker)](https://hub.docker.com/r/drakkarsoftware/octobot-triangular-arbitrage)
88

triangular_arbitrage/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
PROJECT_NAME = "OctoBot-Triangular-Arbitrage"
2-
VERSION = "1.0.2"
2+
VERSION = "1.0.3"

triangular_arbitrage/detector.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,12 @@ def get_opportunity_symbol(a, b):
8787
best_profit = profit
8888
best_triplet = [a_to_b, b_to_c, c_to_a]
8989

90-
# restore original symbols for reversed pairs
91-
best_triplet = [
92-
ShortTicker(symbols.Symbol(f"{triplet.symbol.quote}/{triplet.symbol.base}"), triplet.last_price, reversed=True)
93-
if triplet.reversed else triplet
94-
for triplet in best_triplet]
90+
if best_triplet is not None:
91+
# restore original symbols for reversed pairs
92+
best_triplet = [
93+
ShortTicker(symbols.Symbol(f"{triplet.symbol.quote}/{triplet.symbol.base}"), triplet.last_price, reversed=True)
94+
if triplet.reversed else triplet
95+
for triplet in best_triplet]
9596

9697
return best_triplet, best_profit
9798

0 commit comments

Comments
 (0)