Created
May 20, 2016 21:52
-
-
Save midnightfreddie/6ff41be2bb8879bbf0df66b9eba161c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#$StockList = Get-Content -Path "stocks.json" | ConvertFrom-Json | |
$StockList = '[{ "TICK": "FDX", "EXCH": "NYSE" }, { "TICK": "G", "EXCH": "NYSE" }]' | ConvertFrom-Json | |
# ForEach ($Stock In $StockList) | |
$StockList | ForEach-Object { | |
$Stock = $_ | |
$Sym = $Stock.TICK | |
$Exc = $Stock.EXCH | |
$RawData = Invoke-WebRequest "http://finance.google.com/finance/info?q=$Exc%3a$Sym" | |
$ParsedData = $RawData.Content.Split("//")[-1] | ConvertFrom-Json | |
$object = New-Object PSObject | |
Add-Member -InputObject $object -MemberType NoteProperty -Name TICK -Value $ParsedData.t | |
Add-Member -InputObject $object -MemberType NoteProperty -Name MARK -Value $ParsedData.l | |
Add-Member -InputObject $object -MemberType NoteProperty -Name CHNG -Value $ParsedData.c | |
Write-Output $object | |
} | | |
Format-Table | |
# ConvertTo-Html | |
# Out-GridView | |
# Export-Csv -NoTypeInformation -Path C:\temp\output.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment