How it Works
Set Your Strategy Free
Deploy your trading strategy to the cloud and automate execution.
Our beta deployment process is designed to help you transition from backtesting to real-time execution. With this setup, your strategy can run live, making simulated trades and adapting dynamically to market data.
Alpaca Integration
We recommend Alpaca for trade execution. Alpaca is a commission-free trading platform that provides a robust API for algorithmic trading. Our framework generates a Python script that integrates with Alpaca’s API (or more specifically, Alpaca’s Python SDK), allowing for smooth execution of your trading strategy.
Automated Execution
Your strategy will execute at a specified trading frequency, whether that’s hourly, daily, or another interval of your choosing. Follow our step-by-step tutorial to deploy your Python script, which will run autonomously in the cloud—no manual intervention required.
How does this work?
Execution Process
At each execution interval (e.g., daily), your script will run, performing the following steps:
-
Gather Market Data – Retrieve the latest prices and indicators to assess current market conditions.
-
Generate Trading Signals – Apply your beloved
strategyfunction to recent market data; use the most recent signal to determine whether to buy, sell, or hold. -
Calculate Trade Size – Determine the number of shares to buy or sell based on your portfolio value and cash balance.
Example: A new trading signal of 0.7 appears, and you currently hold no positions. With $100,000 in cash, you aim to allocate $70,000 to the stock.
-
Execute Trade – Using the calculated share quantity, submit a buy or sell order through Alpaca.
Example Order Submission
trading_client.submit_order( symbol="AAPL", notional=70000.00, side="buy", type="market", time_in_force="day",)What Happens if an Error Occurs?
If your strategy encounters a coding error or any other issue during execution, your current position will remain unchanged—no new trades will be placed.
To ensure your strategy performs as expected, regularly monitor your portfolio. An error-prone strategy can severely impact its effectiveness, potentially preventing trades from being executed at all.
How Can I Track/Monitor My Strategy?
You can monitor your orders and portfolio directly on Alpaca.
However, we understand that you may want deeper insights—whether it’s identifying where your strategy went wrong or examining specific calculations. That’s why we’ve integrated Google Cloud Logging, allowing you to track and analyze your strategy’s performance in detail.
This will all be covered in the step-by-step tutorial.
Important Note on Fractional Trading
To execute trades based on specified dollar amounts, we rely on fractional shares. Alpaca supports this for buy orders, but fractional short selling is not yet available. All short sales are rounded down to the nearest whole share. For instance, if your strategy signals a short sale of 31.55 shares of AAPL, only 31 shares will be sold. While any subsequent buy orders will rebalance your portfolio, this rounding may affect your strategy’s execution.
To Avoid This Limitation…
Again, strategies that rely on short positions may not behave the same as they would in real-world conditions. To avoid this limitation, the deployment pipeline is designed to work seamlessly for long and sell operations, while shorting remains restricted by Alpaca’s rules. In the strategy editor, keep your signals between 0 and 1 for the most accurate and reproducible results. You can still build and experiment with sophisticated strategies—just keep in mind that anything involving fractional shorts won’t translate perfectly to live trading (for now).
Ready to Rock!
We’ve covered the basics of the deployment process and discussed the hazards of trading with real capital. Now, you’re ready to bring your strategy to life: Follow our tutorial to get started!