def __get_positions_data(mqids: List[str]) -> Dict: response = GsAssetApi.get_many_assets_data( id=mqids, fields=['id', 'name', 'bbid']) data = {} for asset in response: data[get(asset, 'id')] = dict(name=get(asset, 'name'), bbid=get(asset, 'bbid')) return data
def get_my_baskets(user_id: str = None) -> Optional[pd.DataFrame]: """ Retrieve a list of baskets a user is permissioned to :param user_id: Marquee user/app ID (default is current application's id) :return: dataframe of baskets user has access to **Usage** Retrieve a list of baskets a user is permissioned to **Examples** Retrieve a list of baskets the current user is permissioned to >>> from gs_quant.markets.indices_utils import * >>> >>> get_my_baskets() """ user_id = user_id if user_id is not None else GsSession.current.client_id tag = f'Custom Basket:{user_id}' response = GsMonitorsApi.get_monitors(tags=tag) if len(response): row_groups = get(response, '0.parameters.row_groups') my_baskets = [] for row_group in row_groups: entity_ids = [entity.id for entity in row_group.entity_ids] baskets = GsAssetApi.get_many_assets_data( id=entity_ids, fields=['id', 'ticker', 'name', 'liveDate']) my_baskets += [ dict(monitor_name=row_group.name, id=get(basket, 'id'), ticker=get(basket, 'ticker'), name=get(basket, 'name'), live_date=get(basket, 'liveDate')) for basket in baskets ] return pd.DataFrame(my_baskets)