gs-quant
gs-quant copied to clipboard
[BUG] gs_quant python entity Country not working
Describe the bug country entity only work with lower-case non-space country name
To Reproduce
from gs_quant.entities.entity import Country, Subdivision
from gs_quant.markets.securities import Asset, AssetIdentifier
for cty in ['taiwan', 'Taiwan', 'china', 'united states', 'United Kingdom']:
print( cty, ': ', Country.get(cty, Country.Identifier.NAME) )
Expected behavior all countries should be found
Screenshots
Systems setup:
- OS: Windows 10
- Python version
- GS-Quant version 1.0.3
Additional context Add any other context about the problem here.
I would like to be assigned to this issue
I'll be submitting a pull request that solves this issue in a minute. The 'Country' class, found in in 'entity.py', inherits its 'get' method from the 'Entity' class. I was able to solve this issue with seemingly no averse effects by adding in 'id_value = id_value.lower()' on line 114 of 'entity.py', thereby converting all potentially malicious inputs to be lowercase, as the functionalities of the Country class expect them to be.