Open AlexanderJHall opened 4 years ago
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
@AnastasiyaB Any thoughts on this? RiskMeasure.from_dict(IRFwdRate.as_dict()) != IRFwdRate feels a bit icky...
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