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.4.tar.gz (6.2 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.4-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aptis_strategy_sdk-0.1.4.tar.gz
  • Upload date:
  • Size: 6.2 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.4.tar.gz
Algorithm Hash digest
SHA256 9e1029d30c05219d9efe11c35c6b485af59057cb9d278b6a4ef19297a40d35da
MD5 d086ae4eff0c6f39f9f1be2c9c451de8
BLAKE2b-256 d7aee6bccd045702d8c95bc5396915d23e3100e898a4343e7dc7f456455dcc35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aptis_strategy_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 80a52c08f787cccaba790edaafac749b1a32b4b7e6ca2e6466d27be977a46c96
MD5 644c804e2e2c5f674f491452421a2697
BLAKE2b-256 03375eb04feae55d68f9a7770fa6c2516153a9d144f8334f4a7c4ec4ddf820c3

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