Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpringBot Strategies

Open-source strategy library for the SpringBot algorithmic trading platform.

Overview

Some of the language used here can be confusing, if you are unsure, there is a Terminology Section at the bottom of this readme that defines some of the key terms used in the SpringBot ecosystem.

This repository serves as both the home for offical Springbot supplied strategies, as well as resouces for anyone who wants to develop thier own Tier 1 or Tier 2 strategies.

SpringBot supports two strategy tiers:

  • Tier 1 (WASM) — WebAssembly modules that run in a sandboxed environment. Pure computation, no I/O. Written in Zig, Rust, C, TinyGo, or any language targeting wasm32-freestanding, and can manage its own program memory.
  • Tier 2 (Process) — Managed subprocesses that communicate over JSON Lines via stdin/stdout. Full runtime freedom: network, filesystem, GPU, ML models. Typically, these will be written in Python, JS/TS (NodeJs, Deno, Bun), lua, Java or any executable. The overhead of reading stdin/stdout is not massive, but not negligable- more testing and benchmarking is needed to define concrete lower bounds on the tick interval for configurations using these strategies.

Repository Structure

Directory Description
official/ Marketplace strategies maintained by Protea Technology Services
examples/ Showcase strategies demonstrating different languages and use cases
templates/ Starter projects for building your own strategies
test/ Test strategies used by the SpringBot core CI
docs/ Detailed ABI, protocol, and data type documentation

Quick Start

Install official Tier 1 strategies

The recommended way of installing offical strategies is through the Springbot Marketplace.

You can install strategies using the cli with

springbot strategies install --id protea/bollinger-bands

This will ensure that you have access to updates and improvements of strategies automatically.

Alternatively, you can build the strategies yourself and install them locally. All of the offical strategies are made in Zig, so you will need to have the zig compiler installed on your system.

# Build (requires Zig 0.15+)
cd official/bollinger-bands
zig build -Doptimize=ReleaseSmall

# Install the strategy locally
springbot strategies install \
  --file ./official/bollinger-bands/zig-out/bin/protea-bollinger-bands.wasm \
  --id protea/bollinger-bands

The same process is used for creating and installing any custom Tier 1 strategies you make.

Please feel free to make modifications to the offical strategies and support the community by documenting your findings and opening a Pull Request.

Install a Tier 2 strategy

Until we can safely distribute Tier 2 strategies through the marketplace, all Tier 2 strategies will have to be installed locally. That is why we have included a few Tier 2 strategy examples for you to clone and install.

# No build step required — just install the directory
springbot strategies install --path ./examples/tier2/python-ema/

Official Strategies

Strategy Description Indicator
Bollinger Bands Volatility-based oversold/overbought 20-period SMA +/- 2 std dev
RSI Momentum oscillator 14-period RSI, buy <30, sell >70
MACD Trend momentum crossover EMA 12/26/9, histogram crossover
EMA Crossover Trend following EMA 12/26 crossover

All official strategies are Tier 1 (WASM), written in Zig, and available on the SpringBot marketplace.

Tier Comparison

Tier 1 (WASM) Tier 2 (Process)
Runtime Sandboxed Wazero VM Managed subprocess
Languages Zig, Rust, C, any wasm32 target Python, Node, Deno, any executable
I/O None (pure computation) Full (network, filesystem, GPU)
Speed ~microseconds/eval ~1-10ms/eval
Distribution Local + Marketplace Local only
Use cases Technical indicators, math-heavy ML models, APIs, sentiment analysis

Build Your Own

Start from a template:

  • Tier 1 (WASM): templates/tier1/ — templates for Zig, Rust, and C
  • Tier 2 (Process): templates/tier2/ — templates for Python, Node.js, and Deno

Copy a template, edit the manifest and strategy logic, build (Tier 1) or test (Tier 2), then install with the SpringBot CLI. See templates/ for detailed instructions.

Documentation

  • ABI Reference — WASM function exports, memory protocol, manifest format
  • Process Protocol — JSON Lines protocol for Tier 2 strategies
  • Data Types — Candle, Ticker, OrderBook, Trade, Portfolio schemas

Terminology

Strategy:

Strategies are the underlying logic that decides whether a bot should make a trade, and what the confidence of that decision is. On each tick, the engine evaluates your strategies against live market data and aggregates their signals (BUY, SELL, or HOLD with a confidence score) to decide whether to trade.

Engine:

The SpringBot Engine is the core component that manages the entire lifecycle of trading. It manages the lifecycle of your strategies, feeds them live market data, and executes trades based on their signals. The engine ensures that your strategies are evaluated efficiently and consistently on each market tick.

Configuration:

A configuration is a set of parameters that defines how the engine should run your strategies. This includes which strategies to use, the tick interval, risk tolerence for buying/selling, and other parameters that can be used to customize the behavior of the engine. When you create a configuration, you are essentially telling the engine which exchange to use, which strategies to use, how often to ask the strategies for signals, and how to interpret those signals.

Tick:

A tick represents a single point in the loop, in which the engine will gather all of the required data, as per the strategies manifest, and call out to the various strategies to provide guidance on whether to BUY, SELL, or HOLD. The engine will then aggregate the signals. When creating configurations, users can determine the period of the tick. For example, a 1-minute tick means that the engine will evaluate strategies every minute- This means that documenting the ideal tick interval for a given strategy is important.

License

Apache 2.0 — see LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages