# Fugle Realtime
[![PyPI version][pypi-image]][pypi-url]
[![Python version][python-image]][python-url]
[![Build Status][action-image]][action-url]
> Fugle Realtime API client library for Python
## Install
```sh
$ pip install fugle-realtime
```
## Usage
The library a Python client that supports HTTP API and WebSocket.
### HTTP API
```py
from fugle_realtime import HttpClient
api_client = HttpClient(api_token='demo')
```
#### intraday.meta
```py
api_client.intraday.meta(symbolId='2884')
```
#### intraday.quote
```py
api_client.intraday.quote(symbolId='2884')
```
#### intraday.chart
```py
api_client.intraday.chart(symbolId='2884')
```
#### intraday.dealts
```py
api_client.intraday.dealts(symbolId='2884', limit=50)
```
#### intraday.volumes
```py
api_client.intraday.volumes(symbolId='2884')
```
#### historical.candles
```py
api_client.historical.candles('2884', '2022-02-07', '2022-02-11', None)
api_client.historical.candles('2884', None, None, 'open,high,low,close,volume,turnover,change')
```
### Simple WebSocket Demo
```py
import time
from fugle_realtime import WebSocketClient
def handle_message(message):
print(message)
def main():
ws_client = WebSocketClient(api_token='demo')
ws = ws_client.intraday.quote(symbolId='2884', on_message=handle_message)
ws.run_async()
time.sleep(3)
ws.close()
if __name__ == '__main__':
main()
```
## Reference
[Fugle Realtime API](https://developer.fugle.tw)
## License
[MIT](LICENSE)
[pypi-image]: https://img.shields.io/pypi/v/fugle-realtime
[pypi-url]: https://pypi.org/project/fugle-realtime
[python-image]: https://img.shields.io/pypi/pyversions/fugle-realtime
[python-url]: https://pypi.org/project/fugle-realtime
[action-image]: https://img.shields.io/github/actions/workflow/status/fugle-dev/fugle-realtime-python/pytest.yml?branch=master
[action-url]: https://github.com/fugle-dev/fugle-realtime-py/actions/workflows/pytest.yml
Raw data
{
"_id": null,
"home_page": "https://github.com/fugle-dev/fugle-realtime-py#readme",
"name": "fugle-realtime",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "fugle,realtime,stock",
"author": "Fortuna Intelligence Co., Ltd.",
"author_email": "development@fugle.tw",
"download_url": "https://files.pythonhosted.org/packages/d1/c3/be88dd9966be7b4c51e5579fb6711d2747aaa58f1629124727389d21556a/fugle-realtime-0.4.1.tar.gz",
"platform": null,
"description": "# Fugle Realtime\n\n[![PyPI version][pypi-image]][pypi-url]\n[![Python version][python-image]][python-url]\n[![Build Status][action-image]][action-url]\n\n> Fugle Realtime API client library for Python\n\n## Install\n\n```sh\n$ pip install fugle-realtime\n```\n\n## Usage\n\nThe library a Python client that supports HTTP API and WebSocket.\n\n### HTTP API\n\n```py\nfrom fugle_realtime import HttpClient\n\napi_client = HttpClient(api_token='demo')\n```\n\n#### intraday.meta\n\n```py\napi_client.intraday.meta(symbolId='2884')\n```\n\n#### intraday.quote\n\n```py\napi_client.intraday.quote(symbolId='2884')\n```\n\n#### intraday.chart\n\n```py\napi_client.intraday.chart(symbolId='2884')\n```\n\n#### intraday.dealts\n\n```py\napi_client.intraday.dealts(symbolId='2884', limit=50)\n```\n\n#### intraday.volumes\n\n```py\napi_client.intraday.volumes(symbolId='2884')\n```\n\n#### historical.candles\n\n```py\napi_client.historical.candles('2884', '2022-02-07', '2022-02-11', None)\napi_client.historical.candles('2884', None, None, 'open,high,low,close,volume,turnover,change')\n```\n\n### Simple WebSocket Demo\n\n```py\nimport time\nfrom fugle_realtime import WebSocketClient\n\ndef handle_message(message):\n print(message)\n\ndef main():\n ws_client = WebSocketClient(api_token='demo')\n ws = ws_client.intraday.quote(symbolId='2884', on_message=handle_message)\n ws.run_async()\n time.sleep(3)\n ws.close()\n\nif __name__ == '__main__':\n main()\n```\n\n## Reference\n\n[Fugle Realtime API](https://developer.fugle.tw)\n\n## License\n\n[MIT](LICENSE)\n\n[pypi-image]: https://img.shields.io/pypi/v/fugle-realtime\n[pypi-url]: https://pypi.org/project/fugle-realtime\n[python-image]: https://img.shields.io/pypi/pyversions/fugle-realtime\n[python-url]: https://pypi.org/project/fugle-realtime\n[action-image]: https://img.shields.io/github/actions/workflow/status/fugle-dev/fugle-realtime-python/pytest.yml?branch=master\n[action-url]: https://github.com/fugle-dev/fugle-realtime-py/actions/workflows/pytest.yml\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Fugle Realtime API client library for Python",
"version": "0.4.1",
"split_keywords": [
"fugle",
"realtime",
"stock"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d392d4be38604c7cceb8882cd9547bd2",
"sha256": "657dd7808e42863b3574ad4ff77f00efd04a46c834dd5b7bc7bad90af46cba06"
},
"downloads": -1,
"filename": "fugle_realtime-0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d392d4be38604c7cceb8882cd9547bd2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 6877,
"upload_time": "2022-12-26T02:33:24",
"upload_time_iso_8601": "2022-12-26T02:33:24.815041Z",
"url": "https://files.pythonhosted.org/packages/a5/af/ea24f9d9a4d855754f93fcc2185af42fc7925d93f1c93f83f3ec6d44a56c/fugle_realtime-0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "0b78ca07c5b4f03e9b50b737cb015015",
"sha256": "fe15ef5fc974a7ac13b4b2c5b566ce6be8de4e80f5e756f3450143a929d8ffda"
},
"downloads": -1,
"filename": "fugle-realtime-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "0b78ca07c5b4f03e9b50b737cb015015",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 4774,
"upload_time": "2022-12-26T02:33:23",
"upload_time_iso_8601": "2022-12-26T02:33:23.181495Z",
"url": "https://files.pythonhosted.org/packages/d1/c3/be88dd9966be7b4c51e5579fb6711d2747aaa58f1629124727389d21556a/fugle-realtime-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-26 02:33:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "fugle-dev",
"github_project": "fugle-realtime-py#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "fugle-realtime"
}