mirror of
https://github.com/dfinke/ImportExcel.git
synced 2026-01-05 10:03:30 +00:00
Added try/catch. Expanded aliases
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
<#
|
||||
Revisit I think yahoo deprecated their service
|
||||
#>
|
||||
|
||||
function Get-StockInfo {
|
||||
param(
|
||||
$stock,
|
||||
@@ -7,15 +11,15 @@ function Get-StockInfo {
|
||||
|
||||
Process {
|
||||
|
||||
if(!$endDate) { $endDate = $startDate}
|
||||
if (!$endDate) { $endDate = $startDate}
|
||||
|
||||
$baseUrl = "http://query.yahooapis.com/v1/public/yql?q="
|
||||
$q = @"
|
||||
$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
|
||||
$suffix = "&env=store://datatables.org/alltableswithkeys&format=json"
|
||||
$r = Invoke-RestMethod ($baseUrl + $q + $suffix)
|
||||
$r.query.results.quote
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,20 @@
|
||||
$Symbol = "MSFT"
|
||||
<#
|
||||
Revisit I think yahoo deprecated their service
|
||||
#>
|
||||
|
||||
. .\Get-StockInfo.ps1
|
||||
# try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {}
|
||||
|
||||
rm *.xlsx
|
||||
# $Symbol = "MSFT"
|
||||
|
||||
$chart = New-ExcelChart -XRange Date -YRange Volume `
|
||||
-ChartType ColumnStacked `
|
||||
-Column 9 -Title "$Symbol Volume"
|
||||
# . .\Get-StockInfo.ps1
|
||||
|
||||
Get-StockInfo $Symbol 11/2 11/30 |
|
||||
Export-Excel .\stocks.xlsx -Show `
|
||||
-AutoSize -AutoNameRange `
|
||||
-ExcelChartDefinition $chart
|
||||
# Remove-Item *.xlsx -ErrorAction Ignore
|
||||
|
||||
# $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
|
||||
BIN
Examples/Stocks/stocks.xlsx
Normal file
BIN
Examples/Stocks/stocks.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user