# Fugle MarketData
> Fugle MarketData API client library for Python
## Installation
```sh
$ pip install fugle-marketdata
```
## Importing
```py
from fugle_marketdata import WebSocketClient, RestClient
```
## Usage
The library is an isomorphic Python client that supports REST API and WebSocket.
### REST API
```py
client = RestClient(api_key = 'YOUR_API_KEY')
stock = client.stock # Stock REST API client
print(stock.intraday.quote(symbol="2330"))
```
### WebSocket API
```py
from fugle_marketdata import WebSocketClient, RestClient
def handle_message(message):
print(f'message: {message}')
def handle_connect():
print('connected')
def handle_disconnect(code, message):
print(f'disconnect: {code}, {message}')
def handle_error(error):
print(f'error: {error}')
def main():
client = WebSocketClient(api_key='YOUR_API_KEY')
stock = client.stock
stock.on("connect", handle_connect)
stock.on("message", handle_message)
stock.on("disconnect", handle_disconnect)
stock.on("error", handle_error)
stock.connect()
stock.subscribe({
"channel": 'trades',
"symbol": '2330'
})
if __name__ == "__main__":
main()
```
## License
[MIT](LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/fugle-dev/fugle-realtime-py#readme",
"name": "fugle-marketdata",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.7",
"maintainer_email": null,
"keywords": "fugle, realtime, stock",
"author": "Fortuna Intelligence Co., Ltd.",
"author_email": "development@fugle.tw",
"download_url": "https://files.pythonhosted.org/packages/e1/61/65961af410ca6616d372c7a00543df0c0d6ca584679fecc420edd8e0215a/fugle_marketdata-2.3.0.tar.gz",
"platform": null,
"description": "# Fugle MarketData\n\n> Fugle MarketData API client library for Python\n\n## Installation\n\n```sh\n$ pip install fugle-marketdata\n```\n\n## Importing\n\n```py\nfrom fugle_marketdata import WebSocketClient, RestClient\n\n```\n\n## Usage\n\nThe library is an isomorphic Python client that supports REST API and WebSocket.\n\n### REST API\n\n```py\n\nclient = RestClient(api_key = 'YOUR_API_KEY')\nstock = client.stock # Stock REST API client\nprint(stock.intraday.quote(symbol=\"2330\"))\n```\n\n### WebSocket API\n\n```py\nfrom fugle_marketdata import WebSocketClient, RestClient\n\n\ndef handle_message(message):\n print(f'message: {message}')\n\n\ndef handle_connect():\n print('connected')\n\n\ndef handle_disconnect(code, message):\n print(f'disconnect: {code}, {message}')\n\n\ndef handle_error(error):\n print(f'error: {error}')\n\n\ndef main():\n client = WebSocketClient(api_key='YOUR_API_KEY')\n stock = client.stock\n stock.on(\"connect\", handle_connect)\n stock.on(\"message\", handle_message)\n stock.on(\"disconnect\", handle_disconnect)\n stock.on(\"error\", handle_error)\n stock.connect()\n stock.subscribe({\n \"channel\": 'trades',\n \"symbol\": '2330'\n })\n\n\nif __name__ == \"__main__\":\n main()\n\n```\n\n## License\n\n[MIT](LICENSE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Fugle Realtime API 1.0 client library for Python",
"version": "2.3.0",
"project_urls": {
"Documentation": "https://developer.fugle.tw",
"Homepage": "https://github.com/fugle-dev/fugle-realtime-py#readme",
"Repository": "https://github.com/fugle-dev/fugle-realtime-py"
},
"split_keywords": [
"fugle",
" realtime",
" stock"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "13a96c325441395825ca748d75681f78b0b321c4612473717a3d150c9b0cc379",
"md5": "fce3a81e9355aad3e074d94a03446901",
"sha256": "0f50a135d67f31de8191f8ff0f2448e7499b1acf2176e39eac6493a60865237d"
},
"downloads": -1,
"filename": "fugle_marketdata-2.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fce3a81e9355aad3e074d94a03446901",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.7",
"size": 11499,
"upload_time": "2024-10-23T09:53:22",
"upload_time_iso_8601": "2024-10-23T09:53:22.149490Z",
"url": "https://files.pythonhosted.org/packages/13/a9/6c325441395825ca748d75681f78b0b321c4612473717a3d150c9b0cc379/fugle_marketdata-2.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e16165961af410ca6616d372c7a00543df0c0d6ca584679fecc420edd8e0215a",
"md5": "e487435992f1783ec4bde132d9e814a3",
"sha256": "a0462538d6852c210712cb685555593d6935089b0a8b208c190b3839abd0c06d"
},
"downloads": -1,
"filename": "fugle_marketdata-2.3.0.tar.gz",
"has_sig": false,
"md5_digest": "e487435992f1783ec4bde132d9e814a3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.7",
"size": 6082,
"upload_time": "2024-10-23T09:53:23",
"upload_time_iso_8601": "2024-10-23T09:53:23.398504Z",
"url": "https://files.pythonhosted.org/packages/e1/61/65961af410ca6616d372c7a00543df0c0d6ca584679fecc420edd8e0215a/fugle_marketdata-2.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-23 09:53:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fugle-dev",
"github_project": "fugle-realtime-py#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "fugle-marketdata"
}