forked from cttn/Stockex
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.txt
85 lines (48 loc) · 1.51 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Stockex
Python 3 wrapper for Yahoo! Finance API.
## Requirements
* Python 3
## Install
From PYPI:
```
pip install stockex
```
From Github:
```
git clone https://github.com/cttn/Stockex.git
cd Stockex
python setup.py install
```
## Example Usage
```
from stockex import stockwrapper as sw
data = sw.YahooData()
# Print Current data of a Stock
print(data.get_current(['GOOG']))
# Print historical data of a Stock, returns data of last week
print(data.get_historical("GOOG"))
# Print historical data of a Stock according to the startDate and endDate
print(data.get_historical('YHOO',['Open','Close','High','Low'],startDate='2014-09-11',endDate='2015-02-10',limit=5))
# Trivial formatting
print("Google stock: Date and Price")
for item in data.get_historical("GOOG"):
print(item['Date'] + '\t' + item['Close'])
# Other methods:
# Do a custom YQL query to Yahoo! Finance YQL API:
data.enquire('select * from yahoo.finance.quotes where symbol in ("GOOG", "C")')
# Get news feed of a Company
data.get_news_feed("GOOG")
# Get options data
data.get_options_info("GOOG")
# Get industry ids
data.get_industry_ids()
# Get industry index from a given id
data.get_industry_index('914')
```
## Contributing
Contributions of all sorts are welcomed.
Feel free to fork, make pull requests, ask for features, etc.
## Credits
Based on the Python2.7 (Public Domain) script StockScraper: [Code](https://github.com/gurch101/StockScraper) and [Docs](http://www.gurchet-rai.net/dev/yahoo-finance-yql).
## License
Public Domain.