Skip to main content

Fugle Realtime API 1.0 client library for Python

Project description

Fugle MarketData

Fugle MarketData API client library for Python

Installation

$ pip install fugle-marketdata

Importing

from fugle_marketdata import WebSocketClient, RestClient

Usage

The library is an isomorphic Python client that supports REST API and WebSocket.

REST API

client = RestClient(api_key = 'YOUR_API_KEY')
stock = client.stock  # Stock REST API client
print(stock.intraday.quote(symbol="2330"))

WebSocket API

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fugle_marketdata-2.3.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

fugle_marketdata-2.3.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file fugle_marketdata-2.3.0.tar.gz.

File metadata

  • Download URL: fugle_marketdata-2.3.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for fugle_marketdata-2.3.0.tar.gz
Algorithm Hash digest
SHA256 a0462538d6852c210712cb685555593d6935089b0a8b208c190b3839abd0c06d
MD5 e487435992f1783ec4bde132d9e814a3
BLAKE2b-256 e16165961af410ca6616d372c7a00543df0c0d6ca584679fecc420edd8e0215a

See more details on using hashes here.

File details

Details for the file fugle_marketdata-2.3.0-py3-none-any.whl.

File metadata

  • Download URL: fugle_marketdata-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for fugle_marketdata-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f50a135d67f31de8191f8ff0f2448e7499b1acf2176e39eac6493a60865237d
MD5 fce3a81e9355aad3e074d94a03446901
BLAKE2b-256 13a96c325441395825ca748d75681f78b0b321c4612473717a3d150c9b0cc379

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page