Coder Social home page Coder Social logo

tferreira / topbid Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 3.0 45 KB

Helper library to fetch current best bid/ask from crypto exchanges orderbook APIs

Home Page: https://pypi.org/project/topbid

License: MIT License

Makefile 3.96% Python 96.04%
binance cryptocurrency kucoin orderbook bitcoin crypto exchange okx python trading bybit kraken gateio

topbid's Introduction

topbid

Python 3.8 Code style: black

Helper library to fetch and store current orderbook top bid/ask price and volume from crypto exchanges APIs. Currently supports Binance, Bybit, Gateio, Kraken, Kucoin and OKX.

Requires Python 3.8+

Installation

pip install topbid

Usage

>>> from topbid.orderbook import OrderBook

# Instanciate OrderBook.
>>> orderbook = OrderBook()

# Add one or more market pairs to be fetched from an exchange REST API.
>>> orderbook.add("binance", "BTC/USDT")
>>> orderbook.add("kucoin", ["BTC/USDT", "ETH/USDT"])

# Start the background thread fetching prices and volume (here, every 2 seconds).
>>> orderbook.start(update_every=2)

# Retrieve the highest bid on the orderbook.
>>> orderbook.get_orderbook_top_bid("binance", "BTC/USDT")
(23130.41, 0.0584)

# Retrieve the lowest ask on the orderbook.
>>> orderbook.get_orderbook_top_ask("binance", "BTC/USDT")
(23130.43, 0.0214)

# Removes a pair from being fetched.
>>> orderbook.delete("binance", "BTC/USDT")

# Stop the background thread and removes all watched pairs.
# It must be called before exiting your own application.
>>> orderbook.stop()

topbid's People

Contributors

tferreira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gorilik324

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.