Public/Get-fpCurrentLuck.ps1
function Get-fpCurrentLuck { [CmdletBinding()] param( [Parameter(ValueFromPipeline,ValueFromPipelineByPropertyName)] [ValidateSet("XCH","ETH")] [string[]]$CoinTicker = @("XCH","ETH") ) Process{ foreach ($coin in $CoinTicker){ try{ $Query = "pool/currentLuck?coin=$coin" $Results = Invoke-FlexPoolAPI -Query $Query if ($null -eq $Results.error){ [pscustomobject]@{ Coin = $coin AverageLuck = [decimal]$Results.Result } } else{ Write-Error $Results.error -ErrorAction Stop } } catch{ $PSCmdlet.WriteError($_) } #try/catch } #foreach coin } #Process } |