pvanand commited on
Commit
9aefc52
·
verified ·
1 Parent(s): 27ca0a0

Update yf_docs.py

Browse files
Files changed (1) hide show
  1. 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') # Initialize single ticker
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
- # Method 1: Using Tickers object
23
- tickers = yf.Tickers('MSFT AAPL GOOG')
24
- data = tickers.download(period='1mo')
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
- 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')]
34
- Shape: (21, 21)
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