From 0f831e12b6fbd8f117d6d5ed369555579531ccf5 Mon Sep 17 00:00:00 2001 From: Herklos Date: Mon, 8 Jan 2024 21:25:45 +0100 Subject: [PATCH] Add ignored_symbols param to run_detection --- CHANGELOG.md | 4 ++++ README.md | 2 +- triangular_arbitrage/__init__.py | 2 +- triangular_arbitrage/detector.py | 14 ++++++++------ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ead90f8..78d8d58 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.2] - 2024-01-08 +### Added +- `ignored_symbols` param to `run_detection` + ## [1.0.1] - 2023-10-18 ### Fixed - Added MANIFEST.in to fix PYPI installation diff --git a/README.md b/README.md index 2724c88..8ac712a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Triangular illustration

-# Triangular Arbitrage by OctoBot [1.0.1](https://github.com/Drakkar-Software/Triangular-Arbitrage/blob/master/CHANGELOG.md) +# Triangular Arbitrage by OctoBot [1.0.2](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 d76cef6..381311a 100644 --- a/triangular_arbitrage/__init__.py +++ b/triangular_arbitrage/__init__.py @@ -1,2 +1,2 @@ PROJECT_NAME = "OctoBot-Triangular-Arbitrage" -VERSION = "1.0.1" +VERSION = "1.0.2" diff --git a/triangular_arbitrage/detector.py b/triangular_arbitrage/detector.py index 8aad0af..a852182 100644 --- a/triangular_arbitrage/detector.py +++ b/triangular_arbitrage/detector.py @@ -29,12 +29,14 @@ def is_delisted_symbols(exchange_time, ticker, threshold = 1 * constants.DAYS_TO ticker_time = ticker['timestamp'] return not (exchange_time - ticker_time <= threshold) -def get_last_prices(exchange_time, tickers): +def get_last_prices(exchange_time, tickers, ignored_symbols): return [ ShortTicker(symbol=get_symbol_from_key(key), last_price=tickers[key]['close']) for key, _ in tickers.items() - if tickers[key]['close'] is not None and not is_delisted_symbols(exchange_time, tickers[key]) + if tickers[key]['close'] is not None + and not is_delisted_symbols(exchange_time, tickers[key]) + and str(get_symbol_from_key(key)) not in ignored_symbols ] def get_best_opportunity(tickers: List[ShortTicker]) -> Tuple[List[ShortTicker], float]: @@ -101,12 +103,12 @@ async def get_exchange_data(exchange_name): await exchange.close() return tickers, exchange_time -async def get_exchange_last_prices(exchange_name): +async def get_exchange_last_prices(exchange_name, ignored_symbols): tickers, exchange_time = await get_exchange_data(exchange_name) - last_prices = get_last_prices(exchange_time, tickers) + last_prices = get_last_prices(exchange_time, tickers, ignored_symbols) return last_prices -async def run_detection(exchange_name): - last_prices = await get_exchange_last_prices(exchange_name) +async def run_detection(exchange_name, ignored_symbols=None): + last_prices = await get_exchange_last_prices(exchange_name, ignored_symbols or []) best_opportunity, best_profit = get_best_opportunity(last_prices) return best_opportunity, best_profit