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

Rename class to asset_class in list_assets #571

Open
1 task done
tallm0cha opened this issue Feb 11, 2022 · 2 comments
Open
1 task done

Rename class to asset_class in list_assets #571

tallm0cha opened this issue Feb 11, 2022 · 2 comments
Labels
question Further information is requested

Comments

@tallm0cha
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

I am trying to get a list of all asset classes to filter for different strategies. Current list asset returns:
Asset({` 'class': 'us_equity',
'easy_to_borrow': True,
'exchange': 'OTC',
'fractionable': False,
'id': 'fb514a1e-243c-4334-8b5d-da2b5735037b',
'marginable': False,
'name': 'Tier One Silver Inc Common Shares (Canada)',
'shortable': True,
'status': 'active',
'symbol': 'TSLVF',
'tradable': False})

In its current form, I can't use the class values as it is a python keyword in the following:
assdf = pd.DataFrame({
'asset_class':[asset.class for asset in active_assets if asset.tradable],
'symbol':[asset.symbol for asset in active_assets if asset.tradable],
'exchange': [asset.exchange for asset in active_assets if asset.tradable],
'shortable': [asset.shortable for asset in active_assets if asset.tradable],
'fractionable': [asset.fractionable for asset in active_assets if asset.tradable],
'marginable': [asset.marginable for asset in active_assets if asset.tradable]})

Describe the solution you'd like.

No response

Describe an alternate solution.

Maybe there's a workaround and I'd appreciate the advice

Anything else? (Additional Context)

No response

@gnvk
Copy link
Contributor

gnvk commented Feb 15, 2022

I know about these workarounds:

getattr(asset, "class")

and

asset._raw["class"]

@drew887
Copy link
Contributor

drew887 commented Apr 29, 2022

@tallm0cha sorry about this one, due to the current design of the api these types are all just essentially fancy wrappers around the raw maps; this kind of thing is one of the main points we wanted to address in the new design of the sdk 😞

Does the workaround suggested above work for you ? Am I good to close out this issue?

@drew887 drew887 added the question Further information is requested label Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants