Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RiskMeasure - how to check for equality : RiskMeasure.from_dict(IRFwdRate.as_dict()) == IRFwdRate returns False #124

Open
AlexanderJHall opened this issue Jul 8, 2020 · 1 comment
Assignees

Comments

@AlexanderJHall
Copy link

Describe the bug
RiskMeasure.from_dict(IRFwdRate.as_dict()) == IRFwdRate
Returns False. Arguably this should return True.

What is the correct way to check for RiskMeasure equality?

For example:
RiskMeasure.from_dict(IRFwdRate.as_dict()).measure_type == IRFwdRate.measure_type
returns True, but this feels a little clunky.

I ask as I'd like to write code like:
if risk_measure in (IRFwdRate, IRSpotRate, etc, etc):

where risk_measure has been created by RiskMeasure.from_dict(some_measure.as_dict()).

To Reproduce
from gs_quant.risk import IRFwdRate
from gs_quant.target.risk import RiskMeasure
RiskMeasure.from_dict(IRFwdRate.as_dict()) == IRFwdRate

Returns False.

Expected behavior
RiskMeasure.from_dict(IRFwdRate.as_dict()) == IRFwdRate to return True.

OR please explain how I should compare RiskMeasure types

@AlexanderJHall
Copy link
Author

@AnastasiyaB Any thoughts on this?
RiskMeasure.from_dict(IRFwdRate.as_dict()) != IRFwdRate feels a bit icky...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants