Closed davluangu closed 6 years ago
@csko As a side note, I haven't been able to get tests to successfully run locally. They are also failing on Travis for python 3.6 with my last PR (that was merged into master branch): https://travis-ci.org/csko/gdax-python-api/jobs/323521090
Any idea whats going on? I don't know enough about asyncio to really figure it out yet.
The first test failure (locally and on Travis) has this error:
E TypeError: object MagicMock can't be used in 'await' expression
:exclamation: No coverage uploaded for pull request base (
master@76d9685
). Click here to learn what that means. The diff coverage isn/a
.
@@ Coverage Diff @@
## master #7 +/- ##
========================================
Coverage ? 96.2%
========================================
Files ? 5
Lines ? 501
Branches ? 0
========================================
Hits ? 482
Misses ? 19
Partials ? 0
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 76d9685...b2578d7. Read the comment docs.
Thanks for sending in this pull request. I'd prefer not introducing another dependency. Instead, this can be done with the cls=
arg to json.dumps
, see a2c2cb339ef4193ce62e17bb57367021246f359b. Also, the unit test was set up incorrectly because it was testing an empty orderbook, that's why this wasn't caught. It's fixed now.
The async tests were failing because they were not compatible with the newer release of asynctest. 4002b02388815df82b4a966cb16ab10875acab7c pins the package to the older version, CI should pass now. Make sure to run pip install -r requirements-dev.txt
locally. I did not catch this because my local dev packages were older.
@csko sounds good. thanks for the fix on the tests.
@csko I was running into errors with
json.dumps()
used here: https://github.com/davluangu/gdax-python-api/blob/76d9685a03e5f6404c13101c24c5cd45aec600b1/gdax/orderbook.py#L57 The issue is thatjson.dumps()
cannot deal withDecimal()
types. This is only an issue when using thetrade_log_file_path
arg inOrderBook()
.Here's a toy example of the error:
output:
The fix is quite simple, just use
ujson
(https://pypi.python.org/pypi/ujson) instead ofjson
:Here's how you can recreate the actual error when using
OrderBook()
. It is basically the same code you have inmain
in orderbook.py with the uncommented line that setstrade_log_file_path
: