Skip to content

equibles/websockets-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Equibles WebSockets live quotes for Python

Requirements.

Python 3.4+

Installation & Usage

pip install

pip install git+https://github.com/equibles/websockets-python.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/equibles/cryptos-python.git)

Then import the package:

import equibles_websockets 

Getting Started

Please follow the installation procedure and then run the following:

from equibles_websockets import EquiblesWebSocketsClient, endpoints, Quote

# Create a websockets client. Replace the string "MY_API_KEY" with your own API key. 
# Use the "tickers" argument to choose the tickers you want to listen to. You can listen to as many as you want. 
client = EquiblesWebSocketsClient(api_key="MY_API_KEY", endpoint=endpoints.CRYPTOS, tickers=["BTC", "ETH"], debug=False)
client.connect()

def do_stuff(quote: Quote):
    print(quote.ticker + ": " + str(quote.price))

client.on_quote(do_stuff)

input("Press enter to exit: ")
print("Exited.")

Author

Equibles
equibles@gmail.com