Metadata-Version: 2.1
Name: fugle-realtime
Version: 0.4.1
Summary: Fugle Realtime API client library for Python
Home-page: https://github.com/fugle-dev/fugle-realtime-py#readme
License: MIT
Keywords: fugle,realtime,stock
Author: Fortuna Intelligence Co., Ltd.
Author-email: development@fugle.tw
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: requests (>=2.26.0,<3.0.0)
Requires-Dist: websocket-client (>=1.2.1,<2.0.0)
Project-URL: Documentation, https://developer.fugle.tw
Project-URL: Repository, https://github.com/fugle-dev/fugle-realtime-py
Description-Content-Type: text/markdown

# 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

