Skip to content

standard deviation with scope #690

Answered by Skyscimitar
HuifangYeo asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you for the more detailed explanation, I understand the issue now.
The behavior you described is correct, the original measure should keep it's values at scope level or below. I'll let you know when we have a fix for this.
In the meantime you can use the tt.where function to force the correct value on the HistoricalDate level:

m["PnL vs Benchmark"] = m["Daily Pnl"] - m["Benchmark"]
m["Std"] = tt.agg.std(m["PnL vs Benchmark"], scope=tt.OriginScope(l["Historical Dates"]))
m["Error tracking"] = tt.where(l["Historical Dates"].isnull(), m["Std"], m["PnL vs Benchmark"])

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Skyscimitar
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Skyscimitar
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants