Skip to content

Commit

Permalink
Add check before restoring best_triplet
Browse files Browse the repository at this point in the history
  • Loading branch information
Herklos committed Jan 8, 2024
1 parent 4c5c258 commit 8a7a7cf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="illustration.jpeg" width="250px" height="250px" alt="Triangular illustration">
</p>

# 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)

Expand Down
2 changes: 1 addition & 1 deletion triangular_arbitrage/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PROJECT_NAME = "OctoBot-Triangular-Arbitrage"
VERSION = "1.0.2"
VERSION = "1.0.3"
11 changes: 6 additions & 5 deletions triangular_arbitrage/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 8a7a7cf

Please sign in to comment.