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

[BUG] gs_quant python entity Country not working #273

Open
LeoWu64 opened this issue Jul 19, 2023 · 2 comments
Open

[BUG] gs_quant python entity Country not working #273

LeoWu64 opened this issue Jul 19, 2023 · 2 comments

Comments

@LeoWu64
Copy link

LeoWu64 commented Jul 19, 2023

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
image

Systems setup:

  • OS: Windows 10
  • Python version
  • GS-Quant version 1.0.3

Additional context
Add any other context about the problem here.

@LeoWu64 LeoWu64 changed the title [BUG] [BUG] gs_quant python entity Country not working Jul 19, 2023
@jtranquilli
Copy link

I would like to be assigned to this issue

@jtranquilli
Copy link

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.

jtranquilli pushed a commit to jtranquilli/gs-quant that referenced this issue Sep 26, 2023
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