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
692 stars 164 forks source link

Creating heatmaps #387

Closed spacewalkingninja closed 1 month ago

spacewalkingninja commented 1 month ago

Is your feature request related to a problem? Please describe.

Hello guys, I am trying to get all market force orders for example from binance, can I do it with this software?

Describe the solution you'd like.

No response

Describe alternatives you've considered

No response

Additional context

No response

spacewalkingninja commented 1 month ago

curerntly I use coinank api, but I am interested in using binance api directly, for example. I saw that your solution might be able to do so. If so, please confirm and maybe give some ideas :) Thanks!

oliver-zehentleitner commented 1 month ago

Hello @spacewalkingninja!

Yes, our software supports this :)

Order a trial license: https://shop.lucit.services/software/p/unicorn-binance-suite-test-license-7-days

Then run this script:

import asyncio
from unicorn_binance_websocket_api import BinanceWebSocketApiManager

async def main():
    async def process_asyncio_queue(stream_id=None):
        print(f"Start processing the data from stream '{ubwa.get_stream_label(stream_id)}':")
        while ubwa.is_stop_request(stream_id) is False:
            data = await ubwa.get_stream_data_from_asyncio_queue(stream_id)
            print(data)
            ubwa.asyncio_queue_task_done(stream_id)

    ubwa.create_stream(channels='!forceOrder',
                       markets='arr',
                       stream_label="forceOrder",
                       process_asyncio_queue=process_asyncio_queue)

    while not ubwa.is_manager_stopping():
        await asyncio.sleep(1)

with BinanceWebSocketApiManager(exchange='binance.com-futures') as ubwa:
    try:
        asyncio.run(main())
    except KeyboardInterrupt:
        print("\r\nGracefully stopping ...")
    except Exception as e:
        print(f"\r\nERROR: {e}\r\nGracefully stopping ...")
oliver-zehentleitner commented 1 month ago

I'm closing the issue, if you still have questions, please just ask!