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

Method __str__

python/ccxt/base/precise.py:174–188  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

172 return self.decimals == other.decimals and self.integer == other.integer
173
174 def __str__(self):
175 self.reduce()
176 sign = '-' if self.integer < 0 else ''
177 integer_array = list(str(abs(self.integer)).rjust(self.decimals, '0'))
178 index = len(integer_array) - self.decimals
179 if index == 0:
180 item = '0.'
181 elif self.decimals < 0:
182 item = '0' * (-self.decimals)
183 elif self.decimals == 0:
184 item = ''
185 else:
186 item = '.'
187 integer_array.insert(index, item)
188 return sign + ''.join(integer_array)
189
190 def __repr__(self):
191 return "Precise(" + str(self) + ")"

Callers

nothing calls this directly

Calls 1

reduceMethod · 0.95

Tested by

no test coverage detected