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 candles

from tradelab.candles import renko, heikin_ashi

from tradelab.candles import *

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.2.tar.gz (30.5 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.2-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tradelab-0.1.2.tar.gz
  • Upload date:
  • Size: 30.5 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.2.tar.gz
Algorithm Hash digest
SHA256 6bbb051ff4bd2f4142a3a3a894ff5835b96d0d812ef06d2f330bdbe66e84b041
MD5 d9c8030ab75dc0ca48624720837b0dca
BLAKE2b-256 b3030fb60ca625c848b427294769639f4de5bc417fa7f1b091b2b0ffd2c4cc37

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tradelab-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9da02a3950502854c71133dc28d834c459111cb8fab661979682dd8cbeabec44
MD5 5a64b62c1063a9a2d32a6b6db0b35552
BLAKE2b-256 1a6ce61a709337b694cfaeb466174bc1059355d371bd6a90134ef926c887d3ce

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