Skip to content

Instantly share code, notes, and snippets.

@utarn
Last active October 14, 2018 12:19
Show Gist options
  • Save utarn/2d6a7aa5711871cf9b7867ab350841ba to your computer and use it in GitHub Desktop.
Save utarn/2d6a7aa5711871cf9b7867ab350841ba to your computer and use it in GitHub Desktop.
Powershell script to compare Nicehash/Zergpool
# แก้ตรงบริเวณที่ใส่ตัวเลข
param(
[Parameter(Mandatory=$false)]
[Array]$Algo = (8,14,32,24,20,30,31,33),
[Parameter(Mandatory=$false)]
[Array]$Power = (11.5,400,32,4.2,178,5.4,5.8,150),
# Hashrate for Neoscrypt MH/s, Lyra2REv2 MH/s, Lyra2Z MH/s, Equihash KSol/s, Ethash MH/s, CryptoNightV7 GH/s, CryptoNightHeavy GH/s
# 1 แก้แรงขุด ถ้าไม่มีใส่ 0
[Parameter(Mandatory=$false)]
[Int]$WaitTime = 600,
[Parameter(Mandatory=$false)]
[String]$LineAccessToken = "OuYc5M6uqnmTccMOc0aiC1eKBCh7iIPOhXCFLXY8JVX"
# 2 แก้ Line token
)
$lineURI = "https://notify-api.line.me/api/notify"
$header = @{}
$header.Add("Authorization","Bearer $($LineAccessToken)")
While($true) {
$msg = "`r`n(Nicehash/ZergPool)`r`n"
$msg += "Rate in mBTC`r`nEarn in a day`r`n"
# $msg += "Hashrate`r`n"`
# + "Neoscrypt:$($Power[0]) MH/s`r`n"`
# + "Lyra2REv2:$($Power[1]) MH/s`r`n"`
# + "Lyra2Z :$($Power[2]) MH/s`r`n"`
# + "Equihash :$($Power[3]) KSol/s`r`n"`
# + "Ethash :$($Power[4]) MH/s`r`n"`
# + "CNightV7 :$($Power[5]) GH/s`r`n"`
# + "================`r`n"
$NicehashPrices = Invoke-WebRequest -Uri https://api.nicehash.com/api?method=stats.global.current -UseBasicParsing | ConvertFrom-Json
$ZergPrices = Invoke-WebRequest -Uri https://www.zpool.ca/api/status -UseBasicParsing | ConvertFrom-Json
$neohash = $Power[0].ToString().PadLeft(5, ' ')
$lyra2rev2hash = $Power[1].ToString().PadLeft(5, ' ')
$lyra2zhash = $Power[2].ToString().PadLeft(5, ' ')
$neo24rate = ([double]$ZergPrices.neoscrypt.actual_last24h).ToString("0.0000")
$lyra2rev2rate = ([double]$ZergPrices.lyra2v2.actual_last24h * 1000).ToString("0.0000")
$lyra2zrate = ([double]$ZergPrices.lyra2z.actual_last24h).ToString("0.0000")
$x16rrate = ([double]$ZergPrices.x16r.actual_last24h).ToString("0.0000")
$neo24earn = ([double]$ZergPrices.neoscrypt.actual_last24h * $Power[0]).ToString("0.0000")
$lyra2rev2earn = ([double]$ZergPrices.lyra2v2.actual_last24h * $Power[1]).ToString("0.0000")
$lyra2zearn = ([double]$ZergPrices.lyra2z.actual_last24h * $Power[2]).ToString("0.0000")
$x16rearn = ([double]$ZergPrices.x16r.actual_last24h * $Power[7]).ToString("0.0000")
$neoestrate = ([double]$ZergPrices.neoscrypt.estimate_current * 1000).ToString("0.0000")
$lyra2rev2estrate = ([double]$ZergPrices.lyra2v2.estimate_current * 1000000).ToString("0.0000")
$lyra2zestrate = ([double]$ZergPrices.lyra2z.estimate_current * 1000).ToString("0.0000")
$x16restrate = ([double]$ZergPrices.x16r.estimate_current * 1000).ToString("0.0000")
$neoestearn = ([double]$ZergPrices.neoscrypt.estimate_current * 1000 * $Power[0]).ToString("0.0000")
$lyra2rev2estearn = ([double]$ZergPrices.lyra2v2.estimate_current * 1000 * $Power[1]).ToString("0.0000")
$lyra2zestearn = ([double]$ZergPrices.lyra2z.estimate_current * 1000 * $Power[2]).ToString("0.0000")
$x16restearn = ([double]$ZergPrices.x16r.estimate_current * 1000 * $Power[7]).ToString("0.0000")
$SelectedPrices = @()
For ($i=0; $i -lt $Algo.Count; $i++) {
$MyPrice = $NicehashPrices.result.stats | ? { $_.algo -eq $Algo[$i] } | Select -First 1
$SelectedPrices += $MyPrice
}
Clear-Host
Write-Host Nicehash Profitability Estimator
Write-Host =============================================
Write-Host "Algorithm`tRate`tHash`tEarning"
For ($i=0; $i -lt $SelectedPrices.Count; $i++) {
$currentAlgo = Switch ($SelectedPrices[$i].algo) { 8{"NeoScrypt"} 14 {"Lyra2REv2"} 24{"Equihash"} 32{"Lyra2Z"} 20{ "Ethash" } 30{ "CNV7" } 31 { "CNHeavy" } 33 { "X16R"} }
$pricing = ([double]$SelectedPrices[$i].price).ToString("0.0000")
$hashrate = $Power[$i].ToString().PadLeft(5, ' ')
if ($i -eq 1) {
$earning = ([double]$SelectedPrices[$i].price * $Power[$i] / 1000).ToString("0.000")
} elseif ($i -eq 4) {
$earning = ([double]$SelectedPrices[$i].price * $Power[$i] / 1000).ToString("0.000")
} else {
$earning = ([double]$SelectedPrices[$i].price * $Power[$i]).ToString("0.000")
}
Write-Host -NoNewline "$($currentAlgo.PadRight(15,' '))"
Write-Host "$pricing`t$hashrate`t$earning"
$msg += "---------------------------------------------`r`n"
$msg += "$currentAlgo :`r`n"
#$msg += "NicehashRate : $pricing`r`n"
switch ($i) {
0 {
$msg += "Rate: $pricing/$neo24rate /MH`r`n"
}
1 {
$msg += "Rate: $pricing/$lyra2rev2rate /GH`r`n"
}
2 {
$msg += "Rate: $pricing/$lyra2zrate /MH`r`n"
}
3 {
$msg += "Rate: $pricing /KSol`r`n"
}
4 {
$msg += "Rate: $($([double]$pricing).ToString("0.0000")) /GH`r`n"
}
7 {
$msg += "Rate: $pricing/$x16rrate /GH`r`n"
}
default {
$msg += "Rate: $pricing /GH`r`n"
}
}
`
#$msg += "NicehashEarn: $earning`r`n"
switch ($i) {
0 {
$msg += "Earn: $earning/$neo24earn mBTC`r`n"
}
1 {
$msg += "Earn: $earning/$lyra2rev2earn mBTC`r`n"
}
2 {
$msg += "Earn: $earning/$lyra2zearn mBTC`r`n"
}
7 {
$msg += "Earn: $earning/$x16rearn mBTC`r`n"
}
default {
$msg += "Earn: $earning mBTC`r`n"
}
}
if ($i -eq 3) {
write-host ---------------------------------------------
}
}
$msg += "================`r`n"
Write-Host =============================================`r`n
Write-Host ZPool Profitability Estimator
Write-Host =============================================
Write-Host "Algorithm`t24hour Rate`t24hour Earning`tEstimate Rate`tEstimate Earning"
Write-Host "Neoscrypt`t$($neo24rate.PadLeft(11,' '))`t$($neo24earn.PadLeft(14,' '))`t$($neoestrate.PadLeft(13,' '))`t$($neoestearn.PadLeft(16,' '))"
Write-Host "Lyra2REv2`t$($lyra2rev2rate.PadLeft(11,' '))`t$($lyra2rev2earn.PadLeft(14,' '))`t$($lyra2rev2estrate.PadLeft(13,' '))`t$($lyra2rev2estearn.PadLeft(16,' '))"
Write-Host "Lyra2Z `t$($lyra2zrate.PadLeft(11,' '))`t$($lyra2zearn.PadLeft(14,' '))`t$($lyra2zestrate.PadLeft(13,' '))`t$($lyra2zestearn.PadLeft(16,' '))"
Write-Host "X16R `t$($x16rrate.PadLeft(11,' '))`t$($x16rearn.PadLeft(14,' '))`t$($x16restrate.PadLeft(13,' '))`t$($x16restearn.PadLeft(16,' '))"
Write-Host =============================================
Write-Host Rate is refreshed every $WaitTime
$body =@{message="$($msg)"}
Invoke-WebRequest -Uri $lineURI -Method POST -Headers $header -Body $body -UseBasicParsing -TimeoutSec 10 | Out-Null
Start-Sleep -s $WaitTime
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment