-
-
Notifications
You must be signed in to change notification settings - Fork 166
Add support for Binance Coin-M futures via binance.com-coin-futures exchange type #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Binance Coin-M futures via binance.com-coin-futures exchange type #163
Conversation
# Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api | ||
# PyPI: https://pypi.org/project/unicorn-binance-websocket-api/ | ||
# | ||
# Author: Oliver Zehentleitner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the contribution guideline regarding author here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add a "Thanks to M3tz3l for contributing" to the example file. Is this ok for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
@@ -544,7 +544,7 @@ def test_rest_binance_com_isolated_margin_testnet(self): | |||
BinanceWebSocketApiRestclient(binance_websocket_api_manager) | |||
binance_websocket_api_manager.stop_manager_with_all_streams() | |||
|
|||
def test_rest_binance_com_futures_testnet(self): | |||
def test_rest_binance_com_futures(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I found a bug here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, the names just need to be unique, then the unittests get executed! Thanks anyway!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it was not unique in this case -> see line 552
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see, its double! thanks for fixing!
@@ -126,6 +126,7 @@ async def start_socket(self): | |||
received_stream_data = self.unicorn_fy.binance_com_futures_websocket(received_stream_data_json) | |||
elif self.exchange == "binance.com-futures-testnet": | |||
received_stream_data = self.unicorn_fy.binance_com_futures_websocket(received_stream_data_json) | |||
# TODO coin margined futures (What to do about it?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No sure what to do here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update unicorn-fy too. Since i dont know whats returned from the endpoint we can start with a "try" and map coin-futures in unicorn-fy to std websocket convertation. If you want you can try, if not i can do it too, its not much work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will call it "binance_com_coin_futures_websocket()`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try. I wanted to look into the other packages anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you want this line to be fixed now? Update the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just add it with a call to binance_com_coin_futures_websocket()
, but maybe we should discuss #163 (comment) first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok you accept the broken call to non existing function because you'll not release it yet. I replied to #163 (comment) in #163 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes and the unicorn-fy thing will be done very soon (from you or from me...) so i dont worry about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its fine, thanks
@@ -126,6 +126,7 @@ async def start_socket(self): | |||
received_stream_data = self.unicorn_fy.binance_com_futures_websocket(received_stream_data_json) | |||
elif self.exchange == "binance.com-futures-testnet": | |||
received_stream_data = self.unicorn_fy.binance_com_futures_websocket(received_stream_data_json) | |||
# TODO coin margined futures (What to do about it?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will call it "binance_com_coin_futures_websocket()`
@@ -544,7 +544,7 @@ def test_rest_binance_com_isolated_margin_testnet(self): | |||
BinanceWebSocketApiRestclient(binance_websocket_api_manager) | |||
binance_websocket_api_manager.stop_manager_with_all_streams() | |||
|
|||
def test_rest_binance_com_futures_testnet(self): | |||
def test_rest_binance_com_futures(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see, its double! thanks for fixing!
A question about the name: |
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. |
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? |
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... |
to be honest, i dont know the differences between them. ok, lets go ahead. |
If you are fine with it, i would merge it! |
No wait one commit got lost. I should never change something in the GUI inbetween 🙈 |
Now it should be fine |
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. |
unittest_binance_websocket_api.py
Outdated
@@ -554,6 +554,11 @@ def test_rest_binance_com_futures_testnet(self): | |||
BinanceWebSocketApiRestclient(binance_websocket_api_manager) | |||
binance_websocket_api_manager.stop_manager_with_all_streams() | |||
|
|||
def test_rest_binance_com_coin_futures(self): | |||
binance_websocket_api_manager = BinanceWebSocketApiManager(exchange="binance.com-futures") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think you need to update to "binance.com-coin-futures"
Thanks a lot for this contribution! |
|
PR Details
Add basic support for coin margin futures web sockets.
Description
binance.com-coin-futures
exchange type for wss://dstream.binance.com/ base uriRelated Issue
#134
Motivation and Context
I like the project, but I need coin margin futures 🤷♂️
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
CONTRIBUTING
document.