Please find the below question from client where client has all delayed permission.

Options
shaikh.ahmed
edited May 9 in Datastream

I'm trying to pull data for the following tickers:

FACTOR_LIST = ['<.NSEI>', '<.NISM250>', '<.NV20>', '<.NIFMOM>', '<OIL>']

But I only get results for the first 2.

This is my code:

def get_lseg_data(self, factor_or_model_or_bench: str):
"""
Pulls all portfolio market data from server.
Use 'ticker' or 'factor' or 'benchmark' as keywords for what you want to pull.
"""
data_list = []

if factor_or_model_or_bench == 'ticker':
tix = self.tickers
field= 'P'
elif factor_or_model_or_bench == 'factor':
tix = self.factors
field = 'PI'
elif factor_or_model_or_bench == 'benchmark':
tix = self.benchmark
field = 'PI'

for i in tqdm(range(0, len(tix), self.chunk_size)):
try:
chunk = ','.join(tix[i:i+self.chunk_size])
chunk_data = self.ds.get_data(chunk, fields=[field], start='2015-01-01')
data_list.append(chunk_data)
except Exception as e:
print(e)

port_data = pd.concat(data_list, axis=1)

if factor_or_model_or_bench == 'ticker':
# Create a dictionary mapping ISIN to Ticker
isin_to_ticker = dict(zip(self.portfolio_info['ISIN'], self.portfolio_info['Ticker']))

# Rename columns by mapping ISINs to Tickers at the 'Instrument' level
port_data.rename(columns=isin_to_ticker, level='Instrument', inplace=True)

port_data.columns = [col[0] for col in port_data.columns]

rets_data = self._convert_to_rets(port_data)

rets_data = rets_data.replace(np.nan, 0)

return rets_data

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @shaikh.ahmed

    Thank you for reaching out to us.

    Please contact the Datastream support team directlty via MyAccount to verify if those RICs are available on Datastream.

    image.png

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.