TSMarbell Python Library

A comprehensive Python library for interacting with TSMarbell AI trading indicators, visualizing data, and performing rigorous statistical analysis. Built for quantitative researchers.

Key Features

Everything you need to build, test, and deploy quantitative models.

Python SDK
๐Ÿค–

AI Indicators

Access to BTC/ETH Slope (Trend), Break-Up, and Break-Down probabilities with multiple horizons.

๐Ÿ“Š

Data Management

Easy fetching and combining of multiple indicators into a single Pandas DataFrame.

๐Ÿ“ˆ

Visualization

Interactive Plotly charts for all indicators with customizable styling.

๐Ÿงช

Statistical Validation

Built-in suite of tests to prove strategy significance with p-values and confidence intervals.

โšก

Backtesting

Integration with vectorbt for fast portfolio simulation and performance analysis.

๐Ÿ”ง

Easy Integration

Simple API design that integrates seamlessly with your existing Python workflow.

Installation

01

Clone the repository

TERMINAL
git clone https://github.com/MarbellHosting/tsmarbell.git
cd tsmarbell
02

Install dependencies

TERMINAL
pip install -r requirements.txt

Usage Examples

Jumpstart your development with these boilerplate examples.

1. Fetching & Visualizing Indicators

Visualization
EXAMPLE.PY
from tsbarbell import (
    TSBarbellClient,
    plot_slope_probability,
    plot_break_up_probability
)

# Initialize the client
client = TSBarbellClient(api_key='YOUR_API_KEY')

# Fetch BTC Slope Probability (Trend)
slope_data = client.btc_slope.get_all_horizons(limit=1000)
plot_slope_probability(slope_data).show()

# Fetch BTC Break-Up Probability (Volatility)
break_up_data = client.btc_break_up.get_all_horizons(limit=1000)
plot_break_up_probability(break_up_data).show()

# Fetch Combined Data for Backtesting
df = client.get_combined_data([
    ('btc_slope', 4),
    ('btc_break_up', 1)
], limit=2000)

2. Statistical Analysis & Backtesting

Quantitative Analysis

Validate your strategies using professional statistical tests including Monte Carlo, Bootstrap, and Walk-Forward validations.

BACKTEST.PY
from tsbarbell import StatisticalTests, run_backtest, plot_statistical_analysis

# Define your entry and exit signals based on indicators
entry_signal = (df['slope_4h'] > 0.9) & (df['break_up_24h'] > 0.65)
exit_signal = (df['slope_4h'] < 0.5) | (df['break_up_24h'] < 0.35)

# Run Backtest
portfolio = run_backtest(df['close'], entry_signal, exit_signal)

# Run Statistical Tests
mc_result = StatisticalTests.monte_carlo_test(
    close_price=df['close'],
    actual_return=portfolio.total_return() * 100,
    entry_signal=entry_signal,
    exit_signal=exit_signal
)

# Visualize Results Dashboard
fig = plot_statistical_analysis(
    df=df,
    portfolio=portfolio,
    test_results=[mc_result],
    metrics={"total_return": portfolio.total_return() * 100}
)
fig.show()

Available Indicators

๐Ÿ“ˆ

BTC Slope (Trend)

Probability of price trend continuation based on ML models.

4h12h24h60h
๐Ÿ“ˆ

ETH Slope (Trend)

Probability of price trend continuation for Ethereum based on ML models.

4h12h24h60h
๐Ÿš€

BTC Break-Up

Probability of upward volatility breakout using ATR analysis.

24h48h96h
๐Ÿ“‰

BTC Break-Down

Probability of downward volatility breakout prediction.

24h48h96h

Built-in Statistical Tests

Prove your strategy's significance with professional-grade statistical validation tools.

Monte Carlo Simulation

Randomized sampling to estimate strategy performance distribution

Bootstrap Analysis

Resampling technique for confidence interval estimation

Walk-Forward Validation

Rolling window backtesting for out-of-sample performance

Permutation Tests

Non-parametric significance testing via label shuffling

T-Tests

Statistical hypothesis testing for mean returns

Sharpe Ratio Analysis

Risk-adjusted return metrics with benchmarking

Ready to build your next strategy?

Get your API key and subscribe to indicator packages to start building powerful quantitative trading strategies with our Python SDK.

Disclaimer

The Signals provided by Marbell AG are for informational and educational purposes only and are not investment advice or a recommendation to buy or sell any financial instrument. The Signals are non-personalised and do not consider your objectives, financial situation, or risk tolerance. Past or simulated performance is not indicative of future results. Marbell AG does not execute trades or provide portfolio management or copy-trading services.