Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

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()

Error Handling

The library provides a custom FugleAPIError exception for API-related errors, which includes detailed debugging information.

Catching API Errors

from fugle_marketdata import RestClient, FugleAPIError

client = RestClient(api_key='YOUR_API_KEY')

try:
    data = client.stock.intraday.quote(symbol="2330")
except FugleAPIError as e:
    # Access error details for debugging
    print(f"Error: {e.message}")
    print(f"URL: {e.url}")
    print(f"Status Code: {e.status_code}")
    print(f"Request Params: {e.params}")
    print(f"Response: {e.response_text}")

Error Attributes

The FugleAPIError exception provides the following attributes:

  • message: Error description
  • url: The API endpoint that was called
  • status_code: HTTP status code (if available)
  • params: Request parameters that were sent
  • response_text: Raw response text from the API (truncated to 200 chars)

Common Error Scenarios

HTTP Errors (4xx, 5xx):

try:
    data = client.stock.intraday.quote(symbol="INVALID_SYMBOL")
except FugleAPIError as e:
    if e.status_code == 404:
        print("Symbol not found")
    elif e.status_code >= 500:
        print("Server error, please try again later")

Network Errors:

try:
    data = client.stock.intraday.quote(symbol="2330")
except FugleAPIError as e:
    if e.status_code is None:
        print("Network error occurred")

License

MIT

Metadata

Release files for fugle-marketdata 2.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for fugle-marketdata 2.8.0
File Size Uploaded Provenance Actions
fugle_marketdata-2.8.0.tar.gz 12.0 kB Without provenance Details for fugle_marketdata-2.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fugle-marketdata 2.8.0
File Interpreter ABI Platform Actions
fugle_marketdata-2.8.0-py3-none-any.whl Python 3 none any Details for fugle_marketdata-2.8.0-py3-none-any.whl

Total release size: 30.3 kB

Release files / fugle_marketdata-2.8.0.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL fugle_marketdata-2.8.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
65cfe5bd28662890afe0a4b0162f1738190ba123b29a9f4719457cba26b5d677
BLAKE2b-256 checksum
How to use checksums
4b9284a9de552308f519f7c830e89ebf35f127d30c7da54714820a24ec8c03a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.14.8 Linux/6.17.0-1022-azure

Release files / fugle_marketdata-2.8.0-py3-none-any.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL fugle_marketdata-2.8.0-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cc8765fe1bfc34e62ebb7f9b59840583f23a12a243b283a17fba80994e81a9d
BLAKE2b-256 checksum
How to use checksums
9bc1a7eeb581e67ae7329fa29b2577304ec7e9c1c2bc98eb6fccc5236d6ca9e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.14.8 Linux/6.17.0-1022-azure

Security for fugle-marketdata 2.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 3.0.0rc14 7 files With provenance
  • Added 2.8.0 2 files Without provenance

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.8.0 This release

2 release files Loss of provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page