chart: snap daily equity points to their trading date (fix weekend x-axis drift)
Browse files
app.py
CHANGED
|
@@ -69,6 +69,10 @@ def build_curve():
|
|
| 69 |
except Exception:
|
| 70 |
daily = []
|
| 71 |
if len(daily) >= 4: # enough daily history → daily fund vs SPY
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
base = daily[0][1]
|
| 73 |
rows = [{"date": d, "series": "DeepQuant (paper)", "value": round(v, 2)} for d, v in daily]
|
| 74 |
spy = fetch_spy_daily()
|
|
|
|
| 69 |
except Exception:
|
| 70 |
daily = []
|
| 71 |
if len(daily) >= 4: # enough daily history → daily fund vs SPY
|
| 72 |
+
# Alpaca stamps each session's closing equity at 00:00 UTC of the NEXT day (= 8 PM ET),
|
| 73 |
+
# which renders every close ~80% of the way toward the following day's axis tick
|
| 74 |
+
# (Friday's close shows up under "Saturday"). Snap each point to its trading date.
|
| 75 |
+
daily = [(dt.datetime.combine(d.date(), dt.time.min), v) for d, v in daily]
|
| 76 |
base = daily[0][1]
|
| 77 |
rows = [{"date": d, "series": "DeepQuant (paper)", "value": round(v, 2)} for d, v in daily]
|
| 78 |
spy = fetch_spy_daily()
|