Python algorithmic trading platform

A Python algorithmic trading platform for your code.

Develop custom strategy logic with the Investfly Python SDK while platform services handle supported market data, indicators, order planning, backtesting, virtual portfolios, and eligible account deployment.

  • Public SDK
  • Sample strategies
  • Custom indicators
strategy.py · private
class MyStrategy(TradingStrategy):
    def getSecurityUniverseSelector(self):
        return SecurityUniverseSelector.fromSymbols(
            SecurityType.STOCK, ["AAPL", "MSFT"]
        )

    @data_trigger(
        type=DataType.BARS,
        barInterval=BarInterval.FIFTEEN_MINUTE
    )
    def onMarketData(self, updatedSecurities):
        # Your signal and order-planning logic
        return orders or None
AUTHORING TYPEPYTHON
Strategy SDKTyped models
Data servicesBars + indicators
Shared controlsOrders + limits
Start from working structure

Spend your time on strategy logic—not platform plumbing.

The SDK gives your code explicit interfaces for the universe, market-data callbacks, portfolio access, order requests, and shared position controls.

01 · Clone

Start with sample code

Use a strategy starter template or an asset-specific example to understand the supported interface before adding custom behavior.

02 · Develop

Implement the differentiating logic

Define security selection, data callbacks, custom indicators, signal evaluation, and order-planning requests in Python.

03 · Evaluate

Use shared testing surfaces

Run historical backtests, deploy to a virtual portfolio, inspect activity, and revise code before considering eligible live use.

Multi-asset Python patterns

Use code where the market requires custom behavior.

Asset-native selection and execution models remain visible even when your signal logic is custom.

CODE + PLATFORM CONTRACTUSER AUTHORED
Stocks and ETFs

Custom universes and multi-timeframe indicators.

SELECTReturn symbols or a supported universe selector
COMPUTEUse built-in series or your custom indicator
PLANCreate typed open and close requests
CONTROLApply your portfolio and exposure limits
A bounded execution environment

Powerful enough for custom logic. Explicit about its limits.

Python strategies run inside the supported Investfly environment rather than an unrestricted general-purpose server.

Indicators and data

Access platform-provided bars, quotes, indicator series, and strategy services through supported interfaces.

Supported packages

Use supported runtime imports including NumPy, pandas, TA-Lib, statistics, typing, and Investfly SDK modules.

Shared controls

Express position management and portfolio limits through typed strategy-policy models where applicable.

Same strategy path

Use the same user-authored strategy concept across backtesting, virtual portfolios, and eligible deployments.

Choose your market
Python algo trading questions

Understand what the platform supplies around your code.

What does a Python algorithmic trading platform provide?

It supplies supported market data, strategy interfaces, testing, virtual portfolios, order planning, monitoring, and eligible broker connectivity so your code can focus on the logic you author.

Which Python packages can strategies use?

The current bounded runtime supports Investfly SDK modules and selected packages including NumPy, pandas, TA-Lib, statistics, typing, and math. Check the API documentation for the current interface and restrictions.

Can I backtest and paper trade the same Python strategy?

Supported Python strategies follow the shared strategy path through historical backtesting and virtual portfolio simulation, helping you inspect behavior before considering eligible live use.

When should I use Python instead of the no-code builder?

Use Python when your strategy needs supported custom selection, indicators, callbacks, or signal logic. Use the visual builder when the available configuration fields can express the strategy more simply.

Start with a runnable SDK strategy

The public SDK version 3.1.2 supports Python 3.11+. This minimal authoring example declares a stock universe, runtime-managed protection and an allocation callback. It is an educational starting point; it has no predictive signal and its example allocation must be reviewed before any use.

from typing import List, Optional
from investfly.models import *


class MyStrategy(TradingStrategy):
    def getSecurityUniverseSelector(self) -> SecurityUniverseSelector:
        return SecurityUniverseSelector.fromSymbols(SecurityType.STOCK, ["AAPL", "MSFT"])

    def getStrategyPolicy(self) -> CustomStrategyPolicy:
        return CustomStrategyPolicy(
            assetType=SecurityType.STOCK,
            positionManagement=PositionManagementRules(
                positionExits=ExitRules(
                    protectiveExits=buildProtectiveExitPlan(
                        targetProfitPct=10.0,
                        stopLossPct=5.0,
                        trailingStopPct=2.0,
                    )
                )
            ),
            portfolioLimits=PortfolioLimits(maxOpenPositions=5),
        )

    @data_trigger(type=DataType.BARS, barInterval=BarInterval.FIFTEEN_MINUTE)
    def onMarketData(self, updatedSecurities: List[Security]) -> Optional[List[TradeOrder]]:
        execution = OpenExecutionSettings(
            positionSize=PositionSizeSpec(PositionSizeMode.PERCENT_OF_EQUITY, 15.0),
            orderSpec=OrderSpec(),
            instrumentSelection=DirectInstrumentSelection(),
        )
        return self.services.planAllocationOrders(AllocationPlan(updatedSecurities, execution)) or None

Download MyStrategy.py and follow installation, type-checking, upload and hosted testing. A local import/type check does not reproduce hosted data or fills. The bounded runtime supports Investfly modules and selected math, statistics, typing, NumPy, pandas and TA-Lib imports; it is not unrestricted package hosting.

Hosted Python strategy code editor
The product editor keeps code alongside backtest and deployment views. Fictional local demo; simulated data and results.

Premium/Elite plans provide continued historical testing and automated deployment after the trial. Elite adds eligible broker connections. Use Python templates for worked market-specific logic. Standalone backtesting-library/framework searches can seek a different product; this is a hosted strategy platform.

A complete public Python crypto example

Download the public volatility-adaptive BTC DCA source or inspect its strategy and report. This larger maintained example demonstrates scheduled contributions and volatility-based safety orders; it is separate from MyStrategy.py and is not an investment recommendation.

Reported period Matched closed records Last completed run
2026-09-09 to 2026-10-13 2 2026-10-14

Observed October 14, 2026. Historical modeled output is not a live or paper-deployment result. Downloaded examples are type-checked locally; the platform still validates uploaded code and returns the current run’s actual status, warnings, dates and trades.

Check the paper-deployment output

After uploading, testing and choosing a compatible Investfly virtual portfolio, inspect the saved strategy’s Deployment status and Execution Logs. A deployed state establishes the running copy/account; it does not establish a filled order. Logs can show startup, evaluation, no-order decisions or errors. Reconcile orders and positions separately. See the labeled actual status/log screen and its interpretation. That fictional SMA demo is separate from MyStrategy.py; no hosted paper run of the minimal snippet is claimed here.

Next: compare no-code and Python build routes.

From sample to strategy

Start with the SDK and make the logic yours.

Review the supported interface, clone a sample, and test your own code in the platform.

Available packages, providers, instruments, and live capabilities depend on current platform support.