Skip to content

AsyncSymbols

yafin.AsyncSymbols

Bases: SymbolsBase

Asynchronous Symbols class for specified tickers.

HTTP resources closing

Uses http resources, so do not forget to close them after use to avoid resource leakage or use context manager.

Attributes:

Name Type Description
ticker

Ticker symbol.

_client AsyncClient | None

Client instance, that is used for all http requests. (Is lazily initialized.)

Methods:

Name Description
get_chart

Get chart data for the ticker.

get_quote

Get quote for the ticker.

get_quote_type

Get quote type for the ticker.

get_quote_summary_all_modules

Get quote summary for all modules for the ticker.

get_asset_profile

Get asset profile for the ticker.

get_summary_profile

Get summary profile for the ticker.

get_summary_detail

Get summary detail for the ticker.

get_price

Get price data for the ticker.

get_default_key_statistics

Get default key statistics for the ticker.

get_financial_data

Get financial data for the ticker.

get_calendar_events

Get calendar events for the ticker.

get_sec_filings

Get sec filings for the ticker.

get_upgrade_downgrade_history

Get upgrade downgrade history for the ticker.

get_institution_ownership

Get institution ownership for the ticker.

get_fund_ownership

Get fund ownership for the ticker.

get_major_direct_holders

Get major direct holders for the ticker.

get_major_holders_breakdown

Get major holders breakdown for the ticker.

get_insider_transactions

Get insider transactions for the ticker.

get_insider_holders

Get insider holders for the ticker.

get_net_share_purchase_activity

Get net share purchase activity for the ticker.

get_earnings

Get earnings for the ticker.

get_earnings_history

Get earnings history for the ticker.

get_earnings_trend

Get earnings trend for the ticker.

get_industry_trend

Get industry trend for the ticker.

get_index_trend

Get index trend for the ticker.

get_sector_trend

Get sector trend for the ticker.

get_recommendation_trend

Get recommendation trend for the ticker.

get_page_views

Get page views for the ticker.

get_income_statement

Get income statement for the ticker.

get_balance_sheet

Get balance sheet for the ticker.

get_cash_flow

Get cash flow statement for the ticker.

get_options

Get options data for the ticker.

get_search

Get search results for the ticker.

get_recommendations

Get analyst recommendations for the ticker.

get_insights

Get insights for the ticker.

get_ratings

Get ratings for the ticker.

__init__(tickers)

Create Symbols instance.

Parameters:

Name Type Description Default
tickers str

Comma-separated ticker symbols.

required

close() async

Release the client if open for current symbol.

Note

Only if no other symbols are using the client singleton, is the client closed.

get_chart(interval, period_range=None, period1=None, period2=None, include_pre_post=None, include_div=True, include_split=True, include_earn=True, include_capital_gain=True) async

Get chart data for tickers in series requests.

Parameters:

Name Type Description Default
interval str

Data interval.

required
period_range str | None

Range of the period.

None
period1 int | float | None

Start timestamp in seconds. (optional, default: None)

None
period2 int | float | None

End timestamp in seconds. (optional, default: None)

None
include_pre_post bool | None

Whether to include pre and post market.

None
include_div bool

Whether to include dividends.

True
include_split bool

Whether to include stock splits.

True
include_earn bool

Whether to include earnings.

True
include_capital_gain bool

Whether to include capital gains.

True

Returns: List of chart response result jsons.

Note

Even though the the endpoint param is called range, period_range was chosen to avoid collision with python built-in method name.

get_quote(include_pre_post=None) async

Get quote for tickers in a single request.

Parameters:

Name Type Description Default
include_pre_post bool | None

Whether to include pre and post market.

None

Returns: List of quote response result jsons.

get_quote_type() async

Get quote type for tickers in a single request.

Returns: List of quote type response result jsons.

get_quote_summary_all_modules() async

Get quote summary for all modules for tickers.

Returns: List of quote summary with all modules response result jsons.

get_asset_profile() async

Get asset profile for tickers.

Returns: List of quote summary with asset profile module response result jsons.

get_summary_profile() async

Get summary profile for tickers.

Returns:

Type Description
list[dict[str, Any]]

List of quote summary with summary profile module response result jsons.

get_summary_detail() async

Get summary detail for tickers.

Returns: List of quote summary with summary detail module response result jsons.

get_price() async

Get price data for tickers.

Returns: List of quote summary with price data module response result jsons.

get_default_key_statistics() async

Get default key statistics for tickers.

Returns:

Type Description
list[dict[str, Any]]

List of quote summary with default key statistics module response result

list[dict[str, Any]]

jsons.

get_financial_data() async

Get financial data for tickers.

Returns: List of quote summary with financial data module response result jsons.

get_calendar_events() async

Get calendar events for tickers.

Returns:

Type Description
list[dict[str, Any]]

List of quote summary with calendar events module response result jsons.

get_sec_filings() async

Get sec filings for tickers.

Returns: List of quote summary with sec filings module response result jsons.

get_upgrade_downgrade_history() async

Get upgrade downgrade history for tickers.

Returns:

Type Description
list[list[dict[str, Any]]]

List of quote summary with upgrade downgrade history module response results

list[list[dict[str, Any]]]

jsons.

get_institution_ownership() async

Get institution ownership for tickers.

Returns:

Type Description
list[list[dict[str, Any]]]

List of quote summary with institution ownership module response results

list[list[dict[str, Any]]]

jsons.

get_fund_ownership() async

Get fund ownership for tickers.

Returns:

Type Description
list[list[dict[str, Any]]]

List of quote summary with fund ownership module response results jsons.

get_major_direct_holders() async

Get major direct holders for tickers.

Returns: List of quote summary with direct holders module response result jsons.

get_major_holders_breakdown() async

Get major holders breakdown for tickers.

Returns:

Type Description
list[dict[str, Any]]

List of quote summary with holders breakdown module response result jsons.

get_insider_transactions() async

Get insider transactions for tickers.

Returns:

Type Description
list[list[dict[str, Any]]]

List of quote summary with insider transactions module response results

list[list[dict[str, Any]]]

jsons.

get_insider_holders() async

Get insider holders for tickers.

Returns:

Type Description
list[list[dict[str, Any]]]

List of quote summary with insider holders module response results jsons.

get_net_share_purchase_activity() async

Get net share purchase activity for tickers.

Returns:

Type Description
list[dict[str, Any]]

List of quote summary with net share purchase activity module response

list[dict[str, Any]]

result jsons.

get_earnings() async

Get earnings for tickers.

Returns: List of quote summary with earnings module response result jsons.

get_earnings_history() async

Get earnings history for tickers.

Returns:

Type Description
list[list[dict[str, Any]]]

List of quote summary with earnings history module response results jsons.

get_earnings_trend() async

Get earnings trend for tickers.

Returns:

Type Description
list[list[dict[str, Any]]]

List of quote summary with earnings trend module response results jsons.

get_industry_trend() async

Get industry trend for tickers.

Returns: List of quote summary with industry trend module response result jsons.

get_index_trend() async

Get index trend for the ticker.

Returns: List of quote summary with index trend module response result jsons.

get_sector_trend() async

Get sector trend for tickers.

Returns: List of quote summary with sector trend module response result jsons.

get_recommendation_trend() async

Get recommendation trend for tickers.

Returns:

Type Description
list[list[dict[str, Any]]]

List of quote summary with recommendation trend module response results

list[list[dict[str, Any]]]

jsons.

get_page_views() async

Get page views for tickers.

Returns: List of quote summary with page views module response result jsons.

get_income_statement(frequency, period1=None, period2=None) async

Get income statement for tickers.

Parameters:

Name Type Description Default
frequency str

annual, quarterly or trailing.

required
period1 int | float | None

Start timestamp in seconds. (optional, default: 1st Jan 2020 timestamp)

None
period2 int | float | None

End timestamp in seconds. (optional, default: now timestamp)

None

Returns: List of income statement response results jsons.

get_balance_sheet(frequency, period1=None, period2=None) async

Get balance sheet for tickers.

Parameters:

Name Type Description Default
frequency str

annual, quarterly or trailing.

required
period1 int | float | None

Start timestamp in seconds. (optional, default: 1st Jan 2020 timestamp)

None
period2 int | float | None

End timestamp in seconds. (optional, default: now timestamp)

None

Returns: List of balance sheet response results jsons.

get_cash_flow(frequency, period1=None, period2=None) async

Get cash flow statement for tickers.

Parameters:

Name Type Description Default
frequency str

annual, quarterly or trailing.

required
period1 int | float | None

Start timestamp in seconds. (optional, default: 1st Jan 2020 timestamp)

None
period2 int | float | None

End timestamp in seconds. (optional, default: now timestamp)

None

Returns: List of cash flow response results jsons.

get_options() async

Get options data for tickers.

Returns: List of options response result jsons.

Get search results for tickers in a single request.

Returns: Search response result json.

get_recommendations() async

Get analyst recommendations for tickers in a single request.

Returns: List of recommendations response result jsons.

get_insights() async

Get insights for tickers in a single request.

Returns: List of insights response result jsons.

get_ratings() async

Get ratings for tickers.

Returns: List of ratings response result jsons.