For Ticker MICR.NS we are are not able to get the financial statement date while accessing the works

For Ticker MICR.NS we are are not able to get the financial statement date while accessing the workspace using python from the below code.
Can you able to assist us on this.
######eikon_download.py##############
import eikon as ek
import pandas as pd
import yaml
import time
import re
from itertools import repeat
from multiprocessing import Pool
import lseg.data as ld
ld.open_session()
ek.set_app_key('980d59c17ef047d08e04fd4de1294fd7bf6966fd')
class EikonDownload:
"""
Eikon downloader.
Reads a YAML file for instruments, fields, and parameters to extract data from Eikon.
"""
def __init__(self, download_config):
"""
Initialize with input from YAML file.
:param download_config: Path to YAML file.
"""
self._file_name = download_config
self._yaml_data = None
self.load_config(download_config)
super().__init__()
def set_instrument(self, instrument_list):
"""Set the instrument list to download."""
self._yaml_data['instrument'] = instrument_list
def set_field(self, field_list):
"""Set the list of fields to download from Eikon."""
self._yaml_data['field'] = field_list
def get_download_config(self):
"""
Get instruments, fields, and parameters from the config.
:return: (instrument list, field list, parameters)
"""
return (
self._yaml_data['instrument'],
self._yaml_data['field'],
self._yaml_data['parameter']
)
def load_config(self, file_name):
"""
Load YAML file containing download inputs.
:param file_name: YAML file path.
:return: Tuple (success: bool, error: Exception or None)
"""
try:
with open(file_name, 'r') as stream:
self._yaml_data = yaml.safe_load(stream)
except yaml.YAMLError as ex:
self._yaml_data = None
return False, ex
return True, None
@staticmethod
def download(instrument_list, field_list, parameters, rename_list, key, yaml_file, logger):
"""
Download data as a DataFrame.
:return: (DataFrame, error list)
"""
err_list, data_list = [], []
total_instruments = len(instrument_list)
logger.info(f'Total instruments in {key}: {yaml_file} : {total_instruments}')
counter = 0
for instrument in instrument_list:
succeed = False
while not succeed:
try:
#ld.get_data()
data_tuple = ek.get_data(instrument, field_list, parameters)
counter += 1
logger.info(f'Instrument {counter}/{total_instruments}: {instrument}')
data_list.append(data_tuple[0])
err_list.append(data_tuple[1]) if data_tuple[1] is not None else None
succeed = True
except Exception as e:
logger.info(e)
time.sleep(0.2)
# Remove duplicate DataFrames
def are_equal(df1, df2):
return df1.equals(df2)
unique_data = []
for df in data_list:
if not any(are_equal(df, u_df) for u_df in unique_data):
unique_data.append(df)
logger.info(f"Data list deduplication count: {len(unique_data)}")
# Reset indices
unique_data = [df.reset_index(drop=True) for df in unique_data]
logger.info(f"Before filtering structure: count={len(unique_data)}")
# Identify the most common structure
def most_common_structure(dfs):
structures = [tuple(df.columns) for df in dfs]
return max(set(structures), key=structures.count)
common_structure = most_common_structure(unique_data)
filtered_data = [df for df in unique_data if tuple(df.columns) == common_structure]
logger.info(f"After filtering structure: count={len(filtered_data)}")
result = pd.concat(filtered_data, ignore_index=True)
logger.info(f"Final data:\n{result}")
if rename_list:
result.columns = rename_list
#result.set_axis(rename_list, axis='columns', inplace=True)
return result, err_list
def download_using_config(self, key, yaml_file, logger):
"""
Download data as a DataFrame using the config file.
:return: (DataFrame, error list)
"""
result, err = EikonDownload.download(
self._yaml_data['instrument'],
self._yaml_data['field'],
self._yaml_data['parameter'],
self._yaml_data['rename'],
key,
yaml_file,
logger
)
logger.info("Completed download")
return result, err
Answers
-
Thank you for reaching out to us.
Typically, we don't debug the entire codebase. According to the code, the client is using the ek.get_data method to retrieve data.
data_tuple = ek.get_data(instrument, field_list, parameters)
The client needs to provide the values in the instrument, field_list, and prarameters variables when the problem occurred. Therefore, we can test it.
Otherwise, the client can call the ek.set_log_level(1) before calling the ek.set_app_key method to generate an API log.
ek.set_log_level(1) ek.set_app_key('980d59c17ef047d08e04fd4de1294fd7bf6966fd')
Then, please share a log file when the problem occurred.
0 -
Hello thanks for the assistance.
Client is using below financial yaml to get the data but MICR.NS ticker we are not unable to get the financial statement date
Can you assist me us to find the reason!
financial_download.yaml:
instrument:- MICR.NS
field:
- TR.F.BalanceSheet.periodenddate
- TR.F.BalanceSheet.companyCurrency
- TR.F.BalanceSheet.FCC
- TR.F.BalanceSheet.FCCNameShort
- TR.F.BalanceSheet
- TR.F.IncomeStatement.periodenddate
- TR.F.IncomeStatement.companyCurrency
- TR.F.IncomeStatement.FCC
- TR.F.IncomeStatement.FCCNameShort
- TR.F.IncomeStatement
- TR.F.CashFlowStatement.periodenddate
- TR.F.CashFlowStatement.companyCurrency
- TR.F.CashFlowStatement.FCC
- TR.F.CashFlowStatement.FCCNameShort
- TR.F.CashFlowStatement
- TR.OperatingIncome
- TR.TotalOperatingExpense
#parameter: {Period: FY0, Frq: FY, reportingState: Rsdt, curn: USD}
parameter: {Period: FY0, Frq: FY,curn: USD}
rename: - instrument_id
- stat_date
- currency_code
- fin_metric_short
- fin_metric_long
- fin_metric_value
- stat_date
- currency_code
- fin_metric_short
- fin_metric_long
- fin_metric_value
- stat_date
- currency_code
- fin_metric_short
- fin_metric_long
- fin_metric_value
- fin_metric_value
- fin_metric_value
Thank you
0 -
The code should look like this:
df = ld.get_data( universe = ['MICR.NS'], fields = [ "TR.F.BalanceSheet.periodenddate", "TR.F.BalanceSheet.companyCurrency", "TR.F.BalanceSheet.FCC", "TR.F.BalanceSheet.FCCNameShort", "TR.F.BalanceSheet", "TR.F.IncomeStatement.periodenddate", "TR.F.IncomeStatement.companyCurrency", "TR.F.IncomeStatement.FCC", "TR.F.IncomeStatement.FCCNameShort", "TR.F.IncomeStatement", "TR.F.CashFlowStatement.periodenddate", "TR.F.CashFlowStatement.companyCurrency", "TR.F.CashFlowStatement.FCC", "TR.F.CashFlowStatement.FCCNameShort", "TR.F.CashFlowStatement", "TR.OperatingIncome", "TR.TotalOperatingExpense" ], parameters = {'SDate':'0','EDate':'-2','Period': 'FY0','ConsolBasis':'Consolidated'}) df
The output is:
You can test it on Codebook or compare the data from the Workspace Excel.
0 -
Hello. as per client,
we are currently using these parameters for our listed companies:
- Current:
{Period: FY0, Frq: FY, reportingState: Rsdt, curn: USD}
- Suggested:
{'SDate':'0', 'EDate':'-2', 'Period':'FY0', 'ConsolBasis':'Consolidated'}
If we switch to the suggested set, will it affect any of the other tickers?
0 - Current:
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 688 Datastream
- 1.4K DSS
- 624 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 557 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 276 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 692 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 105 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 10 Wealth Management Web Services
- 91 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