Spaces:
Runtime error
Runtime error
Update yf_docs.py
Browse files- yf_docs.py +20 -21
yf_docs.py
CHANGED
|
@@ -5,7 +5,7 @@ yf_docs = """
|
|
| 5 |
|
| 6 |
```python
|
| 7 |
import yfinance as yf
|
| 8 |
-
ticker = yf.Ticker('MSFT')
|
| 9 |
data = ticker.history(period='6mo')
|
| 10 |
data.columns, data.shape
|
| 11 |
```
|
|
@@ -19,20 +19,29 @@ Returns:
|
|
| 19 |
# Get historical market data for multiple tickers:
|
| 20 |
|
| 21 |
```python
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
data
|
| 25 |
-
|
| 26 |
-
# Method 2: Using download function directly
|
| 27 |
-
data = yf.download(['MSFT', 'AAPL', 'GOOG'], period='1mo')
|
| 28 |
```
|
| 29 |
|
| 30 |
Returns:
|
| 31 |
```python
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
```
|
| 37 |
|
| 38 |
### News
|
|
@@ -52,16 +61,6 @@ Returns:
|
|
| 52 |
- GOOG: list
|
| 53 |
```
|
| 54 |
|
| 55 |
-
### Accessing Individual Tickers
|
| 56 |
-
|
| 57 |
-
Access individual ticker data from a multi-ticker object:
|
| 58 |
-
|
| 59 |
-
```python
|
| 60 |
-
tickers = yf.Tickers('MSFT AAPL GOOG')
|
| 61 |
-
msft_info = tickers.tickers['MSFT'].info
|
| 62 |
-
aapl_history = tickers.tickers['AAPL'].history(period='1mo')
|
| 63 |
-
```
|
| 64 |
-
|
| 65 |
## Single Ticker Methods
|
| 66 |
|
| 67 |
### Info
|
|
|
|
| 5 |
|
| 6 |
```python
|
| 7 |
import yfinance as yf
|
| 8 |
+
ticker = yf.Ticker('MSFT')
|
| 9 |
data = ticker.history(period='6mo')
|
| 10 |
data.columns, data.shape
|
| 11 |
```
|
|
|
|
| 19 |
# Get historical market data for multiple tickers:
|
| 20 |
|
| 21 |
```python
|
| 22 |
+
tickers = yf.Tickers('MSFT AAPL')
|
| 23 |
+
data = tickers.history(period='6mo')
|
| 24 |
+
data.columns,data.shape
|
|
|
|
|
|
|
|
|
|
| 25 |
```
|
| 26 |
|
| 27 |
Returns:
|
| 28 |
```python
|
| 29 |
+
(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 |
### News
|
|
|
|
| 61 |
- GOOG: list
|
| 62 |
```
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
## Single Ticker Methods
|
| 65 |
|
| 66 |
### Info
|