Start Backtesting
In Seconds
No payments required. No installation. Just pure strategy execution on our high-performance cloud infrastructure.
+142.5%
Total Return
SimTrading Engine
Write Powerful Strategies
in Simple Python
Our engine is designed for developers. Use the standard data science stack you love, with a powerful event-driven backtesting engine underneath.
strategy.py
from simtrading import BaseStrategy, OrderIntent, Side
class SMAStrategy(BaseStrategy):
def on_bar(self, context):
# 1. Access Data
current_price = context.candle['BTC-USD'].close
closes = context.get_series('BTC-USD', 'close', limit=20)
# Calculate SMA
sma = sum(closes) / len(closes)
# 2. Check Portfolio & Generate Orders
if current_price > sma and not context.is_long('BTC-USD'):
return [OrderIntent(
symbol='BTC-USD',
side=Side.BUY,
quantity=0.1,
order_type='MARKET'
)]
elif current_price < sma and context.is_long('BTC-USD'):
return [OrderIntent(
symbol='BTC-USD',
side=Side.SELL,
quantity=0.1,
order_type='MARKET'
)]
return []