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

Method parse_precision

python/ccxt/base/exchange.py:6843–6863  ·  view source on GitHub ↗

@ignore :param str precision: The number of digits to the right of the decimal :returns str: a string number equal to 1e-precision

(self, precision: str)

Source from the content-addressed store, hash-verified

6841 return self.parse_number(value, defaultNumber)
6842
6843 def parse_precision(self, precision: str):
6844 """
6845 @ignore
6846 :param str precision: The number of digits to the right of the decimal
6847 :returns str: a string number equal to 1e-precision
6848 """
6849 if precision is None:
6850 return None
6851 precisionNumber = int(precision)
6852 if precisionNumber == 0:
6853 return '1'
6854 if precisionNumber > 0:
6855 parsedPrecision = '0.'
6856 for i in range(0, precisionNumber - 1):
6857 parsedPrecision = parsedPrecision + '0'
6858 return parsedPrecision + '1'
6859 else:
6860 parsedPrecision = '1'
6861 for i in range(0, precisionNumber * -1 - 1):
6862 parsedPrecision = parsedPrecision + '0'
6863 return parsedPrecision + '0'
6864
6865 def integer_precision_to_amount(self, precision: Str):
6866 """

Callers 15

test_parse_precisionFunction · 0.95
parse_currencyMethod · 0.80
parse_currencyMethod · 0.80
parse_currencyMethod · 0.80
fetch_spot_marketsMethod · 0.80
parse_marketMethod · 0.80
parse_marketMethod · 0.80
parse_currencyMethod · 0.80
parse_marketMethod · 0.80
parse_marketMethod · 0.80

Calls 1

rangeFunction · 0.50

Tested by 1

test_parse_precisionFunction · 0.76