You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.
I believe there is a problem with the delta calculation for aggregated positions. In particular, if quantity is >1, the delta should be multiplied by the number of contracts.
I believe there is a problem with the delta calculation for aggregated positions. In particular, if quantity is >1, the delta should be multiplied by the number of contracts.
This diff should take care of it:
diff --git a/simple_portfolio/calculate.py b/simple_portfolio/calculate.py
index 765278b..90efc93 100644
--- a/simple_portfolio/calculate.py
+++ b/simple_portfolio/calculate.py
@@ -55,6 +55,7 @@ def doit():
ops["return_today"] = ops["market_value"] - ops["pv_prev"]
ops["return_total"] = ops["market_value"] - ops["pv_orig"]
+ ops["delta"] = ops["delta"] * abs(ops["quantity"]) * 100
agg_ops = ( ops[["symbol", "market_value", "return_today", "pv_prev",
"return_total", "pv_orig", "delta", "theta"]].
Apparently delta has the right sign already when exported, but quantity is either positive or negative (bought vs. sold), thus the abs().
The text was updated successfully, but these errors were encountered: