-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73a0130
commit 1b2a401
Showing
18 changed files
with
833 additions
and
937 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,73 @@ | ||
|
||
$Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName | ||
$ahashpool_Request = [PSCustomObject]@{ } | ||
$Meets_Threshold = $true; | ||
$Shuffle = 0; | ||
$SmallestValue = 1E-20 | ||
$Pool_Request = [PSCustomObject]@{ } | ||
|
||
if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } | ||
if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } | ||
|
||
if ($Name -in $(arg).PoolName) { | ||
try { $ahashpool_Request = Invoke-RestMethod "https://www.ahashpool.com/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } | ||
try { $Pool_Request = Invoke-RestMethod "https://www.ahashpool.com/api/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } | ||
catch { log "SWARM contacted ($Name) but there was no response."; return } | ||
|
||
if (($ahashpool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { | ||
if (($Pool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { | ||
log "SWARM contacted ($Name) but ($Name) the response was empty." | ||
return | ||
} | ||
|
||
$ahashpool_Request | | ||
Get-Member -MemberType NoteProperty -ErrorAction Ignore | | ||
Select-Object -ExpandProperty Name | | ||
Where-Object { [Double]$ahashpool_Request.$_.estimate_current -gt 0 } | | ||
Where-Object { | ||
$Algo = $ahashpool_Request.$_.name.ToLower(); | ||
$local:ahashpool_Algorithm = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $Algo -in $global:Config.Pool_Algos.$_.alt_names } | ||
return $ahashpool_Algorithm | ||
} | | ||
ForEach-Object { | ||
if ($(vars).Algorithm -contains $ahashpool_Algorithm -or $(arg).ASIC_ALGO -contains $ahashpool_Algorithm) { | ||
if ($Name -notin $global:Config.Pool_Algos.$ahashpool_Algorithm.exclusions -and $ahashpool_Algorithm -notin $(vars).BanHammer) { | ||
|
||
$StatAlgo = $ahashpool_Algorithm -replace "`_", "`-" | ||
$Estimate = [Double]$ahashpool_Request.$_.estimate_current | ||
|
||
if ($(arg).mode -eq "easy") { | ||
if( $ahashpool_Request.$_.actual_last24h -eq 0 ){ $Meets_Threshold = $false } else {$Meets_Threshold = $True} | ||
$Shuffle = Shuffle $ahashpool_Request.$_.estimate_current $ahashpool_Request.$_.actual_last24h | ||
} else {$Meets_Threshold = $true} | ||
|
||
$ahashpool_Host = "$_.mine.ahashpool.com$X" | ||
$ahashpool_Port = $ahashpool_Request.$_.port | ||
$Divisor = 1000000 * $ahashpool_Request.$_.mbtc_mh_factor | ||
$Hashrate = $ahashpool_Request.$_.hashrate | ||
$previous = [Math]::Max(([Double]$ahashpool_Request.$_.actual_last24h * 0.001) / $Divisor * (1 - ($ahashpool_Request.$_.fees / 100)),$SmallestValue) | ||
$Algos = @() | ||
$Algos += $(vars).Algorithm | ||
$Algos += $(arg).ASIC_ALGO | ||
$Algos = $Algos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } | ||
|
||
$Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_profit" -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($ahashpool_Request.$_.fees / 100))) -Shuffle $Shuffle | ||
if (-not $(vars).Pool_Hashrates.$ahashpool_Algorithm) { $(vars).Pool_Hashrates.Add("$ahashpool_Algorithm", @{ }) } | ||
if (-not $(vars).Pool_Hashrates.$ahashpool_Algorithm.$Name) { $(vars).Pool_Hashrates.$ahashpool_Algorithm.Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" }) } | ||
|
||
$Level = $Stat.$($(arg).Stat_Algo) | ||
if($(arg).mode -eq "easy") { | ||
$Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) | ||
} | ||
## Only get algos we need & convert name to universal schema | ||
$Pool_Sorted = $Pool_Request.PSobject.Properties.Value | Where-Object {[Double]$_.estimate_current -gt 0} | ForEach-Object { | ||
$N = $_.Name; | ||
$_ | Add-Member "Original_Algo" $N | ||
$_.Name = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $N -in $global:Config.Pool_Algos.$_.alt_names }; | ||
if ($_.Name) { if ($_.Name -in $Algos -and $Name -notin $global:Config.Pool_Algos.$($_.Name).exclusions -and $_.Name -notin $(vars).BanHammer) { $_ } } | ||
} | ||
|
||
[PSCustomObject]@{ | ||
Symbol = "$ahashpool_Algorithm-Algo" | ||
Algorithm = $ahashpool_Algorithm | ||
Price = $Level | ||
Protocol = "stratum+tcp" | ||
Host = $ahashpool_Host | ||
Port = $ahashpool_Port | ||
User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address | ||
User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address | ||
User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address | ||
Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" | ||
Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" | ||
Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" | ||
Meets_Threshold = $Meets_Threshold | ||
Previous = $Previous | ||
} | ||
} | ||
## Add 24 hour deviation. | ||
$Pool_Sorted | ForEach-Object { | ||
$Raw = shuffle $_.estimate_last24h $_.actual_last24h | ||
$_ | Add-Member "deviation" $Raw | ||
} | ||
|
||
$Pool_Sorted | ForEach-Object { | ||
$StatAlgo = $_.Name -replace "`_", "`-" | ||
$StatPath = "$($Name)_$($StatAlgo)_profit" | ||
if (-not (test-Path ".\stats\$StatPath") ) { $Estimate = [Double]$_.estimate_last24h } | ||
else { $Estimate = [Double]$_.estimate_current } | ||
|
||
$Pool_Port = $_.port | ||
$Pool_Host = "$($_.Original_Algo).mine.ahashpool.com$X" | ||
$Divisor = 1000000 * $_.mbtc_mh_factor | ||
$Hashrate = $_.hashrate_shared | ||
$previous = [Math]::Max(([Double]$_.actual_last24h * 0.001) / $Divisor * (1 - ($_.fees / 100)), $SmallestValue) | ||
|
||
$Stat = Global:Set-Stat -Name $StatPath -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($_.fees / 100))) -Shuffle $_.deviation | ||
if (-not $(vars).Pool_Hashrates.$_.Name) { $(vars).Pool_Hashrates.Add("$($_.Name)", @{ }) } | ||
if (-not $(vars).Pool_Hashrates.$($_.Name).$Name) { $(vars).Pool_Hashrates.$($_.Name).Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" })} | ||
|
||
$Level = $Stat.$($(arg).Stat_Algo) | ||
if ($(arg).mode -eq "easy") { | ||
$SmallestValue = 1E-20 | ||
$Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) | ||
} | ||
|
||
[PSCustomObject]@{ | ||
Symbol = "$($_.Name)-Algo" | ||
Algorithm = "$($_.Name)" | ||
Price = $Level | ||
Protocol = "stratum+tcp" | ||
Host = $Pool_Host | ||
Port = $Pool_Port | ||
User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address | ||
User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address | ||
User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address | ||
Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" | ||
Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" | ||
Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" | ||
Previous = $previous | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,74 @@ | ||
|
||
$Name = Get-Item $MyInvocation.MyCommand.Path | Select-Object -ExpandProperty BaseName | ||
$blazepool_Request = [PSCustomObject]@{ } | ||
$Meets_Threshold = $true | ||
$Pool_Request = [PSCustomObject]@{ } | ||
|
||
|
||
if($(arg).xnsub -eq "Yes"){$X = "#xnsub"} | ||
if ($(arg).xnsub -eq "Yes") { $X = "#xnsub" } | ||
|
||
if ($Name -in $(arg).PoolName) { | ||
try { $blazepool_Request = Invoke-RestMethod "http://api.blazepool.com/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } | ||
try { $Pool_Request = Invoke-RestMethod "http://api.blazepool.com/status" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop } | ||
catch { log "SWARM contacted ($Name) but there was no response."; return } | ||
|
||
if (($blazepool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { | ||
if (($Pool_Request | Get-Member -MemberType NoteProperty -ErrorAction Ignore | Measure-Object Name).Count -le 1) { | ||
log "SWARM contacted ($Name) but ($Name) the response was empty." | ||
return | ||
} | ||
$blazepool_Request | | ||
Get-Member -MemberType NoteProperty -ErrorAction Ignore | | ||
Select-Object -ExpandProperty Name | | ||
Where-Object { [Double]$blazepool_Request.$_.estimate_current -gt 0 } | | ||
Where-Object { | ||
$Algo = $blazepool_Request.$_.name.ToLower(); | ||
$local:blazepool_Algorithm = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $Algo -in $global:Config.Pool_Algos.$_.alt_names } | ||
return $blazepool_Algorithm | ||
} | | ||
ForEach-Object { | ||
if ($(vars).Algorithm -contains $blazepool_Algorithm -or $(arg).ASIC_ALGO -contains $blazepool_Algorithm) { | ||
if ($Name -notin $global:Config.Pool_Algos.$blazepool_Algorithm.exclusions -and $blazepool_Algorithm -notin $(vars).BanHammer) { | ||
} | ||
|
||
$PoolAlgos = @() | ||
$PoolAlgos += $(vars).Algorithm | ||
$PoolAlgos += $(arg).ASIC_ALGO | ||
$Algos = $PoolAlgos | ForEach-Object { if ($Bad_pools.$_ -notcontains $Name) { $_ } } | ||
|
||
## Only get algos we need & convert name to universal schema | ||
$Pool_Sorted = $Pool_Request.PSobject.Properties.Value | Where-Object {[Double]$_.estimate_current -gt 0} | ForEach-Object { | ||
$N = $_.Name; | ||
$_ | Add-Member "Original_Algo" $N | ||
$_.Name = $global:Config.Pool_Algos.PSObject.Properties.Name | Where { $N -in $global:Config.Pool_Algos.$_.alt_names }; | ||
if ($_.Name) { if ($_.Name -in $Algos -and $Name -notin $global:Config.Pool_Algos.$($_.Name).exclusions -and $_.Name -notin $(vars).BanHammer) { $_ } } | ||
} | ||
|
||
$StatAlgo = $blazepool_Algorithm -replace "`_", "`-" | ||
$Estimate = [Double]$blazepool_Request.$_.estimate_current | ||
## Add 24 hour deviation. | ||
$Pool_Sorted | ForEach-Object { | ||
$Raw = shuffle $_.estimate_last24h $_.actual_last24h | ||
$_ | Add-Member "deviation" $Raw | ||
} | ||
|
||
if ($(arg).mode -eq "easy") { | ||
if( $blazepool_Request.$_.actual_last24h -eq 0 ){ $Meets_Threshold = $false } else {$Meets_Threshold = $True} | ||
$Shuffle = Shuffle $blazepool_Request.$_.estimate_current $blazepool_Request.$_.actual_last24h | ||
} else {$Meets_Threshold = $true} | ||
$Pool_Sorted | ForEach-Object { | ||
|
||
$blazepool_Host = "$_.mine.blazepool.com$X" | ||
$blazepool_Port = $blazepool_Request.$_.port | ||
$Divisor = 1000000 * $blazepool_Request.$_.mbtc_mh_factor | ||
$Hashrate = $blazepool_Request.$_.hashrate | ||
$previous = [Math]::Max(([Double]$blazepool_Request.$_.actual_last24h * 0.001) / $Divisor * (1 - ($blazepool_Request.$_.fees / 100)),$SmallestValue) | ||
$StatAlgo = $_.Name -replace "`_", "`-" | ||
$StatPath = "$($Name)_$($StatAlgo)_profit" | ||
if (-not (test-Path ".\stats\$StatPath") ) { $Estimate = [Double]$_.estimate_last24h } | ||
else { $Estimate = [Double]$_.estimate_current } | ||
|
||
$Pool_Port = $_.port | ||
$Pool_Host = "$($_.Original_Algo).mine.blazepool.com$X" | ||
$Divisor = 1000000 * $_.mbtc_mh_factor | ||
$Hashrate = $_.hashrate | ||
$previous = [Math]::Max(([Double]$_.actual_last24h * 0.001) / $Divisor * (1 - ($_.fees / 100)), $SmallestValue) | ||
|
||
$Stat = Global:Set-Stat -Name "$($Name)_$($StatAlgo)_profit" -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($blazepool_Request.$_.fees / 100))) -Shuffle $Shuffle | ||
if (-not $(vars).Pool_Hashrates.$blazepool_Algorithm) { $(vars).Pool_Hashrates.Add("$blazepool_Algorithm", @{ }) } | ||
if (-not $(vars).Pool_Hashrates.$blazepool_Algorithm.$Name) { $(vars).Pool_Hashrates.$blazepool_Algorithm.Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" }) } | ||
$Stat = Global:Set-Stat -Name $StatPath -HashRate $HashRate -Value ( $Estimate / $Divisor * (1 - ($_.fees / 100))) -Shuffle $_.deviation | ||
if (-not $(vars).Pool_Hashrates.$_.Name) { $(vars).Pool_Hashrates.Add("$($_.Name)", @{ }) } | ||
if (-not $(vars).Pool_Hashrates.$($_.Name).$Name) { $(vars).Pool_Hashrates.$($_.Name).Add("$Name", @{HashRate = "$($Stat.HashRate)"; Percent = "" })} | ||
|
||
$Level = $Stat.$($(arg).Stat_Algo) | ||
if($(arg).mode -eq "easy") { | ||
$SmallestValue = 1E-20 | ||
$Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) | ||
} | ||
$Level = $Stat.$($(arg).Stat_Algo) | ||
if ($(arg).mode -eq "easy") { | ||
$SmallestValue = 1E-20 | ||
$Level = [Math]::Max($Level + ($Level * $Stat.Deviation), $SmallestValue) | ||
} | ||
|
||
[PSCustomObject]@{ | ||
Symbol = "$blazepool_Algorithm-Algo" | ||
Algorithm = $blazepool_Algorithm | ||
Price = $Level | ||
Protocol = "stratum+tcp" | ||
Host = $blazepool_Host | ||
Port = $blazepool_Port | ||
User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address | ||
User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address | ||
User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address | ||
Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" | ||
Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" | ||
Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" | ||
Meets_Threshold = $Meets_Threshold | ||
Previous = $previous | ||
} | ||
} | ||
[PSCustomObject]@{ | ||
Symbol = "$($_.Name)-Algo" | ||
Algorithm = "$($_.Name)" | ||
Price = $Level | ||
Protocol = "stratum+tcp" | ||
Host = $Pool_Host | ||
Port = $Pool_Port | ||
User1 = $global:Wallets.Wallet1.$($(arg).Passwordcurrency1).address | ||
User2 = $global:Wallets.Wallet2.$($(arg).Passwordcurrency2).address | ||
User3 = $global:Wallets.Wallet3.$($(arg).Passwordcurrency3).address | ||
Pass1 = "c=$($global:Wallets.Wallet1.keys),id=$($(arg).RigName1)" | ||
Pass2 = "c=$($global:Wallets.Wallet2.keys),id=$($(arg).RigName2)" | ||
Pass3 = "c=$($global:Wallets.Wallet3.keys),id=$($(arg).RigName3)" | ||
Previous = $previous | ||
} | ||
} | ||
} |
Oops, something went wrong.