def coordinates_for_asset(result: DataFrameWithInfo): return tuple( itertools.chain.from_iterable( GsDataApi.get_many_coordinates( mkt_type=t, mkt_asset=a, return_type=MarketDataCoordinate, limit=10000) for t, a in zip(result.mkt_type, result.mkt_asset)))
def test_get_many_coordinates(mocker): coordinates = [{ 'id': 'MC123', 'name': 'A_B_C_D_E.F1' }, { 'id': 'MC123', 'name': 'A_B_C_D_E.F2' }] mocker.patch.object(GsSession.__class__, 'default_value', return_value=GsSession.get(Environment.QA, 'client_id', 'secret')) GsSession.current._post = mocker.Mock( return_value={'results': coordinates}) response = GsDataApi.get_many_coordinates(mkt_type='A', mkt_asset='B') assert response == ('A_B_C_D_E.F1', 'A_B_C_D_E.F2')