mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-14 23:33:18 +00:00
Initial commit
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -56,3 +56,4 @@ test.xlsx
|
|||||||
testCCFMT.ps1
|
testCCFMT.ps1
|
||||||
testHide.ps1
|
testHide.ps1
|
||||||
ImportExcel.zip
|
ImportExcel.zip
|
||||||
|
*.xlsx
|
||||||
|
|||||||
21
Examples/Stocks/Get-StockInfo.ps1
Normal file
21
Examples/Stocks/Get-StockInfo.ps1
Normal 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
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Examples/Stocks/GetMSFT.ps1
Normal file
14
Examples/Stocks/GetMSFT.ps1
Normal 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
|
||||||
Reference in New Issue
Block a user