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

Method parseToNumeric

js/src/base/Exchange.js:2938–2948  ·  view source on GitHub ↗
(number)

Source from the content-addressed store, hash-verified

2936 return parseInt(convertedNumber);
2937 }
2938 parseToNumeric(number) {
2939 const stringVersion = this.numberToString(number); // this will convert 1.0 and 1 to "1" and 1.1 to "1.1"
2940 // keep this in mind:
2941 // in JS: 1 === 1.0 is true
2942 // in Python: 1 == 1.0 is true
2943 // in PHP: 1 == 1.0 is true, but 1 === 1.0 is false.
2944 if (stringVersion.indexOf('.') >= 0) {
2945 return parseFloat(stringVersion);
2946 }
2947 return parseInt(stringVersion);
2948 }
2949 isRoundNumber(value) {
2950 // this method is similar to isInteger, but this is more loyal and does not check for types.
2951 // i.e. isRoundNumber(1.000) returns true, while isInteger(1.000) returns false

Callers 15

helperTestInitThrottlerFunction · 0.95
isRoundNumberMethod · 0.95
createOrdersMethod · 0.45
addMarginMethod · 0.45
reduceMarginMethod · 0.45
parseMarketMethod · 0.45
createOrderRequestMethod · 0.45
createOrderMethod · 0.45
createOrderRequestMethod · 0.45
fetchTimeMethod · 0.45
createOrderMethod · 0.45

Calls 2

numberToStringMethod · 0.95
parseIntFunction · 0.85

Tested by

no test coverage detected