Skip to main content

Tasilab Python SDK

Tasilab is the first API-native paper trading sandbox for the Saudi Stock Exchange, empowering developers to build, test, and deploy AI-driven trading strategies with zero financial risk.

This package is the official Python client. Use it to pull historical TASI data, log backtests as experiments, and view results in the Tasilab dashboard.

Install

pip install tasilab

Quick start

from tasilab import Tasilab

tasi = Tasilab(api_key="YOUR_API_KEY")

# 1. Pull historical bars (Tasilab caches them for you)
hist = tasi.get_historical("1120", "2024-01-01", "2025-12-31")

# 2. Run your strategy locally → list of trade dicts
trades = my_strategy(hist["bars"])

# 3. Log the run as a Tasilab experiment (auto-seals on exit)
with tasi.create_experiment(
    name="MACD 12/26/9 on Al Rajhi",
    symbol="1120",
    start_date="2024-01-01",
    end_date="2025-12-31",
    parameters={"fast": 12, "slow": 26, "signal": 9},
) as exp:
    exp.log_trades(trades)
    exp.log_metrics({"total_return_sar": 439.64, "win_rate": 0.412})

The with block automatically marks the experiment completed on clean exit and failed if an exception propagates, so experiments never get stuck in running.

Paper trading

The SDK also supports live paper-trading against the simulated exchange:

order = tasi.buy("2222", quantity=100)
portfolio = tasi.portfolio()

See https://tasilab.com for the full surface.

License

Proprietary — see https://tasilab.com for terms.

Metadata

Release files for tasilab 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tasilab 0.1.1
File Size Uploaded
tasilab-0.1.1.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tasilab 0.1.1
File Interpreter ABI Platform
tasilab-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / tasilab-0.1.1.tar.gz

Download URL tasilab-0.1.1.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
03af3107926e9b7c3bf05bb9c95f694f9872964d8d9e0148a5c1369d422cf360
BLAKE2b-256 checksum
How to use checksums
3cd8217c981fb5ce29560ebf30f4e353dfdeed1223bb6587de36e23e2d44c48b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / tasilab-0.1.1-py3-none-any.whl

Download URL tasilab-0.1.1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cddb63db3edfcaaf69c67166ad4f482e57f6d38f3e66ea1a060509b0dbc49d1
BLAKE2b-256 checksum
How to use checksums
2f1a9801b946d13ea299a19e9e0c2252ad6da02e293a9c3cd709ab071bbda7ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page