Barchart Openfeed Example Client for Python
Project description
Openfeed SDK for Python
This SDK encapuslates the openfeed proto objects and faciliates client connections to openfeed servers.
Installation
pip install openfeed
Example Usage
import openfeed
# new client with credentials
of_client = openfeed.OpenfeedClient("username", "password")
# optional state handlers
of_client.on_error = lambda x: print("Error:", x)
of_client.on_connected = lambda x: print("Connected")
of_client.on_disconnected = lambda x: print("Disconnected")
# sub to markets by symbol
def on_message(msg):
print("Market Data: ", msg)
of_client.add_symbol_subscription("AAPL", callback=on_message)
# sub to markets by exchange
of_client.add_exchange_subscription("NYSE", callback=on_message)
Expected Output
of-client: Connected
of-client: Market Data: subscriptionResponse
of-client: Market Data: marketSnapshot
of-client: Market Data: marketUpdate
of-client: Market Data: marketUpdate
Known Issues
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
openfeed-1.0.1.tar.gz
(34.4 kB
view hashes)
Built Distribution
openfeed-1.0.1-py3-none-any.whl
(68.4 kB
view hashes)