Skip to main content

A simple and powerful Python package for algorithmic trading and technical analysis. Calculate technical indicators and analyze market data with ease.

Project description

TradeLab

A simple and powerful Python package for algorithmic trading and technical analysis. Calculate technical indicators and analyze market data with ease.

What Does It Do?

TradeLab helps you:

  • Calculate technical indicators (moving averages, RSI, SuperTrend, etc.)
  • Compare different stocks or assets
  • Analyze market data without complex coding

Quick Start

Installation

pip install tradelab

Basic Usage

import pandas as pd

from tradelab.indicators import rsi, ema, supertrend


# Load your stock data (CSV file with columns: date, open, high, low, close, volume)

data = pd.read_csv('your_stock_data.csv')


# Calculate indicators

rsi_values =rsi(data,period=14)

moving_average =ema(data,period=20)

trend_data =supertrend(data,period=10,multiplier=3.0)


print(f"Current RSI: {rsi_values.iloc[-1]:.2f}")

print(f"Current EMA: {moving_average.iloc[-1]:.2f}")

Available Indicators

Trend Indicators

-EMA - Exponential Moving Average

-SuperTrend - Trend following indicator

-Normalized T3 - Smoothed trend oscillator

Momentum Indicators

-RSI - Relative Strength Index (0-100 scale)

-ADX - Average Directional Index

Volatility Indicators

-ATR - Average True Range

Comparative Indicators

-Relative Strength - Compare two stocks or assets

Examples

Calculate RSI values

from tradelab.indicators import rsi


# Calculate RSI

rsi_values =rsi(data,period=14)

print(f"Current RSI: {rsi_values.iloc[-1]:.2f}")


# Check if overbought (>70) or oversold (<30)

if rsi_values.iloc[-1]>70:

    print("Potentially overbought")

elif rsi_values.iloc[-1]<30:

    print("Potentially oversold")

Compare two stocks

from tradelab.indicators import relative_strength


# Compare Apple vs S&P 500

apple_data = pd.read_csv('AAPL.csv')

spy_data = pd.read_csv('SPY.csv')


comparison =relative_strength(apple_data, spy_data)

print(f"Apple vs S&P 500 strength: {comparison['relative_strength'].iloc[-1]:.4f}")

Calculate multiple indicators

from tradelab.indicators import rsi, ema, atr


# Calculate multiple indicators at once

rsi_14 =rsi(data,period=14)

ema_20 =ema(data,period=20)

volatility =atr(data,period=14)


print(f"RSI(14): {rsi_14.iloc[-1]:.2f}")

print(f"EMA(20): {ema_20.iloc[-1]:.2f}")

print(f"ATR(14): {volatility.iloc[-1]:.2f}")

Data Format

Your data should be a pandas DataFrame with these columns:

-date (optional, can be index)

-open - Opening price

-high - Highest price

-low - Lowest price

-close - Closing price

-volume - Trading volume

Example:

date,open,high,low,close,volume

2024-01-01,150.00,152.50,149.00,151.25,1000000

2024-01-02,151.30,153.00,150.50,152.75,1200000

Import Options

You can import indicators in different ways:

# Import everything

from tradelab.indicators import*


# Import specific indicators

from tradelab.indicators import rsi, ema


# Import by category

from tradelab.indicators.momentum import rsi

from tradelab.indicators.trend import ema

Requirements

  • Python 3.8+
  • pandas
  • numpy
  • ta-lib
  • fixedta

Contributing

We welcome contributions! Feel free to:

  • Report bugs
  • Suggest new indicators
  • Submit pull requests
  • Improve documentation

License

MIT License - feel free to use in your projects.

Support

If you find this package helpful, please give it a star ⭐ on GitHub!


Disclaimer: This package is for educational and research purposes. Always do your own research before making investment decisions.

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

tradelab-0.1.0.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

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

tradelab-0.1.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file tradelab-0.1.0.tar.gz.

File metadata

  • Download URL: tradelab-0.1.0.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for tradelab-0.1.0.tar.gz
Algorithm Hash digest
SHA256 44c264234b3ef0fcfbd470c52a8a21646748154b2f2733b57bb3dd795a1a0d8f
MD5 b1caac2c27f4f22df27d7e64c5cafa32
BLAKE2b-256 b98020099bbc16df0fb5341872ff2bf51c9f7cf220ec9ef4ecbef75d8d739f25

See more details on using hashes here.

File details

Details for the file tradelab-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tradelab-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for tradelab-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f9ffa79639ea0404115fad8ff9cbdec5b59176d4bb070e7ee5ff5e188cb9e18
MD5 7b06906e2fd5b9ac31f4f1636774c792
BLAKE2b-256 b8630bcd3d8014e0f5c5a4bbc2f45bf4f3ea3a5eed4f8e14f39442bdd9bbcaf9

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