PoshCode Archive  Artifact [42eacac2f5]

Artifact 42eacac2f54b7fa766d38565b38ccb4563d5135278512b8038f41851b3eaaac5:

  • File Get-Stock-Quotes.ps1 — part of check-in [d24cb50c8d] at 2018-06-10 14:23:41 on branch trunk — Get-StockQuotes gives a very easy way to get stock quotes using PowerShell CTP3’s new Web Services capabilities. (user: Carter Shanklin size: 717)

# encoding: ascii
# api: powershell
# title: Get Stock Quotes
# description: Get-StockQuotes gives a very easy way to get stock quotes using PowerShell CTP3’s new Web Services capabilities.
# version: 0.1
# type: function
# author: Carter Shanklin
# license: CC0
# function: Get-StockQuote
# x-poshcode-id: 752
# x-archived: 2015-05-05T05:42:05
# x-published: 2009-12-27T00:34:00
#
#
function Get-StockQuote {
	param($symbols)

	process {
		$s = new-webserviceproxy -uri http://www.webservicex.net/stockquote.asmx

		foreach ($symbol in $symbols) {
			$result = [xml]$s.GetQuote($symbol)
			$result.StockQuotes.Stock
		}
	}
}

# Example:
# Get-StockQuote VMW, EMC | select Symbol, Last