Trading: Full Stack

Get the complete Datafye trading environment running in under 5 minutes. Includes data, broker connectivity, algo runtime, backtesting, and AI assistance.

What you'll have:

  • Data Cloud with synthetic market data

  • Broker Connector for Alpaca paper trading

  • Algo Container runtime with example strategy

  • Backtesting engine with sample results

  • Environment MCP Server for AI-assisted development

Prerequisites:

  • Docker Desktop installed and running

  • 12GB+ RAM available

  • Alpaca paper trading account (free - sign up here)

  • Python 3.7+ (optional - for testing)

Windows users: You need WSL to install the CLI. Click here for instructions

Setting up WSL for Windows

If you don't already have WSL installed, follow these steps:

  1. Install WSL: Open PowerShell or Windows Command Prompt in administrator mode and run:

    wsl --install

    This will install Ubuntu by default.

  2. Restart your computer when prompted

  3. Launch WSL: Open the Start menu, search for "Ubuntu" (or your chosen Linux distribution), and click to launch

  4. Complete initial setup: Create a username and password when prompted

Once WSL is installed and running, continue with the installation instructions below (WSL provides a Linux environment, so follow the Linux instructions).

For more details, see Microsoft's WSL installation guide.

Tip: Consider using Windows Terminal for a better terminal experience.

Step 1: Install the Datafye CLI

Verify installation:

Expected output:

No sudo access? See CLI Installation for alternative installation methods.

Step 2: Get Alpaca Credentials

  1. Sign up for a free Alpaca paper trading account at alpaca.markets

  2. Navigate to your paper trading dashboard

  3. Copy your API Key ID and Secret Key

Set as environment variables:

Step 3: Download Deployment Descriptor

This descriptor configures:

  • Synthetic dataset with 10 symbols:

    • Tech: AAPL, MSFT, GOOGL, AMZN, NVDA

    • Growth: TSLA, META, NFLX, AMD, INTC

  • Trades and quotes (tick data)

  • 1-minute OHLC bars

  • 90 days of historical data

  • Alpaca Broker Connector (paper trading mode)

  • Pre-built momentum algo container

  • Backtesting engine

  • Environment MCP Server

  • No additional API keys required (besides Alpaca)

Step 4: Provision Full Stack Environment

Expected Output (when available):

Provisioning takes 5-10 minutes.

What Just Happened?

The deployment descriptor configured:

  • Data Cloud - Normalized market data service with REST and WebSocket APIs

  • Broker Connector - Integration with Alpaca for paper trading

  • Algo Container Runtime - Managed environment for running trading algorithms

  • Backtesting Engine - Historical strategy testing and optimization

  • Environment MCP Server - AI-assisted exploration and development

  • Synthetic Dataset - 10 symbols with 90 days of historical data:

    • Tech: AAPL, MSFT, GOOGL, AMZN, NVDA

    • Growth: TSLA, META, NFLX, AMD, INTC

  • Data Types - Trades, quotes, and 1-minute OHLC bars

What's running:

  • Data Cloud container at http://localhost:8080

  • Broker Connector container at http://localhost:8082

  • Algo Runtime container at http://localhost:8081

  • Environment MCP Server at http://localhost:3000

  • Connected to your Alpaca paper trading account

  • Pre-built momentum algo deployed and ready to trade

  • Backtesting engine ready for strategy testing

Step 5: Verify Services

Option A: Python Test Script

Output:

Option B: CLI Commands

Step 6: Run a Backtest

Note: Backtesting commands are being finalized. The example shows expected workflow.

Expected output:

View full scorecard:

Step 7: Paper Trade Your Algo

Start your algo in paper trading mode:

Monitor trades in real-time:

Step 8: Connect AI Tools (Optional)

The Environment MCP Server at http://localhost:3000 enables AI-assisted development and analysis.

Setup:

  1. Configure your AI tool (VS Code, Cursor, Claude, etc.) with MCP server endpoint

  2. Explore your deployment conversationally

  3. Analyze backtest results with AI assistance

  4. Debug algo behavior interactively

See: Integrating with AI Agents

Manage Your Deployment

Next Steps

Learn the SDK:

Deep dive into backtesting:

AI-assisted development:

Paper trading best practices:

Production deployment:

Troubleshooting

Docker not running: Start Docker Desktop and retry.

Insufficient resources: Increase Docker memory to 12GB+ in Docker Desktop settings.

Broker connection failed: Verify your ALPACA_API_KEY and ALPACA_SECRET_KEY environment variables are set correctly.

Port conflicts: Stop conflicting services or see CLI Reference for custom ports.

MCP server not responding: Check docker logs datafye-mcp-server

Algo not trading: Check algo logs with datafye trading algo logs <algo-name> and verify broker account status.

Last updated: 2025-01-23

Last updated