Skip to content

Symbol

yafin.AsyncSymbol

Bases: object

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.)

Source code in yafin/symbol.py
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
class AsyncSymbol(object):
    """Symbol class for a specific ticker.

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

    Attributes:
        ticker: Ticker symbol.
        _client:
            client instance, that is used for all http requests.
                (Is lazily initialized.)
    """

    def __init__(self, ticker: str) -> None:
        """Create new AsyncSymbol instance.

        Args:
            ticker: Ticker symbol.
        """
        self.ticker = ticker
        self._client: AsyncClient | None = None

    async def _get_client(self) -> None:
        if self._client is None:
            self._client = await _ClientManager._get_client()

    async def close(self) -> None:
        """Release the client if open for current symbol.

        Note:
            Only if no other symbols are using the client singleton, is the client
                closed.
        """
        if self._client:
            await _ClientManager._release_client()
            self._client = None

    async def __aenter__(self) -> Self:
        """When entering context manager, get the client."""
        await self._get_client()
        return self

    async def __aexit__(
        self,
        exc_type: Type[BaseException] | None = None,
        exc_val: BaseException | None = None,
        exc_tb: TracebackType | None = None,
    ) -> None:
        """When closing context manager, release the client."""
        await self.close()

    @_log_args
    async def get_chart(
        self,
        period_range: str,
        interval: str,
        include_div: bool = True,
        include_split: bool = True,
        include_earn: bool = True,
        include_capital_gain: bool = True,
    ) -> ChartResult:
        """Get chart data for the ticker.

        Args:
            period_range: Range of the period.
            interval: Data interval.
            include_div: Whether to include dividends.
            include_split: Whether to include stock splits.
            include_earn: Whether to include earnings.
            include_capital_gain: Whether to include capital gains.

        Returns: Chart response result json.
        """
        events_list = []

        if include_div:
            events_list.append('div')

        if include_split:
            events_list.append('split')

        if include_earn:
            events_list.append('earn')

        if include_capital_gain:
            events_list.append('capitalGain')

        events = ','.join(events_list) if events_list else None

        await self._get_client()
        chart_json = await self._client.get_chart(
            self.ticker, period_range, interval, events
        )
        return chart_json['chart']['result'][0]

    @_log_args
    async def get_quote(self) -> QuoteResult:
        """Get quote for the ticker.

        Returns: Quote response result json.
        """
        await self._get_client()
        quote_json = await self._client.get_quote(self.ticker)
        return quote_json['quoteResponse']['result'][0]

    @_log_args
    async def get_quote_type(self) -> QuoteTypeResult:
        """Get quote type for the ticker.

        Returns: Quote type response result json.
        """
        await self._get_client()
        quote_type_json = await self._client.get_quote_type(self.ticker)
        return quote_type_json['quoteType']['result'][0]

    @_log_args
    async def get_quote_summary_all_modules(self) -> QuoteSummaryResult:
        """Get quote summary for all modules for the ticker.

        Returns: Quote summary with all modules response result json.
        """
        await self._get_client()
        quote_summary_json = await self._client.get_quote_summary(
            self.ticker, QUOTE_SUMMARY_MODULES
        )
        return quote_summary_json['quoteSummary']['result'][0]

    @_log_args
    async def _get_quote_summary_single_module(
        self, module: str
    ) -> QuoteSummaryModuleResult:
        await self._get_client()
        quote_summary_json = await self._client.get_quote_summary(self.ticker, module)
        return quote_summary_json['quoteSummary']['result'][0][module]

    @_log_args
    async def get_quote_summary_quote_type(self) -> QuoteTypeItem:
        """Get quote type for the ticker.

        Returns: Quote summary with quote type module response result json.
        """
        return await self._get_quote_summary_single_module('quoteType')

    @_log_args
    async def get_asset_profile(self) -> AssetProfile:
        """Get asset profile for the ticker.

        Returns: Quote summary with asset profile module response result json.
        """
        return await self._get_quote_summary_single_module('assetProfile')

    @_log_args
    async def get_summary_profile(self) -> SummaryProfile:
        """Get summary profile for the ticker.

        Returns: Quote summary with summary profile module response result json.
        """
        return await self._get_quote_summary_single_module('summaryProfile')

    @_log_args
    async def get_summary_detail(self) -> SummaryDetail:
        """Get summary detail for the ticker.

        Returns: Quote summary with summary detail module response result json.
        """
        return await self._get_quote_summary_single_module('summaryDetail')

    @_log_args
    async def get_income_statement_history(self) -> list[IncomeStatementItem]:
        """Get income statement history for the ticker.

        Returns:
            Quote summary with income statement history module response results
                json.
        """
        result = await self._get_quote_summary_single_module('incomeStatementHistory')
        return result['incomeStatementHistory']

    @_log_args
    async def get_income_statement_history_quarterly(self) -> list[IncomeStatementItem]:
        """Get income statement history quarterly for the ticker.

        Returns:
            Quote summary with income statement history quarterly module response
                results json.
        """
        result = await self._get_quote_summary_single_module(
            'incomeStatementHistoryQuarterly'
        )
        return result['incomeStatementHistory']

    @_log_args
    async def get_balance_sheet_history(self) -> list[BalanceSheetItem]:
        """Get balance sheet history for the ticker.

        Returns: Quote summary with balance sheet history module response results json.
        """
        result = await self._get_quote_summary_single_module('balanceSheetHistory')
        return result['balanceSheetStatements']

    @_log_args
    async def get_balance_sheet_history_quarterly(self) -> list[BalanceSheetItem]:
        """Get balance sheet history quarterly for the ticker.

        Returns:
            Quote summary with balance sheet history quarterly module response
                results json.
        """
        result = await self._get_quote_summary_single_module(
            'balanceSheetHistoryQuarterly'
        )
        return result['balanceSheetStatements']

    @_log_args
    async def get_cashflow_statement_history(self) -> list[CashflowItem]:
        """Get cashflow statement history for the ticker.

        Returns:
            Quote summary with cashflow statement history module response results
                json.
        """
        result = await self._get_quote_summary_single_module('cashflowStatementHistory')
        return result['cashflowStatements']

    @_log_args
    async def get_cashflow_statement_history_quarterly(self) -> list[CashflowItem]:
        """Get cashflow statement history quarterly for the ticker.

        Returns:
            Quote summary with cashflow statement history quarterly module response
                results json.
        """
        result = await self._get_quote_summary_single_module(
            'cashflowStatementHistoryQuarterly'
        )
        return result['cashflowStatements']

    @_log_args
    async def get_price(self) -> Price:
        """Get price data for the ticker.

        Returns: Quote summary with price data module response result json.
        """
        return await self._get_quote_summary_single_module('price')

    @_log_args
    async def get_default_key_statistics(self) -> DefaultKeyStatistics:
        """Get default key statistics for the ticker.

        Returns: Quote summary with default key statistics module response result json.
        """
        return await self._get_quote_summary_single_module('defaultKeyStatistics')

    @_log_args
    async def get_financial_data(self) -> FinancialData:
        """Get financial data for the ticker.

        Returns: Quote summary with financial data module response result json.
        """
        return await self._get_quote_summary_single_module('financialData')

    @_log_args
    async def get_calendar_events(self) -> CalendarEvents:
        """Get calendar events for the ticker.

        Returns: Quote summary with calendar events module response result json.
        """
        return await self._get_quote_summary_single_module('calendarEvents')

    @_log_args
    async def get_sec_filings(self) -> SecFilings:
        """Get sec filings for the ticker.

        Returns: Quote summary with sec filings module response result json.
        """
        return await self._get_quote_summary_single_module('secFilings')

    @_log_args
    async def get_upgrade_downgrade_history(self) -> list[UpgradeDowngradeHistoryItem]:
        """Get upgrade downgrade history for the ticker.

        Returns:
            Quote summary with upgrade downgrade history module response results
                json.
        """
        result = await self._get_quote_summary_single_module('upgradeDowngradeHistory')
        return result['history']

    @_log_args
    async def get_institution_ownership(self) -> list[InstitutionOwnershipItem]:
        """Get institution ownership for the ticker.

        Returns: Quote summary with institution ownership module response results json.
        """
        result = await self._get_quote_summary_single_module('institutionOwnership')
        return result['ownershipList']

    @_log_args
    async def get_fund_ownership(self) -> list[FundOwnershipItem]:
        """Get fund ownership for the ticker.

        Returns: Quote summary with fund ownership module response results json.
        """
        result = await self._get_quote_summary_single_module('fundOwnership')
        return result['ownershipList']

    @_log_args
    async def get_major_direct_holders(self) -> MajorDirectHolders:
        """Get major direct holders for the ticker.

        Returns: Quote summary with direct holders module response result json.
        """
        return await self._get_quote_summary_single_module('majorDirectHolders')

    @_log_args
    async def get_major_holders_breakdown(self) -> MajorHoldersBreakdown:
        """Get major holders breakdown for the ticker.

        Returns: Quote summary with holders breakdown module response result json.
        """
        return await self._get_quote_summary_single_module('majorHoldersBreakdown')

    @_log_args
    async def get_insider_transactions(self) -> list[InsiderTransactionItem]:
        """Get insider transactions for the ticker.

        Returns: Quote summary with insider transactions module response results json.
        """
        result = await self._get_quote_summary_single_module('insiderTransactions')
        return result['transactions']

    @_log_args
    async def get_insider_holders(self) -> list[InsiderHolderItem]:
        """Get insider holders for the ticker.

        Returns: Quote summary with insider holders module response results json.
        """
        result = await self._get_quote_summary_single_module('insiderHolders')
        return result['holders']

    @_log_args
    async def get_net_share_purchase_activity(self) -> NetSharePurchaseActivity:
        """Get net share purchase activity for the ticker.

        Returns:
            Quote summary with net share purchase activity module response result
                json.
        """
        return await self._get_quote_summary_single_module('netSharePurchaseActivity')

    @_log_args
    async def get_earnings(self) -> Earnings:
        """Get earnings for the ticker.

        Returns: Quote summary with earnings module response result json.
        """
        return await self._get_quote_summary_single_module('earnings')

    @_log_args
    async def get_earnings_history(self) -> list[EarningsHistoryItem]:
        """Get earnings history for the ticker.

        Returns: Quote summary with earnings history module response results json.
        """
        result = await self._get_quote_summary_single_module('earningsHistory')
        return result['history']

    @_log_args
    async def get_earnings_trend(self) -> list[EarningsTrendItem]:
        """Get earnings trend for the ticker.

        Returns: Quote summary with earnings trend module response results json.
        """
        result = await self._get_quote_summary_single_module('earningsTrend')
        return result['trend']

    @_log_args
    async def get_industry_trend(self) -> IndustryTrend:
        """Get industry trend for the ticker.

        Returns: Quote summary with industry trend module response result json.
        """
        return await self._get_quote_summary_single_module('industryTrend')

    @_log_args
    async def get_index_trend(self) -> IndexTrend:
        """Get index trend for the ticker.

        Returns: Quote summary with index trend module response result json.
        """
        return await self._get_quote_summary_single_module('indexTrend')

    @_log_args
    async def get_sector_trend(self) -> SectorTrend:
        """Get sector trend for the ticker.

        Returns: Quote summary with sector trend module response result json.
        """
        return await self._get_quote_summary_single_module('sectorTrend')

    @_log_args
    async def get_recommendation_trend(self) -> list[RecommendationTrendItem]:
        """Get recommendation trend for the ticker.

        Returns: Quote summary with recommendation trend module response results json.
        """
        result = await self._get_quote_summary_single_module('recommendationTrend')
        return result['trend']

    @_log_args
    async def get_page_views(self) -> PageViews:
        """Get page views for the ticker.

        Returns: Quote summary with page views module response result json.
        """
        return await self._get_quote_summary_single_module('pageViews')

    @_log_args
    async def _get_financials(
        self,
        frequency: str,
        typ: str,
        period1: int | float | None = None,
        period2: int | float | None = None,
    ) -> list[TimeseriesResult]:
        await self._get_client()
        types = get_types_with_frequency(typ, frequency)
        timeseries_json = await self._client.get_timeseries(
            self.ticker, types, period1, period2
        )
        return timeseries_json['timeseries']['result']

    @_log_args
    async def get_income_statement(
        self,
        frequency: str,
        period1: int | float | None = None,
        period2: int | float | None = None,
    ) -> list[TimeseriesResult]:
        """Get income statement for the ticker.

        Args:
            frequency: annual, quarterly or trailing.
            period1: Start timestamp in seconds.
            period2: End timestamp in seconds.

        Returns: Income statement response results json.
        """
        return await self._get_financials(
            frequency, 'income_statement', period1, period2
        )

    @_log_args
    async def get_balance_sheet(
        self,
        frequency: str,
        period1: int | float | None = None,
        period2: int | float | None = None,
    ) -> list[TimeseriesResult]:
        """Get balance sheet for the ticker.

        Args:
            frequency: annual, quarterly or trailing.
            period1: Start timestamp in seconds.
            period2: End timestamp in seconds.

        Returns: Balance sheet response results json.
        """
        return await self._get_financials(frequency, 'balance_sheet', period1, period2)

    @_log_args
    async def get_cash_flow(
        self,
        frequency: str,
        period1: int | float | None = None,
        period2: int | float | None = None,
    ) -> list[TimeseriesResult]:
        """Get cash flow statement for the ticker.

        Args:
            frequency: annual, quarterly or trailing.
            period1: Start timestamp in seconds.
            period2: End timestamp in seconds.

        Returns: Cash flow response results json.
        """
        return await self._get_financials(frequency, 'cash_flow', period1, period2)

    @_log_args
    async def get_options(self) -> OptionChainResult:
        """Get options data for the ticker.

        Returns: Options response result json.
        """
        await self._get_client()
        options_json = await self._client.get_options(self.ticker)
        return options_json['optionChain']['result'][0]

    @_log_args
    async def get_search(self) -> SearchResponseJson:
        """Get search results for the ticker.

        Returns: Search response result json.
        """
        await self._get_client()
        return await self._client.get_search(self.ticker)

    @_log_args
    async def get_recommendations(self) -> RecommendationsFinanceResult:
        """Get analyst recommendations for the ticker.

        Returns: Recommendations response result json.
        """
        await self._get_client()
        recommendations_json = await self._client.get_recommendations(self.ticker)
        return recommendations_json['finance']['result'][0]

    @_log_args
    async def get_insights(self) -> InsightsFinanceResult:
        """Get insights for the ticker.

        Returns: Insights response result json.
        """
        await self._get_client()
        insights_json = await self._client.get_insights(self.ticker)
        return insights_json['finance']['result'][0]

    @_log_args
    async def get_ratings(self) -> RatingsResponseJson:
        """Get ratings for the ticker.

        Returns: Ratings response result json.
        """
        await self._get_client()
        return await self._client.get_ratings(self.ticker)

    @_log_args
    async def get_analysis(self) -> AnalysisResponseJson:
        """Get analysis for the ticker.

        Returns: Analysis response result json.
        """
        await self._get_client()
        return await self._client.get_analysis(self.ticker)

