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.10.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.10-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xnoapi-0.1.10.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.10.tar.gz
Algorithm Hash digest
SHA256 56187710a0e41c9ea4196a03799743ad58a9f29fdc22ef7e3d3afb60d8984eb8
MD5 b6ccae69bc4fd21f910d256600829c83
BLAKE2b-256 a36f36e1835abbb3cc63b0b26133cf41c2639139fb27d53c5251a8ad7a58308d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xnoapi-0.1.10-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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 678df2f788aa35d5357bd6a630e1d56f0798f76d4d78636be9d8b1f200033b9c
MD5 bc60bf4bbeb24ecdb96165f4d4cfc05a
BLAKE2b-256 66bcb299eccd5ba529ebf5aa5282d1815f9da12e97098672219583d5d23e1929

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