Powershell Script monitors Mining Pool Hub earnings

Share on:

This Powershell Script monitors Mining Pool Hub earnings with market values to make a unique dashboard. Mining Pool Hub is one of the best out there with the auto exchange feature and frequent payouts. On the other hand, the website itself is very cumbersome and not user-friendly with infrequent updates. Consequently, use the following script for viewing outside of the browser, however, if you want a browser-based monitor I recommend miningpoolhubstats.com.

Afterward, you need to copy your API key into the start of this script and also type your auto exchange currency of choice. My preferred is litecoin.

Download Script

Here is a download link if you don’t want to copy this into a .ps1 file.

mphstats

$api_key = 'ENTERAPIKEYHERE'<br /> $autoexchangecoin = 'litecoin'<br /> $ScriptDir = Split-Path $MyInvocation.MyCommand.Path -Parent<br /> $ScriptName = $MyInvocation.MyCommand.Name

``function call-self { Start-Process -FilePath “C:\WINDOWS\system32\WindowsPowerShell\v1.0\Powershell.exe” -ArgumentList .$ScriptName -WorkingDirectory $PSScriptRoot -NoNewWindow EXIT } Function Get-LtcStats { Clear-Host $base_url = ‘miningpoolhub.com/index.php?page=api&action=getdashboarddata' $URL = “http://$($autoexchangecoin).$($base_url)&api_key=$($api_key)&id=" $WebRequest = Invoke-WebRequest $URL | ConvertFrom-Json $data = $WebRequest.getdashboarddata.data $autoexchangesymbol = $($data.pool.info.currency) $USDURL = “https://min-api.cryptocompare.com/data/price?fsym=$($autoexchangesymbol)&tsyms=USD"<br /> $WebRequestUSD = Invoke-WebRequest $USDURL | ConvertFrom-Json $usddata = $WebRequestUSD | ForEach-Object {$_ -replace ‘[\D-[.]]',''} $24hourrate = “{0:N5}” -f $data.recent_credits_24hours.amount $usddata = [float]$usddata $24hourrate = [float]$24hourrate $24hourincome = ($usddata*$24hourrate) $24hourincome = “{0:N2}” -f $24hourincome $lastcredit1 = “{0:N5}” -f $data.recent_credits[0].amount $lastcredit2 = “{0:N5}” -f $data.recent_credits1.amount $lastcredit3 = “{0:N5}” -f $data.recent_credits2.amount Write-Host ““ Write-Host ““ Write-Host ““ Write-Host ““ Write-Host ““ Write-Host ““ Write-Host ““ Write-Host ““ Write-Host “rnStatistics for: $($data.pool.info.name)” -BackgroundColor Black Write-Host “Current USD Rate of $($autoexchangecoin) is $$($usddata)"<br /> Write-Host "Estimated Balance:t $($data.balance.confirmed + $data.balance.unconfirmed)“ Write-Host “24-Hour rate:t $($24hourrate) $($autoexchangesymbol)"<br /> Write-Host "24-Hour income:t $$($24hourincome)"<br /> Write-Host "Last Credit 1:t $($data.recent_credits[0].date)t $($lastcredit1) $($autoexchangesymbol)"<br /> Write-Host "Last Credit 2:t $($data.recent_credits1.date)t $($lastcredit2) $($autoexchangesymbol)"<br /> Write-Host "Last Credit 3:t $($data.recent_credits2.date)t $($lastcredit3) $($autoexchangesymbol)"<br /> }<br /> Function Get-AllStats<br /> {<br /> $base_url = 'https://miningpoolhub.com/index.php?page=api&action=getuserallbalances'<br /> $URL = "$($base_url)&api_key=$($api_key)&id="<br /> $WebRequest = Invoke-WebRequest $URL | ConvertFrom-Json<br /> $data = $WebRequest.getuserallbalances.data<br /> $displayarray = @()<br /> For ($i=1; $i -lt $data.Count; $i++) {<br /> $assetcoin = $($data[$i].coin)<br /> $walletbalance = $($data[$i].confirmed + $data[$i].unconfirmed)<br /> $walletbalance = [float]$walletbalance<br /> $exchangebalance = $($data[$i].ae_confirmed + $data[$i].ae_unconfirmed + $data[$i].exchange)<br /> $exchangebalance = [float]$exchangebalance<br /> $base_url2 = 'miningpoolhub.com/index.php?page=api&action=getdashboarddata'<br /> $URL2 = "http://$($assetcoin).$($base_url2)&api_key=$($api_key)&id="<br /> $WebRequest2 = Invoke-WebRequest $URL2 | ConvertFrom-Json<br /> $data2 = $WebRequest2.getdashboarddata.data<br /> $assethash = $data2.personal.hashrate<br /> $assethash = "{0:N3}" -f $assethash<br /> $exchangesymbol = $($data2.pool.info.currency)<br /> $USDURL = "https://min-api.cryptocompare.com/data/price?fsym=$($exchangesymbol)&tsyms=USD"<br /> $WebRequestUSD = Invoke-WebRequest $USDURL | ConvertFrom-Json<br /> $usddata = $WebRequestUSD | ForEach-Object {$_ -replace '[\D-[.]]',''}<br /> $usddata = [float]$usddata<br /> $poolamount = $usddata*($walletbalance+$exchangebalance)<br /> $totalpoolamount = $poolamount+$totalpoolamount<br /> #Formatting Table<br /> $poolamount = "{0:N2}" -f $poolamount<br /> $poolamount = [string]$poolamount<br /> $poolamount = '$'+$poolamount<br /> $usddata = "{0:N2}" -f $usddata<br /> $usddata = [string]$usddata<br /> $usddata = '$'+$usddata<br /> $exchangebalance = "{0:N5}" -f $exchangebalance<br /> $walletbalance = "{0:N5}" -f $walletbalance<br /> #Setup Array for Table<br /> $objoutput = new-object psobject -Property @{<br /> Coin = $assetcoin<br /> Wallet = $walletbalance<br /> Exchange = $exchangebalance<br /> HashRate = $assethash<br /> MarketRate = $usddata<br /> PoolAmount = $poolamount<br /> }<br /> $displayarray += $objoutput<br /> }<br /> $totalpoolamount = "{0:N2}" -f $totalpoolamount<br /> $displayarray | Format-Table Coin, Wallet, Exchange, HashRate, MarketRate, PoolAmount -auto<br /> Write-Host "Total Amount on Pool: $$($totalpoolamount)“ } function Start-Sleep($seconds) { $doneDT = (Get-Date).AddSeconds($seconds) while($doneDT -gt (Get-Date)) { $secondsLeft = $doneDT.Subtract((Get-Date)).TotalSeconds $percent = ($seconds - $secondsLeft) / $seconds * 100 Write-Progress -Activity “Sleeping” -Status “Refresh in…” -SecondsRemaining $secondsLeft -PercentComplete $percent [System.Threading.Thread]::Sleep(500) } Write-Progress -Activity “Sleeping” -Status “…” -SecondsRemaining 0 -Completed } Get-LtcStats Get-AllStats Start-Sleep(300) call-Self # Restart the script

The End of the World as we know it #####

EXIT``

Leave any Questions and Comments below and I will get back to you. I regularly publish on YouTube, Steemit, and christitus.com so if you’d like to see more videos please like, subscribe, and follow me.