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 git@github.com:yourusername/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:
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.stockslist_liquid_asset(): Retrieve a list of liquid stocks.get_hist(asset_name, frequency): Get historical data for a given asset.
xnoapi.vn.data.derivativesget_hist(): Get historical derivative data.
Metrics and Analytics
xnoapi.vn.metricsMetrics: 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xnoapi-0.1.9.tar.gz.
File metadata
- Download URL: xnoapi-0.1.9.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0574a56dc00d831f4841427e9525b6926e7b1ed88ae5c774c8df65df46ab0cc3
|
|
| MD5 |
c07fc7651ab88efd3e6c07a77c800717
|
|
| BLAKE2b-256 |
84beee6059f92428e459800471ecea197ecaa9775cc34cb183b0935cacc54465
|
File details
Details for the file xnoapi-0.1.9-py3-none-any.whl.
File metadata
- Download URL: xnoapi-0.1.9-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
352044d497835e23309f867227f9b2bffac55f63641d24a7482aad692b071d41
|
|
| MD5 |
76554c1b022ad3a1fa21d587b3287964
|
|
| BLAKE2b-256 |
548eb09913f541e4763ee160b5a88c2754ab2eec51b5b9753fdfb8145de305ac
|