Skip to content

Commit

Permalink
added load_trading_limits to python
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed May 31, 2018
1 parent 77d9d16 commit 4c8c6f2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions python/ccxt/async/base/exchange.py
Expand Up @@ -217,3 +217,17 @@ async def edit_order(self, id, symbol, *args):
self.raise_error(ExchangeError, details='updateOrder() requires enableRateLimit = true')
await self.cancel_order(id, symbol)
return await self.create_order(symbol, *args)

async def load_trading_limits(self, symbols=None, reload=False, params={}):
if self.has['fetchTradingLimits']:
if reload or not('limitsLoaded' in list(self.options.keys())):
response = await self.fetch_trading_limits(symbols)
limits = response['limits']
keys = list(limits.keys())
for i in range(0, len(keys)):
symbol = keys[i]
self.markets[symbol] = self.deep_extend(self.markets[symbol], {
'limits': limits[symbol],
})
self.options['limitsLoaded'] = self.milliseconds()
return self.markets
15 changes: 15 additions & 0 deletions python/ccxt/base/exchange.py
Expand Up @@ -171,6 +171,7 @@ class Exchange(object):
'fetchTickers': False,
'fetchTrades': True,
'fetchTradingFees': False,
'fetchTradingLimits': False,
'withdraw': False,
}

Expand Down Expand Up @@ -1055,6 +1056,20 @@ def fetch_used_balance(self, params={}):
def fetch_total_balance(self, params={}):
return self.fetch_partial_balance('total', params)

def load_trading_limits(self, symbols=None, reload=False, params={}):
if self.has['fetchTradingLimits']:
if reload or not('limitsLoaded' in list(self.options.keys())):
response = self.fetch_trading_limits(symbols)
limits = response['limits']
keys = list(limits.keys())
for i in range(0, len(keys)):
symbol = keys[i]
self.markets[symbol] = self.deep_extend(self.markets[symbol], {
'limits': limits[symbol],
})
self.options['limitsLoaded'] = self.milliseconds()
return self.markets

def fetch_ohlcv(self, symbol, timeframe='1m', since=None, limit=None, params={}):
if not self.has['fetchTrades']:
self.raise_error(NotSupported, details='fetch_ohlcv() not implemented yet')
Expand Down

0 comments on commit 4c8c6f2

Please sign in to comment.