Skip to main content

XNO API Library for Financial Data

Project description

XNO API Library

XNO API is a Python package for retrieving financial data from multiple sources with a simple and intuitive interface.

Contents

Installation

You can install the XNO API package using pip:

pip install xnoapi

Alternatively, you can clone this repository and install the package manually:

$ git clone https://github.com/xnoproject/xnoapi.git
$ pip install ./xnoapi

After installation, you can import and start using XNO API:

from xnoapi import client
from xnoapi.vn.data import stocks, derivatives
from xnoapi.vn.metrics import Metrics, Backtest_Derivates

client(apikey="your_api_key")

Documentation

Full documentation is available online:

Documentation Status

A PDF version of the documentation is available here.

Usage

XNO API provides a structured interface for retrieving financial data:

from xnoapi import client
from xnoapi.vn.data import stocks, derivatives

client(apikey="your_api_key")

# Retrieve list of liquid assets
stocks.list_liquid_asset()

# Get historical stock data
stocks.get_hist("VIC", "1D")

#Get historical derivatives
derivatives.get_hist("VN30F1M", "1m")

Available Modules

XNO API includes the following modules:

Financial Data

  • xnoapi.vn.data.stocks
    • list_liquid_asset(): Retrieve a list of liquid stocks.
    • get_hist(asset_name, frequency): Get historical data for a given asset.
  • xnoapi.vn.data.derivatives
    • get_hist(): Get historical derivative data.

Metrics and Analytics

  • xnoapi.vn.metrics
    • Metrics: Various financial metrics calculation.
    • Backtest_Derivates: Backtesting tools for derivatives.

Examples

Retrieving Stock Data

from xnoapi import client
from xnoapi.vn.data import stocks

client(apikey="your_api_key")

# Get list of liquid assets
liquid_assets = stocks.list_liquid_asset()

# Get historical data for VIC stock
vic_history = stocks.get_hist("VIC", "1D")

Using Metrics

from xnoapi.vn.metrics import Metrics, Backtest_Derivates
from xnoapi.vn.data import derivatives

def gen_position(df):
    """
    Position generation strategy: Volume change detection
    """
    return df.assign(
        position=np.sign(df["Close"] - df["Close"].rolling(window=20).median())
    )

# Initialize metrics instance
historical = derivatives.get_hist("VN30F1M", "1m")
position = gen_position(historical)
backtest = Backtest_Derivates(position, "raw") # raw or after_fees
metrics = Metrics(backtest)

# Example usage
result = metrics.avg_loss()

Credits

This library is developed and maintained by the XNO API team. Special thanks to contributors and financial data providers for their support.

License

This library is licensed under the MIT License. See LICENSE for more details.

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

xnoapi-0.1.13.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xnoapi-0.1.13-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file xnoapi-0.1.13.tar.gz.

File metadata

  • Download URL: xnoapi-0.1.13.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for xnoapi-0.1.13.tar.gz
Algorithm Hash digest
SHA256 c243d44ee87eba0c2188e791fb20aec7d39b9b1d34d47e2b844c1ad2332f7aa7
MD5 adb8c0c5fa5ebca6a1935c40318a8801
BLAKE2b-256 bc31a136c1f1570d8fdb7b6204013e8127337256d428b3d0db943910f0ac4552

See more details on using hashes here.

File details

Details for the file xnoapi-0.1.13-py3-none-any.whl.

File metadata

  • Download URL: xnoapi-0.1.13-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for xnoapi-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 54730c859e0a2db0be2bd84fedbc18aa359876457c881ad362ee5c05444f91ad
MD5 3c872e9a1757d41839e8fe8bbaa6c1bc
BLAKE2b-256 09bf6eb95dbe317b826d3ebbaf563a2b222258668df7979f710f6c7deeaa857a

See more details on using hashes here.

Supported by

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