Scripts/Update-CoinbaseCurrencyAndTradingPair.ps1
Function Update-CoinbaseCurrencyAndTradingPair { <# .SYNOPSIS Update Currencies and Trading Pairs .DESCRIPTION Update Currencies and Trading Pairs .EXAMPLE Update-CoinbaseCurrencyAndTradingPair .NOTES N/A .LINK N/A #> [CmdletBinding ()] Param () BEGIN { Function Show-Output ($Values) { [PSCustomObject]@{ Currencies = $Values[0] TradingPairs = $Values[1] Status = $Values[2] } } } PROCESS { Try { Write-Progress -Activity 'Coinbase Module' -Status 'Updating Currencies and Trading pairs...' If ((Test-Path -Path "$env:ALLUSERSPROFILE\Coinbase") -eq $False) { New-Item -Path "$env:ALLUSERSPROFILE\Coinbase" -ItemType Directory -Force | Out-Null ICACLS "$env:ALLUSERSPROFILE\Coinbase\" /Grant:R 'Everyone:(OI)(CI)(F)' /Q /C /T | Out-Null } $Currency = Get-CoinbaseCurrencyList | Select-Object Id | Sort-Object Id | ConvertTo-Csv -NoTypeInformation | Select-Object -Skip 1 $Currency = $Currency.Replace("""", "") $Currency | Out-File -FilePath "$env:ALLUSERSPROFILE\Coinbase\Currencies.txt" -Force $Pair = Get-CoinbaseTradingPairList | Select-Object Id | Sort-Object Id | ConvertTo-Csv -NoTypeInformation | Select-Object -Skip 1 $Pair = $Pair.Replace("""", '') $Pair | Out-File -FilePath "$env:ALLUSERSPROFILE\Coinbase\Pairs.txt" -Force Show-Output ('Updated', 'Updated', 'Ok') } Catch { Show-Output ('', '', $PSItem.Exception.Message) } } END {} } |