コード例 #1
0
ファイル: exchange.py プロジェクト: timwill1881/ccxt
 def handle_response(self, url, method='GET', headers=None, body=None):
     try:
         if (len(body) < 2):
             raise ExchangeError(''.join(
                 [self.id, method, url, 'returned empty response']))
         return json.loads(body)
     except Exception as e:
         ddos_protection = re.search('(cloudflare|incapsula)',
                                     body,
                                     flags=re.IGNORECASE)
         exchange_not_available = re.search(
             '(offline|busy|retry|wait|unavailable|maintain|maintenance|maintenancing)',
             body,
             flags=re.IGNORECASE)
         if ddos_protection:
             raise DDoSProtection(' '.join([self.id, method, url, body]))
         if exchange_not_available:
             message = 'exchange downtime, exchange closed for maintenance or offline, DDoS protection or rate-limiting in effect'
             raise ExchangeNotAvailable(' '.join([
                 self.id,
                 method,
                 url,
                 body,
                 message,
             ]))
         if isinstance(e, ValueError):
             raise ExchangeError(' '.join(
                 [self.id, method, url, body,
                  str(e)]))
         raise
コード例 #2
0
 def edit_order(self, id, symbol, *args):
     if not self.enableRateLimit:
         raise ExchangeError(
             self.id + ' edit_order() requires enableRateLimit = true')
     self.cancel_order(id, symbol)
     return self.create_order(symbol, *args)
コード例 #3
0
ファイル: exchange.py プロジェクト: mindw00rk/ccxt
 def update_order(self, id, *args):
     if not self.enableRateLimit:
         raise ExchangeError(
             self.id + ' updateOrder() requires enableRateLimit = true')
     self.cancelOrder(id)
     return self.createOrder(*args)
コード例 #4
0
ファイル: exchange.py プロジェクト: zeropool/ccxt
 async def update_order(self, id, symbol, *args):
     if not self.enableRateLimit:
         raise ExchangeError(
             self.id + ' updateOrder() requires enableRateLimit = true')
     await self.cancel_order(id, symbol)
     return await self.create_order(symbol, *args)
コード例 #5
0
 def fetch_tickers(self):
     raise ExchangeError(self.id + ' API does not allow to fetch all tickers at once with a single call to fetch_tickers () for now')