__init__(ticker)

Create new AsyncSymbol instance.

Parameters:

Name Type Description Default
ticker str

Ticker symbol.

required
Source code in yafin/symbol.py
def __init__(self, ticker: str) -> None:
    """Create new AsyncSymbol instance.

    Args:
        ticker: Ticker symbol.
    """
    self.ticker = ticker
    self._client: AsyncClient | None = None

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.

Source code in yafin/symbol.py
async def close(self) -> None:
    """Release the client if open for current symbol.

    Note:
        Only if no other symbols are using the client singleton, is the client
            closed.
    """
    if self._client:
        await _ClientManager._release_client()
        self._client = None

get_chart(period_range, interval, 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
period_range str

Range of the period.

required
interval str

Data interval.

required
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.

Source code in yafin/symbol.py
@_log_args
async def get_chart(
    self,
    period_range: str,
    interval: str,
    include_div: bool = True,
    include_split: bool = True,
    include_earn: bool = True,
    include_capital_gain: bool = True,
) -> ChartResult:
    """Get chart data for the ticker.

    Args:
        period_range: Range of the period.
        interval: Data interval.
        include_div: Whether to include dividends.
        include_split: Whether to include stock splits.
        include_earn: Whether to include earnings.
        include_capital_gain: Whether to include capital gains.

    Returns: Chart response result json.
    """
    events_list = []

    if include_div:
        events_list.append('div')

    if include_split:
        events_list.append('split')

    if include_earn:
        events_list.append('earn')

    if include_capital_gain:
        events_list.append('capitalGain')

    events = ','.join(events_list) if events_list else None

    await self._get_client()
    chart_json = await self._client.get_chart(
        self.ticker, period_range, interval, events
    )
    return chart_json['chart']['result'][0]

get_quote() async

Get quote for the ticker.

Returns: Quote response result json.

Source code in yafin/symbol.py
@_log_args
async def get_quote(self) -> QuoteResult:
    """Get quote for the ticker.

    Returns: Quote response result json.
    """
    await self._get_client()
    quote_json = await self._client.get_quote(self.ticker)
    return quote_json['quoteResponse']['result'][0]

get_quote_summary_all_modules() async

Get quote summary for all modules for the ticker.

Returns: Quote summary with all modules response result json.

Source code in yafin/symbol.py
@_log_args
async def get_quote_summary_all_modules(self) -> QuoteSummaryResult:
    """Get quote summary for all modules for the ticker.

    Returns: Quote summary with all modules response result json.
    """
    await self._get_client()
    quote_summary_json = await self._client.get_quote_summary(
        self.ticker, QUOTE_SUMMARY_MODULES
    )
    return quote_summary_json['quoteSummary']['result'][0]

get_quote_type() async

Get quote type for the ticker.

Returns: Quote type response result json.

Source code in yafin/symbol.py
@_log_args
async def get_quote_type(self) -> QuoteTypeResult:
    """Get quote type for the ticker.

    Returns: Quote type response result json.
    """
    await self._get_client()
    quote_type_json = await self._client.get_quote_type(self.ticker)
    return quote_type_json['quoteType']['result'][0]

get_asset_profile() async

Get asset profile for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_asset_profile(self) -> AssetProfile:
    """Get asset profile for the ticker.

    Returns: Quote summary with asset profile module response result json.
    """
    return await self._get_quote_summary_single_module('assetProfile')

get_summary_profile() async

Get summary profile for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_summary_profile(self) -> SummaryProfile:
    """Get summary profile for the ticker.

    Returns: Quote summary with summary profile module response result json.
    """
    return await self._get_quote_summary_single_module('summaryProfile')

get_summary_detail() async

Get summary detail for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_summary_detail(self) -> SummaryDetail:
    """Get summary detail for the ticker.

    Returns: Quote summary with summary detail module response result json.
    """
    return await self._get_quote_summary_single_module('summaryDetail')

get_income_statement_history() async

Get income statement history for the ticker.

Returns:

Type Description
list[IncomeStatementItem]

Quote summary with income statement history module response results json.

Source code in yafin/symbol.py
@_log_args
async def get_income_statement_history(self) -> list[IncomeStatementItem]:
    """Get income statement history for the ticker.

    Returns:
        Quote summary with income statement history module response results
            json.
    """
    result = await self._get_quote_summary_single_module('incomeStatementHistory')
    return result['incomeStatementHistory']

get_income_statement_history_quarterly() async

Get income statement history quarterly for the ticker.

Returns:

Type Description
list[IncomeStatementItem]

Quote summary with income statement history quarterly module response results json.

Source code in yafin/symbol.py
@_log_args
async def get_income_statement_history_quarterly(self) -> list[IncomeStatementItem]:
    """Get income statement history quarterly for the ticker.

    Returns:
        Quote summary with income statement history quarterly module response
            results json.
    """
    result = await self._get_quote_summary_single_module(
        'incomeStatementHistoryQuarterly'
    )
    return result['incomeStatementHistory']

get_balance_sheet_history() async

Get balance sheet history for the ticker.

Returns: Quote summary with balance sheet history module response results json.

Source code in yafin/symbol.py
@_log_args
async def get_balance_sheet_history(self) -> list[BalanceSheetItem]:
    """Get balance sheet history for the ticker.

    Returns: Quote summary with balance sheet history module response results json.
    """
    result = await self._get_quote_summary_single_module('balanceSheetHistory')
    return result['balanceSheetStatements']

get_balance_sheet_history_quarterly() async

Get balance sheet history quarterly for the ticker.

Returns:

Type Description
list[BalanceSheetItem]

Quote summary with balance sheet history quarterly module response results json.

Source code in yafin/symbol.py
@_log_args
async def get_balance_sheet_history_quarterly(self) -> list[BalanceSheetItem]:
    """Get balance sheet history quarterly for the ticker.

    Returns:
        Quote summary with balance sheet history quarterly module response
            results json.
    """
    result = await self._get_quote_summary_single_module(
        'balanceSheetHistoryQuarterly'
    )
    return result['balanceSheetStatements']

get_cashflow_statement_history() async

Get cashflow statement history for the ticker.

Returns:

Type Description
list[CashflowItem]

Quote summary with cashflow statement history module response results json.

Source code in yafin/symbol.py
@_log_args
async def get_cashflow_statement_history(self) -> list[CashflowItem]:
    """Get cashflow statement history for the ticker.

    Returns:
        Quote summary with cashflow statement history module response results
            json.
    """
    result = await self._get_quote_summary_single_module('cashflowStatementHistory')
    return result['cashflowStatements']

get_cashflow_statement_history_quarterly() async

Get cashflow statement history quarterly for the ticker.

Returns:

Type Description
list[CashflowItem]

Quote summary with cashflow statement history quarterly module response results json.

Source code in yafin/symbol.py
@_log_args
async def get_cashflow_statement_history_quarterly(self) -> list[CashflowItem]:
    """Get cashflow statement history quarterly for the ticker.

    Returns:
        Quote summary with cashflow statement history quarterly module response
            results json.
    """
    result = await self._get_quote_summary_single_module(
        'cashflowStatementHistoryQuarterly'
    )
    return result['cashflowStatements']

get_price() async

Get price data for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_price(self) -> Price:
    """Get price data for the ticker.

    Returns: Quote summary with price data module response result json.
    """
    return await self._get_quote_summary_single_module('price')

get_default_key_statistics() async

Get default key statistics for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_default_key_statistics(self) -> DefaultKeyStatistics:
    """Get default key statistics for the ticker.

    Returns: Quote summary with default key statistics module response result json.
    """
    return await self._get_quote_summary_single_module('defaultKeyStatistics')

get_financial_data() async

Get financial data for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_financial_data(self) -> FinancialData:
    """Get financial data for the ticker.

    Returns: Quote summary with financial data module response result json.
    """
    return await self._get_quote_summary_single_module('financialData')

get_calendar_events() async

Get calendar events for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_calendar_events(self) -> CalendarEvents:
    """Get calendar events for the ticker.

    Returns: Quote summary with calendar events module response result json.
    """
    return await self._get_quote_summary_single_module('calendarEvents')

get_sec_filings() async

Get sec filings for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_sec_filings(self) -> SecFilings:
    """Get sec filings for the ticker.

    Returns: Quote summary with sec filings module response result json.
    """
    return await self._get_quote_summary_single_module('secFilings')

get_upgrade_downgrade_history() async

Get upgrade downgrade history for the ticker.

Returns:

Type Description
list[UpgradeDowngradeHistoryItem]

Quote summary with upgrade downgrade history module response results json.

Source code in yafin/symbol.py
@_log_args
async def get_upgrade_downgrade_history(self) -> list[UpgradeDowngradeHistoryItem]:
    """Get upgrade downgrade history for the ticker.

    Returns:
        Quote summary with upgrade downgrade history module response results
            json.
    """
    result = await self._get_quote_summary_single_module('upgradeDowngradeHistory')
    return result['history']

get_institution_ownership() async

Get institution ownership for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_institution_ownership(self) -> list[InstitutionOwnershipItem]:
    """Get institution ownership for the ticker.

    Returns: Quote summary with institution ownership module response results json.
    """
    result = await self._get_quote_summary_single_module('institutionOwnership')
    return result['ownershipList']

get_fund_ownership() async

Get fund ownership for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_fund_ownership(self) -> list[FundOwnershipItem]:
    """Get fund ownership for the ticker.

    Returns: Quote summary with fund ownership module response results json.
    """
    result = await self._get_quote_summary_single_module('fundOwnership')
    return result['ownershipList']

get_major_direct_holders() async

Get major direct holders for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_major_direct_holders(self) -> MajorDirectHolders:
    """Get major direct holders for the ticker.

    Returns: Quote summary with direct holders module response result json.
    """
    return await self._get_quote_summary_single_module('majorDirectHolders')

get_major_holders_breakdown() async

Get major holders breakdown for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_major_holders_breakdown(self) -> MajorHoldersBreakdown:
    """Get major holders breakdown for the ticker.

    Returns: Quote summary with holders breakdown module response result json.
    """
    return await self._get_quote_summary_single_module('majorHoldersBreakdown')

get_insider_transactions() async

Get insider transactions for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_insider_transactions(self) -> list[InsiderTransactionItem]:
    """Get insider transactions for the ticker.

    Returns: Quote summary with insider transactions module response results json.
    """
    result = await self._get_quote_summary_single_module('insiderTransactions')
    return result['transactions']

get_insider_holders() async

Get insider holders for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_insider_holders(self) -> list[InsiderHolderItem]:
    """Get insider holders for the ticker.

    Returns: Quote summary with insider holders module response results json.
    """
    result = await self._get_quote_summary_single_module('insiderHolders')
    return result['holders']

get_net_share_purchase_activity() async

Get net share purchase activity for the ticker.

Returns:

Type Description
NetSharePurchaseActivity

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

Source code in yafin/symbol.py
@_log_args
async def get_net_share_purchase_activity(self) -> NetSharePurchaseActivity:
    """Get net share purchase activity for the ticker.

    Returns:
        Quote summary with net share purchase activity module response result
            json.
    """
    return await self._get_quote_summary_single_module('netSharePurchaseActivity')

get_earnings() async

Get earnings for the ticker.

Returns: Quote summary with earnings module response result json.

Source code in yafin/symbol.py
@_log_args
async def get_earnings(self) -> Earnings:
    """Get earnings for the ticker.

    Returns: Quote summary with earnings module response result json.
    """
    return await self._get_quote_summary_single_module('earnings')

get_earnings_history() async

Get earnings history for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_earnings_history(self) -> list[EarningsHistoryItem]:
    """Get earnings history for the ticker.

    Returns: Quote summary with earnings history module response results json.
    """
    result = await self._get_quote_summary_single_module('earningsHistory')
    return result['history']

get_earnings_trend() async

Get earnings trend for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_earnings_trend(self) -> list[EarningsTrendItem]:
    """Get earnings trend for the ticker.

    Returns: Quote summary with earnings trend module response results json.
    """
    result = await self._get_quote_summary_single_module('earningsTrend')
    return result['trend']

get_industry_trend() async

Get industry trend for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_industry_trend(self) -> IndustryTrend:
    """Get industry trend for the ticker.

    Returns: Quote summary with industry trend module response result json.
    """
    return await self._get_quote_summary_single_module('industryTrend')

get_index_trend() async

Get index trend for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_index_trend(self) -> IndexTrend:
    """Get index trend for the ticker.

    Returns: Quote summary with index trend module response result json.
    """
    return await self._get_quote_summary_single_module('indexTrend')

get_sector_trend() async

Get sector trend for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_sector_trend(self) -> SectorTrend:
    """Get sector trend for the ticker.

    Returns: Quote summary with sector trend module response result json.
    """
    return await self._get_quote_summary_single_module('sectorTrend')

get_recommendation_trend() async

Get recommendation trend for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_recommendation_trend(self) -> list[RecommendationTrendItem]:
    """Get recommendation trend for the ticker.

    Returns: Quote summary with recommendation trend module response results json.
    """
    result = await self._get_quote_summary_single_module('recommendationTrend')
    return result['trend']

get_page_views() async

Get page views for the ticker.

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

Source code in yafin/symbol.py
@_log_args
async def get_page_views(self) -> PageViews:
    """Get page views for the ticker.

    Returns: Quote summary with page views module response result json.
    """
    return await self._get_quote_summary_single_module('pageViews')

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.

None
period2 int | float | None

End timestamp in seconds.

None

Returns: Income statement response results json.

Source code in yafin/symbol.py
@_log_args
async def get_income_statement(
    self,
    frequency: str,
    period1: int | float | None = None,
    period2: int | float | None = None,
) -> list[TimeseriesResult]:
    """Get income statement for the ticker.

    Args:
        frequency: annual, quarterly or trailing.
        period1: Start timestamp in seconds.
        period2: End timestamp in seconds.

    Returns: Income statement response results json.
    """
    return await self._get_financials(
        frequency, 'income_statement', period1, period2
    )

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.

None
period2 int | float | None

End timestamp in seconds.

None

Returns: Balance sheet response results json.

Source code in yafin/symbol.py
@_log_args
async def get_balance_sheet(
    self,
    frequency: str,
    period1: int | float | None = None,
    period2: int | float | None = None,
) -> list[TimeseriesResult]:
    """Get balance sheet for the ticker.

    Args:
        frequency: annual, quarterly or trailing.
        period1: Start timestamp in seconds.
        period2: End timestamp in seconds.

    Returns: Balance sheet response results json.
    """
    return await self._get_financials(frequency, 'balance_sheet', period1, period2)

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.

None
period2 int | float | None

End timestamp in seconds.

None

Returns: Cash flow response results json.

Source code in yafin/symbol.py
@_log_args
async def get_cash_flow(
    self,
    frequency: str,
    period1: int | float | None = None,
    period2: int | float | None = None,
) -> list[TimeseriesResult]:
    """Get cash flow statement for the ticker.

    Args:
        frequency: annual, quarterly or trailing.
        period1: Start timestamp in seconds.
        period2: End timestamp in seconds.

    Returns: Cash flow response results json.
    """
    return await self._get_financials(frequency, 'cash_flow', period1, period2)

get_options() async

Get options data for the ticker.

Returns: Options response result json.

Source code in yafin/symbol.py
@_log_args
async def get_options(self) -> OptionChainResult:
    """Get options data for the ticker.

    Returns: Options response result json.
    """
    await self._get_client()
    options_json = await self._client.get_options(self.ticker)
    return options_json['optionChain']['result'][0]

Get search results for the ticker.

Returns: Search response result json.

Source code in yafin/symbol.py
@_log_args
async def get_search(self) -> SearchResponseJson:
    """Get search results for the ticker.

    Returns: Search response result json.
    """
    await self._get_client()
    return await self._client.get_search(self.ticker)

get_recommendations() async

Get analyst recommendations for the ticker.

Returns: Recommendations response result json.

Source code in yafin/symbol.py
@_log_args
async def get_recommendations(self) -> RecommendationsFinanceResult:
    """Get analyst recommendations for the ticker.

    Returns: Recommendations response result json.
    """
    await self._get_client()
    recommendations_json = await self._client.get_recommendations(self.ticker)
    return recommendations_json['finance']['result'][0]

get_insights() async

Get insights for the ticker.

Returns: Insights response result json.

Source code in yafin/symbol.py
@_log_args
async def get_insights(self) -> InsightsFinanceResult:
    """Get insights for the ticker.

    Returns: Insights response result json.
    """
    await self._get_client()
    insights_json = await self._client.get_insights(self.ticker)
    return insights_json['finance']['result'][0]