ccxt has pairs in BASE_CURRENCY / QUOTE_CURRENCY format, remove bittrex references

This commit is contained in:
Samuel Husso 2018-01-31 17:29:07 +02:00
parent f0945c354e
commit b562239ec8
4 changed files with 15 additions and 14 deletions

View File

@ -23,13 +23,6 @@ _CONF: dict = {}
_DRY_RUN_OPEN_ORDERS: Dict[str, Any] = {}
class Exchanges(enum.Enum):
"""
Maps supported exchange names to correspondent classes.
"""
BITTREX = Bittrex
def init(config: dict) -> None:
"""
Initializes this module with the given config,
@ -63,10 +56,13 @@ def init(config: dict) -> None:
# we need load api markets
_API.load_markets()
# Check if all pairs are available
validate_pairs(config['exchange']['pair_whitelist'])
print("*"*20)
def validate_pairs(pairs: List[str]) -> None:
"""
@ -75,15 +71,22 @@ def validate_pairs(pairs: List[str]) -> None:
:param pairs: list of pairs
:return: None
"""
# Note: ccxt has BaseCurrency/QuoteCurrency format for pairs
if not _API.markets:
_API.load_markets()
try:
markets = _API.get_markets()
markets = _API.markets
except requests.exceptions.RequestException as e:
logger.warning('Unable to validate pairs (assuming they are correct). Reason: %s', e)
return
stake_cur = _CONF['stake_currency']
for pair in pairs:
if not pair.startswith(stake_cur):
# TODO: ccxt expects pairs in BTC/USD format
pair = pair.replace('_', '/')
if not pair.endswith(stake_cur):
raise OperationalException(
'Pair {} not compatible with stake_currency: {}'.format(pair, stake_cur)
)

View File

@ -406,7 +406,7 @@ CONF_SCHEMA = {
'type': 'array',
'items': {
'type': 'string',
'pattern': '^[0-9A-Z]+_[0-9A-Z]+$'
'pattern': '^[0-9A-Z]+/[0-9A-Z]+$'
},
'uniqueItems': True
},
@ -414,7 +414,7 @@ CONF_SCHEMA = {
'type': 'array',
'items': {
'type': 'string',
'pattern': '^[0-9A-Z]+_[0-9A-Z]+$'
'pattern': '^[0-9A-Z]+/[0-9A-Z]+$'
},
'uniqueItems': True
}

View File

@ -11,7 +11,6 @@ import freqtrade.misc as misc
import freqtrade.optimize as optimize
from freqtrade import exchange
from freqtrade.analyze import populate_buy_trend, populate_sell_trend
from freqtrade.exchange import Bittrex
from freqtrade.main import should_sell
from freqtrade.persistence import Trade
from freqtrade.strategy.strategy import Strategy

View File

@ -22,7 +22,6 @@ import freqtrade.vendor.qtpylib.indicators as qtpylib
# Monkey patch config
from freqtrade import main # noqa; noqa
from freqtrade import exchange, misc, optimize
from freqtrade.exchange import Bittrex
from freqtrade.misc import load_config
from freqtrade.optimize import backtesting
from freqtrade.optimize.backtesting import backtest