text: # -*- coding: utf-8 -*-
  
  # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
  # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
  
  from ccxt.async.liqui import liqui
  from ccxt.base.errors import ExchangeError
  from ccxt.base.errors import InsufficientFunds
  from ccxt.base.errors import DDoSProtection
  
  
  class yobit (liqui):
  
      def describe(self):
          return self.deep_extend(super(yobit, self).describe(), {
              'id': 'yobit',
              'name': 'YoBit',
              'countries': 'RU',
              'rateLimit': 3000,  # responses are cached every 2 seconds
              'version': '3',
              'has': {
                  'createDepositAddress': True,
                  'fetchDepositAddress': True,
                  'CORS': False,
                  'withdraw': True,
              },
              'urls': {
                  'logo': 'https://user-images.githubusercontent.com/1294454/27766910-cdcbfdae-5eea-11e7-9859-03fea873272d.jpg',
                  'api': {
                      'public': 'https://yobit.net/api',
                      'private': 'https://yobit.net/tapi',
                  },
                  'www': 'https://www.yobit.net',
                  'doc': 'https://www.yobit.net/en/api/',
                  'fees': 'https://www.yobit.net/en/fees/',
              },
              'api': {
                  'public': {
                      'get': [
                          'depth/{pair}',
                          'info',
                          'ticker/{pair}',
                          'trades/{pair}',
                      ],
                  },
                  'private': {
                      'post': [
                          'ActiveOrders',
                          'CancelOrder',
                          'GetDepositAddress',
                          'getInfo',
                          'OrderInfo',
                          'Trade',
                          'TradeHistory',
                          'WithdrawCoinsToAddress',
                      ],
                  },
              },
              'fees': {
                  'trading': {
                      'maker': 0.002,
                      'taker': 0.002,
                  },
                  'funding': {
                      'withdraw': {},
                  },
              },
              'commonCurrencies': {
                  'AIR': 'AirCoin',
                  'ANI': 'ANICoin',
                  'ANT': 'AntsCoin',
                  'AST': 'Astral',
                  'ATM': 'Autumncoin',
                  'BCC': 'BCH',
                  'BCS': 'BitcoinStake',
                  'BLN': 'Bulleon',
                  'BTS': 'Bitshares2',
                  'CAT': 'BitClave',
                  'COV': 'Coven Coin',
                  'CPC': 'Capricoin',
                  'CS': 'CryptoSpots',
                  'DCT': 'Discount',
                  'DGD': 'DarkGoldCoin',
                  'DROP': 'FaucetCoin',
                  'ERT': 'Eristica Token',
                  'ICN': 'iCoin',
                  'KNC': 'KingN Coin',
                  'LIZI': 'LiZi',
                  'LOC': 'LocoCoin',
                  'LOCX': 'LOC',
                  'LUN': 'LunarCoin',
                  'MDT': 'Midnight',
                  'NAV': 'NavajoCoin',
                  'OMG': 'OMGame',
                  'STK': 'StakeCoin',
                  'PAY': 'EPAY',
                  'PLC': 'Platin Coin',
                  'REP': 'Republicoin',
                  'RUR': 'RUB',
                  'XIN': 'XINCoin',
              },
              'options': {
                  'fetchOrdersRequiresSymbol': True,
              },
          })
  
      def parse_order_status(self, status):
          statuses = {
              '0': 'open',
              '1': 'closed',
              '2': 'canceled',
              '3': 'open',  # or partially-filled and closed? https://github.com/ccxt/ccxt/issues/1594
          }
          if status in statuses:
              return statuses[status]
          return status
  
      async def fetch_balance(self, params={}):
          await self.load_markets()
          response = await self.privatePostGetInfo()
          balances = response['return']
          result = {'info': balances}
          sides = {'free': 'funds', 'total': 'funds_incl_orders'}
          keys = list(sides.keys())
          for i in range(0, len(keys)):
              key = keys[i]
              side = sides[key]
              if side in balances:
                  currencies = list(balances[side].keys())
                  for j in range(0, len(currencies)):
                      lowercase = currencies[j]
                      uppercase = lowercase.upper()
                      currency = self.common_currency_code(uppercase)
                      account = None
                      if currency in result:
                          account = result[currency]
                      else:
                          account = self.account()
                      account[key] = balances[side][lowercase]
                      if account['total'] and account['free']:
                          account['used'] = account['total'] - account['free']
                      result[currency] = account
          return self.parse_balance(result)
  
      async def create_deposit_address(self, code, params={}):
          response = await self.fetch_deposit_address(code, self.extend({
              'need_new': 1,
          }, params))
          address = self.safe_string(response, 'address')
          self.check_address(address)
          return {
              'currency': code,
              'address': address,
              'status': 'ok',
              'info': response['info'],
          }
  
      async def fetch_deposit_address(self, code, params={}):
          await self.load_markets()
          currency = self.currency(code)
          request = {
              'coinName': currency['id'],
              'need_new': 0,
          }
          response = await self.privatePostGetDepositAddress(self.extend(request, params))
          address = self.safe_string(response['return'], 'address')
          self.check_address(address)
          return {
              'currency': code,
              'address': address,
              'status': 'ok',
              'info': response,
          }
  
      async def withdraw(self, code, amount, address, tag=None, params={}):
          self.check_address(address)
          await self.load_markets()
          currency = self.currency(code)
          response = await self.privatePostWithdrawCoinsToAddress(self.extend({
              'coinName': currency['id'],
              'amount': amount,
              'address': address,
          }, params))
          return {
              'info': response,
              'id': None,
          }
  
      async def request(self, path, api='public', method='GET', params={}, headers=None, body=None):
          response = await self.fetch2(path, api, method, params, headers, body)
          if 'success' in response:
              if not response['success']:
                  if response['error'].find('Insufficient funds') >= 0:  # not enougTh is a typo inside Liqui's own API...
                      raise InsufficientFunds(self.id + ' ' + self.json(response))
                  elif response['error'] == 'Requests too often':
                      raise DDoSProtection(self.id + ' ' + self.json(response))
                  elif (response['error'] == 'not available') or (response['error'] == 'external service unavailable'):
                      raise DDoSProtection(self.id + ' ' + self.json(response))
                  else:
                      raise ExchangeError(self.id + ' ' + self.json(response))
          return response
  