Configuration

All trading parameters in one place.

Trading Parameters

Configure via the dashboard, POST /agent/config, or edit defaults in makora-harness.ts:

Setting Default Description
max_positions 5 Maximum concurrent positions
max_position_value 5000 Maximum $ per position
take_profit_pct 10 Auto-sell at this % profit
stop_loss_pct 5 Auto-sell at this % loss
min_sentiment_score 0.3 Minimum sentiment to consider (0-1)
min_analyst_confidence 0.6 Minimum LLM confidence to trade (0-1)
position_size_pct_of_cash 25 Max % of available cash per trade

LLM Configuration

Setting Default Description
llm_provider openai-raw openai-raw, ai-sdk, or cloudflare-gateway
llm_model gpt-4o-mini Model for bulk research (cheap, fast)
llm_analyst_model gpt-4o Model for trading decisions (smarter)

Timing Parameters

Setting Default Description
data_poll_interval_ms 30000 How often to fetch signals (30s)
analyst_interval_ms 120000 How often to run trading logic (2min)

Optional Features

Setting Default Description
crypto_enabled false Enable 24/7 crypto trading
crypto_symbols ["BTC", "ETH", "SOL"] Which cryptos to trade
stale_position_enabled true Auto-exit positions that lose momentum
ticker_blacklist [] Symbols to never trade (e.g., insider restrictions)

Environment Variables

Set in .dev.vars (local) or via wrangler secret put (production):

Variable Required Description
MAKORA_API_TOKEN Yes API auth token for all endpoints. Generate with: openssl rand -base64 48
ETORO_API_KEY Yes Your eToro public API key
ETORO_USER_KEY Yes Your eToro user key
ETORO_ENV No demo (default) or real
OPENAI_API_KEY Depends Required if using openai-raw or ai-sdk with OpenAI
KILL_SWITCH_SECRET Yes Separate secret for emergency kill switch
DISCORD_WEBHOOK_URL No Get Discord alerts on BUY signals
TWITTER_BEARER_TOKEN No Enable Twitter sentiment confirmation

Safety Features

These are enforced by the MCP server's policy engine:

Feature Description
Kill Switch Emergency halt for all trading
Position Limits Max positions and $ per position
Daily Loss Limit Stops trading after 2% daily loss
Cooldown Period 30-minute pause after losses
Approval Tokens Orders expire after 5 minutes
LLM Confidence Gate Trades require minimum confidence
No Margin Cash-only trading
No Shorting Long positions only

API Endpoints

All endpoints require Authorization: Bearer $MAKORA_API_TOKEN

Endpoint Description
GET /agent/status Full status: account, positions, signals, config
GET /agent/enable Start the trading agent
GET /agent/disable Stop the trading agent
GET /agent/config Get current configuration
POST /agent/config Update configuration (JSON body)
GET /agent/logs Recent activity logs
GET /agent/costs LLM usage and costs
GET /agent/signals Current signal cache
GET /agent/trigger Manually trigger the agent loop (testing)
GET /agent/kill Emergency stop (requires KILL_SWITCH_SECRET)

Tuning Tips

Agent not making trades?

Too many trades?

High LLM costs?

Using a different LLM provider?