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

Built distribution (wheel)

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

Total release size: 30.2 kB

Release files / fugle_marketdata-2.7.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.7.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6083cf939bea04bd70580902c9b38164530f3f06cc03f791d45a9cabe081cc96
BLAKE2b-256 checksum
How to use checksums
83fc990d833adfcf7ea0287eed8d90ca61c1c643b189c05cbdcb2f04769bf326
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.7.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.7.0-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92973f36ca66046340d2ff231e34b36c39ea9db3db8a22933b57672b6a2268b0
BLAKE2b-256 checksum
How to use checksums
336f92b2c71d23cb37da629f9dc83b5a04607158ee327306142c6823b9bc036e
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.7.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.0rc9 7 files With provenance
  • Added 2.7.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.7.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