Spaces:
Running
Running
Fix shadowing app.py and frontend null checks
Browse files- app.py +0 -13
- assets/index-BrK9DE2H.js +0 -0
- external/Quant.ai/frontend/src/App.tsx +2 -2
- external/Quant.ai/frontend/src/components/PortfolioStats.tsx +14 -9
- external/Quant.ai/index.html +1 -1
- quant.html +1 -1
- quant/index.html +1 -1
app.py
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
import sys
|
| 2 |
-
import os
|
| 3 |
-
import uvicorn
|
| 4 |
-
|
| 5 |
-
# Ensure project root is in sys.path
|
| 6 |
-
root_dir = os.path.dirname(os.path.abspath(__file__))
|
| 7 |
-
if root_dir not in sys.path:
|
| 8 |
-
sys.path.insert(0, root_dir)
|
| 9 |
-
|
| 10 |
-
from inferroute.main import app
|
| 11 |
-
|
| 12 |
-
if __name__ == "__main__":
|
| 13 |
-
uvicorn.run("inferroute.main:app", host="0.0.0.0", port=7860, reload=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/index-BrK9DE2H.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
external/Quant.ai/frontend/src/App.tsx
CHANGED
|
@@ -657,10 +657,10 @@ function App() {
|
|
| 657 |
<div className="pnl-header-container">
|
| 658 |
<div>
|
| 659 |
<div className="portfolio-value">
|
| 660 |
-
${data.summary.final_equity.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
| 661 |
</div>
|
| 662 |
<div className={`pnl-text ${pnlColorClass}`}>
|
| 663 |
-
{pnlSign}${data.summary.net_pnl.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ({pnlSign}{data.summary.pnl_pct.toFixed(2)}%)
|
| 664 |
</div>
|
| 665 |
</div>
|
| 666 |
|
|
|
|
| 657 |
<div className="pnl-header-container">
|
| 658 |
<div>
|
| 659 |
<div className="portfolio-value">
|
| 660 |
+
${(data.summary?.final_equity ?? 0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
| 661 |
</div>
|
| 662 |
<div className={`pnl-text ${pnlColorClass}`}>
|
| 663 |
+
{pnlSign}${(data.summary?.net_pnl ?? 0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ({pnlSign}${(data.summary?.pnl_pct ?? 0).toFixed(2)}%)
|
| 664 |
</div>
|
| 665 |
</div>
|
| 666 |
|
external/Quant.ai/frontend/src/components/PortfolioStats.tsx
CHANGED
|
@@ -25,15 +25,20 @@ interface PortfolioStatsProps {
|
|
| 25 |
}
|
| 26 |
|
| 27 |
export const PortfolioStats: React.FC<PortfolioStatsProps> = ({ summary }) => {
|
| 28 |
-
const isUp = summary.net_pnl >= 0;
|
| 29 |
const pnlColor = isUp ? 'var(--color-green)' : 'var(--color-red)';
|
| 30 |
const pnlSign = isUp ? '+' : '';
|
| 31 |
|
| 32 |
-
const
|
| 33 |
-
const
|
| 34 |
-
const
|
| 35 |
-
const
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
const sharpeColor = sharpe > 1 ? 'var(--color-green)' : sharpe > 0 ? '#f5a623' : 'var(--color-red)';
|
| 39 |
const calmarColor = calmar > 1 ? 'var(--color-green)' : calmar > 0 ? '#f5a623' : 'var(--color-red)';
|
|
@@ -47,18 +52,18 @@ export const PortfolioStats: React.FC<PortfolioStatsProps> = ({ summary }) => {
|
|
| 47 |
<div className="stats-grid">
|
| 48 |
<div className="stat-box">
|
| 49 |
<span className="stat-label">Initial Capital</span>
|
| 50 |
-
<span className="stat-value">${
|
| 51 |
</div>
|
| 52 |
|
| 53 |
<div className="stat-box">
|
| 54 |
<span className="stat-label">Final Equity</span>
|
| 55 |
-
<span className="stat-value">${
|
| 56 |
</div>
|
| 57 |
|
| 58 |
<div className="stat-box">
|
| 59 |
<span className="stat-label">Net PnL</span>
|
| 60 |
<span className="stat-value" style={{ color: pnlColor }}>
|
| 61 |
-
{pnlSign}${
|
| 62 |
</span>
|
| 63 |
</div>
|
| 64 |
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
export const PortfolioStats: React.FC<PortfolioStatsProps> = ({ summary }) => {
|
| 28 |
+
const isUp = (summary?.net_pnl ?? 0) >= 0;
|
| 29 |
const pnlColor = isUp ? 'var(--color-green)' : 'var(--color-red)';
|
| 30 |
const pnlSign = isUp ? '+' : '';
|
| 31 |
|
| 32 |
+
const initialCash = summary?.initial_cash ?? 0;
|
| 33 |
+
const finalEquity = summary?.final_equity ?? 0;
|
| 34 |
+
const netPnl = summary?.net_pnl ?? 0;
|
| 35 |
+
const pnlPct = summary?.pnl_pct ?? 0;
|
| 36 |
+
|
| 37 |
+
const sharpe = summary?.sharpe ?? 0;
|
| 38 |
+
const calmar = summary?.calmar ?? 0;
|
| 39 |
+
const cagr = summary?.cagr ?? 0;
|
| 40 |
+
const profitFactor = summary?.profit_factor ?? 0;
|
| 41 |
+
const maxDD = (summary?.max_drawdown ?? 0) * 100;
|
| 42 |
|
| 43 |
const sharpeColor = sharpe > 1 ? 'var(--color-green)' : sharpe > 0 ? '#f5a623' : 'var(--color-red)';
|
| 44 |
const calmarColor = calmar > 1 ? 'var(--color-green)' : calmar > 0 ? '#f5a623' : 'var(--color-red)';
|
|
|
|
| 52 |
<div className="stats-grid">
|
| 53 |
<div className="stat-box">
|
| 54 |
<span className="stat-label">Initial Capital</span>
|
| 55 |
+
<span className="stat-value">${initialCash.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 0 })}</span>
|
| 56 |
</div>
|
| 57 |
|
| 58 |
<div className="stat-box">
|
| 59 |
<span className="stat-label">Final Equity</span>
|
| 60 |
+
<span className="stat-value">${finalEquity.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}</span>
|
| 61 |
</div>
|
| 62 |
|
| 63 |
<div className="stat-box">
|
| 64 |
<span className="stat-label">Net PnL</span>
|
| 65 |
<span className="stat-value" style={{ color: pnlColor }}>
|
| 66 |
+
{pnlSign}${netPnl.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ({pnlSign}{pnlPct.toFixed(2)}%)
|
| 67 |
</span>
|
| 68 |
</div>
|
| 69 |
|
external/Quant.ai/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<title>frontend</title>
|
| 8 |
-
<script type="module" crossorigin src="/assets/index-
|
| 9 |
<link rel="stylesheet" crossorigin href="/assets/index-DCSOhC_L.css">
|
| 10 |
</head>
|
| 11 |
<body>
|
|
|
|
| 5 |
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<title>frontend</title>
|
| 8 |
+
<script type="module" crossorigin src="/assets/index-BrK9DE2H.js"></script>
|
| 9 |
<link rel="stylesheet" crossorigin href="/assets/index-DCSOhC_L.css">
|
| 10 |
</head>
|
| 11 |
<body>
|
quant.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<title>frontend</title>
|
| 8 |
-
<script type="module" crossorigin src="/assets/index-
|
| 9 |
<link rel="stylesheet" crossorigin href="/assets/index-DCSOhC_L.css">
|
| 10 |
</head>
|
| 11 |
<body>
|
|
|
|
| 5 |
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<title>frontend</title>
|
| 8 |
+
<script type="module" crossorigin src="/assets/index-BrK9DE2H.js"></script>
|
| 9 |
<link rel="stylesheet" crossorigin href="/assets/index-DCSOhC_L.css">
|
| 10 |
</head>
|
| 11 |
<body>
|
quant/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<title>Quant.ai Trading Terminal</title>
|
| 8 |
-
<script type="module" crossorigin src="/assets/index-
|
| 9 |
<link rel="stylesheet" crossorigin href="/assets/index-DCSOhC_L.css">
|
| 10 |
</head>
|
| 11 |
<body>
|
|
|
|
| 5 |
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<title>Quant.ai Trading Terminal</title>
|
| 8 |
+
<script type="module" crossorigin src="/assets/index-BrK9DE2H.js"></script>
|
| 9 |
<link rel="stylesheet" crossorigin href="/assets/index-DCSOhC_L.css">
|
| 10 |
</head>
|
| 11 |
<body>
|