Company Fundamentals¶
Use the company fundamentals methods on MarketData to fetch financial ratios, statements, corporate actions, and shareholding data for listed companies.
These methods support equity symbols such as INFY, TCS, RELIANCE, and HDFCBANK.
Basic Usage¶
from nubra_python_sdk.start_sdk import InitNubraSdk, NubraEnv
from nubra_python_sdk.marketdata.market_data import MarketData
from nubra_python_sdk.marketdata.validation import (
ExchangeEnum,
FundamentalsTypeEnum,
ResultTypeEnum,
)
# Use NubraEnv.PROD for live usage or NubraEnv.UAT for sandbox testing.
nubra = InitNubraSdk(NubraEnv.PROD, env_creds=True)
market_data = MarketData(nubra)
ratios = market_data.key_ratios("INFY")
print("KEY RATIOS:")
print(ratios)
cash_flow = market_data.cash_flow("INFY", limit=5)
print("CASH FLOW:")
print(cash_flow)
balance_sheet = market_data.balance_sheet("HDFCBANK", limit=5)
print("BALANCE SHEET:")
print(balance_sheet)
profit_loss = market_data.profit_loss(
"RELIANCE",
result_type=ResultTypeEnum.QUARTERLY,
limit=8,
)
print("PROFIT AND LOSS:")
print(profit_loss)
actions = market_data.corp_actions("TCS")
print("CORPORATE ACTIONS:")
print(actions)
fincode = ratios.result.keyratios_shareholding.fincode
shareholding = market_data.shareholding_pattern(fincode, limit=4)
print("SHAREHOLDING PATTERN:")
print(shareholding)
Available Methods¶
| Method | Purpose |
|---|---|
key_ratios(symbol, ...) |
Key financial ratios and shareholding summary for a company |
cash_flow(symbol, ...) |
Historical cash flow statement rows |
balance_sheet(symbol, ...) |
Historical balance sheet rows |
profit_loss(symbol, ...) |
Historical profit and loss rows |
corp_actions(symbol, ...) |
Corporate actions such as dividend, bonus, split, rights, buyback, merger, and demerger events |
shareholding_pattern(fincode, ...) |
Quarterly shareholding breakdown using company fincode |
Enums¶
from nubra_python_sdk.marketdata.validation import (
ExchangeEnum,
FundamentalsTypeEnum,
ResultTypeEnum,
)
| Enum | Values |
|---|---|
ExchangeEnum |
ExchangeEnum.NSE, ExchangeEnum.BSE, ExchangeEnum.MCX |
FundamentalsTypeEnum |
FundamentalsTypeEnum.STANDALONE, FundamentalsTypeEnum.CONSOLIDATED |
ResultTypeEnum |
ResultTypeEnum.ANNUAL, ResultTypeEnum.QUARTERLY |
Key Ratios¶
response = market_data.key_ratios(
"INFY",
exchange=ExchangeEnum.NSE,
peers="TCS,WIPRO",
fundamentals_type=FundamentalsTypeEnum.CONSOLIDATED,
)
print(response.result.keyratios_shareholding.fincode)
print(response.result.keyratios_shareholding.key_ratios)
print(response)
The response includes result.keyratios_shareholding, with fields such as:
symbolfincodekey_ratios- shareholding summary fields
Use the returned fincode when calling shareholding_pattern().
Cash Flow¶
response = market_data.cash_flow(
"INFY",
exchange=ExchangeEnum.NSE,
fundamentals_type=FundamentalsTypeEnum.CONSOLIDATED,
limit=5,
offset=0,
)
print(response.result.cash_flow.dates)
print(response.result.cash_flow.data)
print(response)
The response includes result.cash_flow:
dates: statement periods such as202603,202503data: cash flow rows withlabel,is_key_ratio, andvalues
Balance Sheet¶
response = market_data.balance_sheet(
"HDFCBANK",
exchange=ExchangeEnum.NSE,
fundamentals_type=FundamentalsTypeEnum.CONSOLIDATED,
limit=5,
)
print(response.result.balance_sheet.dates)
print(response.result.balance_sheet.data)
print(response)
The response includes result.balance_sheet:
dates: statement periodsdata: balance sheet rows withlabel,is_key_ratio, andvalues
Some bank-specific rows may be null for non-bank companies.
Profit And Loss¶
annual = market_data.profit_loss(
"RELIANCE",
result_type=ResultTypeEnum.ANNUAL,
limit=5,
)
quarterly = market_data.profit_loss(
"RELIANCE",
result_type=ResultTypeEnum.QUARTERLY,
limit=8,
)
print("ANNUAL PROFIT AND LOSS:")
print(annual)
print("QUARTERLY PROFIT AND LOSS:")
print(quarterly)
The response includes result.profit_loss:
dates: annual or quarterly periodsdata: P&L rows withlabel,is_key_ratio, andvalues
Use ResultTypeEnum.ANNUAL for annual statements and ResultTypeEnum.QUARTERLY for quarterly statements.
Corporate Actions¶
response = market_data.corp_actions("TCS", exchange=ExchangeEnum.NSE)
for action in response.result.corporate_actions:
print(action.corp_action_name)
print(action.action_type)
print(action.upcoming_event)
print(action.record_date)
print(response)
The response includes result.corporate_actions, with fields such as:
corp_action_nameaction_typeupcoming_eventrecord_dateexecution_dateratio1ratio2dividend_type
Shareholding Pattern¶
shareholding_pattern() takes a company fincode, not a symbol.
ratios = market_data.key_ratios("INFY", exchange=ExchangeEnum.NSE)
fincode = ratios.result.keyratios_shareholding.fincode
response = market_data.shareholding_pattern(
fincode,
limit=4,
offset=0,
)
print(response.result.shareholding_pattern.dates)
print(response.result.shareholding_pattern.data)
print(response)
The response includes result.shareholding_pattern:
dates: quarterly periodsdata: shareholding buckets such as promoter, institution, and public/retail categories- nested
shareholding_children/childrendata where available
Values are percentages, not absolute share counts.
Parameters¶
| Parameter | Used By | Description |
|---|---|---|
symbol |
key_ratios, cash_flow, balance_sheet, profit_loss, corp_actions |
Equity symbol such as INFY, TCS, RELIANCE |
exchange |
Most methods | Optional exchange enum, usually ExchangeEnum.NSE or ExchangeEnum.BSE |
peers |
key_ratios |
Optional comma-separated peer symbols, such as "TCS,WIPRO" |
fundamentals_type |
key_ratios, cash_flow, balance_sheet, profit_loss |
Optional standalone or consolidated result type |
result_type |
profit_loss |
Optional annual or quarterly result type |
limit |
Statement/shareholding methods | Number of periods to return |
offset |
Statement/shareholding methods | Offset for paginated periods |
fincode |
shareholding_pattern |
Company fincode from key_ratios() |
Important Rules¶
- Call these methods on
MarketData. - Use
key_ratios()first when you need thefincodeforshareholding_pattern(). limitandoffsetcan be used to fetch specific historical windows.- Financial statement responses use period keys such as
202603. - Rows with
is_key_ratio=Truerepresent ratio-style values.