Skip to main content

Library for analyzing financial data using ML and classical approaches

Project description


AlphaAnalysis — is a library for analyzing financial indicators, which includes classical data analysis methods and machine learning. The project is intended for use in financial markets and can be useful for analysis, forecasting and optimization of trading strategies, as well as for portfolio management.

Module Description

1. data

Module for data loading, cleaning and preprocessing. This includes functions for extracting data from various sources, cleaning and transforming data, and creating new attributes for further analysis.

2. visualization

A module for visualizing financial data, including plotting time series, correlations and technical indicators such as moving averages and Bollinger Bands.

3. models

This module includes various models for analyzing financial data, both classical (e.g. ARIMA, GARCH, VAR) and modern machine learning models (Random Forest, XGBoost, CatBoost), as well as deep neural networks (LSTM, GRU, Transformer) for trading.

4. trading

Module for algorithmic trading. Includes functionality for backtesting trading strategies and risk management.

5. portfolio

Module for investment portfolio management. Includes tools for portfolio optimization (MPT, Black-Litterman), risk assessment (VaR, CVaR) and asset clustering.

6. signal_generation

Module for generating trading signals. Includes analysis of news and social networks (sentiment analysis), creation of technical signals and fundamental analysis.

Installation

Use pip to install the library:

pip install alpha_analysis

Or follow these steps:

  1. Clone the repository:
git clone https://github.com/ImplicitLayer/AlphaAnalysis.git
cd alpha_analysis
  1. Install the dependencies:
pip install -r requirements.txt
  1. For installing the library in your development environment, use:
pip install -e .

Examples of use

Example of use for time series forecasting:

from alpha_analysis.models import classical_models
from alpha_analysis.data import data_loader

# load data
data = data_loader.load_from_csv('historical_stock_data.csv')

# using ARIMA model
classical_models = classical_models.ClassicalModels()

forecast, summary = classical_models.arima_model(data, 'price', order=(5, 1, 0))
print("ARIMA Model Summary:")
print(summary)

The example of asset clustering:

from alpha_analysis.portfolio.clustering import PortfolioClustering
import numpy as np
import pandas as pd

np.random.seed(42)
assets = ['AAPL', 'GOOGL', 'MSFT', 'AMZN', 'TSLA', 'NFLX', 'NVDA', 'JPM', 'XOM', 'META']
num_assets = len(assets)
num_days = 252

# profit simulation
simulated_returns = pd.DataFrame(np.random.randn(num_days, num_assets) / 100, columns=assets)

clustering = PortfolioClustering(simulated_returns)

# K-Means
kmeans_result = clustering.kmeans_clustering(num_clusters=3)
print("K-Means Clustering:")
print(kmeans_result)

Future plans

We are actively developing AlphaAnalysis and plan to add:

  • Generative models (GANs) to simulate market data
  • Customisable trading strategies via custom scripts
  • Reinforcement learning
  • More complex modelling methods

If you have suggestions, open an issue in the repository!

Contacts

We can be contacted by:

📩 Email: burenok023@gmail.com

🔗 Telegram: @artemburenok

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

alpha_analysis-1.1.2.tar.gz (23.6 kB view details)

Uploaded Source

File details

Details for the file alpha_analysis-1.1.2.tar.gz.

File metadata

  • Download URL: alpha_analysis-1.1.2.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for alpha_analysis-1.1.2.tar.gz
Algorithm Hash digest
SHA256 ffd17a3701dee82fcf0242bccdaa1d42f3a1f4bbab2f97d9bef48ca698602184
MD5 772ce384078c49265516de2cf4933e5c
BLAKE2b-256 284d72e4751be18770e0faf46341240f71c6acbeeed661fd4ab9875a7f29e77f

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