MCPcopy Create free account
hub / github.com/ccxt/ccxt / check_precision_accuracy

Function check_precision_accuracy

python/ccxt/test/exchange/base/test_shared_methods.py:331–349  ·  view source on GitHub ↗
(exchange, skipped_properties, method, entry, key)

Source from the content-addressed store, hash-verified

329
330
331def check_precision_accuracy(exchange, skipped_properties, method, entry, key):
332 if key in skipped_properties:
333 return
334 if exchange.is_tick_precision():
335 # TICK_SIZE should be above zero
336 assert_greater(exchange, skipped_properties, method, entry, key, '0')
337 # the below array of integers are inexistent tick-sizes (theoretically technically possible, but not in real-world cases), so in our case, such values probably indicate an incorrectly implemented tick-sizes calculation, so we throw error
338 decimal_numbers = ['2', '3', '4', '5', '6', '7', '8', '9', '11', '12', '13', '14', '15', '16']
339 if key == 'amount' and 'precisionAmountAbnormal' in skipped_properties:
340 return
341 for i in range(0, len(decimal_numbers)):
342 num = decimal_numbers[i]
343 num_str = num
344 assert_non_equal(exchange, skipped_properties, method, entry, key, num_str)
345 else:
346 # todo: significant-digits return doubles from `this.parseNumber`, so for now can't assert against integer atm
347 # assertInteger (exchange, skippedProperties, method, entry, key); # should be integer
348 assert_less_or_equal(exchange, skipped_properties, method, entry, key, '18') # should be under 18 decimals
349 assert_greater_or_equal(exchange, skipped_properties, method, entry, key, '-8') # in real-world cases, there would not be less than that
350
351
352def fetch_best_bid_ask(exchange, method, symbol):

Callers

nothing calls this directly

Calls 6

assert_greaterFunction · 0.85
assert_non_equalFunction · 0.85
assert_less_or_equalFunction · 0.85
assert_greater_or_equalFunction · 0.85
is_tick_precisionMethod · 0.80
rangeFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…