Metadata-Version: 2.1
Name: openfeed
Version: 1.0.4
Summary: Barchart Openfeed Example Client for Python
Home-page: https://github.com/openfeed-org/sdk-python
Author: Barchart
Author-email: mike@barchart.com
License: MIT
Download-URL: https://github.com/openfeed-org/sdk-python/archive/master.zip
Platform: UNKNOWN
Description-Content-Type: text/markdown
Requires-Dist: websocket-client (>=0.40.0)
Requires-Dist: protobuf
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: python-dateutil (>=2.7.5) ; extra == 'test'

# Openfeed SDK for Python

This SDK encapuslates the openfeed proto objects and faciliates client connections to openfeed servers.

![PyPI and TestPyPI](https://github.com/openfeed-org/sdk-python/workflows/PyPI%20and%20TestPyPI/badge.svg)

## Installation

```
pip install openfeed
```

## Example Usage

```python
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)

of_client.start()
```

### Expected Output

```log
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

* https://github.com/protocolbuffers/protobuf/issues/1491


