Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified Core File for Minimum Mining Switch Threshold #178

Closed
dmilin1 opened this issue Dec 18, 2017 · 4 comments
Closed

Modified Core File for Minimum Mining Switch Threshold #178

dmilin1 opened this issue Dec 18, 2017 · 4 comments

Comments

@dmilin1
Copy link

dmilin1 commented Dec 18, 2017

I modified the core.ps1 file so that it now supports a PercentToSwitch input parameter. This parameter makes it so that at the end of each interval, a new algorithm is only switched to if it is more profitable by a certain percentage (PercentToSwitch) over the current best algorithm. A number of other algo-switching programs support this feature and I thought it might be nice to have.

This is my first time writing anything in Powershell so it might not be the best, but could something like this be implemented in a future version of your program? This is also my first time using GitHub so I'm not sure if there is a better way for me to share my code.

The code I added was a change to the foreach () method around line 535 and a change to the input parameters at the beginning. I have the code I changed pasted below and the modified core.ps1 file attached.

The foreach () changes:

 foreach ($Type in $Types) {
	
	if ($BestId.PSObject.Properties.value -ne $null) {
	echo "The percent to switch is $PercentToSwitch"
	if ($ActiveMiners[$BestId.PSObject.Properties.value].Profits -le ($ActiveMiners[($ActiveMiners |Where-Object IsValid | select-object NeedBenchmark,Profits,Id,Types,Algorithm | where-object {(Compare-Object $Type $_.Types -IncludeEqual -ExcludeDifferent | Measure-Object).Count -gt 0} | Sort-Object -Descending {if ($_.NeedBenchmark) {1} else {0}}, {$_.Profits},Algorithm | Select-Object -First 1 | Select-Object id).PSObject.Properties.value].Profits * (1/(1+($PercentToSwitch/100))))) {
		$BestId=($ActiveMiners |Where-Object IsValid | select-object NeedBenchmark,Profits,Id,Types,Algorithm | where-object {(Compare-Object $Type $_.Types -IncludeEqual -ExcludeDifferent | Measure-Object).Count -gt 0} | Sort-Object -Descending {if ($_.NeedBenchmark) {1} else {0}}, {$_.Profits},Algorithm | Select-Object -First 1 | Select-Object id)
	}
	} else {
		$BestId=($ActiveMiners |Where-Object IsValid | select-object NeedBenchmark,Profits,Id,Types,Algorithm | where-object {(Compare-Object $Type $_.Types -IncludeEqual -ExcludeDifferent | Measure-Object).Count -gt 0} | Sort-Object -Descending {if ($_.NeedBenchmark) {1} else {0}}, {$_.Profits},Algorithm | Select-Object -First 1 | Select-Object id)
	}
	
	$ActiveMiners[$BestId.PSObject.Properties.value].best=$true
    }

The input parameter changes:

param(
    [Parameter(Mandatory = $false)]
    [Array]$Algorithm = $null,

    [Parameter(Mandatory = $false)]
    [Array]$PoolsName = $null,

    [Parameter(Mandatory = $false)]
    [array]$CoinsName= $null,

    [Parameter(Mandatory = $false)]
    [String]$Proxy = "", #i.e http://192.0.0.1:8080 

    [Parameter(Mandatory = $false)]
    [String]$MiningMode = $null,
	
	[Parameter(Mandatory = $false)]
    [Float]$PercentToSwitch = 0

)

core.zip

@tutulino
Copy link
Owner

I wil include, but this is dangerous you can be hours mining less profitable coin

@dmilin1
Copy link
Author

dmilin1 commented Dec 18, 2017

That's why the percent difference is adjustable. I mine primarily to PPLNS payment system pools and constantly switching algos for a few cents more profitability can end up actually hurting profits. Thank you very much for including it!

@tutulino
Copy link
Owner

Included next release

@tutulino tutulino reopened this Dec 20, 2017
@dmilin1
Copy link
Author

dmilin1 commented Dec 20, 2017

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants