Closed ghgh2 closed 6 years ago
Merging #17 into master will increase coverage by
0.01%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #17 +/- ##
==========================================
+ Coverage 95.8% 95.82% +0.01%
==========================================
Files 2 2
Lines 334 335 +1
==========================================
+ Hits 320 321 +1
Misses 14 14
Impacted Files | Coverage Δ | |
---|---|---|
btcde.py | 89.23% <100%> (+0.08%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 04c9ef5...8e1d5a6. Read the comment docs.
@ghgh2 Can you provide a test code that will show that decimals is calculating correct, while float wouldn't? For example you make a test with mocked response for show_orderbook('buy'), that returns a float value and in then you add another fload/decimal to that value and see if it returns the correct value. for example
params = {'type': 'buy',
'trading_pair': 'btceur',
'max_amount': 10,
'price': 1337}
response = self.sampleData('showOrderbook_buy')
m.get(requests_mock.ANY, json=response, status_code=200)
data = self.conn.showOrderbook(params.get('type'),
params.get('trading_pair'),
price=params.get('price'))
assertEqual(data.get('price') + decimal(22.3), decimal(2232.2))
assertNotEqual(data.get('price') +22.3, 2232.2)
Something like this... I am not so experience on the usage of the package decimal
As we're dealing with financial data here and exactness is required, we should tell the json parser to parse decimal numbers as
decimal.Decimal
and not asfloat
.