Initial commit

This commit is contained in:
dfinke
2015-12-17 17:50:10 -05:00
parent 58e8c85740
commit 775421cad3
3 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
function Get-StockInfo {
param(
$stock,
[datetime]$startDate,
[datetime]$endDate
)
Process {
if(!$endDate) { $endDate = $startDate}
$baseUrl = "http://query.yahooapis.com/v1/public/yql?q="
$q = @"
select * from yahoo.finance.historicaldata where symbol = "$($stock)" and startDate = "$($startDate.ToString('yyyy-MM-dd'))" and endDate = "$($endDate.ToString('yyyy-MM-dd'))"
"@
$suffix = "&env=store://datatables.org/alltableswithkeys&format=json"
$r=Invoke-RestMethod ($baseUrl + $q + $suffix)
$r.query.results.quote
}
}

View File

@@ -0,0 +1,14 @@
$Symbol = "MSFT"
. .\Get-StockInfo.ps1
rm *.xlsx
$chart = New-ExcelChart -XRange Date -YRange Volume `
-ChartType ColumnStacked `
-Column 9 -Title "$Symbol Volume"
Get-StockInfo $Symbol 11/2 11/30 |
Export-Excel .\stocks.xlsx -Show `
-AutoSize -AutoNameRange `
-ExcelChartDefinition $chart