GithubHelp home page GithubHelp logo

kmilodenisglez / hitbtc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crypto-toolbox/hitbtc

0.0 0.0 0.0 456 KB

HitBTC Websocket API 2.0 Client written in Python 3

License: MIT License

Python 100.00%

hitbtc's Introduction

hitbtc

HitBTC Websocket API 2.0 Client written in Python 3.

This client is a fork, we have replaced the use of some libraries to get performance improvements:

Replaced libraries

The client supplies data both visually via console, as well as python objects via its HitBTC.recv(). It's important to note that this does not receive data from the API directly - instead, the data is pulled from a queue.Queue object, which defaults to a length of 100 items. So only the last 100 messages will be cached - either make sure you process the messages fast enough, or increas the length of the queue (can be done by passing the q_maxsize kwarg on instantiation).

By default, data is unpacked - that means you will never see the raw JSONRPC message (this, too, can be turned off by passing raw=True upon initialization). This will, however, also turn off all handling of error messages etc.

For an in-depth description of the client and its methods, please see the documenation at readthedocs.org

Installation

Stable: pip install hitbtc Release Candidate: pip install --pre hitbtc

Example Usage

import time
import queue
from hitbtc import HitBTC
c = HitBTC()
c.start()  # start the websocket connection
time.sleep(2)  # Give the socket some time to connect
c.subscribe_ticker(symbol='ETHBTC') # Subscribe to ticker data for the pair ETHBTC

while True:
    try:
        data = c.recv()
    except queue.Empty:
        continue

    # process data from websocket
    ...

c.stop()

hitbtc's People

Contributors

petros-double-test1 avatar samjosephmark avatar kmilodenisglez avatar

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.