pvanand commited on
Commit
caf8c54
·
verified ·
1 Parent(s): d82b3b4

Create yf_docs.py

Browse files
Files changed (1) hide show
  1. yf_docs.py +272 -0
yf_docs.py ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ yf_docs = """
2
+ # YFinance Documentation
3
+
4
+ ## Single Ticker Usage
5
+
6
+ ```python
7
+ import yfinance as yf
8
+ ticker = yf.Ticker('MSFT')
9
+ ```
10
+
11
+ ## Multi-Ticker Usage
12
+
13
+ ### Initialization
14
+
15
+ ```python
16
+ import yfinance as yf
17
+ tickers = yf.Tickers('MSFT AAPL GOOG')
18
+ ```
19
+
20
+ ### Download Historical Data
21
+
22
+ Get historical market data for multiple tickers:
23
+
24
+ ```python
25
+ # Method 1: Using Tickers object
26
+ tickers = yf.Tickers('MSFT AAPL GOOG')
27
+ data = tickers.download(period='1mo')
28
+
29
+ # Method 2: Using download function directly
30
+ data = yf.download(['MSFT', 'AAPL', 'GOOG'], period='1mo')
31
+ ```
32
+
33
+ Returns:
34
+ ```python
35
+
36
+ DataFrame with columns: [('Close', 'AAPL'), ('Close', 'GOOG'), ('Close', 'MSFT'), ('Dividends', 'AAPL'), ('Dividends', 'GOOG'), ('Dividends', 'MSFT'), ('High', 'AAPL'), ('High', 'GOOG'), ('High', 'MSFT'), ('Low', 'AAPL'), ('Low', 'GOOG'), ('Low', 'MSFT'), ('Open', 'AAPL'), ('Open', 'GOOG'), ('Open', 'MSFT'), ('Stock Splits', 'AAPL'), ('Stock Splits', 'GOOG'), ('Stock Splits', 'MSFT'), ('Volume', 'AAPL'), ('Volume', 'GOOG'), ('Volume', 'MSFT')]
37
+ Shape: (21, 21)
38
+
39
+ ```
40
+
41
+ ### News
42
+
43
+ Get news for multiple tickers:
44
+
45
+ ```python
46
+ tickers = yf.Tickers('MSFT AAPL GOOG')
47
+ news = tickers.news()
48
+ ```
49
+
50
+ Returns:
51
+ ```python
52
+
53
+ - MSFT: list
54
+ - AAPL: list
55
+ - GOOG: list
56
+ ```
57
+
58
+ ### Accessing Individual Tickers
59
+
60
+ Access individual ticker data from a multi-ticker object:
61
+
62
+ ```python
63
+ tickers = yf.Tickers('MSFT AAPL GOOG')
64
+ msft_info = tickers.tickers['MSFT'].info
65
+ aapl_history = tickers.tickers['AAPL'].history(period='1mo')
66
+ ```
67
+
68
+ ## Single Ticker Methods
69
+
70
+ ### Info
71
+
72
+ ```python
73
+ ticker.info
74
+ ```
75
+
76
+ Returns:
77
+ ```python
78
+
79
+ - address1: str
80
+ - city: str
81
+ - state: str
82
+ - zip: str
83
+ - country: str
84
+ - phone: str
85
+ - website: str
86
+ - industry: str
87
+ - industryKey: str
88
+ - industryDisp: str
89
+ - sector: str
90
+ - sectorKey: str
91
+ - sectorDisp: str
92
+ - longBusinessSummary: str
93
+ - fullTimeEmployees: int
94
+ - companyOfficers: list
95
+ - auditRisk: int
96
+ - boardRisk: int
97
+ - compensationRisk: int
98
+ - shareHolderRightsRisk: int
99
+ - overallRisk: int
100
+ - governanceEpochDate: int
101
+ - compensationAsOfEpochDate: int
102
+ - irWebsite: str
103
+ - maxAge: int
104
+ - priceHint: int
105
+ - previousClose: float
106
+ - open: float
107
+ - dayLow: float
108
+ - dayHigh: float
109
+ - regularMarketPreviousClose: float
110
+ - regularMarketOpen: float
111
+ - regularMarketDayLow: float
112
+ - regularMarketDayHigh: float
113
+ - dividendRate: float
114
+ - dividendYield: float
115
+ - exDividendDate: int
116
+ - payoutRatio: float
117
+ - fiveYearAvgDividendYield: float
118
+ - beta: float
119
+ - trailingPE: float
120
+ - forwardPE: float
121
+ - volume: int
122
+ - regularMarketVolume: int
123
+ - averageVolume: int
124
+ - averageVolume10days: int
125
+ - averageDailyVolume10Day: int
126
+ - bid: float
127
+ - ask: float
128
+ - bidSize: int
129
+ - askSize: int
130
+ - marketCap: int
131
+ - fiftyTwoWeekLow: float
132
+ - fiftyTwoWeekHigh: float
133
+ - priceToSalesTrailing12Months: float
134
+ - fiftyDayAverage: float
135
+ - twoHundredDayAverage: float
136
+ - currency: str
137
+ - enterpriseValue: int
138
+ - profitMargins: float
139
+ - floatShares: int
140
+ - sharesOutstanding: int
141
+ - sharesShort: int
142
+ - sharesShortPriorMonth: int
143
+ - sharesShortPreviousMonthDate: int
144
+ - dateShortInterest: int
145
+ - sharesPercentSharesOut: float
146
+ - heldPercentInsiders: float
147
+ - heldPercentInstitutions: float
148
+ - shortRatio: float
149
+ - shortPercentOfFloat: float
150
+ - impliedSharesOutstanding: int
151
+ - bookValue: float
152
+ - priceToBook: float
153
+ - lastFiscalYearEnd: int
154
+ - nextFiscalYearEnd: int
155
+ - mostRecentQuarter: int
156
+ - earningsQuarterlyGrowth: float
157
+ - netIncomeToCommon: int
158
+ - trailingEps: float
159
+ - forwardEps: float
160
+ - lastSplitFactor: str
161
+ - lastSplitDate: int
162
+ - enterpriseToRevenue: float
163
+ - enterpriseToEbitda: float
164
+ - 52WeekChange: float
165
+ - SandP52WeekChange: float
166
+ - lastDividendValue: float
167
+ - lastDividendDate: int
168
+ - exchange: str
169
+ - quoteType: str
170
+ - symbol: str
171
+ - underlyingSymbol: str
172
+ - shortName: str
173
+ - longName: str
174
+ - firstTradeDateEpochUtc: int
175
+ - timeZoneFullName: str
176
+ - timeZoneShortName: str
177
+ - uuid: str
178
+ - messageBoardId: str
179
+ - gmtOffSetMilliseconds: int
180
+ - currentPrice: float
181
+ - targetHighPrice: float
182
+ - targetLowPrice: float
183
+ - targetMeanPrice: float
184
+ - targetMedianPrice: float
185
+ - recommendationMean: float
186
+ - recommendationKey: str
187
+ - numberOfAnalystOpinions: int
188
+ - totalCash: int
189
+ - totalCashPerShare: float
190
+ - ebitda: int
191
+ - totalDebt: int
192
+ - quickRatio: float
193
+ - currentRatio: float
194
+ - totalRevenue: int
195
+ - debtToEquity: float
196
+ - revenuePerShare: float
197
+ - returnOnAssets: float
198
+ - returnOnEquity: float
199
+ - grossProfits: int
200
+ - freeCashflow: int
201
+ - operatingCashflow: int
202
+ - earningsGrowth: float
203
+ - revenueGrowth: float
204
+ - grossMargins: float
205
+ - ebitdaMargins: float
206
+ - operatingMargins: float
207
+ - financialCurrency: str
208
+ - trailingPegRatio: float
209
+ ```
210
+
211
+ ### History
212
+
213
+ ```python
214
+ ticker.history(period='1mo')
215
+ ```
216
+
217
+ Returns:
218
+ ```python
219
+
220
+ DataFrame with columns: ['Open', 'High', 'Low', 'Close', 'Volume', 'Dividends', 'Stock Splits']
221
+ Shape: (21, 7)
222
+
223
+ ```
224
+
225
+ ### Financial Statements
226
+
227
+ #### Income Statement
228
+
229
+ ```python
230
+ ticker.income_stmt
231
+ ```
232
+
233
+ Returns:
234
+ ```python
235
+
236
+ DataFrame 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')]
237
+ Shape: (47, 4)
238
+
239
+ ```
240
+
241
+ ## Common Parameters
242
+
243
+ ### Period Options
244
+
245
+ - `1d`: 1 day
246
+ - `5d`: 5 days
247
+ - `1mo`: 1 month
248
+ - `3mo`: 3 months
249
+ - `6mo`: 6 months
250
+ - `1y`: 1 year
251
+ - `2y`: 2 years
252
+ - `5y`: 5 years
253
+ - `10y`: 10 years
254
+ - `ytd`: Year to date
255
+ - `max`: Maximum available data
256
+
257
+ ### Interval Options
258
+
259
+ - `1m`: 1 minute
260
+ - `2m`: 2 minutes
261
+ - `5m`: 5 minutes
262
+ - `15m`: 15 minutes
263
+ - `30m`: 30 minutes
264
+ - `60m`: 60 minutes
265
+ - `90m`: 90 minutes
266
+ - `1h`: 1 hour
267
+ - `1d`: 1 day
268
+ - `5d`: 5 days
269
+ - `1wk`: 1 week
270
+ - `1mo`: 1 month
271
+ - `3mo`: 3 months
272
+ """