Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Available #1168

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ 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).

## [2.4.148] - 2025-01-20
### Added
[Exchanges] support custom domains
[Exchanges] add INCLUDE_DISABLED_SYMBOLS_IN_AVAILABLE_SYMBOLS

## [2.4.147] - 2025-01-13
### Fixed
[Exchange] properly propagate ExchangeOrderCancelError
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OctoBot-Trading [2.4.147](https://github.com/Drakkar-Software/OctoBot-Trading/blob/master/CHANGELOG.md)
# OctoBot-Trading [2.4.148](https://github.com/Drakkar-Software/OctoBot-Trading/blob/master/CHANGELOG.md)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/903b6b22bceb4661b608a86fea655f69)](https://app.codacy.com/gh/Drakkar-Software/OctoBot-Trading?utm_source=github.com&utm_medium=referral&utm_content=Drakkar-Software/OctoBot-Trading&utm_campaign=Badge_Grade_Dashboard)
[![PyPI](https://img.shields.io/pypi/v/OctoBot-Trading.svg)](https://pypi.python.org/pypi/OctoBot-Trading/)
[![Coverage Status](https://coveralls.io/repos/github/Drakkar-Software/OctoBot-Trading/badge.svg?branch=master)](https://coveralls.io/github/Drakkar-Software/OctoBot-Trading?branch=master)
Expand Down
2 changes: 1 addition & 1 deletion octobot_trading/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# License along with this library.

PROJECT_NAME = "OctoBot-Trading"
VERSION = "2.4.147" # major.minor.revision
VERSION = "2.4.148" # major.minor.revision
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ async def initialize_impl(self):
)

# initialize symbols and timeframes
self.symbols = self.get_client_symbols(active_only=True)
self.symbols = self.exchange_manager.exchange.get_all_available_symbols(active_only=True)
self.time_frames = self.get_client_time_frames()

except (ccxt.ExchangeNotAvailable, ccxt.RequestTimeout) as e:
Expand Down
6 changes: 5 additions & 1 deletion octobot_trading/exchanges/types/rest_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class RestExchange(abstract_exchange.AbstractExchange):
# set True when get_fixed_market_status should adapt amounts for contract size
# (amounts are in not kept as contract size with OctoBot)
ADAPT_MARKET_STATUS_FOR_CONTRACT_SIZE = False
# set True when disabled symbols should still be considered (ex: mexc with its temporary api trading disabled symbols)
INCLUDE_DISABLED_SYMBOLS_IN_AVAILABLE_SYMBOLS = False
REQUIRE_ORDER_FEES_FROM_TRADES = False # set True when get_order is not giving fees on closed orders and fees
# should be fetched using recent trades.
REQUIRE_CLOSED_ORDERS_FROM_RECENT_TRADES = False # set True when get_closed_orders is not supported
Expand Down Expand Up @@ -731,7 +733,9 @@ def get_all_available_symbols(self, active_only=True) -> set[str]:
"""
:return: the list of all symbols supported by the exchange
"""
return self.connector.get_client_symbols(active_only=active_only)
return self.connector.get_client_symbols(
active_only=False if self.INCLUDE_DISABLED_SYMBOLS_IN_AVAILABLE_SYMBOLS else active_only
)

async def get_all_tradable_symbols(self, active_only=True) -> set[str]:
"""
Expand Down
11 changes: 4 additions & 7 deletions tests/exchanges/connectors/ccxt/test_ccxt_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def setSandboxMode(self, is_sandboxed):
with patch.object(ccxt_connector, 'client', new=MockCCXT()) as mocked_ccxt, \
patch.object(ccxt_connector, '_ensure_auth', new=mock.AsyncMock()) as _ensure_auth_mock:
await ccxt_connector.initialize_impl()
assert ccxt_connector.symbols == set()
assert len(ccxt_connector.symbols) == 171 # all enabled symbols
assert ccxt_connector.time_frames == set()
assert mocked_ccxt.set_markets_calls in ([[]], []) # depends on call order
_ensure_auth_mock.assert_called_once()
Expand Down Expand Up @@ -90,7 +90,7 @@ def setSandboxMode(self, is_sandboxed):
with patch.object(ccxt_connector, 'client', new=MockCCXT()) as mocked_ccxt, \
patch.object(ccxt_connector, '_ensure_auth', new=mock.AsyncMock()) as _ensure_auth_mock:
await ccxt_connector.initialize_impl()
assert ccxt_connector.symbols == set()
assert len(ccxt_connector.symbols) == 171 # all enabled symbols
assert ccxt_connector.time_frames == set()
assert mocked_ccxt.set_markets_calls in ([[]], []) # depends on call order
_ensure_auth_mock.assert_called_once()
Expand Down Expand Up @@ -127,12 +127,9 @@ def setSandboxMode(self, is_sandboxed):

with patch.object(ccxt_connector, 'client', new=MockCCXT()) as mocked_ccxt, \
patch.object(ccxt_connector, '_ensure_auth', new=mock.AsyncMock()) as _ensure_auth_mock:
ccxt_connector.exchange_manager.exchange.INCLUDE_DISABLED_SYMBOLS_IN_AVAILABLE_SYMBOLS = True
await ccxt_connector.initialize_impl()
assert ccxt_connector.symbols == {
"BTC/USDT",
"ETH/USDT",
"ETH/BTC",
}
assert len(ccxt_connector.symbols) == 541 # all enabled + diasabled symbols
assert ccxt_connector.time_frames == {
"1h",
"2h",
Expand Down
Loading