Skip to content

Build multi-asset rebalancing strategy engine in the agent loop #227

Description

@robertocarlous

Summary

The agent loop makes portfolio decisions but lacks a structured strategy engine. A pluggable strategy system would allow rule-based (target allocation %) and optimisation-based (max APY, min risk) rebalancing.

Proposed Solution

  • Define a RebalanceStrategy interface in src/agent/types.ts
  • Implement two initial strategies:
    • TargetAllocationStrategy: rebalance toward user-configured % per protocol
    • MaxYieldStrategy: shift capital to highest-APY protocol within risk limits
  • The agent router.ts selects strategy based on user preference (new DB column)
  • Log chosen strategy and deviation trigger in AgentLog

Acceptance Criteria

  • Strategy interface defined and documented
  • Both strategies implemented and unit tested
  • User preference column added via Prisma migration
  • Agent loop uses selected strategy, logs decision rationale
  • Existing agent behaviour unchanged when no preference set (defaults to current logic)

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions