Code Monkey home page Code Monkey logo

bittrex-ws-v3's Introduction

logo bittrex-websocket-aio

pypi-v pypi-pyversions pypi-l pypi-wheel

What is bittrex-websocket-aio?

Python Bittrex WebSocket (PBW) is the first unofficial Python wrapper for the Bittrex Websocket API. It provides users with a simple and easy to use interface to the Bittrex Exchange.

Users can use it to access real-time public data (e.g exchange status, summary ticks and order fills) and account-level data such as order and balance status. The goal of the package is to serve as a foundation block which users can use to build upon their applications. Examples usages can include maintaining live order books, recording trade history, analysing order flow and many more.

The version is built upon asyncio which is Python's standard asynchronous I/O framework.


Documentation

http://python-bittrex-websocket-docs.readthedocs.io/en/latest/

Getting started/How-to

http://python-bittrex-websocket-docs.readthedocs.io/en/latest/howto.html

Methods

http://python-bittrex-websocket-docs.readthedocs.io/en/latest/methods.html

Changelog

http://python-bittrex-websocket-docs.readthedocs.io/en/latest/changelog.html#bittrex-websocket-aio

I am constantly working on new features. Make sure you stay up to date by regularly checking the official docs!

Having an issue or a question? Found a bug or perhaps you want to contribute? Open an issue!

Quick Start

pip install git+https://github.com/r3bers/bittrex-ws-v3
#!/usr/bin/python
# /examples/ticker_updates.py

# Sample script showing how subscribe_to_exchange_deltas() works.

# Overview:
# ---------
# 1) Creates a custom ticker_updates_container dict.
# 2) Subscribes to N tickers and starts receiving market data.
# 3) When information is received, checks if the ticker is
#    in ticker_updates_container and adds it if not.
# 4) Disconnects when it has data information for each ticker.

from bittrex_websocket.websocket_client import BittrexSocket
from time import sleep

def main():
    class MySocket(BittrexSocket):

        async def on_public(self, msg):
            name = msg['M']
            if name not in ticker_updates_container:
                ticker_updates_container[name] = msg
                print('Just received market update for {}.'.format(name))

    # Create container
    ticker_updates_container = {}
    # Create the socket instance
    ws = MySocket()
    # Enable logging
    ws.enable_log()
    # Define tickers
    tickers = ['BTC-ETH', 'BTC-NEO', 'BTC-ZEC', 'ETH-NEO', 'ETH-ZEC']
    # Subscribe to ticker information
    for ticker in tickers:
        sleep(0.01)
        ws.subscribe_to_exchange_deltas([ticker])

    # Users can also subscribe without introducing delays during invoking but
    # it is the recommended way when you are subscribing to a large list of tickers.
    # ws.subscribe_to_exchange_deltas(tickers)

    while len(ticker_updates_container) < len(tickers):
        sleep(1)
    else:
        print('We have received updates for all tickers. Closing...')
        ws.disconnect()
        sleep(10)

if __name__ == "__main__":
    main()

Disclaimer

I am not associated with Bittrex. Use the library at your own risk, I don't bear any responsibility if you end up losing your money.

bittrex-ws-v3's People

Contributors

r3bers avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

jfontestad

bittrex-ws-v3's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.