Skip to content

feat(options): include comparisons in CSV exports - #2319

Open
he-yufeng wants to merge 1 commit into
HKUDS:mainfrom
he-yufeng:feat/options-comparison-export
Open

he-yufeng wants to merge 1 commit into
HKUDS:mainfrom
he-yufeng:feat/options-comparison-export

Conversation

@he-yufeng

Copy link
Copy Markdown
Collaborator

Summary

  • Include saved-alternative expiry curves, spot × IV grids and comparison outcomes in OptionsLab CSV exports.
  • Preserve calculation failures and unavailable metrics as labelled rows instead of silently dropping them.
  • Keep the original four CSV columns in place, append comparison metadata on the right, and escape user-controlled text for spreadsheet safety.

Why

Related: #2202

OptionsLab already displays saved alternatives and their return comparisons, but CSV export only contains the primary strategy. Exporting the same completed analysis to a spreadsheet therefore loses the alternatives and comparison conclusions that remain available in the UI and JSON snapshot.

Changes

  • Export primary and saved-alternative curves from the same completed response without recomputing payoff mathematics in TypeScript.
  • Add comparison labels, metric values, relations and percentage-point differences, including explicit unavailable/error reasons.
  • Bind the primary label to the exact resultRequest snapshot, validate alternative grid alignment and reject non-finite values or malformed results.
  • Preserve the original series,iv,spot,pnl prefix and append metadata columns. Quote commas, quotes and newlines, and neutralize spreadsheet formula prefixes in text cells.
  • Update the Options Lab capability documentation.

No live broker, order, payment, wallet, credential, deployment or real market-data path is changed.

Test Plan

Validation on the original candidate and an independent replay from 6ed378dee5a6e6eb87df796a6546c8ca972a8281:

  • Regression-first export checks: 5 failed / 2 passed before implementation, 7 passed after it.
  • Frontend options, chart, export and OptionsLab suites: 143 passed on both trees.
  • Production frontend build: passed on both trees.
  • Independent replay tree matches the original candidate tree exactly.
  • git diff --check, repository grep gates and private-files gate: passed.
  • Full frontend or backend test suites: not run; the 143 tests above are the related options surface.
  • Live browser and real API manual test: not run. Validation uses synthetic responses and the production frontend build.

Checklist

  • No changes to protected areas (src/agent/, src/session/, src/providers/).
  • No credentials, private paths or secret values added.
  • Code follows the contribution guide and preserves backend-owned calculations.
  • User-facing CSV behavior and coverage are documented.

Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com>
@he-yufeng

Copy link
Copy Markdown
Collaborator Author

@warren618 Could you check the CSV schema choice here? The original four columns stay in place, while strategy labels and comparison outcomes are appended on the right. Failed alternatives and unavailable metrics retain their reasons instead of disappearing from the spreadsheet.

This branch has not been deployed

No deployments
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.

1 participant