Skip to content

Add portfolio allocation planning with Deep snapshots - #359

Open
AIVensk wants to merge 1 commit into
linksplatform:mainfrom
AIVensk:bounty/138-portfolio-deep
Open

AIVensk wants to merge 1 commit into
linksplatform:mainfrom
AIVensk:bounty/138-portfolio-deep

Conversation

@AIVensk

@AIVensk AIVensk commented Sep 28, 2026

Copy link
Copy Markdown

Summary

Closes #138.

  • Add a decimal portfolio allocation planner with validated percentage targets and conserved total value, including holdings absent from the target allocation.
  • Store immutable target snapshots as typed Deep links connected to the portfolio and asset identifiers. Targets can be read back through a fresh wrapper around the same FinancialStorage.
  • Add an explicit --balance-portfolio <json> CLI mode, documented example, and an xUnit project in both solutions.

Verification

  • dotnet test Bot.sln --no-restore -c Release -f net8: 24 passed using .NET SDK 8.0.425.
  • Tests cover the issue's 25/25/50 example, validation, rounding/value conservation, large totals, tiny percentages, Unicode/culture-independent Deep round trips, immutable snapshots and command errors.
  • Ran the actual offline example: Gold +15,000, USD -5,000, stocks -10,000; net value change zero.
  • git diff --check: pass.

Existing restore/build warnings (including System.CommandLine.Parser framework compatibility and obsolete upstream broker properties) remain unchanged.

Scope

The algorithm returns value changes in a common valuation currency. It does not place orders or infer prices, FX rates, fees or share quantities. Deep snapshots use the existing heap-backed FinancialStorage and live for the lifetime of that store; this does not claim disk persistence. All verification used synthetic data.

Submitting for the 1,000 RUB reward advertised in #138, subject to maintainer acceptance. Implementation and tests were prepared with Codex assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trader: Trading portfolio auto balance algorithm, that uses, that uses Deep (associative data storage)

1 participant