Example #1
0
 async def fetch_currencies(self, params={}):
     response = await self.publicGetInfoCoinInfo(params)
     if isinstance(response, basestring):
         if response.find('site is under maintenance') >= 0:
             raise OnMaintenance(
                 self.id +
                 ' fetchCurrencies() failed to fetch the currencies, the exchange is on maintenance'
             )
         else:
             raise BadResponse(
                 self.id +
                 ' fetchCurrencies() failed to fetch the currencies')
     currencies = self.safe_value(response, 'info')
     result = {}
     for i in range(0, len(currencies)):
         currency = currencies[i]
         id = self.safe_string(currency, 'symbol')
         # todo: will need to rethink the fees
         # to add support for multiple withdrawal/deposit methods and
         # differentiated fees for each particular method
         code = self.safe_currency_code(id)
         precision = 8  # default precision, todo: fix "magic constants"
         walletStatus = self.safe_string(currency, 'walletStatus')
         active = (walletStatus == 'normal')
         name = self.safe_string(currency, 'name')
         fee = self.safe_float(currency, 'withdrawFee')
         result[code] = {
             'id': id,
             'code': code,
             'info': currency,
             'name': name,
             'active': active,
             'fee': fee,
             'precision': precision,
             'limits': {
                 'amount': {
                     'min': self.safe_float(currency, 'minOrderAmount'),
                     'max': math.pow(10, precision),
                 },
                 'price': {
                     'min': math.pow(10, -precision),
                     'max': math.pow(10, precision),
                 },
                 'cost': {
                     'min': self.safe_float(currency, 'minOrderAmount'),
                     'max': None,
                 },
                 'withdraw': {
                     'min': self.safe_float(currency, 'minWithdrawAmount'),
                     'max': math.pow(10, precision),
                 },
                 'deposit': {
                     'min': self.safe_float(currency, 'minDepositAmount'),
                     'max': None,
                 },
             },
         }
     result = self.append_fiat_currencies(result)
     return result
Example #2
0
 def parse_other_ws(self, reply):
     code = reply['code'] if self.key_exists(reply, 'code') else None
     if code == 20051:
         raise Reconnect('Unsubscribe/subscribe to all channels.')
     elif code == 20060:
         # TODO handle this issue once unsubscribe feature is added.
         raise OnMaintenance('Exchange is undergoing maintenance.' +
                             ' Pause activity for 2 minutes and then' +
                             ' unsubscribe/subscribe all channels.')
     if self.key_exists(reply, 'version'):
         if reply['version'] == 2:
             pass
         else:
             raise ExchangeError('API version number changed.')