Skip to content

Getting Started

For Everyone: Use the Dashboard

  1. Sign up at the dashboard with GitHub
  2. Browse the Marketplace for strategies
  3. Add your Exchange Credentials (Account > Credentials)
  4. Backtest a strategy to review its performance
  5. Deploy to your exchange

No code or CLI needed — everything is available from the web dashboard.


For Developers: Use the CLI

Prerequisites

  • Rust (edition 2021)
  • A tradectl account (sign up via the dashboard with GitHub)

1. Install the CLI

bash
curl -fsSL https://tradectl.com/install.sh | sh

See the installation guide for manual download options and PATH setup.

2. Log In

Create an API key from the dashboard (Account > API Keys), then:

bash
echo "st_live_<your-key>" | tradectl login

3. Scaffold a Strategy

bash
tradectl init my-strategy
cd my-strategy

This creates a Rust project with:

my-strategy/
├── Cargo.toml
├── config.json          # Exchange config and strategy parameters
├── src/
│   ├── lib.rs           # Strategy implementation
│   └── params.rs        # Parameter definitions
├── tests/
│   └── test.rs          # Unit test
├── data/                # Backtest data files
├── README.md
├── STRATEGY.md
└── .gitignore

4. Write Your Strategy

Edit src/lib.rs. The scaffold looks like:

rust
use tradectl_sdk::{Strategy, Action, TickerEvent, StrategyContext, Params, ParamDef};

tradectl_sdk::declare_strategy!("my_strategy", MyStrategy::new);

pub struct MyStrategy {
    _params: MyStrategyParams,
}

impl MyStrategy {
    pub fn new(params: &Params) -> Self {
        Self {
            _params: MyStrategyParams::from_params(params),
        }
    }
}

impl Strategy for MyStrategy {
    fn on_ticker(&mut self, ticker: &TickerEvent, ctx: &StrategyContext) -> Action {
        // Your strategy logic here
        //
        // Available data:
        //   ticker.bid_price, ticker.ask_price, ticker.bid_qty, ticker.ask_qty
        //   ctx.positions    — open positions
        //   ctx.balance      — available balance
        //   ctx.timestamp_ms — current event timestamp
        //
        // Return:
        //   Action::Hold                         — do nothing
        //   Action::MarketOpen { side, size }     — open at market
        //   Action::LimitOpen { side, price, size } — place a limit order
        //   Action::ClosePosition { position_id, reason } — close a position
        //   Action::CloseAll                      — close all positions
        //   Action::CancelPending                 — cancel pending orders

        let _ = (ticker, ctx);
        Action::Hold
    }

    fn name(&self) -> &str { "my_strategy" }
    fn describe(&self) -> &str { "My first strategy" }
    fn params_schema(&self) -> Vec<ParamDef> { MyStrategyParams::schema() }
}

5. Test

bash
cargo test

6. Build

bash
tradectl build

7. Run (Paper Trading)

bash
# Edit config.json with your settings (isEmulator: true for paper trading)
tradectl run --config config.json

This connects to the live exchange WebSocket for real market data but simulates all fills locally — no exchange API keys needed for paper trading.

Next Steps

tradectl — Automate Crypto Trading