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