Skip to main content

Portfolio Position Management With AI Makler — Track, Review, and Act on Open Positions

One of the most powerful features of AI Makler is its ability to manage open positions. Instead of just generating new trading signals, you can feed it your current portfolio and let it review each position individually.

This article shows you how to build a complete position management system — from feeding current positions to AI Makler, through decision-making, to logging and execution.

How Position Management Works

AI Makler accepts a currentPositions parameter — a JSON array describing your open positions. For each position, the agent considers:

  • Current market conditions — price action, volume, technical indicators
  • Position performance — P&L, time held, distance from entry
  • News and sentiment — any relevant news provided
  • Its own memory — what it thought about this symbol before

It then decides for each position: hold, close, or modify (adjust stop-loss/target).

Position Object Format

[
{
"symbol": "BTCUSD",
"side": "buy",
"size": 0.5,
"entry_price": 85000.00,
"current_price": 87200.00,
"pnl_percent": 2.59,
"open_time": "2026-06-20T10:00:00"
},
{
"symbol": "ETHUSD",
"side": "sell",
"size": 2.0,
"entry_price": 2900.00,
"current_price": 2850.00,
"pnl_percent": 1.72,
"open_time": "2026-06-19T14:00:00"
}
]
FieldTypeRequiredDescription
symbolstringInstrument symbol (e.g. BTCUSD)
sidestringbuy (long) or sell (short)
sizenumberPosition size
entry_pricenumberAverage entry price
current_pricenumberCurrent market price
pnl_percentnumberP&L as percentage
open_timestringISO timestamp when position was opened

Pattern 1: Scheduled Portfolio Review

The most common pattern — run a portfolio review every N hours/minutes.

[Schedule Trigger: every 4h]
→ [Fetch Portfolio Positions (from User List or API)]
→ [Fetch Market Data for All Symbols]
→ [Fetch Latest News]
→ [AI Makler: decision with currentPositions]
→ [Condition: any close/modify orders?]
→ Yes: [Run Workflow "Execute Position Changes"]
→ No: [Log to User List "No Changes Needed"]
→ [Save Positions Back to User List]
graph TD
S[Schedule Trigger<br/>Every 4h] --> FP[Fetch Portfolio Positions]
FP --> FD[Fetch Market Data]
FD --> FN[Fetch News]
FN --> AM[AI Makler<br/>decision<br/>+ currentPositions]
AM --> C{Condition<br/>any close/modify?}
C -->|Yes| RW[Run Workflow<br/>Execute Position Changes]
C -->|No| LOG[Log to User List<br/>No Changes]

What the Agent Does With Positions

When you pass currentPositions, the agent reviews each one individually. Example decision output:

{
"results": "Portfolio review complete. 2 positions analysed.",
"orders": [
{
"action": "hold",
"symbol": "BTCUSD",
"reason": "Trend still intact, MACD bullish, no reason to close",
"certainty_pct": 80
},
{
"action": "close",
"symbol": "ETHUSD",
"position_size": 2.0,
"reason": "Bearish divergence on RSI, reducing risk before potential drop",
"certainty_pct": 72
}
],
"marketState": "BTCUSD: Bullish, ETHUSD: Bearish divergence forming"
}

Pattern 2: Multi-Symbol Portfolio Tracker

For a portfolio with 5+ symbols, combine AI Makler with a Parameter Loop to review each symbol independently.

[Schedule Trigger]
→ [Parameter Loop: iterate over portfolio symbols]
→ [Fetch Symbol Data]
→ [AI Makler: decision with single position]
→ [Collect Results]
→ [Aggregate Decisions]
→ [Execute Bulk Changes]
graph LR
S[Trigger] --> PL[Parameter Loop<br/>per symbol]
PL --> FD[Fetch Data<br/>for symbol]
FD --> AM[AI Makler<br/>review 1 position]
AM --> COL[Collect Results]
COL --> AG[Aggregate All Decisions]
AG --> EXEC[Execute Bulk Changes]

The advantage of this pattern is that each AI Makler call focuses on just one position and its specific market data, leading to more precise decisions.

Pattern 3: Stop-Loss and Take-Profit Management

Use AI Makler to dynamically adjust stop-losses and take-profits based on evolving market conditions.

[Schedule: every 1h]
→ [Fetch Open Positions from Exchange]
→ [Fetch Current Prices + Volatility]
→ [AI Makler: decision with positions]
→ [For each position with "modify" action:]
→ [Extract new stop_loss / target_price]
→ [Update Stop-Loss Order via Exchange API]

The agent might output:

{
"orders": [
{
"action": "modify",
"symbol": "BTCUSD",
"current_stop_loss": 84000,
"new_stop_loss": 85800,
"reason": "Trailing stop — price moved up, lock in gains",
"certainty_pct": 85
},
{
"action": "hold",
"symbol": "SOLUSD",
"reason": "Position small, not worth adjusting yet",
"certainty_pct": 65
}
]
}

Pattern 4: Position Sizing Based on Confidence

AI Makler's certainty_pct can be used to dynamically size positions. A follow-up worker can calculate:

# Example logic for position sizing based on certainty
certainty = 75 # from AI Makler output
base_size = 1.0 # base position size

if certainty >= 80:
size = base_size * 1.0 # full position
elif certainty >= 60:
size = base_size * 0.5 # half position
else:
size = 0 # no position

In your workflow, use a Python Exec worker after AI Makler to calculate position sizes based on certainty.

Saving Position History

To track how your positions evolve, save AI Makler's decisions to a User List after each review:

TimestampSymbolActionReasonCertaintyBTC Price
2026-06-21 08:00BTCUSDholdTrend intact80%$87,200
2026-06-21 08:00ETHUSDcloseBearish divergence72%$2,850
2026-06-20 20:00BTCUSDbuyBullish breakout75%$86,520
2026-06-20 20:00ETHUSDsellResistance test68%$2,900

This creates a decision journal that AI Makler can reference in future sessions through its built-in memory — it remembers what it decided and why.

Complete Workflow Example

Here's a full workflow combining position management with AI Makler:

1. Trigger: Schedule Trigger (every 6 hours)
2. Fetch Data: Get BTCUSD, ETHUSD, SOLUSD daily prices
3. Fetch Positions: Get current positions from User List "Open Positions"
4. Fetch News: Latest crypto news from RSS
5. AI Makler: Decision mode with currentPositions + data + news
6. Condition: Check if ordersCount > 0
- Yes → proceed to execution
- No → log "No action needed"
7. For each order with action="close":
- Log to "Closed Positions" User List
- Remove from "Open Positions" User List
8. For each order with action="hold":
- Update timestamp in "Open Positions"
9. Telegram Notify: Send portfolio summary

Key Benefits

  • Active monitoring — your portfolio is reviewed automatically on schedule
  • Context-aware decisions — the agent considers market conditions AND position performance
  • Self-improving — memory of past decisions helps the agent learn from experience
  • Risk management — stop-losses and take-profits can be adjusted dynamically
  • Full audit trail — every decision is logged in memory and optionally in User Lists

Tips

  • Start with analysis mode for a few days to build market context before switching to decision mode
  • For large portfolios, use the Parameter Loop per symbol pattern for more precise analysis
  • Always set maxHistoryIterations high enough (20+) to capture multiple review cycles
  • Combine with a Telegram notification to stay informed of AI Makler's decisions in real time
  • Review the agent's decision journal weekly to validate its reasoning

This is not financial advice. Trading involves risk of financial loss. Position management decisions from AI Makler should be reviewed by a qualified professional before execution.