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

Method safe_integer_n

python/ccxt/base/exchange.py:942–953  ·  view source on GitHub ↗
(dictionary, key_list, default_value=None)

Source from the content-addressed store, hash-verified

940
941 @staticmethod
942 def safe_integer_n(dictionary, key_list, default_value=None):
943 value = Exchange.get_object_value_from_key_list(dictionary, key_list)
944 if value is None:
945 return default_value
946 try:
947 # needed to avoid breaking on "100.0"
948 # https://stackoverflow.com/questions/1094717/convert-a-string-to-integer-with-decimal-in-python#1094721
949 return int(float(value))
950 except ValueError:
951 return default_value
952 except TypeError:
953 return default_value
954
955 @staticmethod
956 def safe_integer_product_n(dictionary, key_list, factor, default_value=None):

Callers 15

test_safe_methodsFunction · 0.95
parse_orderMethod · 0.80
parse_tradeMethod · 0.80
parse_positionMethod · 0.80
parse_orderMethod · 0.80
parse_conversionMethod · 0.80
fetch_ordersMethod · 0.80
fetch_ohlcvMethod · 0.80

Calls 1

Tested by 1

test_safe_methodsFunction · 0.76