Download frontend/src/components/PortfolioVersions.jsx from bhuvi3/CIOAgent: direct link, hf CLI and curl.
- Browser
- Download file 1.74 kB
-
https://huggingface.co/spaces/bhuvi3/CIOAgent/resolve/main/frontend/src/components/PortfolioVersions.jsx
- Command line
-
hf download hf://spaces/bhuvi3/CIOAgent/frontend/src/components/PortfolioVersions.jsx
-
curl -L -o PortfolioVersions.jsx https://huggingface.co/spaces/bhuvi3/CIOAgent/resolve/main/frontend/src/components/PortfolioVersions.jsx
1.74 kB
| import React from "react"; | |
| export default function PortfolioVersions({ snapshots, onRestore }) { | |
| if (!snapshots || snapshots.length === 0) return null; | |
| return ( | |
| <div className="section"> | |
| <h2>Portfolio History</h2> | |
| <p className="caption">Previous portfolio snapshots. Click to restore.</p> | |
| <table className="data-table"> | |
| <thead> | |
| <tr> | |
| <th>#</th> | |
| <th>Label</th> | |
| <th>Date</th> | |
| <th>Tickers</th> | |
| <th>Return</th> | |
| <th>Sharpe</th> | |
| <th></th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| {snapshots.map((s, i) => ( | |
| <tr key={i}> | |
| <td>{i + 1}</td> | |
| <td><strong>{s.label || `Snapshot #${i + 1}`}</strong></td> | |
| <td style={{ fontSize: "0.8rem" }}> | |
| {new Date(s.timestamp * 1000).toLocaleDateString()} | |
| </td> | |
| <td style={{ fontSize: "0.8rem" }}>{s.tickers.join(", ")}</td> | |
| <td> | |
| {s.performance?.annual_return != null | |
| ? `${(s.performance.annual_return * 100).toFixed(2)}%` | |
| : "—"} | |
| </td> | |
| <td> | |
| {s.performance?.sharpe_ratio != null | |
| ? s.performance.sharpe_ratio.toFixed(2) | |
| : "—"} | |
| </td> | |
| <td> | |
| <button | |
| className="btn" | |
| style={{ padding: "0.2rem 0.5rem", fontSize: "0.75rem" }} | |
| onClick={() => onRestore(s)} | |
| > | |
| Restore | |
| </button> | |
| </td> | |
| </tr> | |
| ))} | |
| </tbody> | |
| </table> | |
| </div> | |
| ); | |
| } | |