Team Ai
Apppublic

Elevatics/code-chat-api

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
yf_docs.py254 linesDownload Raw Back to root
1yf_docs = """2# YFinance UPDATED API DOCUMENTATION3# Always refer the following updated documentation for writing python code to call yf api4## Single Ticker Usage5 6```python7import yfinance as yf8ticker = yf.Ticker('MSFT')9data = ticker.history(period='6mo')10data.columns, data.shape 11```12Returns:13```python14(Index(['Open', 'High', 'Low', 'Close', 'Volume', 'Dividends', 'Stock Splits'], dtype='object'),15 (126, 7))16 ```17## Multi-Ticker Usage18 19# Get historical market data for multiple tickers:20 21```python22tickers = yf.Tickers('MSFT AAPL')23data = tickers.history(period='6mo')24data.columns,data.shape25```26 27Returns:28```python29(MultiIndex([(       'Close', 'AAPL'),30             (       'Close', 'MSFT'),31             (   'Dividends', 'AAPL'),32             (   'Dividends', 'MSFT'),33             (        'High', 'AAPL'),34             (        'High', 'MSFT'),35             (         'Low', 'AAPL'),36             (         'Low', 'MSFT'),37             (        'Open', 'AAPL'),38             (        'Open', 'MSFT'),39             ('Stock Splits', 'AAPL'),40             ('Stock Splits', 'MSFT'),41             (      'Volume', 'AAPL'),42             (      'Volume', 'MSFT')],43            names=['Price', 'Ticker']),44 (126, 14))45```46 47### News48 49Get news for multiple tickers:50 51```python52tickers = yf.Tickers('MSFT AAPL GOOG')53news = tickers.news()54```55 56Returns:57```python58 59- MSFT: list60- AAPL: list61- GOOG: list62```63 64## Single Ticker Methods65 66### Info67 68```python69ticker.info70```71 72Returns:73```python74 75- address1: str76- city: str77- state: str78- zip: str79- country: str80- phone: str81- website: str82- industry: str83- industryKey: str84- industryDisp: str85- sector: str86- sectorKey: str87- sectorDisp: str88- longBusinessSummary: str89- fullTimeEmployees: int90- companyOfficers: list91- auditRisk: int92- boardRisk: int93- compensationRisk: int94- shareHolderRightsRisk: int95- overallRisk: int96- governanceEpochDate: int97- compensationAsOfEpochDate: int98- irWebsite: str99- maxAge: int100- priceHint: int101- previousClose: float102- open: float103- dayLow: float104- dayHigh: float105- regularMarketPreviousClose: float106- regularMarketOpen: float107- regularMarketDayLow: float108- regularMarketDayHigh: float109- dividendRate: float110- dividendYield: float111- exDividendDate: int112- payoutRatio: float113- fiveYearAvgDividendYield: float114- beta: float115- trailingPE: float116- forwardPE: float117- volume: int118- regularMarketVolume: int119- averageVolume: int120- averageVolume10days: int121- averageDailyVolume10Day: int122- bid: float123- ask: float124- bidSize: int125- askSize: int126- marketCap: int127- fiftyTwoWeekLow: float128- fiftyTwoWeekHigh: float129- priceToSalesTrailing12Months: float130- fiftyDayAverage: float131- twoHundredDayAverage: float132- currency: str133- enterpriseValue: int134- profitMargins: float135- floatShares: int136- sharesOutstanding: int137- sharesShort: int138- sharesShortPriorMonth: int139- sharesShortPreviousMonthDate: int140- dateShortInterest: int141- sharesPercentSharesOut: float142- heldPercentInsiders: float143- heldPercentInstitutions: float144- shortRatio: float145- shortPercentOfFloat: float146- impliedSharesOutstanding: int147- bookValue: float148- priceToBook: float149- lastFiscalYearEnd: int150- nextFiscalYearEnd: int151- mostRecentQuarter: int152- earningsQuarterlyGrowth: float153- netIncomeToCommon: int154- trailingEps: float155- forwardEps: float156- lastSplitFactor: str157- lastSplitDate: int158- enterpriseToRevenue: float159- enterpriseToEbitda: float160- 52WeekChange: float161- SandP52WeekChange: float162- lastDividendValue: float163- lastDividendDate: int164- exchange: str165- quoteType: str166- symbol: str167- underlyingSymbol: str168- shortName: str169- longName: str170- firstTradeDateEpochUtc: int171- timeZoneFullName: str172- timeZoneShortName: str173- uuid: str174- messageBoardId: str175- gmtOffSetMilliseconds: int176- currentPrice: float177- targetHighPrice: float178- targetLowPrice: float179- targetMeanPrice: float180- targetMedianPrice: float181- recommendationMean: float182- recommendationKey: str183- numberOfAnalystOpinions: int184- totalCash: int185- totalCashPerShare: float186- ebitda: int187- totalDebt: int188- quickRatio: float189- currentRatio: float190- totalRevenue: int191- debtToEquity: float192- revenuePerShare: float193- returnOnAssets: float194- returnOnEquity: float195- grossProfits: int196- freeCashflow: int197- operatingCashflow: int198- earningsGrowth: float199- revenueGrowth: float200- grossMargins: float201- ebitdaMargins: float202- operatingMargins: float203- financialCurrency: str204- trailingPegRatio: float205```206 207### Financial Statements208 209#### Income Statement210 211```python212ticker.income_stmt213```214 215Returns:216```python217 218DataFrame with columns: [Timestamp('2024-06-30 00:00:00'), Timestamp('2023-06-30 00:00:00'), Timestamp('2022-06-30 00:00:00'), Timestamp('2021-06-30 00:00:00')]219Shape: (47, 4)220 221```222 223## Common Parameters224 225### Period Options226 227- `1d`: 1 day228- `5d`: 5 days229- `1mo`: 1 month230- `3mo`: 3 months231- `6mo`: 6 months232- `1y`: 1 year233- `2y`: 2 years234- `5y`: 5 years235- `10y`: 10 years236- `ytd`: Year to date237- `max`: Maximum available data238 239### Interval Options240 241- `1m`: 1 minute242- `2m`: 2 minutes243- `5m`: 5 minutes244- `15m`: 15 minutes245- `30m`: 30 minutes246- `60m`: 60 minutes247- `90m`: 90 minutes248- `1h`: 1 hour249- `1d`: 1 day250- `5d`: 5 days251- `1wk`: 1 week252- `1mo`: 1 month253- `3mo`: 3 months254"""