Bittrex provider

remove redundant 'name' property and pair validation call
This commit is contained in:
xsmile 2017-10-11 19:51:37 +02:00 committed by GitHub
parent 0c8c149b86
commit d76476040a

View File

@ -26,10 +26,6 @@ class Bittrex(Exchange):
# Sleep time to avoid rate limits, used in the main loop # Sleep time to avoid rate limits, used in the main loop
SLEEP_TIME: float = 25 SLEEP_TIME: float = 25
@property
def name(self) -> str:
return self.__class__.__name__
@property @property
def sleep_time(self) -> float: def sleep_time(self) -> float:
return self.SLEEP_TIME return self.SLEEP_TIME
@ -40,13 +36,6 @@ class Bittrex(Exchange):
_EXCHANGE_CONF.update(config) _EXCHANGE_CONF.update(config)
_API = _Bittrex(api_key=_EXCHANGE_CONF['key'], api_secret=_EXCHANGE_CONF['secret']) _API = _Bittrex(api_key=_EXCHANGE_CONF['key'], api_secret=_EXCHANGE_CONF['secret'])
# Check if all pairs are available
markets = self.get_markets()
exchange_name = self.name
for pair in _EXCHANGE_CONF['pair_whitelist']:
if pair not in markets:
raise RuntimeError('Pair {} is not available at {}'.format(pair, exchange_name))
def buy(self, pair: str, rate: float, amount: float) -> str: def buy(self, pair: str, rate: float, amount: float) -> str:
data = _API.buy_limit(pair.replace('_', '-'), amount, rate) data = _API.buy_limit(pair.replace('_', '-'), amount, rate)
if not data['success']: if not data['success']: