Skip to content

AsyncSymbol

yafin.AsyncSymbol

Bases: SymbolBase

Asynchronous Symbol class for a specific ticker.

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__(ticker)

Create new AsyncSymbol instance.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

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 the ticker.

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: Chart response result json.

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 the ticker.

Parameters:

Name Type Description Default
include_pre_post bool | None

Whether to include pre and post market.

None

Returns: Quote response result json.

get_quote_type() async

Get quote type for the ticker.

Returns: Quote type response result json.

get_quote_summary_all_modules() async

Get quote summary for all modules for the ticker.

Returns: Quote summary with all modules response result json.

get_asset_profile() async

Get asset profile for the ticker.

Returns: Quote summary with asset profile module response result json.

get_summary_profile() async

Get summary profile for the ticker.

Returns: Quote summary with summary profile module response result json.

get_summary_detail() async

Get summary detail for the ticker.

Returns: Quote summary with summary detail module response result json.

get_price() async

Get price data for the ticker.

Returns: Quote summary with price data module response result json.

get_default_key_statistics() async

Get default key statistics for the ticker.

Returns: Quote summary with default key statistics module response result json.

get_financial_data() async

Get financial data for the ticker.

Returns: Quote summary with financial data module response result json.

get_calendar_events() async

Get calendar events for the ticker.

Returns: Quote summary with calendar events module response result json.

get_sec_filings() async

Get sec filings for the ticker.

Returns: Quote summary with sec filings module response result json.

get_upgrade_downgrade_history() async

Get upgrade downgrade history for the ticker.

Returns:

Type Description
list[dict[str, Any]]

Quote summary with upgrade downgrade history module response results json.

get_institution_ownership() async

Get institution ownership for the ticker.

Returns: Quote summary with institution ownership module response results json.

get_fund_ownership() async

Get fund ownership for the ticker.

Returns: Quote summary with fund ownership module response results json.

get_major_direct_holders() async

Get major direct holders for the ticker.

Returns: Quote summary with direct holders module response result json.

get_major_holders_breakdown() async

Get major holders breakdown for the ticker.

Returns: Quote summary with holders breakdown module response result json.

get_insider_transactions() async

Get insider transactions for the ticker.

Returns: Quote summary with insider transactions module response results json.

get_insider_holders() async

Get insider holders for the ticker.

Returns: Quote summary with insider holders module response results json.

get_net_share_purchase_activity() async

Get net share purchase activity for the ticker.

Returns:

Type Description
dict[str, Any]

Quote summary with net share purchase activity module response result json.

get_earnings() async

Get earnings for the ticker.

Returns: Quote summary with earnings module response result json.

get_earnings_history() async

Get earnings history for the ticker.

Returns: Quote summary with earnings history module response results json.

get_earnings_trend() async

Get earnings trend for the ticker.

Returns: Quote summary with earnings trend module response results json.

get_industry_trend() async

Get industry trend for the ticker.

Returns: Quote summary with industry trend module response result json.

get_index_trend() async

Get index trend for the ticker.

Returns: Quote summary with index trend module response result json.

get_sector_trend() async

Get sector trend for the ticker.

Returns: Quote summary with sector trend module response result json.

get_recommendation_trend() async

Get recommendation trend for the ticker.

Returns: Quote summary with recommendation trend module response results json.

get_page_views() async

Get page views for the ticker.

Returns: Quote summary with page views module response result json.

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

Get income statement for the ticker.

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: Income statement response results json.

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

Get balance sheet for the ticker.

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: Balance sheet response results json.

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

Get cash flow statement for the ticker.

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: Cash flow response results json.

get_options() async

Get options data for the ticker.

Returns: Options response result json.

Get search results for the ticker.

Returns: Search result json.

get_recommendations() async

Get analyst recommendations for the ticker.

Returns: Recommendations response result json.

get_insights() async

Get insights for the ticker.

Returns: Insights response result json.

get_ratings() async

Get ratings for the ticker.

Returns: Ratings result json.