LUCIT-Systems-and-Development / unicorn-binance-websocket-api

A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
678 stars 166 forks source link

Add support for Binance Coin-M futures via binance.com-coin-futures exchange type #163

Closed M3tz3l closed 3 years ago

M3tz3l commented 3 years ago

PR Details

Add basic support for coin margin futures web sockets.

Description

Related Issue

https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/issues/134

Motivation and Context

I like the project, but I need coin margin futures :man_shrugging:

How Has This Been Tested

Tested with the newly introduced example and by running other test examples with the changes with a Linux machine and my own Binance account. I transferred funds to my coin-m futures account to test the user data stream events.

Types of changes

Checklist

codecov-io commented 3 years ago

Codecov Report

Merging #163 (e06f8ab) into master (d610c4d) will decrease coverage by 0.03%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #163      +/-   ##
==========================================
- Coverage   91.01%   90.98%   -0.04%     
==========================================
  Files           7        7              
  Lines        1524     1530       +6     
==========================================
+ Hits         1387     1392       +5     
- Misses        137      138       +1     
Impacted Files Coverage Δ
...ocket_api/unicorn_binance_websocket_api_manager.py 89.74% <ø> (-0.23%) :arrow_down:
...socket_api/unicorn_binance_websocket_api_socket.py 91.17% <ø> (ø)
...et_api/unicorn_binance_websocket_api_restclient.py 96.37% <100.00%> (+1.60%) :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 d610c4d...e06f8ab. Read the comment docs.

oliver-zehentleitner commented 3 years ago

A question about the name: Is "binance.com-coin-futures" the right name we should choose? Does "binance.com-perpectual-coin-futures" makes more sense? Can there be other types of coin futures than perpectual one?

M3tz3l commented 3 years ago

A question about the name: Is "binance.com-coin-futures" the right name we should choose? Does "binance.com-perpectual-coin-futures" makes more sense? Can there be other types of coin futures than perpectual one?

I think it's fine. There are also quaterly futures. You can see them by running e.g. https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/pull/163/files#diff-59faa32510214f3e87431673745a42f9fe19b8de950f1ec79eb7452c8e5977e4R71. I didn't include them in the example because you would have to change them periodically

M3tz3l commented 3 years ago

What's the process now? Does this PR need to wait for the unicorn-fy changes and need to be adapted afterwards or can this be done in a second step? What about this failing check? Do you merge it manually with a version bump?

oliver-zehentleitner commented 3 years ago

please finish unicorn_binance_websocket_api/unicorn_binance_websocket_api_socket.py , then i think its ready to merge.

the coverals check is ok, I care about this.

but before i create a new pypi package we have to update unicorn-fy too, or there is a call to a non existing mehtod...

oliver-zehentleitner commented 3 years ago

A question about the name: Is "binance.com-coin-futures" the right name we should choose? Does "binance.com-perpectual-coin-futures" makes more sense? Can there be other types of coin futures than perpectual one?

I think it's fine. There are also quaterly futures. You can see them by running e.g. https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/pull/163/files#diff-59faa32510214f3e87431673745a42f9fe19b8de950f1ec79eb7452c8e5977e4R71. I didn't include them in the example because you would have to change them periodically

to be honest, i dont know the differences between them. ok, lets go ahead.

oliver-zehentleitner commented 3 years ago

If you are fine with it, i would merge it!

M3tz3l commented 3 years ago

No wait one commit got lost. I should never change something in the GUI inbetween :see_no_evil:

M3tz3l commented 3 years ago

Now it should be fine

M3tz3l commented 3 years ago

Would be nice if you could provide the unicorn_fy minimum implementation. The coin-m jsons seem to be quite different. I'll try to patch it on the way when I work on it.

oliver-zehentleitner commented 3 years ago

Thanks a lot for this contribution!

oliver-zehentleitner commented 3 years ago

Would be nice if you could provide the unicorn_fy minimum implementation. The coin-m jsons seem to be quite different. I'll try to patch it on the way when I work on it.

https://github.com/oliver-zehentleitner/unicorn-fy/issues/26