|
22 | 22 | import sys
|
23 | 23 |
|
24 | 24 | import ccxt.async_support as ccxt
|
| 25 | +import octobot_commons as octobot_commons |
25 | 26 | import octobot_commons.enums as commons_enums
|
| 27 | +import octobot_commons.symbols.symbol_util as symbol_util |
26 | 28 | import octobot_commons.tree as commons_tree
|
27 | 29 |
|
28 | 30 | from octobot_commons import number_util
|
@@ -93,7 +95,7 @@ def _create_connector(self, config, exchange_manager, connector_class):
|
93 | 95 |
|
94 | 96 | async def initialize_impl(self):
|
95 | 97 | await self.connector.initialize()
|
96 |
| - self.symbols = self.connector.symbols |
| 98 | + self.symbols = self.get_exchange_pairs() |
97 | 99 | self.time_frames = self.connector.time_frames
|
98 | 100 |
|
99 | 101 | async def stop(self) -> None:
|
@@ -558,6 +560,17 @@ def get_split_pair_from_exchange(self, pair) -> (str, str):
|
558 | 560 | def get_exchange_pair(self, pair) -> str:
|
559 | 561 | return self.connector.get_exchange_pair(pair)
|
560 | 562 |
|
| 563 | + def get_exchange_pairs(self) -> set: |
| 564 | + # make sure spot doesnt use futures pairs and vice versa |
| 565 | + if self.exchange_manager.is_spot_only or self.exchange_manager.is_margin: |
| 566 | + return {symbol for symbol in self.connector.symbols |
| 567 | + if symbol_util.parse_symbol(symbol).is_spot()} |
| 568 | + elif self.exchange_manager.is_future: |
| 569 | + return {symbol for symbol in self.connector.symbols |
| 570 | + if symbol_util.parse_symbol(symbol).is_future()} |
| 571 | + else: |
| 572 | + return self.connector.symbols |
| 573 | + |
561 | 574 | def get_pair_cryptocurrency(self, pair) -> str:
|
562 | 575 | return self.connector.get_pair_cryptocurrency(pair)
|
563 | 576 |
|
|
0 commit comments