Skip to main content
Loss of provenance

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

Pre-release

This release is a pre-release and may not be stable for production use.

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.0rc1

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.0rc1
File Size Uploaded Provenance Actions
fugle_marketdata-2.8.0rc1.tar.gz 12.0 kB Without provenance Details for fugle_marketdata-2.8.0rc1.tar.gz

Built distribution (wheel)

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

Total release size: 30.3 kB

Release files / fugle_marketdata-2.8.0rc1.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.0rc1.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c41914f690baaa3d430857a8c0ec0a335cd9316e6e52532a3e63d187a45e7d31
BLAKE2b-256 checksum
How to use checksums
e60899e113285dcdb99895de112a004570879b3c066d9aa9aefdeafcb3f66bcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.14.7 Linux/6.17.0-1022-azure

Release files / fugle_marketdata-2.8.0rc1-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.0rc1-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d54345553daadc5fa6cb2dbe5f7fadbfb09ef5e5c6b0f23f77da68dae83e1cb5
BLAKE2b-256 checksum
How to use checksums
d4051a35ce104cd85b6b9c4511809e986f7b1a3bf8b4658ced51630ecb1fcd4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.14.7 Linux/6.17.0-1022-azure

Security for fugle-marketdata 2.8.0rc1

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.0rc12 7 files With provenance
  • Added 2.8.0rc1 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
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