Sage Reference Manual: Quantitative Finance - Mirrors
Sage Reference Manual: Quantitative Finance - Mirrors
Sage Reference Manual: Quantitative Finance - Mirrors
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Quantitative</strong> <strong>Finance</strong>, Release 6.1.1<br />
EXAMPLES:<br />
You can directly obtain Open data as so:<br />
sage: finance.Stock(’vmw’).open(startdate=’Jan+1,+2008’, enddate=’Feb+1,+2008’)<br />
[83.0500, 85.4900, 84.9000, 82.0000, 81.2500 ... 82.0000, 58.2700, 54.4900, 55.6000, 56.9800<br />
Or, you can initialize stock data first and then extract the Open data:<br />
[55.6000, 56.9800, 58.0000, 57.6000, 60.3200 ... 56.5500, 59.3000, 60.0000, 59.7900, 59.2600<br />
sage: c = finance.Stock(’vmw’)<br />
sage: c.google(startdate=’Feb+1,+2008’, enddate=’Mar+1,+2008’)[:5] # optional -- internet<br />
[<br />
31-Jan-08 55.60 57.35 55.52 56.67 2591100,<br />
1-Feb-08 56.98 58.14 55.06 57.85 2473000,<br />
4-Feb-08 58.00 60.47 56.91 58.05 1816500,<br />
5-Feb-08 57.60 59.30 57.17 59.30 1709000,<br />
6-Feb-08 60.32 62.00 59.50 61.52 2191100<br />
]<br />
sage: c.open() # optional -- internet<br />
Otherwise, self.google() will be called with the default arguments returning a year’s worth of data:<br />
sage: finance.Stock(’vmw’).open() # random; optional -- internet<br />
[52.1100, 60.9900, 59.0000, 56.0500, 57.2500 ... 83.0500, 85.4900, 84.9000, 82.0000, 81.2500<br />
yahoo()<br />
Get Yahoo current price data for this stock.<br />
OUTPUT:<br />
A dictionary.<br />
EXAMPLES:<br />
sage: finance.Stock(’GOOG’).yahoo()<br />
# random; optional -- internet<br />
{’stock_exchange’: ’"NasdaqNM"’, ’market_cap’: ’181.1B’, ’200day_moving_avg’: ’564.569’, ’52<br />
27