# Openfeed SDK for Python
This SDK encapuslates the openfeed proto objects and faciliates client connections to openfeed servers.
![Build](https://github.com/openfeed-org/sdk-python/workflows/PyPI%20and%20TestPyPI/badge.svg)
![PyPI](https://img.shields.io/pypi/v/openfeed?label=PyPI%20)
## 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
PyPI 官网下载 | openfeed-1.0.7.tar.gz
版权申诉
84 浏览量
2022-02-10
18:25:16
上传
评论
收藏 40KB GZ 举报
![avatar](https://profile-avatar.csdnimg.cn/277f6345dca0446498fbbc03843436aa_qq_38161040.jpg!1)
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
最新资源
- 数据库管理工具:dbeaver-ce-23.2.1-macos-aarch64.dmg
- 数据库管理工具:dbeaver-ce-23.2.0-stable.x86-64.rpm
- 全国大学生建模大赛题目.pdf
- 数据库管理工具:dbeaver-ce-23.2.0-macos-x86-64.dmg
- 数据库管理工具:dbeaver-ce-23.2.0-macos-aarch64.dmg
- 电机学运动控制课程基础知识-绪论部分
- Delphi 12 控件之HGetIt.zip
- 数据库管理工具:dbeaver-ce-23.1.5-x86-64-setup.exe
- ADS1256的stm32参考程序
- 数据库管理工具:dbeaver-ce-23.1.5-macos-x86-64.dmg
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)