Invertee / CoinbasePro-Powershell

Powershell module for the CoinbasePro API.
MIT License
11 stars 6 forks source link

Code Samples (not an issue): A thread to share and document scripts as I learn this module #7

Open jasonpearce opened 5 years ago

jasonpearce commented 5 years ago

If it is inappropriate for me to create a thread here that lets me document and share some scripts I've written using your module, please let me know and I'll stop. Optionally, would enabling the Wiki feature for this GitHub module be a better option? Or would you prefer I fork your module and use the Wiki or Issues section within my own fork of this module?

Basically, I want to contribute to your module and share in my own small way without being a nuisance. So let me know if I'm being a nuisance by creating a new Issue called Code Samples. :-)

My first set of code samples that I'll post here were written to get me familiar with your module and the data it retrieves from Coinbase's API. All they do is create variables and arrays that I might use in future scripts that will perform more functionality.

These scripts are variable overkill, because they each also create an array. I start with just the Public functions you created. When done, you'll end up with almost 2,400 $CBP* variables.

Public Functions

Name                              Category  Module                    Synopsis
----                              --------  ------                    --------
Get-CoinbaseProCurrencies         Function  CoinbasePro-Powershell    ...
Get-CoinbaseProPaymentMethods     Function  CoinbasePro-Powershell    ...
Get-CoinbaseProProductOrderBook   Function  CoinbasePro-Powershell    ...
Get-CoinbaseProProducts           Function  CoinbasePro-Powershell    ...
Get-CoinbaseProProductStats       Function  CoinbasePro-Powershell    ...
Get-CoinbaseProProductTicker      Function  CoinbasePro-Powershell    ...
Get-CoinbaseProProductTrades      Function  CoinbasePro-Powershell    ...
Get-CoinbaseProTime               Function  CoinbasePro-Powershell    ...                                                                                                          
jasonpearce commented 5 years ago

Creating arrays and variables for Coinbase Pro Currencies.

# Create arrays and variables for Coinbase Pro Currencies
# Using Get-CoinbaseProCurrencies, a public function (no API Key required)

# Get-CoinbaseProCurrencies
$CBPCurrencies = Get-CoinbaseProCurrencies | Sort-Object Id

# Get-CoinbaseProCurrencies and dynamically create Currencies variables
foreach ($CBPCurrency in $CBPCurrencies) {

    # Variables
    $CurrencyId           = $CBPCurrency.Id
    $CurrencyName         = $CBPCurrency.Name
    $CurrencyMinSize      = $CBPCurrency.Min_Size
    $CurrencyStatus       = $CBPCurrency.Status
    $CurrencyMessage      = $CBPCurrency.Message
    $CurrencyDetails      = $CBPCurrency.Details
    $CurrencyMaxPrecision = $CBPCurrency.Max_Precision

    # Create Currency-Specific Variable
    $Name = "CBP" + $CurrencyId + "Currency"
    $Value = $CBPCurrency
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Currency-Specific Variable
    $Name = "CBP" + $CurrencyId + "CurrencyID"
    $Value = $CurrencyId
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Currency-Specific Variable
    $Name = "CBP" + $CurrencyId + "CurrencyName"
    $Value = $CurrencyName
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Currency-Specific Variable
    $Name = "CBP" + $CurrencyId + "CurrencyMinSize"
    $Value = $CurrencyMinSize
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Currency-Specific Variable
    $Name = "CBP" + $CurrencyId + "CurrencyStatus"
    $Value = $CurrencyStatus
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Currency-Specific Variable
    $Name = "CBP" + $CurrencyId + "CurrencyMessage"
    $Value = $CurrencyMessage
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Currency-Specific Variable
    $Name = "CBP" + $CurrencyId + "CurrencyDetails"
    $Value = $CurrencyDetails
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Currency-Specific Variable
    $Name = "CBP" + $CurrencyId + "CurrencyMaxPrecision"
    $Value = $CurrencyMaxPrecision
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Write a line break
    Write-Host "-----------------------------------------------------"

}

# Write New Variables to Screen
Get-Variable -Name CBP*Currency*
$CBPCurrencies | Format-Table -AutoSize

Results

Created new variable: $CBPALGOCurrency
Created new variable: $CBPALGOCurrencyID
Created new variable: $CBPALGOCurrencyName
Created new variable: $CBPALGOCurrencyMinSize
Created new variable: $CBPALGOCurrencyStatus
Created new variable: $CBPALGOCurrencyMessage
Created new variable: $CBPALGOCurrencyDetails
Created new variable: $CBPALGOCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPBATCurrency
Created new variable: $CBPBATCurrencyID
Created new variable: $CBPBATCurrencyName
Created new variable: $CBPBATCurrencyMinSize
Created new variable: $CBPBATCurrencyStatus
Created new variable: $CBPBATCurrencyMessage
Created new variable: $CBPBATCurrencyDetails
Created new variable: $CBPBATCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPBCHCurrency
Created new variable: $CBPBCHCurrencyID
Created new variable: $CBPBCHCurrencyName
Created new variable: $CBPBCHCurrencyMinSize
Created new variable: $CBPBCHCurrencyStatus
Created new variable: $CBPBCHCurrencyMessage
Created new variable: $CBPBCHCurrencyDetails
Created new variable: $CBPBCHCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPBTCCurrency
Created new variable: $CBPBTCCurrencyID
Created new variable: $CBPBTCCurrencyName
Created new variable: $CBPBTCCurrencyMinSize
Created new variable: $CBPBTCCurrencyStatus
Created new variable: $CBPBTCCurrencyMessage
Created new variable: $CBPBTCCurrencyDetails
Created new variable: $CBPBTCCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPCVCCurrency
Created new variable: $CBPCVCCurrencyID
Created new variable: $CBPCVCCurrencyName
Created new variable: $CBPCVCCurrencyMinSize
Created new variable: $CBPCVCCurrencyStatus
Created new variable: $CBPCVCCurrencyMessage
Created new variable: $CBPCVCCurrencyDetails
Created new variable: $CBPCVCCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPDAICurrency
Created new variable: $CBPDAICurrencyID
Created new variable: $CBPDAICurrencyName
Created new variable: $CBPDAICurrencyMinSize
Created new variable: $CBPDAICurrencyStatus
Created new variable: $CBPDAICurrencyMessage
Created new variable: $CBPDAICurrencyDetails
Created new variable: $CBPDAICurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPDNTCurrency
Created new variable: $CBPDNTCurrencyID
Created new variable: $CBPDNTCurrencyName
Created new variable: $CBPDNTCurrencyMinSize
Created new variable: $CBPDNTCurrencyStatus
Created new variable: $CBPDNTCurrencyMessage
Created new variable: $CBPDNTCurrencyDetails
Created new variable: $CBPDNTCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPEOSCurrency
Created new variable: $CBPEOSCurrencyID
Created new variable: $CBPEOSCurrencyName
Created new variable: $CBPEOSCurrencyMinSize
Created new variable: $CBPEOSCurrencyStatus
Created new variable: $CBPEOSCurrencyMessage
Created new variable: $CBPEOSCurrencyDetails
Created new variable: $CBPEOSCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPETCCurrency
Created new variable: $CBPETCCurrencyID
Created new variable: $CBPETCCurrencyName
Created new variable: $CBPETCCurrencyMinSize
Created new variable: $CBPETCCurrencyStatus
Created new variable: $CBPETCCurrencyMessage
Created new variable: $CBPETCCurrencyDetails
Created new variable: $CBPETCCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPETHCurrency
Created new variable: $CBPETHCurrencyID
Created new variable: $CBPETHCurrencyName
Created new variable: $CBPETHCurrencyMinSize
Created new variable: $CBPETHCurrencyStatus
Created new variable: $CBPETHCurrencyMessage
Created new variable: $CBPETHCurrencyDetails
Created new variable: $CBPETHCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPEURCurrency
Created new variable: $CBPEURCurrencyID
Created new variable: $CBPEURCurrencyName
Created new variable: $CBPEURCurrencyMinSize
Created new variable: $CBPEURCurrencyStatus
Created new variable: $CBPEURCurrencyMessage
Created new variable: $CBPEURCurrencyDetails
Created new variable: $CBPEURCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPGBPCurrency
Created new variable: $CBPGBPCurrencyID
Created new variable: $CBPGBPCurrencyName
Created new variable: $CBPGBPCurrencyMinSize
Created new variable: $CBPGBPCurrencyStatus
Created new variable: $CBPGBPCurrencyMessage
Created new variable: $CBPGBPCurrencyDetails
Created new variable: $CBPGBPCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPGNTCurrency
Created new variable: $CBPGNTCurrencyID
Created new variable: $CBPGNTCurrencyName
Created new variable: $CBPGNTCurrencyMinSize
Created new variable: $CBPGNTCurrencyStatus
Created new variable: $CBPGNTCurrencyMessage
Created new variable: $CBPGNTCurrencyDetails
Created new variable: $CBPGNTCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPLINKCurrency
Created new variable: $CBPLINKCurrencyID
Created new variable: $CBPLINKCurrencyName
Created new variable: $CBPLINKCurrencyMinSize
Created new variable: $CBPLINKCurrencyStatus
Created new variable: $CBPLINKCurrencyMessage
Created new variable: $CBPLINKCurrencyDetails
Created new variable: $CBPLINKCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPLOOMCurrency
Created new variable: $CBPLOOMCurrencyID
Created new variable: $CBPLOOMCurrencyName
Created new variable: $CBPLOOMCurrencyMinSize
Created new variable: $CBPLOOMCurrencyStatus
Created new variable: $CBPLOOMCurrencyMessage
Created new variable: $CBPLOOMCurrencyDetails
Created new variable: $CBPLOOMCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPLTCCurrency
Created new variable: $CBPLTCCurrencyID
Created new variable: $CBPLTCCurrencyName
Created new variable: $CBPLTCCurrencyMinSize
Created new variable: $CBPLTCCurrencyStatus
Created new variable: $CBPLTCCurrencyMessage
Created new variable: $CBPLTCCurrencyDetails
Created new variable: $CBPLTCCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPMANACurrency
Created new variable: $CBPMANACurrencyID
Created new variable: $CBPMANACurrencyName
Created new variable: $CBPMANACurrencyMinSize
Created new variable: $CBPMANACurrencyStatus
Created new variable: $CBPMANACurrencyMessage
Created new variable: $CBPMANACurrencyDetails
Created new variable: $CBPMANACurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPMKRCurrency
Created new variable: $CBPMKRCurrencyID
Created new variable: $CBPMKRCurrencyName
Created new variable: $CBPMKRCurrencyMinSize
Created new variable: $CBPMKRCurrencyStatus
Created new variable: $CBPMKRCurrencyMessage
Created new variable: $CBPMKRCurrencyDetails
Created new variable: $CBPMKRCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPREPCurrency
Created new variable: $CBPREPCurrencyID
Created new variable: $CBPREPCurrencyName
Created new variable: $CBPREPCurrencyMinSize
Created new variable: $CBPREPCurrencyStatus
Created new variable: $CBPREPCurrencyMessage
Created new variable: $CBPREPCurrencyDetails
Created new variable: $CBPREPCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPUSDCurrency
Created new variable: $CBPUSDCurrencyID
Created new variable: $CBPUSDCurrencyName
Created new variable: $CBPUSDCurrencyMinSize
Created new variable: $CBPUSDCurrencyStatus
Created new variable: $CBPUSDCurrencyMessage
Created new variable: $CBPUSDCurrencyDetails
Created new variable: $CBPUSDCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPUSDCCurrency
Created new variable: $CBPUSDCCurrencyID
Created new variable: $CBPUSDCCurrencyName
Created new variable: $CBPUSDCCurrencyMinSize
Created new variable: $CBPUSDCCurrencyStatus
Created new variable: $CBPUSDCCurrencyMessage
Created new variable: $CBPUSDCCurrencyDetails
Created new variable: $CBPUSDCCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPXLMCurrency
Created new variable: $CBPXLMCurrencyID
Created new variable: $CBPXLMCurrencyName
Created new variable: $CBPXLMCurrencyMinSize
Created new variable: $CBPXLMCurrencyStatus
Created new variable: $CBPXLMCurrencyMessage
Created new variable: $CBPXLMCurrencyDetails
Created new variable: $CBPXLMCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPXRPCurrency
Created new variable: $CBPXRPCurrencyID
Created new variable: $CBPXRPCurrencyName
Created new variable: $CBPXRPCurrencyMinSize
Created new variable: $CBPXRPCurrencyStatus
Created new variable: $CBPXRPCurrencyMessage
Created new variable: $CBPXRPCurrencyDetails
Created new variable: $CBPXRPCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPXTZCurrency
Created new variable: $CBPXTZCurrencyID
Created new variable: $CBPXTZCurrencyName
Created new variable: $CBPXTZCurrencyMinSize
Created new variable: $CBPXTZCurrencyStatus
Created new variable: $CBPXTZCurrencyMessage
Created new variable: $CBPXTZCurrencyDetails
Created new variable: $CBPXTZCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPZECCurrency
Created new variable: $CBPZECCurrencyID
Created new variable: $CBPZECCurrencyName
Created new variable: $CBPZECCurrencyMinSize
Created new variable: $CBPZECCurrencyStatus
Created new variable: $CBPZECCurrencyMessage
Created new variable: $CBPZECCurrencyDetails
Created new variable: $CBPZECCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPZILCurrency
Created new variable: $CBPZILCurrencyID
Created new variable: $CBPZILCurrencyName
Created new variable: $CBPZILCurrencyMinSize
Created new variable: $CBPZILCurrencyStatus
Created new variable: $CBPZILCurrencyMessage
Created new variable: $CBPZILCurrencyDetails
Created new variable: $CBPZILCurrencyMaxPrecision
-----------------------------------------------------
Created new variable: $CBPZRXCurrency
Created new variable: $CBPZRXCurrencyID
Created new variable: $CBPZRXCurrencyName
Created new variable: $CBPZRXCurrencyMinSize
Created new variable: $CBPZRXCurrencyStatus
Created new variable: $CBPZRXCurrencyMessage
Created new variable: $CBPZRXCurrencyDetails
Created new variable: $CBPZRXCurrencyMaxPrecision
-----------------------------------------------------

