MCPcopy Index your code
hub / github.com/ccxt/ccxt / add

Method add

java/lib/src/main/java/io/github/ccxt/base/Precise.java:71–91  ·  view source on GitHub ↗
(Precise other)

Source from the content-addressed store, hash-verified

69 }
70
71 public Precise add(Precise other) {
72 if (this.decimals == other.decimals) {
73 BigInteger integerResult = this.integer.add(other.integer);
74 return new Precise(integerResult.toString(), this.decimals);
75 } else {
76 Precise smaller;
77 Precise bigger;
78 if (toInt(this.decimals) < toInt(other.decimals)) {
79 smaller = this;
80 bigger = other;
81 } else {
82 smaller = other;
83 bigger = this;
84 }
85 int exponent = toInt(bigger.decimals) - toInt(smaller.decimals);
86 BigInteger factor = BigInteger.valueOf(baseNumber).pow(exponent);
87 BigInteger normalized = smaller.integer.multiply(factor);
88 BigInteger result = normalized.add(bigger.integer);
89 return new Precise(result.toString(), bigger.decimals);
90 }
91 }
92
93 public Precise mod(Precise other) {
94 int rationizerNumerator = Math.max(-toInt(this.decimals) + toInt(other.decimals), 0);

Callers 15

subMethod · 0.95
parseEntriesMethod · 0.45
fetchMarketsMethod · 0.45
fetchMarketsMethod · 0.45
fetchLastPricesMethod · 0.45
createOrdersMethod · 0.45
fetchPositionsRiskMethod · 0.45
parseAccountPositionsMethod · 0.45
loadLeverageBracketsMethod · 0.45
signOrderRequestMethod · 0.45
createOrdersMethod · 0.45
cancelOrdersMethod · 0.45

Calls 4

toIntMethod · 0.95
toStringMethod · 0.45
powMethod · 0.45
multiplyMethod · 0.45

Tested by

no test coverage detected