Development of Trading Strategy Marketplace
A trading strategy marketplace is a platform where developers publish algorithmic strategies and users subscribe and run them on their accounts. Works like App Store, but instead of apps — trading algorithms.
Platform Architecture
Strategy Runtime — execution environment. Each strategy runs in isolated container with limited resources and access only to authorized APIs.
Strategy SDK — tools for developers: typed interfaces, market data access, order placement through platform API.
Backtesting Integration — automatic backtest of each strategy before publication.
Marketplace Frontend — strategy catalog with filtering, detailed cards, subscription system.
Billing System — payment collection and distribution between platform and developer.
Strategy SDK
from abc import ABC, abstractmethod
class StrategyBase(ABC):
"""Base class for all strategies"""
def __init__(self, context: StrategyContext):
self.ctx = context
@abstractmethod
async def on_candle(self, candle: Candle) -> None:
"""Called on every candle close"""
async def on_trade(self, trade: Trade) -> None:
"""Optional: called on every trade"""
async def on_order_update(self, order: Order) -> None:
"""Optional: called on order status change"""
async def buy_market(self, quantity: float) -> Order:
return await self.ctx.place_order('BUY', 'MARKET', quantity=quantity)
async def sell_market(self, quantity: float) -> Order:
return await self.ctx.place_order('SELL', 'MARKET', quantity=quantity)
def get_position(self) -> float:
return self.ctx.position.quantity
# Example simple strategy from developer
class RSICrossStrategy(StrategyBase):
"""EMA crossover + RSI filter"""
def __init__(self, context, fast_period=9, slow_period=21, rsi_period=14):
super().__init__(context)
self.fast_ema = EMA(fast_period)
self.slow_ema = EMA(slow_period)
self.rsi = RSI(rsi_period)
async def on_candle(self, candle: Candle):
fast = self.fast_ema.update(candle.close)
slow = self.slow_ema.update(candle.close)
rsi = self.rsi.update(candle.close)
position = self.get_position()
if fast > slow and rsi < 70 and position == 0:
await self.buy_market(quantity=self.get_balance() * 0.95 / candle.close)
elif fast < slow and position > 0:
await self.sell_market(quantity=position)
Isolation and Security
Running untrusted code — serious security risk. Protections:
Docker containers with resource limits:
services:
strategy-runner:
image: strategy-runtime:latest
mem_limit: 256m
cpus: 0.5
network_mode: none
read_only: true
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
Network isolation — strategy cannot make arbitrary HTTP requests. All data access through platform APIs only.
Code review — manual review before publication for new developers.
Sandbox testing — automatic run in sandbox with suspicious behavior detection.
Publication Pipeline
Each strategy must pass mandatory backtest before publication:
class PublicationPipeline:
REQUIRED_BACKTEST_PERIOD = 365 # days
async def process_submission(self, strategy: StrategySubmission):
# 1. Static code analysis
lint_result = await self.code_linter.check(strategy.code)
if lint_result.has_errors:
return PublicationResult.rejected(lint_result.errors)
# 2. Automatic backtest
backtest = await self.backtester.run(
strategy=strategy,
symbol=strategy.config.symbol,
period_days=self.REQUIRED_BACKTEST_PERIOD,
)
# 3. Check minimum metrics
if backtest.sharpe_ratio < 0.5:
return PublicationResult.rejected("Sharpe ratio below minimum")
if backtest.max_drawdown > 0.5:
return PublicationResult.rejected("Max drawdown exceeds 50%")
# 4. Publish
published = await self.publish(strategy, backtest)
return PublicationResult.approved(published.id)
Monetization for Developers
Models:
Monthly Subscription — fixed fee per month. Simple, predictable income.
Performance Fee — % of subscriber profit. Aligns incentives.
One-time Purchase — one-time access fee.
Free + Upsell — basic free, advanced features paid.
Income calculation:
def calculate_developer_payout(subscription, performance):
if subscription.model == 'MONTHLY':
platform_fee = subscription.price * Decimal('0.30')
return subscription.price - platform_fee
elif subscription.model == 'PERFORMANCE':
profit = performance.follower_profit
if profit <= 0:
return Decimal(0)
developer_share = profit * subscription.performance_fee_pct
platform_fee = developer_share * Decimal('0.30')
return developer_share - platform_fee
Strategy Card UI
Key data: P&L chart over time, max drawdown, Sharpe ratio, win rate, active subscribers, avg holding time, supported exchanges/symbols, logic description in plain language, version history.
Transparency is key — users must understand what strategy does, even without seeing code.







