LUCIT-Systems-and-Development / unicorn-fy

A Python SDK by LUCIT to convert received raw data from crypto exchange API endpoints into well-formed python dictionaries.
https://unicorn-fy.docs.lucit.tech
MIT License
54 stars 20 forks source link

Slight differences between Binance.com and Binance-futures #1

Closed hbizot closed 4 years ago

hbizot commented 4 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] The response message from a aggTrade stream is slightly different than than that from Binance.com. The resonse I get is: {"stream":"btcusdt@aggTrade","data":{"e":"aggTrade","E":1573576417345,"a":6292316,"s":"BTCUSDT","p":"8718.19","q":"0.792","f":8414086,"l":8414086,"T":1573576417240,"m":true}}

This key doen't exist for futures: stream_data['data']['M']

Describe the solution you'd like A clear and concise description of what you want to happen.

Remove this part in method 'binance_websocket': 'ignore': stream_data['data']['M']

in: if stream_data['data']['e'] == 'aggTrade': unicorn_fied_data = {'stream_type': stream_data['stream'], 'event_type': stream_data['data']['e'], 'event_time': stream_data['data']['E'], 'symbol': stream_data['data']['s'], 'aggregate_trade_id': stream_data['data']['a'], 'price': stream_data['data']['p'], 'quantity': stream_data['data']['q'], 'first_trade_id': stream_data['data']['f'], 'last_trade_id': stream_data['data']['l'], 'trade_time': stream_data['data']['T'], 'is_market_maker': stream_data['data']['m'], --> 'ignore': stream_data['data']['M'] <-- }

since it's not used anyway.

Thanks.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

oliver-zehentleitner commented 4 years ago

I only mention this, because i see your github account is very new.

If you want, you can fork the repository and create a pull request. Its not much more work for you than creating this issue and i am able to merge the code after a review. Your benefit is that you get added to contributors list and maybe its faster pushed to pypi because its less work for me :)

tell me if you want to try it!