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

Method precision_from_string

python/ccxt/base/exchange.py:1776–1790  ·  view source on GitHub ↗
(self, str)

Source from the content-addressed store, hash-verified

1774 return list(value.values()) if type(value) is dict else value
1775
1776 def precision_from_string(self, str):
1777 # support string formats like '1e-4'
1778 if 'e' in str or 'E' in str:
1779 # Find the exponent part after e/E
1780 idx = str.find('e')
1781 if idx == -1:
1782 idx = str.find('E')
1783 return -int(str[idx + 1:])
1784 # default strings like '0.0001'
1785 dot_idx = str.find('.')
1786 if dot_idx == -1:
1787 return 0
1788 # Strip trailing zeros and count decimal places
1789 decimal_part = str[dot_idx + 1:].rstrip('0')
1790 return len(decimal_part)
1791
1792 def map_to_safe_map(self, dictionary):
1793 return dictionary # wrapper for go

Callers 15

safe_tickerMethod · 0.95
price_to_precisionMethod · 0.80
parse_position_riskMethod · 0.80
eip_message_for_orderMethod · 0.80
parse_positionMethod · 0.80
parse_position_riskMethod · 0.80
price_to_precisionMethod · 0.80
parse_position_riskMethod · 0.80

Calls 1

findMethod · 0.80

Tested by 1