PS C:\> $CBPCurrencies | Format-Table -AutoSize

id   name                  min_size   status message details
--   ----                  --------   ------ ------- -------
ALGO Algorand              1          online         @{type=crypto; symbol=A; network_confirmations=1; sort_order=93; crypto_address_link=https://algoexplorer.io/address/{{addr...
BAT  Basic Attention Token 1          online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=70; crypto_address_link=https://etherscan.io/token/0x0d8775f6...
BCH  Bitcoin Cash          0.00000001 online         @{type=crypto; symbol=₿; network_confirmations=12; sort_order=40; crypto_address_link=https://blockchair.com/bitcoin-cash/a...
BTC  Bitcoin               0.00000001 online         @{type=crypto; symbol=₿; network_confirmations=6; sort_order=20; crypto_address_link=https://live.blockcypher.com/btc/addre...
CVC  Civic                 1          online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=125; crypto_address_link=https://etherscan.io/token/0x41e5560...
DAI  Dai                   0.00001    online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=100; crypto_address_link=https://etherscan.io/token/0x89d24a6...
DNT  district0x            1          online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=130; crypto_address_link=https://etherscan.io/token/0x0abdace...
EOS  EOS                   0.1        online         @{type=crypto; symbol=; sort_order=45; crypto_address_link=https://www.eosx.io/account/{{address}}; crypto_transaction_link...
ETC  Ether Classic         0.00000001 online         @{type=crypto; symbol=⟠; network_confirmations=5676; sort_order=55; crypto_address_link=https://gastracker.io/addr/{{addres...
ETH  Ether                 0.00000001 online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=25; crypto_address_link=https://etherscan.io/address/{{addres...
EUR  Euro                  0.01       online         @{type=fiat; symbol=€; sort_order=2; push_payment_methods=System.Object[]; group_types=System.Object[]}
GBP  British Pound         0.01       online         @{type=fiat; symbol=£; sort_order=3; push_payment_methods=System.Object[]; group_types=System.Object[]}
GNT  Golem                 1          online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=105; crypto_address_link=https://etherscan.io/token/0xa744764...
LINK Chainlink             1          online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=67; crypto_address_link=https://etherscan.io/token/0x51491077...
LOOM Loom Network          1          online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=115; crypto_address_link=https://etherscan.io/token/0xa4e8c3e...
LTC  Litecoin              0.00000001 online         @{type=crypto; symbol=Ł; network_confirmations=6; sort_order=35; crypto_address_link=https://live.blockcypher.com/ltc/addre...
MANA Decentraland          1          online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=110; crypto_address_link=https://etherscan.io/token/0x0f5d2fb...
MKR  Maker                 0.000001   online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=60; crypto_address_link=https://etherscan.io/token/0x9f8f72aa...
REP  REP                   0.000001   online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=85; crypto_address_link=https://etherscan.io/token/0x1985365e...
USD  United States Dollar  0.01       online         @{type=fiat; symbol=$; sort_order=1; push_payment_methods=System.Object[]; display_name=US Dollar; group_types=System.Objec...
USDC USD Coin              0.000001   online         @{type=crypto; symbol=$; network_confirmations=35; sort_order=80; crypto_address_link=https://etherscan.io/token/0xa0b86991...
XLM  Stellar               1          online         @{type=crypto; symbol=; sort_order=50; crypto_address_link=https://stellar.expert/explorer/public/account/{{address}}; cryp...
XRP  XRP                   1          online         @{type=crypto; symbol=$; sort_order=30; crypto_address_link=https://bithomp.com/explorer/{{address}}; crypto_transaction_li...
XTZ  Tezos                 0.000001   online         @{type=crypto; symbol=Τ; network_confirmations=60; sort_order=53; crypto_address_link=https://tzscan.io/{{address}}; crypto...
ZEC  Zcash                 0.00000001 online         @{type=crypto; symbol=ᙇ; network_confirmations=18; sort_order=65; crypto_address_link=https://zcash.blockexplorer.com/addre...
ZIL  Zilliqa               1          online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=95; crypto_address_link=https://etherscan.io/token/0x05f4a42e...
ZRX  0x                    0.00001    online         @{type=crypto; symbol=Ξ; network_confirmations=35; sort_order=90; crypto_address_link=https://etherscan.io/token/0xe41d2489...

jasonpearce commented 5 years ago

Creating arrays and variables for Coinbase Pro Products.

# Create arrays and variables for Coinbase Pro Products
# Using Get-CoinbaseProProducts, a public function (no API Key required)

# Get-CoinbaseProProducts
$CBPProducts = Get-CoinbaseProProducts | Sort-Object Id

# Get-CoinbaseProProducts and dynamically create Product variables
foreach ($CBPProduct in $CBPProducts) {

    # Variables
    $ProductPair           = $CBPProduct.id.Replace("-","")
    $ProductId             = $CBPProduct.id
    $ProductBaseCurrency   = $CBPProduct.base_currency
    $ProductQuoteCurrency  = $CBPProduct.quote_currency
    $ProductBaseMinSize    = $CBPProduct.base_min_size
    $ProductBaseMaxSize    = $CBPProduct.base_max_size
    $ProductQuoteIncrement = $CBPProduct.quote_increment
    $ProductBaseIncrement  = $CBPProduct.base_increment
    $ProductDisplayName    = $CBPProduct.display_name
    $ProductMinMarketFunds = $CBPProduct.min_market_funds
    $ProductMaxMarketFunds = $CBPProduct.max_market_funds
    $ProductMarginEnabled  = $CBPProduct.margin_enabled
    $ProductPostOnly       = $CBPProduct.post_only
    $ProductLimitOnly      = $CBPProduct.limit_only
    $ProductCancelOnly     = $CBPProduct.cancel_only
    $ProductStatus         = $CBPProduct.status
    $ProductStatusMessage  = $CBPProduct.status_message

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "Product"
    $Value = $CBPProduct
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductId"
    $Value = $ProductId
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductBaseCurrency"
    $Value = $ProductBaseCurrency
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductQuoteCurrency"
    $Value = $ProductQuoteCurrency
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductBaseMinSize"
    $Value = $ProductBaseMinSize
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductBaseMaxSize"
    $Value = $ProductBaseMaxSize
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductQuoteIncrement"
    $Value = $ProductQuoteIncrement
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductBaseIncrement"
    $Value = $ProductBaseIncrement
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductDisplayName"
    $Value = $ProductDisplayName
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductMinMarketFunds"
    $Value = $ProductMinMarketFunds
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductMaxMarketFunds"
    $Value = $ProductMaxMarketFunds
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductMarginEnabled"
    $Value = $ProductMarginEnabled
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductPostOnly"
    $Value = $ProductPostOnly
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductLimitOnly"
    $Value = $ProductLimitOnly
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductCancelOnly"
    $Value = $ProductCancelOnly
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductStatus"
    $Value = $ProductStatus
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create Product-Specific Variable
    $Name = "CBP" + $ProductPair + "ProductStatusMessage"
    $Value = $ProductStatusMessage
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Write a line break
    Write-Host "-----------------------------------------------------"

}

# Write New Variables to Screen
Get-Variable -Name CBP*Product*
$CBPProducts | Format-Table -AutoSize

Results

Created new variable: $CBPALGOUSDProduct
Created new variable: $CBPALGOUSDProductId
Created new variable: $CBPALGOUSDProductBaseCurrency
Created new variable: $CBPALGOUSDProductQuoteCurrency
Created new variable: $CBPALGOUSDProductBaseMinSize
Created new variable: $CBPALGOUSDProductBaseMaxSize
Created new variable: $CBPALGOUSDProductQuoteIncrement
Created new variable: $CBPALGOUSDProductBaseIncrement
Created new variable: $CBPALGOUSDProductDisplayName
Created new variable: $CBPALGOUSDProductMinMarketFunds
Created new variable: $CBPALGOUSDProductMaxMarketFunds
Created new variable: $CBPALGOUSDProductMarginEnabled
Created new variable: $CBPALGOUSDProductPostOnly
Created new variable: $CBPALGOUSDProductLimitOnly
Created new variable: $CBPALGOUSDProductCancelOnly
Created new variable: $CBPALGOUSDProductStatus
Created new variable: $CBPALGOUSDProductStatusMessage
-----------------------------------------------------
Created new variable: $CBPBATETHProduct
Created new variable: $CBPBATETHProductId
Created new variable: $CBPBATETHProductBaseCurrency
Created new variable: $CBPBATETHProductQuoteCurrency
Created new variable: $CBPBATETHProductBaseMinSize
Created new variable: $CBPBATETHProductBaseMaxSize
Created new variable: $CBPBATETHProductQuoteIncrement
Created new variable: $CBPBATETHProductBaseIncrement
Created new variable: $CBPBATETHProductDisplayName
Created new variable: $CBPBATETHProductMinMarketFunds
Created new variable: $CBPBATETHProductMaxMarketFunds
Created new variable: $CBPBATETHProductMarginEnabled
Created new variable: $CBPBATETHProductPostOnly
Created new variable: $CBPBATETHProductLimitOnly
Created new variable: $CBPBATETHProductCancelOnly
Created new variable: $CBPBATETHProductStatus
Created new variable: $CBPBATETHProductStatusMessage
-----------------------------------------------------
Created new variable: $CBPBATUSDCProduct
Created new variable: $CBPBATUSDCProductId
Created new variable: $CBPBATUSDCProductBaseCurrency
Created new variable: $CBPBATUSDCProductQuoteCurrency
Created new variable: $CBPBATUSDCProductBaseMinSize
Created new variable: $CBPBATUSDCProductBaseMaxSize
Created new variable: $CBPBATUSDCProductQuoteIncrement
Created new variable: $CBPBATUSDCProductBaseIncrement
Created new variable: $CBPBATUSDCProductDisplayName
Created new variable: $CBPBATUSDCProductMinMarketFunds
Created new variable: $CBPBATUSDCProductMaxMarketFunds
Created new variable: $CBPBATUSDCProductMarginEnabled
Created new variable: $CBPBATUSDCProductPostOnly
Created new variable: $CBPBATUSDCProductLimitOnly
Created new variable: $CBPBATUSDCProductCancelOnly
Created new variable: $CBPBATUSDCProductStatus
Created new variable: $CBPBATUSDCProductStatusMessage
-----------------------------------------------------

...etc...

PS C:\> $CBPProducts | Format-Table -AutoSize

id        base_currency quote_currency base_min_size base_max_size     quote_increment base_increment display_name min_market_funds max_market_funds
--        ------------- -------------- ------------- -------------     --------------- -------------- ------------ ---------------- ----------------
ALGO-USD  ALGO          USD            1.00000000    500000.00000000   0.00010000      1.00000000     ALGO/USD     10               100000
BAT-ETH   BAT           ETH            1.00000000    300000.00000000   0.00000001      1.00000000     BAT/ETH      0.01             500
BAT-USDC  BAT           USDC           1.00000000    800000.00000000   0.00000100      1.00000000     BAT/USDC     10               100000
BCH-BTC   BCH           BTC            0.01000000    400.00000000      0.00001000      0.00000001     BCH/BTC      0.001            60
BCH-EUR   BCH           EUR            0.01000000    100.00000000      0.01000000      0.00000001     BCH/EUR      10               300000
BCH-GBP   BCH           GBP            0.01000000    250.00000000      0.01000000      0.00000001     BCH/GBP      10               500000
BCH-USD   BCH           USD            0.01000000    700.00000000      0.01000000      0.00000001     BCH/USD      10               500000
BTC-EUR   BTC           EUR            0.00100000    200.00000000      0.01000000      0.00000001     BTC/EUR      10               600000
BTC-GBP   BTC           GBP            0.00100000    80.00000000       0.01000000      0.00000001     BTC/GBP      10               200000
BTC-USD   BTC           USD            0.00100000    280.00000000      0.01000000      0.00000001     BTC/USD      10               1000000
BTC-USDC  BTC           USDC           0.00100000    280.00000000      0.01000000      0.00000001     BTC/USDC     10               1000000
CVC-USDC  CVC           USDC           1.00000000    2000000.00000000  0.00000100      1.00000000     CVC/USDC     0.1              100000
DAI-USDC  DAI           USDC           1.00000000    100000.00000000   0.00000100      0.00001000     DAI/USDC     5                100000
DNT-USDC  DNT           USDC           1.00000000    10000000.00000000 0.00000100      1.00000000     DNT/USDC     0.1              100000
EOS-BTC   EOS           BTC            0.10000000    5000.00000000     0.00000100      0.10000000     EOS/BTC      0.001            30
EOS-EUR   EOS           EUR            0.10000000    5000.00000000     0.00100000      0.10000000     EOS/EUR      10               100000
EOS-USD   EOS           USD            0.10000000    5000.00000000     0.00100000      0.10000000     EOS/USD      10               100000
ETC-BTC   ETC           BTC            0.10000000    5000.00000000     0.00000100      0.00000001     ETC/BTC      0.001            30
ETC-EUR   ETC           EUR            0.10000000    20000.00000000    0.00100000      0.00000001     ETC/EUR      10               100000
ETC-GBP   ETC           GBP            0.10000000    20000.00000000    0.00100000      0.00000001     ETC/GBP      10               100000
ETC-USD   ETC           USD            0.10000000    20000.00000000    0.00100000      0.00000001     ETC/USD      10               100000
ETH-BTC   ETH           BTC            0.01000000    2400.00000000     0.00001000      0.00000001     ETH/BTC      0.001            80
ETH-DAI   ETH           DAI            0.01000000    700.00000000      0.01000000      0.00010000     ETH/DAI      10               100000
ETH-EUR   ETH           EUR            0.01000000    1600.00000000     0.01000000      0.00000001     ETH/EUR      10               400000
ETH-GBP   ETH           GBP            0.01000000    1400.00000000     0.01000000      0.00000001     ETH/GBP      10               1000000
ETH-USD   ETH           USD            0.01000000    2800.00000000     0.01000000      0.00000001     ETH/USD      10               1000000
ETH-USDC  ETH           USDC           0.01000000    2800.00000000     0.01000000      0.00000001     ETH/USDC     10               1000000
GNT-USDC  GNT           USDC           1.00000000    1500000.00000000  0.00000100      1.00000000     GNT/USDC     0.01             100000
LINK-ETH  LINK          ETH            1.00000000    90000.00000000    0.00000001      0.01000000     LINK/ETH     0.01             400
LINK-USD  LINK          USD            1.00000000    90000.00000000    0.00001000      0.01000000     LINK/USD     10               100000
LOOM-USDC LOOM          USDC           1.00000000    2500000.00000000  0.00000100      1.00000000     LOOM/USDC    0.1              100000
LTC-BTC   LTC           BTC            0.10000000    8000.00000000     0.00000100      0.00000001     LTC/BTC      0.001            120
LTC-EUR   LTC           EUR            0.10000000    1000.00000000     0.01000000      0.00000001     LTC/EUR      10               250000
LTC-GBP   LTC           GBP            0.10000000    1000.00000000     0.01000000      0.00000001     LTC/GBP      10               250000
LTC-USD   LTC           USD            0.10000000    4000.00000000     0.01000000      0.00000001     LTC/USD      10               250000
MANA-USDC MANA          USDC           1.00000000    2800000.00000000  0.00000100      1.00000000     MANA/USDC    0.1              100000
REP-BTC   REP           BTC            0.10000000    5000.00000000     0.00000100      0.00000100     REP/BTC      0.001            6
REP-USD   REP           USD            0.10000000    5000.00000000     0.01000000      0.00000100     REP/USD      10               30000
XLM-BTC   XLM           BTC            1.00000000    600000.00000000   0.00000001      1.00000000     XLM/BTC      0.001            50
XLM-EUR   XLM           EUR            1.00000000    600000.00000000   0.00000100      1.00000000     XLM/EUR      0.1              100000
XLM-USD   XLM           USD            1.00000000    600000.00000000   0.00000100      1.00000000     XLM/USD      0.1              100000
XRP-BTC   XRP           BTC            1.00000000    500000.00000000   0.00000001      1.00000000     XRP/BTC      0.001            30
XRP-EUR   XRP           EUR            1.00000000    500000.00000000   0.00010000      1.00000000     XRP/EUR      10               100000
XRP-USD   XRP           USD            1.00000000    500000.00000000   0.00010000      1.00000000     XRP/USD      10               100000
XTZ-BTC   XTZ           BTC            1.00000000    100000.00000000   0.00000001      0.01000000     XTZ/BTC      0.001            10
XTZ-USD   XTZ           USD            1.00000000    100000.00000000   0.00010000      0.01000000     XTZ/USD      10               100000
ZEC-BTC   ZEC           BTC            0.01000000    1500.00000000     0.00000100      0.00010000     ZEC/BTC      0.001            30
ZEC-USDC  ZEC           USDC           0.01000000    5000.00000000     0.01000000      0.00000001     ZEC/USDC     10               250000
ZRX-BTC   ZRX           BTC            1.00000000    600000.00000000   0.00000001      0.00001000     ZRX/BTC      0.001            60
ZRX-EUR   ZRX           EUR            1.00000000    600000.00000000   0.00000100      0.00001000     ZRX/EUR      10               100000
ZRX-USD   ZRX           USD            1.00000000    600000.00000000   0.00000100      0.00001000     ZRX/USD      10               100000
jasonpearce commented 5 years ago

Creating arrays and variables for Coinbase Pro Order Book.

# Create arrays and variables for Coinbase Pro Order Book
# Using Get-CoinbaseProProductOrderBook, a public function (no API Key required)

# Create an Array for Coinbase Pro OrderBook
$CBPOrderBook = $null
$CBPOrderBook = @()

# Get-CoinbaseProProducts
$CBPProducts = Get-CoinbaseProProducts | Sort-Object Id

# Get-CoinbaseProProductOrderBook and dynamically create OrderBook variables
foreach ($CBPProduct in $CBPProducts) {

    # Variables
    $ProductPair      = $CBPProduct.id.Replace("-","")
    $ProductId        = $CBPProduct.id
    $ProductOrderBook = Get-CoinbaseProProductOrderBook -ProductID $ProductId

    # Create OrderBook-Specific Variable
    $Name = "CBP" + $ProductPair + "OrderBook"
    $Value = $ProductOrderBook
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create OrderBook-Specific Variable
    $Name = "CBP" + $ProductPair + "OrderBookSequence"
    $Value = $ProductOrderBook.Sequence
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create OrderBook-Specific Variable
    $Name = "CBP" + $ProductPair + "OrderBookBids"
    $Value = $ProductOrderBook.Bids
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create OrderBook-Specific Variable
    $Name = "CBP" + $ProductPair + "OrderBookAsks"
    $Value = $ProductOrderBook.Asks
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create an Ordered Object
    $MyObject = $null
    $MyObject = [PSCustomObject][Ordered]@{
        Pair     = $ProductPair
        Sequence = $ProductOrderBook.Sequence
        Bids     = $ProductOrderBook.Bids
        Asks     = $ProductOrderBook.Asks
    }

    # Add Object to the CBPOrderBook
    $CBPOrderBook += $MyObject

    # Wait a half-second so API doesn't trigger limits, failing to provide results
    Start-Sleep -Milliseconds 200

    # Write a line break
    Write-Host "-----------------------------------------------------"

}

# Write New Variables and Array to Screen
Get-Variable -Name CBP*OrderBook*
$CBPOrderBook | Format-Table -AutoSize

Results

Created new variable: $CBPALGOUSDOrderBook
Created new variable: $CBPALGOUSDOrderBookSequence
Created new variable: $CBPALGOUSDOrderBookBids
Created new variable: $CBPALGOUSDOrderBookAsks
-----------------------------------------------------
Created new variable: $CBPBATETHOrderBook
Created new variable: $CBPBATETHOrderBookSequence
Created new variable: $CBPBATETHOrderBookBids
Created new variable: $CBPBATETHOrderBookAsks
-----------------------------------------------------
Created new variable: $CBPBATUSDCOrderBook
Created new variable: $CBPBATUSDCOrderBookSequence
Created new variable: $CBPBATUSDCOrderBookBids
Created new variable: $CBPBATUSDCOrderBookAsks
-----------------------------------------------------

...etc...

PS C:\> $CBPOrderBook | Format-Table -AutoSize

Pair        Sequence Bids                       Asks
----        -------- ----                       ----
ALGOUSD      6040491 {0.4077 2000 1}            {0.4104 949 1}
BATETH      78224881 {0.00105217 5985 2}        {0.00105516 5116 2}
BATUSDC    736125745 {0.17696 10481 2}          {0.177228 1370 1}
BCHBTC    1098361704 {0.0288 19.912 1}          {0.02883 24.55531225 3}
BCHEUR    2037229180 {251.84 1.42 1}            {252.15 10 1}
BCHGBP     687999789 {226.81 12.47 1}           {227.52 79 1}
BCHUSD    8072198685 {276.14 9.81400632 5}      {276.15 11.15768311 2}
BTCEUR    5941174181 {8746.33 0.99935036 1}     {8748.2 0.58999125 1}
BTCGBP    7068255856 {7888.6 0.48838946 1}      {7899.99 0.25572835 1}
BTCUSD   10746939422 {9590.14 9.07030224 9}     {9590.15 5.02909579 1}
BTCUSDC    625244661 {9589.04 1 1}              {9593.11 6.371 1}
CVCUSDC    122859607 {0.040435 30000 1}         {0.040777 5388 1}
DAIUSDC    156626615 {1.008774 10.55005 1}      {1.010713 508.19678 1}
DNTUSDC     41568581 {0.007127 1 1}             {0.007399 644592 1}
EOSBTC      44870640 {0.000334 2955.2 7}        {0.000335 1222.3 8}
EOSEUR      95539137 {2.925 2517.2 2}           {2.933 400 1}
EOSUSD     146526140 {3.205 5728.5 4}           {3.211 783.3 2}
ETCBTC     107901768 {0.000656 1622.78653445 3} {0.000657 390.22075289 3}
ETCEUR     306922066 {5.734 218.93146423 4}     {5.747 0.99851691 1}
ETCGBP     340109364 {5.163 160 1}              {5.205 5 1}
ETCUSD     432095338 {6.293 107.21107875 2}     {6.298 3.35738108 1}
ETHBTC    1848632811 {0.01752 20.25769979 7}    {0.01753 3.72719626 1}
ETHDAI      47696369 {166.36 6.305 2}           {166.37 25.9649 2}
ETHEUR    2795928268 {153.21 6.40157189 2}      {153.34 6.26839304 1}
ETHGBP    1171028791 {138.26 42.07089888 1}     {138.69 5.25463827 1}
ETHUSD    7246315675 {168.06 0.13317885 1}      {168.07 46.147 3}
ETHUSDC    249532033 {168.05 5.72949016 1}      {168.35 5.72949016 1}
GNTUSDC    141907081 {0.060039 24274 2}         {0.060695 4233 1}
LINKETH     73094214 {0.01053772 1 1}           {0.01054996 921.01 2}
LINKUSD    245388174 {1.77216 21 1}             {1.77391 381.95 1}
LOOMUSDC    47614305 {0.027778 28486 2}         {0.028046 100 1}
LTCBTC    1089061069 {0.006592 9.74671909 2}    {0.0066 30 1}
LTCEUR    1503253810 {57.67 5.408 1}            {57.75 0.5035 1}
LTCGBP     754826853 {52.18 101.52183322 1}     {52.58 109.6 2}
LTCUSD    3896459001 {63.29 2 1}                {63.32 60 1}
MANAUSDC    88756183 {0.031854 469 1}           {0.032022 39983 1}
REPBTC      23192262 {0.000833 111.2744 1}      {0.000836 128.036001 2}
REPUSD      94862656 {7.98 321.992959 2}        {8.01 16.6 1}
XLMBTC      65517199 {0.0000065 115036 3}       {0.00000652 111106 4}
XLMEUR     373461410 {0.056801 2813 1}          {0.057037 92615 1}
XLMUSD     376493451 {0.062335 28004 1}         {0.062406 12458 2}
XRPBTC     119577780 {0.00002681 2462 2}        {0.00002684 13300 1}
XRPEUR     127180517 {0.2346 4810 1}            {0.2347 2819 3}
XRPUSD     199456869 {0.2572 5881 3}            {0.2574 2346 1}
XTZBTC      13843463 {0.00010956 1552.6 4}      {0.00010966 1015 1}
XTZUSD      34464293 {1.0508 791.78 4}          {1.051 78.93 1}
ZECBTC      25193353 {0.004619 47.4189 2}       {0.004639 47.4041 2}
ZECUSDC    347630651 {44.34 48.60543279 2}      {44.42 7 1}
ZRXBTC     125398513 {0.0000169 6903.09081 2}   {0.00001692 10580.49015 3}
ZRXEUR     506570365 {0.147252 2118.047 1}      {0.148306 5272.71096 1}
ZRXUSD     646554043 {0.161808 6250 1}          {0.161922 2501 1}

jasonpearce commented 5 years ago

Creating arrays and variables for Coinbase Pro Stats.

# Create arrays and variables for Coinbase Pro Stats
# Using Get-CoinbaseProProductStats, a public function (no API Key required)

# Create an Array for Coinbase Pro ProductStats
$CBPProductStats = $null
$CBPProductStats = @()

# Get-CoinbaseProProducts
$CBPProducts = Get-CoinbaseProProducts | Sort-Object Id

# Get-CoinbaseProProductStats and dynamically create ProductStats variables
foreach ($CBPProduct in $CBPProducts) {

    # Get-CoinbaseProProductStats
    $ProductStats = Get-CoinbaseProProductStats -ProductId $CBPProduct.id

    # Variables
    $ProductStatsPair        = $CBPProduct.id.Replace("-","")
    $ProductStatsId          = $CBPProduct.id
    $ProductStatsOpen        = $ProductStats.open
    $ProductStatsHigh        = $ProductStats.high
    $ProductStatsLow         = $ProductStats.low
    $ProductStatsVolume      = $ProductStats.volume
    $ProductStatsLast        = $ProductStats.last
    $ProductStatsVolume30Day = $ProductStats.volume_30day

    # Create ProductStats-Specific Variable
    $Name = "CBP" + $ProductStatsPair + "ProductStats"
    $Value = $ProductStats
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductStats-Specific Variable
    $Name = "CBP" + $ProductStatsPair + "ProductStatsOpen"
    $Value = $ProductStatsOpen
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductStats-Specific Variable
    $Name = "CBP" + $ProductStatsPair + "ProductStatsHigh"
    $Value = $ProductStatsHigh
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductStats-Specific Variable
    $Name = "CBP" + $ProductStatsPair + "ProductStatsLow"
    $Value = $ProductStatsLow
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductStats-Specific Variable
    $Name = "CBP" + $ProductStatsPair + "ProductStatsVolume"
    $Value = $ProductStatsVolume
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductStats-Specific Variable
    $Name = "CBP" + $ProductStatsPair + "ProductStatsLast"
    $Value = $ProductStatsLast
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductStats-Specific Variable
    $Name = "CBP" + $ProductStatsPair + "ProductStatsVolume30Day"
    $Value = $ProductStatsVolume30Day
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create an Ordered Object
    $MyObject = $null
    $MyObject = [PSCustomObject][Ordered]@{
        Pair        = $ProductStatsPair
        Open        = $ProductStats.open
        High        = $ProductStats.high
        Low         = $ProductStats.low
        Volume      = $ProductStats.volume
        Last        = $ProductStats.last
        Volume30Day = $ProductStats.volume_30day
    }

    # Add Object to the CBPProductStats
    $CBPProductStats += $MyObject

    # Wait a half-second so API doesn't trigger limits, failing to provide results
    Start-Sleep -Milliseconds 200

    # Write a line break
    Write-Host "-----------------------------------------------------"

}

# Write New Variables and Array to Screen
Get-Variable -Name CBP*ProductStats*
$CBPProductStats | Format-Table -AutoSize

Results

Created new variable: $CBPALGOUSDProductStats
Created new variable: $CBPALGOUSDProductStatsOpen
Created new variable: $CBPALGOUSDProductStatsHigh
Created new variable: $CBPALGOUSDProductStatsLow
Created new variable: $CBPALGOUSDProductStatsVolume
Created new variable: $CBPALGOUSDProductStatsLast
Created new variable: $CBPALGOUSDProductStatsVolume30Day
-----------------------------------------------------
Created new variable: $CBPBATETHProductStats
Created new variable: $CBPBATETHProductStatsOpen
Created new variable: $CBPBATETHProductStatsHigh
Created new variable: $CBPBATETHProductStatsLow
Created new variable: $CBPBATETHProductStatsVolume
Created new variable: $CBPBATETHProductStatsLast
Created new variable: $CBPBATETHProductStatsVolume30Day
-----------------------------------------------------
Created new variable: $CBPBATUSDCProductStats
Created new variable: $CBPBATUSDCProductStatsOpen
Created new variable: $CBPBATUSDCProductStatsHigh
Created new variable: $CBPBATUSDCProductStatsLow
Created new variable: $CBPBATUSDCProductStatsVolume
Created new variable: $CBPBATUSDCProductStatsLast
Created new variable: $CBPBATUSDCProductStatsVolume30Day
-----------------------------------------------------

...etc...

PS C:\> $CBPProductStats | Format-Table -AutoSize

Pair     Open          High          Low           Volume            Last          Volume30Day
----     ----          ----          ---           ------            ----          -----------
ALGOUSD  0.41330000    0.43160000    0.40800000    429006.00000000   0.40800000    10945558
BATETH   0.00104587    0.00107794    0.00104070    96154.00000000    0.00105154    6809705
BATUSDC  0.17629600    0.18250000    0.17489000    2127486.00000000  0.17684300    155206066
BCHBTC   0.02936000    0.02953000    0.02878000    1362.95173632     0.02880000    155678.66834509
BCHEUR   256.93000000  258.98000000  251.00000000  531.20566672      251.84000000  69433.7816765
BCHGBP   231.68000000  232.66000000  226.65000000  383.97733104      226.81000000  20803.83765606
BCHUSD   281.94000000  283.76000000  275.20000000  13545.87751726    276.14000000  685239.52283396
BTCEUR   8727.15000000 8855.14000000 8622.13000000 801.14249520      8747.00000000 53601.75461746
BTCGBP   7877.93000000 7982.55000000 7783.91000000 272.35923719      7899.75000000 18738.95934817
BTCUSD   9583.06000000 9699.00000000 9451.67000000 5212.07231765     9584.93000000 404847.68982357
BTCUSDC  9582.79000000 9700.88000000 9461.74000000 237.66549435      9580.71000000 23330.5933677
CVCUSDC  0.04169000    0.04200000    0.04001100    384783.00000000   0.04077800    13922886
DAIUSDC  1.01233700    1.01591300    1.00732000    400007.21176000   1.00877100    37452940.82416
DNTUSDC  0.00708600    0.00760000    0.00683100    2826289.00000000  0.00707500    342397519
EOSBTC   0.00033900    0.00034000    0.00033200    36069.30000000    0.00033400    2866708.6
EOSEUR   2.95400000    2.98300000    2.90000000    25640.40000000    2.92500000    1883744.9
EOSUSD   3.25300000    3.25500000    3.18100000    221782.60000000   3.21100000    10950678.4
ETCBTC   0.00065100    0.00067600    0.00064200    68201.18740663    0.00065500    1994096.68774134
ETCEUR   5.68300000    5.89800000    5.60000000    58775.43544393    5.73700000    1379719.62775907
ETCGBP   5.13600000    5.35500000    5.06900000    8011.11127716     5.20200000    394444.76322443
ETCUSD   6.22500000    6.49900000    6.14600000    262092.99008592   6.28200000    9042907.33860616
ETHBTC   0.01768000    0.01770000    0.01748000    4663.85413419     0.01751000    517246.99367775
ETHDAI   167.16000000  168.00000000  164.00000000  467.29180000      166.37000000  42624.7482
ETHEUR   154.66000000  154.98000000  151.29000000  4313.83516425     153.17000000  333848.14050008
ETHGBP   139.84000000  140.38000000  136.66000000  1736.81928373     138.69000000  92217.20576091
ETHUSD   169.40000000  170.07000000  165.63000000  37819.81226223    168.02000000  2426131.23869887
ETHUSDC  169.50000000  170.06000000  165.73000000  912.82433413      168.42000000  107202.05854638
GNTUSDC  0.06106700    0.06250000    0.05923200    170599.00000000   0.06003900    6086227
LINKETH  0.01095417    0.01111815    0.01053773    23153.03000000    0.01057546    2073345.75
LINKUSD  1.86416000    1.89499000    1.76565000    960907.81000000   1.77547000    66462833.24
LOOMUSDC 0.02843700    0.02843700    0.02758600    54195.00000000    0.02777900    17674990
LTCBTC   0.00669200    0.00680400    0.00656000    15500.53994665    0.00660000    1367034.05710888
LTCEUR   58.47000000   59.79000000   57.58000000   21136.27403176    57.67000000   682953.09239496
LTCGBP   52.80000000   54.23000000   52.00000000   6269.21872778     52.42000000   206871.0138475
LTCUSD   64.29000000   65.57000000   62.89000000   88086.16299395    63.25000000   5245246.71150726
MANAUSDC 0.03181300    0.03251600    0.03158400    57483.00000000    0.03202200    8635908
REPBTC   0.00087700    0.00087800    0.00083200    4204.99350800     0.00083200    214895.852147
REPUSD   8.40000000    8.41000000    7.97000000    14610.28541800    7.98000000    1031627.680241
XLMBTC   0.00000657    0.00000659    0.00000638    1662753.00000000  0.00000650    115648109
XLMEUR   0.05750000    0.05754700    0.05573600    1320003.00000000  0.05683000    63766002
XLMUSD   0.06309600    0.06309600    0.06117700    6019574.00000000  0.06240700    355757518
XRPBTC   0.00002673    0.00002695    0.00002639    3193360.00000000  0.00002683    234808504
XRPEUR   0.23380000    0.23540000    0.23030000    1203480.00000000  0.23470000    83807527
XRPUSD   0.25630000    0.25790000    0.25240000    13089786.00000000 0.25720000    709903249
XTZBTC   0.00010635    0.00011169    0.00010635    155622.30000000   0.00010956    8492867.29
XTZUSD   1.01660000    1.08820000    1.01610000    414604.44000000   1.05340000    34247843.04
ZECBTC   0.00467800    0.00469500    0.00460000    940.68690000      0.00461900    21166.5569
ZECUSDC  44.77000000   45.39000000   44.15000000   3290.77364773     44.35000000   235893.04649662
ZRXBTC   0.00001659    0.00001733    0.00001649    865309.28998000   0.00001690    25722846.47435
ZRXEUR   0.14352800    0.15000000    0.14352800    566442.00169000   0.14752500    16780780.57432
ZRXUSD   0.15906600    0.16584200    0.15836200    1900122.70488000  0.16192200    106120825.52983
jasonpearce commented 5 years ago

Creating arrays and variables for Coinbase Pro Product Ticker

# Create arrays and variables for Coinbase Pro Product Ticker
# Using Get-CoinbaseProProductTicker, a public function (no API Key required)

# Create an Array for Coinbase Pro ProductTicker
$CBPProductTicker = $null
$CBPProductTicker = @()

# Get-CoinbaseProProducts
$CBPProducts = Get-CoinbaseProProducts | Sort-Object Id

# Get-CoinbaseProProductTicker and dynamically create ProductTicker variables
foreach ($CBPProduct in $CBPProducts) {

    # Get-CoinbaseProProductTicker
    $ProductTicker = Get-CoinbaseProProductTicker -ProductId $CBPProduct.id

    # Variables
    $ProductTickerPair    = $CBPProduct.id.Replace("-","")
    $ProductTickerTradeID = $ProductTicker.trade_id
    $ProductTickerPrice   = $ProductTicker.price
    $ProductTickerSize    = $ProductTicker.size
    $ProductTickerTime    = $ProductTicker.time
    $ProductTickerBid     = $ProductTicker.bid
    $ProductTickerAsk     = $ProductTicker.ask
    $ProductTickerVolume  = $ProductTicker.volume

    # Create ProductTicker-Specific Variable
    $Name = "CBP" + $ProductTickerPair + "ProductTicker"
    $Value = $ProductTicker
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTicker-Specific Variable
    $Name = "CBP" + $ProductTickerPair + "ProductTickerPair"
    $Value = $ProductTickerPair
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTicker-Specific Variable
    $Name = "CBP" + $ProductTickerPair + "ProductTickerTradeID"
    $Value = $ProductTickerTradeID
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTicker-Specific Variable
    $Name = "CBP" + $ProductTickerPair + "ProductTickerPrice"
    $Value = $ProductTickerPrice
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTicker-Specific Variable
    $Name = "CBP" + $ProductTickerPair + "ProductTickerSize"
    $Value = $ProductTickerSize
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTicker-Specific Variable
    $Name = "CBP" + $ProductTickerPair + "ProductTickerTime"
    $Value = $ProductTickerTime
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTicker-Specific Variable
    $Name = "CBP" + $ProductTickerPair + "ProductTickerBid"
    $Value = $ProductTickerBid
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTicker-Specific Variable
    $Name = "CBP" + $ProductTickerPair + "ProductTickerAsk"
    $Value = $ProductTickerAsk
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTicker-Specific Variable
    $Name = "CBP" + $ProductTickerPair + "ProductTickerVolume"
    $Value = $ProductTickerVolume
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create an Ordered Object
    $MyObject = $null
    $MyObject = [PSCustomObject][Ordered]@{
        Pair    = $ProductTickerPair
        TradeID = $ProductTicker.trade_id
        Price   = $ProductTicker.price
        Size    = $ProductTicker.size
        Time    = $ProductTicker.time
        Bid     = $ProductTicker.bid
        Ask     = $ProductTicker.ask
        Volume  = $ProductTicker.volume
    }

    # Add Object to the CBPProductTicker
    $CBPProductTicker += $MyObject

    # Wait a half-second so API doesn't trigger limits, failing to provide results
    Start-Sleep -Milliseconds 200

    # Write a line break
    Write-Host "-----------------------------------------------------"

}

# Write New Variables and Array to Screen
Get-Variable -Name CBP*ProductTicker*
$CBPProductTicker | Format-Table -AutoSize

Results.

Created new variable: $CBPALGOUSDProductTicker
Created new variable: $CBPALGOUSDProductTickerPair
Created new variable: $CBPALGOUSDProductTickerTradeID
Created new variable: $CBPALGOUSDProductTickerPrice
Created new variable: $CBPALGOUSDProductTickerSize
Created new variable: $CBPALGOUSDProductTickerTime
Created new variable: $CBPALGOUSDProductTickerBid
Created new variable: $CBPALGOUSDProductTickerAsk
Created new variable: $CBPALGOUSDProductTickerVolume
-----------------------------------------------------
Created new variable: $CBPBATETHProductTicker
Created new variable: $CBPBATETHProductTickerPair
Created new variable: $CBPBATETHProductTickerTradeID
Created new variable: $CBPBATETHProductTickerPrice
Created new variable: $CBPBATETHProductTickerSize
Created new variable: $CBPBATETHProductTickerTime
Created new variable: $CBPBATETHProductTickerBid
Created new variable: $CBPBATETHProductTickerAsk
Created new variable: $CBPBATETHProductTickerVolume
-----------------------------------------------------
Created new variable: $CBPBATUSDCProductTicker
Created new variable: $CBPBATUSDCProductTickerPair
Created new variable: $CBPBATUSDCProductTickerTradeID
Created new variable: $CBPBATUSDCProductTickerPrice
Created new variable: $CBPBATUSDCProductTickerSize
Created new variable: $CBPBATUSDCProductTickerTime
Created new variable: $CBPBATUSDCProductTickerBid
Created new variable: $CBPBATUSDCProductTickerAsk
Created new variable: $CBPBATUSDCProductTickerVolume
-----------------------------------------------------

...etc...

PS C:\> $CBPProductTicker | Format-Table -AutoSize

Pair      TradeID Price         Size          Time                     Bid        Ask        Volume
----      ------- -----         ----          ----                     ---        ---        ------
ALGOUSD     13612 0.40850000    1.00000000    2019-08-31T19:30:13.980Z 0.408      0.4106     311199.00000000
BATETH      36063 0.00106370    92.00000000   2019-08-31T19:24:16.763Z 0.00106306 0.00106777 108432.00000000
BATUSDC   2016651 0.17786600    33.00000000   2019-08-31T19:32:20.564Z 0.17765    0.177866   1628589.00000000
BCHBTC    2202469 0.02855000    0.15350817    2019-08-31T19:31:07.552Z 0.02854    0.02856    1792.13969764
BCHEUR    1423541 249.15000000  5.39014866    2019-08-31T19:31:39.238Z 249.15     249.51     521.87561626
BCHGBP     268217 220.47000000  0.04270268    2019-08-31T19:19:39.369Z 223.92     225        517.19742293
BCHUSD   12911599 273.13000000  0.06734460    2019-08-31T19:32:13.886Z 273.13     273.48     12779.16782317
BTCEUR   21704941 8728.99000000 0.14085460    2019-08-31T19:32:26.948Z 8721.76    8729.22    468.54199186
BTCGBP    6966581 7877.00000000 0.11202462    2019-08-31T19:32:30.571Z 7874.81    7877       229.68798427
BTCUSD   73298173 9565.23000000 0.01000305    2019-08-31T19:32:32.410Z 9565.21    9565.24    4375.24935274
BTCUSDC    579380 9561.22000000 0.08717609    2019-08-31T19:32:18.155Z 9561.22    9566.21    205.79400992
CVCUSDC     40284 0.04030800    1.00000000    2019-08-31T19:00:11.722Z 0.040308   0.040613   123454.00000000
DAIUSDC    326931 1.01015000    5.91950000    2019-08-31T19:32:20.373Z 1.010235   1.011514   445472.03778000
DNTUSDC     85315 0.00726200    1.00000000    2019-08-31T19:21:25.335Z 0.007134   0.007262   1547902.00000000
EOSBTC     173051 0.00033900    3.00000000    2019-08-31T19:32:16.474Z 0.000339   0.00034    23611.10000000
EOSEUR     118060 2.96300000    3.00000000    2019-08-31T19:29:26.804Z 2.963      2.967      19427.80000000
EOSUSD     594619 3.25300000    0.90000000    2019-08-31T19:32:34.800Z 3.247      3.253      179111.10000000
ETCBTC     481998 0.00065200    4.78025924    2019-08-31T19:30:19.221Z 0.000652   0.000654   57320.20202508
ETCEUR     467015 5.71000000    141.30781422  2019-08-31T19:30:49.300Z 5.694      5.709      39376.63137257
ETCGBP     229515 5.12900000    0.57577440    2019-08-31T19:26:40.136Z 5.126      5.162      5631.82678347
ETCUSD    2488284 6.24900000    42.98981824   2019-08-31T19:32:32.132Z 6.249      6.254      191844.57918492
ETHBTC    8223851 0.01744000    3.20000000    2019-08-31T19:31:57.771Z 0.01744    0.01746    4664.94513432
ETHDAI     168060 165.48000000  0.00640000    2019-08-31T19:31:40.392Z 164.68     165.47     362.53150000
ETHEUR    7250765 152.31000000  0.94218071    2019-08-31T19:31:35.106Z 152.23     152.31     4076.35744275
ETHGBP     844283 137.68000000  0.03528611    2019-08-31T19:32:23.500Z 137.19     137.58     1805.59288367
ETHUSD   51127003 166.93000000  0.04234942    2019-08-31T19:32:32.356Z 166.9      166.93     35422.92677363
ETHUSDC    224196 167.17000000  0.23196640    2019-08-31T19:21:40.138Z 166.74     166.99     1120.41034508
GNTUSDC     54653 0.06000000    4.00000000    2019-08-31T19:31:09.170Z 0.059722   0.06       98882.00000000
LINKETH     65840 0.01065865    244.76        2019-08-31T19:28:13.467Z 0.01058676 0.01066275 22676.70000000
LINKUSD    999069 1.77594000    22.00000000   2019-08-31T19:32:14.493Z 1.77255    1.77595    858188.65000000
LOOMUSDC    66256 0.02798600    2.00000000    2019-08-31T19:32:10.250Z 0.027998   0.028231   54667.00000000
LTCBTC    6265782 0.00662500    3.25864619    2019-08-31T19:32:10.480Z 0.006625   0.00663    15028.07176773
LTCEUR    5054969 57.76000000   0.77667821    2019-08-31T19:32:12.481Z 57.76      57.81      20520.37188042
LTCGBP     467402 52.16000000   0.57793279    2019-08-31T19:31:08.167Z 52.18      52.35      6426.03602471
LTCUSD   41513010 63.44000000   1.14959805    2019-08-31T19:32:24.768Z 63.43      63.46      79669.29672366
MANAUSDC    71862 0.03140600    1.00000000    2019-08-31T19:17:10.736Z 0.031406   0.031759   65632.00000000
REPBTC      76230 0.00083200    0.74948700    2019-08-31T19:31:16.460Z 0.000828   0.000832   3254.84673600
REPUSD     271568 7.95000000    0.37673200    2019-08-31T19:31:45.980Z 7.94       7.95       17044.42566600
XLMBTC     430986 0.00000644    161.00000000  2019-08-31T19:32:26.683Z 0.00000644 0.00000645 1503399.00000000
XLMEUR     495376 0.05614500    159.00000000  2019-08-31T19:25:53.842Z 0.056151   0.056346   1146412.00000000
XLMUSD    1589048 0.06185100    4258.00000000 2019-08-31T19:32:32.418Z 0.061718   0.061849   5718247.00000000
XRPBTC     711705 0.00002654    3.00000000    2019-08-31T19:32:06.329Z 0.00002655 0.00002659 3033251.00000000
XRPEUR     545006 0.23210000    398.00000000  2019-08-31T19:31:12.311Z 0.2318     0.2321     1168762.00000000
XRPUSD    3170533 0.25440000    1926.00000000 2019-08-31T19:32:38.939Z 0.2542     0.2544     11635837.00000000
XTZBTC      33328 0.00010559    461.93000000  2019-08-31T19:31:53.315Z 0.0001053  0.00010546 130151.13000000
XTZUSD     147282 1.00710000    2.96000000    2019-08-31T19:32:46.301Z 1.0067     1.0071     315009.94000000
ZECBTC      34081 0.00462900    0.13180000    2019-08-31T19:31:12.142Z 0.004611   0.004629   897.02290000
ZECUSDC    486398 44.24000000   4.46703833    2019-08-31T19:32:18.426Z 44.16      44.23      3484.77343256
ZRXBTC     724301 0.00001686    36.98597000   2019-08-31T19:31:11.117Z 0.00001683 0.00001686 788675.87630000
ZRXEUR     438356 0.14643900    126.00000000  2019-08-31T19:21:40.111Z 0.146479   0.147209   630152.05634000
ZRXUSD    1877179 0.16128100    600.00000000  2019-08-31T19:31:19.290Z 0.160728   0.161258   1859366.69250000

jasonpearce commented 5 years ago

Creating arrays and variables for Coinbase Pro Product Trades.


# Create arrays and variables for Coinbase Pro Product Trades
# Using Get-CoinbaseProProductTrades, a public function (no API Key required)

# Create an Array for Coinbase Pro ProductTrades
$CBPProductTrades = $null
$CBPProductTrades = @()

# Get-CoinbaseProProducts
$CBPProducts = Get-CoinbaseProProducts | Sort-Object Id

# Get-CoinbaseProProductTrades and dynamically create ProductTrades variables
foreach ($CBPProduct in $CBPProducts) {

    # Get-CoinbaseProProductTicker
    $ProductTrades = Get-CoinbaseProProductTrades -ProductId $CBPProduct.id

    # Variables
    $ProductTradesPair         = $CBPProduct.id.Replace("-","")
    $ProductTradesTime         = $ProductTrades.time
    $ProductTradesTradeID      = $ProductTrades.trade_id
    $ProductTradesPrice        = $ProductTrades.price
    $ProductTradesSize         = $ProductTrades.size
    $ProductTradesSide         = $ProductTrades.side

    # Create ProductTrades-Specific Variable
    $Name = "CBP" + $ProductTradesPair + "ProductTrades"
    $Value = $ProductTrades
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTrades-Specific Variable
    $Name = "CBP" + $ProductTradesPair + "ProductTradesPair"
    $Value = $ProductTradesPair
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTrades-Specific Variable
    $Name = "CBP" + $ProductTradesPair + "ProductTradesTime"
    $Value = $ProductTradesTime
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTrades-Specific Variable
    $Name = "CBP" + $ProductTradesPair + "ProductTradesTradeID"
    $Value = $ProductTradesTradeID
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTrades-Specific Variable
    $Name = "CBP" + $ProductTradesPair + "ProductTradesPrice"
    $Value = $ProductTradesPrice
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTrades-Specific Variable
    $Name = "CBP" + $ProductTradesPair + "ProductTradesSize"
    $Value = $ProductTradesSize
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create ProductTrades-Specific Variable
    $Name = "CBP" + $ProductTradesPair + "ProductTradesSide"
    $Value = $ProductTradesSide
    New-Variable -Name $Name -Value $Value -Force
    Write-Host "Created new variable: `$$Name"

    # Create an Ordered Object
    $MyObject = $null
    $MyObject = [PSCustomObject][Ordered]@{
        Pair    = $ProductTradesPair
        Time    = $ProductTrades.time
        TradeID = $ProductTrades.trade_id
        Price   = $ProductTrades.price
        Size    = $ProductTrades.size
        Side    = $ProductTrades.side
    }

    # Add Object to the CBPProductTicker
    $CBPProductTrades += $MyObject

    # Wait a half-second so API doesn't trigger limits, failing to provide results
    Start-Sleep -Milliseconds 200

    # Write a line break
    Write-Host "-----------------------------------------------------"

}

# Write New Variables and Array to Screen
Get-Variable -Name CBP*ProductTrades*
$CBPProductTrades | Format-Table -AutoSize

Results

Created new variable: $CBPALGOUSDProductTrades
Created new variable: $CBPALGOUSDProductTradesPair
Created new variable: $CBPALGOUSDProductTradesTime
Created new variable: $CBPALGOUSDProductTradesTradeID
Created new variable: $CBPALGOUSDProductTradesPrice
Created new variable: $CBPALGOUSDProductTradesSize
Created new variable: $CBPALGOUSDProductTradesSide
-----------------------------------------------------
Created new variable: $CBPBATETHProductTrades
Created new variable: $CBPBATETHProductTradesPair
Created new variable: $CBPBATETHProductTradesTime
Created new variable: $CBPBATETHProductTradesTradeID
Created new variable: $CBPBATETHProductTradesPrice
Created new variable: $CBPBATETHProductTradesSize
Created new variable: $CBPBATETHProductTradesSide
-----------------------------------------------------
Created new variable: $CBPBATUSDCProductTrades
Created new variable: $CBPBATUSDCProductTradesPair
Created new variable: $CBPBATUSDCProductTradesTime
Created new variable: $CBPBATUSDCProductTradesTradeID
Created new variable: $CBPBATUSDCProductTradesPrice
Created new variable: $CBPBATUSDCProductTradesSize
Created new variable: $CBPBATUSDCProductTradesSide
-----------------------------------------------------

...etc...

PS C:\> $CBPProductTrades | Format-Table -AutoSize

Pair     Time                                                                                                        TradeID                                     Price
----     ----                                                                                                        -------                                     -----
ALGOUSD  {2019-08-31T19:30:13.98Z, 2019-08-31T18:49:47.105Z, 2019-08-31T18:45:45.604Z, 2019-08-31T18:45:45.604Z...}  {13612, 13611, 13610, 13609...}             {0.40850000, 0....
BATETH   {2019-08-31T19:24:16.763Z, 2019-08-31T19:24:16.74Z, 2019-08-31T19:24:15.647Z, 2019-08-31T19:24:15.18Z...}   {36063, 36062, 36061, 36060...}             {0.00106370, 0....
BATUSDC  {2019-08-31T19:34:53.892Z, 2019-08-31T19:34:14.206Z, 2019-08-31T19:33:35.436Z, 2019-08-31T19:32:20.564Z...} {2016654, 2016653, 2016652, 2016651...}     {0.17757500, 0....
BCHBTC   {2019-08-31T19:33:16.163Z, 2019-08-31T19:33:16.163Z, 2019-08-31T19:31:07.552Z, 2019-08-31T19:30:38.446Z...} {2202471, 2202470, 2202469, 2202468...}     {0.02853000, 0....
BCHEUR   {2019-08-31T19:35:23.965Z, 2019-08-31T19:35:23.965Z, 2019-08-31T19:35:23.965Z, 2019-08-31T19:35:23.965Z...} {1423546, 1423545, 1423544, 1423543...}     {249.88000000, ...
BCHGBP   {2019-08-31T19:35:11.824Z, 2019-08-31T19:35:11.824Z, 2019-08-31T19:19:39.369Z, 2019-08-31T19:18:26.829Z...} {268219, 268218, 268217, 268216...}         {225.71000000, ...
BCHUSD   {2019-08-31T19:35:02.233Z, 2019-08-31T19:34:15.201Z, 2019-08-31T19:32:13.886Z, 2019-08-31T19:31:58.405Z...} {12911601, 12911600, 12911599, 12911598...} {273.64000000, ...
BTCEUR   {2019-08-31T19:35:18.63Z, 2019-08-31T19:35:14.5Z, 2019-08-31T19:35:03.387Z, 2019-08-31T19:35:02.86Z...}     {21704960, 21704959, 21704958, 21704957...} {8729.02000000,...
BTCGBP   {2019-08-31T19:35:22.911Z, 2019-08-31T19:35:08.925Z, 2019-08-31T19:34:41.938Z, 2019-08-31T19:34:20.908Z...} {6966595, 6966594, 6966593, 6966592...}     {7877.00000000,...
BTCUSD   {2019-08-31T19:35:28.206Z, 2019-08-31T19:35:28.8Z, 2019-08-31T19:35:27.412Z, 2019-08-31T19:35:25.263Z...}   {73298279, 73298278, 73298277, 73298276...} {9571.73000000,...
BTCUSDC  {2019-08-31T19:33:35.659Z, 2019-08-31T19:33:14.556Z, 2019-08-31T19:33:14.556Z, 2019-08-31T19:33:14.556Z...} {579384, 579383, 579382, 579381...}         {9566.21000000,...
CVCUSDC  {2019-08-31T19:00:11.722Z, 2019-08-31T18:48:45.809Z, 2019-08-31T18:47:11.901Z, 2019-08-31T18:17:11.144Z...} {40284, 40283, 40282, 40281...}             {0.04030800, 0....
DAIUSDC  {2019-08-31T19:32:20.373Z, 2019-08-31T19:32:14.191Z, 2019-08-31T19:31:44.105Z, 2019-08-31T19:31:42.953Z...} {326931, 326930, 326929, 326928...}         {1.01015000, 1....
DNTUSDC  {2019-08-31T19:21:25.335Z, 2019-08-31T19:00:16.749Z, 2019-08-31T19:00:15.729Z, 2019-08-31T18:48:55.442Z...} {85315, 85314, 85313, 85312...}             {0.00726200, 0....
EOSBTC   {2019-08-31T19:32:37.396Z, 2019-08-31T19:32:35.732Z, 2019-08-31T19:32:35.714Z, 2019-08-31T19:32:16.474Z...} {173054, 173053, 173052, 173051...}         {0.00033900, 0....
EOSEUR   {2019-08-31T19:34:22.425Z, 2019-08-31T19:29:26.804Z, 2019-08-31T19:29:07.97Z, 2019-08-31T19:29:07.97Z...}   {118061, 118060, 118059, 118058...}         {2.96700000, 2....
EOSUSD   {2019-08-31T19:35:26.581Z, 2019-08-31T19:35:07.21Z, 2019-08-31T19:34:47.949Z, 2019-08-31T19:34:42.733Z...}  {594626, 594625, 594624, 594623...}         {3.24900000, 3....
ETCBTC   {2019-08-31T19:30:19.221Z, 2019-08-31T19:30:00.73Z, 2019-08-31T19:29:40.886Z, 2019-08-31T19:29:14.798Z...}  {481998, 481997, 481996, 481995...}         {0.00065200, 0....
ETCEUR   {2019-08-31T19:35:15.591Z, 2019-08-31T19:35:15.573Z, 2019-08-31T19:35:15.443Z, 2019-08-31T19:30:49.3Z...}   {467018, 467017, 467016, 467015...}         {5.71100000, 5....
ETCGBP   {2019-08-31T19:26:40.136Z, 2019-08-31T19:19:33.775Z, 2019-08-31T19:19:33.775Z, 2019-08-31T19:19:33.775Z...} {229515, 229514, 229513, 229512...}         {5.12900000, 5....
ETCUSD   {2019-08-31T19:35:15.884Z, 2019-08-31T19:35:15.671Z, 2019-08-31T19:35:15.603Z, 2019-08-31T19:35:15.603Z...} {2488301, 2488300, 2488299, 2488298...}     {6.24900000, 6....
ETHBTC   {2019-08-31T19:34:55.26Z, 2019-08-31T19:33:52.811Z, 2019-08-31T19:31:57.771Z, 2019-08-31T19:31:54.595Z...}  {8223853, 8223852, 8223851, 8223850...}     {0.01745000, 0....
ETHDAI   {2019-08-31T19:31:40.392Z, 2019-08-31T19:31:40.392Z, 2019-08-31T19:26:21.782Z, 2019-08-31T19:22:41.272Z...} {168060, 168059, 168058, 168057...}         {165.48000000, ...
ETHEUR   {2019-08-31T19:34:44.952Z, 2019-08-31T19:34:44.952Z, 2019-08-31T19:34:37.666Z, 2019-08-31T19:34:37.666Z...} {7250771, 7250770, 7250769, 7250768...}     {152.07000000, ...
ETHGBP   {2019-08-31T19:34:33.425Z, 2019-08-31T19:32:23.5Z, 2019-08-31T19:30:38.448Z, 2019-08-31T19:28:58.659Z...}   {844284, 844283, 844282, 844281...}         {137.69000000, ...
ETHUSD   {2019-08-31T19:35:20.314Z, 2019-08-31T19:35:20.314Z, 2019-08-31T19:35:08.476Z, 2019-08-31T19:34:54.302Z...} {51127029, 51127028, 51127027, 51127026...} {167.14000000, ...
ETHUSDC  {2019-08-31T19:34:53.361Z, 2019-08-31T19:21:40.138Z, 2019-08-31T19:09:01.193Z, 2019-08-31T19:06:57.486Z...} {224197, 224196, 224195, 224194...}         {167.05000000, ...
GNTUSDC  {2019-08-31T19:34:43.769Z, 2019-08-31T19:33:55.533Z, 2019-08-31T19:33:55.533Z, 2019-08-31T19:31:09.17Z...}  {54656, 54655, 54654, 54653...}             {0.05971800, 0....
LINKETH  {2019-08-31T19:28:13.467Z, 2019-08-31T19:16:05.763Z, 2019-08-31T18:53:35.596Z, 2019-08-31T18:53:31.419Z...} {65840, 65839, 65838, 65837...}             {0.01065865, 0....
LINKUSD  {2019-08-31T19:35:15.443Z, 2019-08-31T19:35:15.443Z, 2019-08-31T19:34:15.584Z, 2019-08-31T19:32:14.493Z...} {999072, 999071, 999070, 999069...}         {1.77657000, 1....
LOOMUSDC {2019-08-31T19:32:10.25Z, 2019-08-31T19:30:56.14Z, 2019-08-31T19:15:57.548Z, 2019-08-31T19:01:05.373Z...}   {66256, 66255, 66254, 66253...}             {0.02798600, 0....
LTCBTC   {2019-08-31T19:34:48.275Z, 2019-08-31T19:32:56.926Z, 2019-08-31T19:32:10.48Z, 2019-08-31T19:32:10.48Z...}   {6265784, 6265783, 6265782, 6265781...}     {0.00663000, 0....
LTCEUR   {2019-08-31T19:32:12.481Z, 2019-08-31T19:30:59.746Z, 2019-08-31T19:30:59.746Z, 2019-08-31T19:29:19.96Z...}  {5054969, 5054968, 5054967, 5054966...}     {57.76000000, 5...
LTCGBP   {2019-08-31T19:31:08.167Z, 2019-08-31T19:30:19.352Z, 2019-08-31T19:27:14.48Z, 2019-08-31T19:27:14.48Z...}   {467402, 467401, 467400, 467399...}         {52.16000000, 5...
LTCUSD   {2019-08-31T19:35:04.39Z, 2019-08-31T19:35:04.39Z, 2019-08-31T19:35:04.39Z, 2019-08-31T19:34:49.793Z...}    {41513028, 41513027, 41513026, 41513025...} {63.47000000, 6...
MANAUSDC {2019-08-31T19:17:10.736Z, 2019-08-31T19:15:56.542Z, 2019-08-31T19:01:04.421Z, 2019-08-31T19:00:10.697Z...} {71862, 71861, 71860, 71859...}             {0.03140600, 0....
REPBTC   {2019-08-31T19:31:16.46Z, 2019-08-31T19:24:48.691Z, 2019-08-31T19:23:44.662Z, 2019-08-31T19:16:03.583Z...}  {76230, 76229, 76228, 76227...}             {0.00083200, 0....
REPUSD   {2019-08-31T19:35:26.86Z, 2019-08-31T19:34:40.857Z, 2019-08-31T19:31:45.98Z, 2019-08-31T19:31:00.544Z...}   {271570, 271569, 271568, 271567...}         {7.95000000, 7....
XLMBTC   {2019-08-31T19:34:33.465Z, 2019-08-31T19:33:28.301Z, 2019-08-31T19:32:58.37Z, 2019-08-31T19:32:26.683Z...}  {430989, 430988, 430987, 430986...}         {0.00000644, 0....
XLMEUR   {2019-08-31T19:25:53.842Z, 2019-08-31T19:25:23.633Z, 2019-08-31T19:24:20.945Z, 2019-08-31T19:24:17.582Z...} {495376, 495375, 495374, 495373...}         {0.05614500, 0....
XLMUSD   {2019-08-31T19:35:26.862Z, 2019-08-31T19:33:48.644Z, 2019-08-31T19:33:40.926Z, 2019-08-31T19:33:05.523Z...} {1589053, 1589052, 1589051, 1589050...}     {0.06191100, 0....
XRPBTC   {2019-08-31T19:34:54.75Z, 2019-08-31T19:34:21.161Z, 2019-08-31T19:33:15.64Z, 2019-08-31T19:32:06.329Z...}   {711708, 711707, 711706, 711705...}         {0.00002655, 0....
XRPEUR   {2019-08-31T19:33:03.418Z, 2019-08-31T19:33:03.418Z, 2019-08-31T19:33:03.418Z, 2019-08-31T19:31:12.311Z...} {545009, 545008, 545007, 545006...}         {0.23170000, 0....
XRPUSD   {2019-08-31T19:35:35.139Z, 2019-08-31T19:35:30.927Z, 2019-08-31T19:35:23.801Z, 2019-08-31T19:35:23.801Z...} {3170560, 3170559, 3170558, 3170557...}     {0.25470000, 0....
XTZBTC   {2019-08-31T19:35:24.101Z, 2019-08-31T19:31:53.315Z, 2019-08-31T19:31:13.178Z, 2019-08-31T19:29:08.736Z...} {33329, 33328, 33327, 33326...}             {0.00010530, 0....
XTZUSD   {2019-08-31T19:34:33.289Z, 2019-08-31T19:32:46.301Z, 2019-08-31T19:32:10.22Z, 2019-08-31T19:32:10.22Z...}   {147283, 147282, 147281, 147280...}         {1.00510000, 1....
ZECBTC   {2019-08-31T19:31:12.142Z, 2019-08-31T19:16:00.565Z, 2019-08-31T19:11:36.142Z, 2019-08-31T19:01:10.381Z...} {34081, 34080, 34079, 34078...}             {0.00462900, 0....
ZECUSDC  {2019-08-31T19:32:18.426Z, 2019-08-31T19:32:18.426Z, 2019-08-31T19:31:05.805Z, 2019-08-31T19:31:05.805Z...} {486398, 486397, 486396, 486395...}         {44.24000000, 4...
ZRXBTC   {2019-08-31T19:31:11.117Z, 2019-08-31T19:25:56.356Z, 2019-08-31T19:22:40.615Z, 2019-08-31T19:18:57.602Z...} {724301, 724300, 724299, 724298...}         {0.00001686, 0....
ZRXEUR   {2019-08-31T19:34:09.754Z, 2019-08-31T19:32:55.929Z, 2019-08-31T19:32:55.929Z, 2019-08-31T19:21:40.111Z...} {438359, 438358, 438357, 438356...}         {0.14720200, 0....
ZRXUSD   {2019-08-31T19:33:10.429Z, 2019-08-31T19:31:19.29Z, 2019-08-31T19:30:09.533Z, 2019-08-31T19:30:06.907Z...}  {1877180, 1877179, 1877178, 1877177...}     {0.16125300, 0....

jasonpearce commented 5 years ago

Creating arrays and variables for Coinbase Pro Time.

# Create arrays and variables for Coinbase Pro Time
# Using Get-CoinbaseProTime, a public function (no API Key required)

# Get-CoinbaseProTime
$CBPTime = Get-CoinbaseProTime
$CBPTimeISO = $CBPTime.iso
$CBPTimeEpoch = $CBPTime.epoch

# Write New Variables and Array to Screen
Get-Variable -Name CBPTime*
$CBPTime | Format-Table -AutoSize

Results.

PS C:\> Get-Variable -Name CBPTime*

Name                           Value
----                           -----
CBPTime                        @{iso=2019-08-31T19:37:01.761Z; epoch=1567280221.761}
CBPTimeEpoch                   1567280221.761
CBPTimeISO                     2019-08-31T19:37:01.761Z

PS C:\> $CBPTime | Format-Table -AutoSize

iso                               epoch
---                               -----
2019-08-31T19:37:01.761Z 1567280221.761