Skip to content

Commit

Permalink
Merge pull request #2525 from hroff-1902/exchange-bibox
Browse files Browse the repository at this point in the history
Add fix for bibox exchange
  • Loading branch information
xmatthias committed Nov 13, 2019
2 parents d449933 + 6174a5d commit 17c11b2
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
1 change: 1 addition & 0 deletions freqtrade/exchange/__init__.py
Expand Up @@ -15,3 +15,4 @@
symbol_is_pair)
from freqtrade.exchange.kraken import Kraken # noqa: F401
from freqtrade.exchange.binance import Binance # noqa: F401
from freqtrade.exchange.bibox import Bibox # noqa: F401
22 changes: 22 additions & 0 deletions freqtrade/exchange/bibox.py
@@ -0,0 +1,22 @@
""" Bibox exchange subclass """
import logging
from typing import Dict

from freqtrade.exchange import Exchange

logger = logging.getLogger(__name__)


class Bibox(Exchange):
"""
Bibox exchange class. Contains adjustments needed for Freqtrade to work
with this exchange.
Please note that this exchange is not included in the list of exchanges
officially supported by the Freqtrade development team. So some features
may still not work as expected.
"""

# fetchCurrencies API point requires authentication for Bibox,
# so switch it off for Freqtrade load_markets()
_ccxt_config: Dict = {"has": {"fetchCurrencies": False}}
14 changes: 12 additions & 2 deletions freqtrade/exchange/exchange.py
Expand Up @@ -30,6 +30,9 @@ class Exchange:

_config: Dict = {}

# Parameters to add directly to ccxt sync/async initialization.
_ccxt_config: Dict = {}

# Parameters to add directly to buy/sell calls (like agreeing to trading agreement)
_params: Dict = {}

Expand Down Expand Up @@ -91,10 +94,17 @@ def __init__(self, config: dict, validate: bool = True) -> None:
self._trades_pagination_arg = self._ft_has['trades_pagination_arg']

# Initialize ccxt objects
ccxt_config = self._ccxt_config.copy()
ccxt_config = deep_merge_dicts(exchange_config.get('ccxt_config', {}),
ccxt_config)
self._api = self._init_ccxt(
exchange_config, ccxt_kwargs=exchange_config.get('ccxt_config'))
exchange_config, ccxt_kwargs=ccxt_config)

ccxt_async_config = self._ccxt_config.copy()
ccxt_async_config = deep_merge_dicts(exchange_config.get('ccxt_async_config', {}),
ccxt_async_config)
self._api_async = self._init_ccxt(
exchange_config, ccxt_async, ccxt_kwargs=exchange_config.get('ccxt_async_config'))
exchange_config, ccxt_async, ccxt_kwargs=ccxt_async_config)

logger.info('Using Exchange "%s"', self.name)

Expand Down

0 comments on commit 17c11b2

Please sign in to comment.