Skip to content

Commit 4c5c258

Browse files
committed
Add ignored_symbols param to run_detection
1 parent 213c515 commit 4c5c258

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
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.2] - 2024-01-08
8+
### Added
9+
- `ignored_symbols` param to `run_detection`
10+
711
## [1.0.1] - 2023-10-18
812
### Fixed
913
- Added MANIFEST.in to fix PYPI installation

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.1](https://github.com/Drakkar-Software/Triangular-Arbitrage/blob/master/CHANGELOG.md)
5+
# Triangular Arbitrage by OctoBot [1.0.2](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.1"
2+
VERSION = "1.0.2"

triangular_arbitrage/detector.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ def is_delisted_symbols(exchange_time, ticker, threshold = 1 * constants.DAYS_TO
2929
ticker_time = ticker['timestamp']
3030
return not (exchange_time - ticker_time <= threshold)
3131

32-
def get_last_prices(exchange_time, tickers):
32+
def get_last_prices(exchange_time, tickers, ignored_symbols):
3333
return [
3434
ShortTicker(symbol=get_symbol_from_key(key),
3535
last_price=tickers[key]['close'])
3636
for key, _ in tickers.items()
37-
if tickers[key]['close'] is not None and not is_delisted_symbols(exchange_time, tickers[key])
37+
if tickers[key]['close'] is not None
38+
and not is_delisted_symbols(exchange_time, tickers[key])
39+
and str(get_symbol_from_key(key)) not in ignored_symbols
3840
]
3941

4042
def get_best_opportunity(tickers: List[ShortTicker]) -> Tuple[List[ShortTicker], float]:
@@ -101,12 +103,12 @@ async def get_exchange_data(exchange_name):
101103
await exchange.close()
102104
return tickers, exchange_time
103105

104-
async def get_exchange_last_prices(exchange_name):
106+
async def get_exchange_last_prices(exchange_name, ignored_symbols):
105107
tickers, exchange_time = await get_exchange_data(exchange_name)
106-
last_prices = get_last_prices(exchange_time, tickers)
108+
last_prices = get_last_prices(exchange_time, tickers, ignored_symbols)
107109
return last_prices
108110

109-
async def run_detection(exchange_name):
110-
last_prices = await get_exchange_last_prices(exchange_name)
111+
async def run_detection(exchange_name, ignored_symbols=None):
112+
last_prices = await get_exchange_last_prices(exchange_name, ignored_symbols or [])
111113
best_opportunity, best_profit = get_best_opportunity(last_prices)
112114
return best_opportunity, best_profit

0 commit comments

Comments
 (0)