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, create alternative candle charts, and analyze market data with ease.

What Does It Do?

TradeLab helps you:

  • Calculate technical indicators (moving averages, RSI, SuperTrend, etc.)
  • Create alternative candle charts (Heikin Ashi, Renko)
  • 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

Available Candles

Alternative Chart Types

  • Heikin Ashi - Smoothed candlesticks for clearer trend visualization
  • Renko - Price movement based boxes that filter out time and minor price movements

Examples

Calculate Heikin Ashi candles

from tradelab.candles import heikin_ashi

# Transform regular OHLC data to Heikin Ashi
ha_data = heikin_ashi(data)
print("Heikin Ashi data:")
print(ha_data.tail())

Calculate Renko charts

from tradelab.candles import renko

# Create Renko bricks with fixed brick size
renko_data = renko(data, brick_size=25, mode='normal')
print("Renko bricks:")
print(renko_data.tail())

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.1.tar.gz (29.0 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.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tradelab-0.1.1.tar.gz
  • Upload date:
  • Size: 29.0 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.1.tar.gz
Algorithm Hash digest
SHA256 c66053cd3ee114e1d0b0b302e02b037d99c92c86f304088f1d1518bd0ee06e99
MD5 8e96974fa5937ffe51cce94772e40da7
BLAKE2b-256 aafa5e67f9590d468063ec0a031ba2cf00c198c3d46e1ed1e41cdc71dc06d751

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tradelab-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ff1a121ab7ab0e71d26debf45a0227eef80283e615c2442ea511b10e03217e14
MD5 256263774cf2acd5c7e8f79222af91fc
BLAKE2b-256 3a67d0ebedd7033f95252d5f7363bfbae77f03d763ded1cf8e9ff275bc50f1f6

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