Symbol
yafin.Symbol
Bases: SymbolBase
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 |
Client | 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 Symbol instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ticker
|
str
|
Ticker symbol. |
required |
close()
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)
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)
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()
Get quote type for the ticker.
Returns: Quote type response result json.
get_quote_summary_all_modules()
Get quote summary for all modules for the ticker.
Returns: Quote summary with all modules response result json.
get_asset_profile()
Get asset profile for the ticker.
Returns: Quote summary with asset profile module response result json.
get_summary_profile()
Get summary profile for the ticker.
Returns: Quote summary with summary profile module response result json.
get_summary_detail()
Get summary detail for the ticker.
Returns: Quote summary with summary detail module response result json.
get_price()
Get price data for the ticker.
Returns: Quote summary with price data module response result json.
get_default_key_statistics()
Get default key statistics for the ticker.
Returns: Quote summary with default key statistics module response result json.
get_financial_data()
Get financial data for the ticker.
Returns: Quote summary with financial data module response result json.
get_calendar_events()
Get calendar events for the ticker.
Returns: Quote summary with calendar events module response result json.
get_sec_filings()
Get sec filings for the ticker.
Returns: Quote summary with sec filings module response result json.
get_upgrade_downgrade_history()
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()
Get institution ownership for the ticker.
Returns: Quote summary with institution ownership module response results json.
get_fund_ownership()
Get fund ownership for the ticker.
Returns: Quote summary with fund ownership module response results json.
get_major_direct_holders()
Get major direct holders for the ticker.
Returns: Quote summary with direct holders module response result json.
get_major_holders_breakdown()
Get major holders breakdown for the ticker.
Returns: Quote summary with holders breakdown module response result json.
get_insider_transactions()
Get insider transactions for the ticker.
Returns: Quote summary with insider transactions module response results json.
get_insider_holders()
Get insider holders for the ticker.
Returns: Quote summary with insider holders module response results json.
get_net_share_purchase_activity()
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()
Get earnings for the ticker.
Returns: Quote summary with earnings module response result json.
get_earnings_history()
Get earnings history for the ticker.
Returns: Quote summary with earnings history module response results json.
get_earnings_trend()
Get earnings trend for the ticker.
Returns: Quote summary with earnings trend module response results json.
get_industry_trend()
Get industry trend for the ticker.
Returns: Quote summary with industry trend module response result json.
get_index_trend()
Get index trend for the ticker.
Returns: Quote summary with index trend module response result json.
get_sector_trend()
Get sector trend for the ticker.
Returns: Quote summary with sector trend module response result json.
get_recommendation_trend()
Get recommendation trend for the ticker.
Returns: Quote summary with recommendation trend module response results json.
get_page_views()
Get page views for the ticker.
Returns: Quote summary with page views module response result json.
get_income_statement(frequency, period1=None, period2=None)
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)
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)
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()
Get options data for the ticker.
Returns: Options response result json.
get_search()
Get search results for the ticker.
Returns: Search result json.
get_recommendations()
Get analyst recommendations for the ticker.
Returns: Recommendations response result json.
get_insights()
Get insights for the ticker.
Returns: Insights response result json.
get_ratings()
Get ratings for the ticker.
Returns: Ratings result json.