Skip to main content

Python SDK for building plugin trading strategies on the Aptis platform

Project description

Aptis Strategy SDK

Python SDK for building trading strategies on the Aptis platform.

Author: Richard Chung

Installation

pip install aptis-strategy-sdk

Environment Variables

APTIS_API_KEY=your_api_key_here     # Your API key
APTIS_ACCOUNT=Theme                  # Account to trade under (Theme or QSpark)
APTIS_API_URL=http://localhost:8082  # Backend URL

Never hardcode these — always read from env vars.

Quick Start

import os
from aptis_strategy_sdk import AptisClient, Strategy, Signal
from datetime import date

client = AptisClient(
    api_key=os.getenv("APTIS_API_KEY", "test_key_123"),
    base_url=os.getenv("APTIS_API_URL", "http://localhost:8082")
)

class MyStrategy(Strategy):
    def generate_signals(self, run_date: date):
        # your logic here
        return [Signal(symbol="AAPL", asset_class="equity",
                       quantity=100, side="BUY", signal_type="ENTRY")]

strategy = MyStrategy(
    name="My Strategy",
    client=client,
    account=os.getenv("APTIS_ACCOUNT", "Theme")
)
result = strategy.run(date.today())

Accounts

The platform supports multiple accounts (trading scenarios). Each account has its own API key. Set APTIS_ACCOUNT to target the correct account:

# Run against Theme account
APTIS_ACCOUNT=Theme APTIS_API_KEY=test_key_123 python my_strategy.py

# Run against QSpark account
APTIS_ACCOUNT=QSpark APTIS_API_KEY=qspark_key_123 python my_strategy.py

API Methods

AptisClient

  • submit_signal(signal, strategy_name, account) — submit a trading signal
  • get_config(strategy_name) — get NAV, funds, portfolio_weight, enabled
  • get_quotes(symbols, asset_class) — get market quotes
  • get_bars(symbol, asset_class, timeframe, start, end) — get OHLCV bars
  • get_positions(account, strategy_name) — get current positions
  • get_pnl(account, start_date, end_date, strategy_name) — get P&L

Strategy Base Class

  • generate_signals(date) — override with your logic, return List[Signal]
  • run(date) — calls generate_signals, submits all signals
  • get_features(symbols, date, features) — fetch Dagster features
  • get_positions() — get positions for this strategy

Signal Fields

Field Required Description
symbol Yes Ticker
asset_class Yes equity, etf, crypto, forex, commodity
quantity Yes Units
side Yes BUY or SELL
signal_type Yes ENTRY, EXIT, ADJUST
order_parameters No order_type, limit_price, etc.
metadata No Notes only, not used for execution

Full Documentation

See docs/customer-integration/ for complete guides.

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

aptis_strategy_sdk-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

aptis_strategy_sdk-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aptis_strategy_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.18

File hashes

Hashes for aptis_strategy_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ef3c4512ab21789e52859b5a357030f54af747cfbecc477547e05eee656b3d5
MD5 479c5b1914853764e4aaf9a2f5307f26
BLAKE2b-256 ee658761d57cfd5e2038965ce036e327d1a0f4cfc995e7dc9ac42d8bbbd0308c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aptis_strategy_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 908acb92456f1c798405920671e22ca156d96c8907493f03744a49d5bc36a677
MD5 69b351186315e3cce2f2d577be65588e
BLAKE2b-256 12f32fb4c8e2207eba542a6145b898f47f3a705539f8f3daf1df788782fc5a30

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