Sunday, July 7, 2013

Profitability Mining in CGWatcher

Update: This post has been updated to reflect changes in newer versions. As of this update, the latest version is 1.3.2.Profitability Mining is mining whatever crypto-coin is most profitable at any given time based on how much it is worth in Bitcoins. This is not a new concept and has been in practice since the first alt-coin appeared. I did not come up with the idea, I just made it easier to do in CGWatcher. I realize Profitability Mining may not be the best name for it, as even mining one coin is done in hopes of being profitable. But I have to refer to it as something other than "switching coins often based on current profitability at the time of the switch".CGWatcher 1.2.0 introduced profitability mining, the second most requested feature behind CGRemote (in beta). This post will explain how this works, and how the Scheduled Actions used to control profitability mining work.Scheduled ActionsThe previous scheduling feature in CGWatcher provided a basic "start miner" and "stop miner" option, and meant that the scheduled mining would have to occur on the set days at the set times every week. I didn't want to just duplicate this feature a few times, and instead wanted to allow for unlimited control of scheduling the miner to perform a variety of actions. I think the Scheduled Actions (similar to Window's Scheduled Tasks but named differently to avoid confusion) provide that and allow for additional actions to be easily added in the future. They allow you to fine-tune what your miner does and when it does it, down to the exact second.The Scheduled Actions you create are displayed in the Schedule tab. They are sorted to display all enabled actions first, in chronological order of when they will next run. Disabled actions are displayed last.

List of Scheduled Actions

Each action has an enable/disable checkbox, Edit button, and Delete button. Click Add Scheduled Action... to create a new action.The actions available as of version 1.3.2:

Start Mining

Stop Mining

Restart Mining

Restart Computer

Change Intensity

Change All Intensities

Switch Profile

Enable Device

Disable Device

Restart Device

Run Program

Send API Commands to Miner

Send E-Mail

Creating a scheduled action is as easy as building a sentence.

Along with switching to a specific profile, you can switch to the next profile (rotation) or have CGWatcher choose a profile based on profitability when the action is triggered.

When creating a scheduled action, think of creating a sentence instructing CGWatcher of what you want it to do. As you select one option, other available options may be changed or filtered.

After selecting an action, one or more "value" options may appear under it depending on which action you selected. For the Change Intensity action, this is the GPU and intensity you want to change to. For the Switch Profile action, a drop-down list of your profiles allows you to select which profile to switch to. There are some additional options at the bottom of this list related to profitability, which I'll go into more below.

Next in the sentence are the frequency options. You can choose to have the action run daily, on a specific day, weekdays, weekends, or at set intervals (you can use decimals in the interval to specify less than one hour). You can also choose to have the action triggered by an event - the computer becoming idle, a specific program starts running, or a wide variety of mining and coin-based events. Similar to actions, certain frequencies may have additional options that appear underneath when selected.

You can create scheduled actions that run at the exact same time, but if you want to ensure one runs before another you should add at least one second to the one you want to run last because they are ran in order of the time you set. If you schedule a Start Mining action to run at 3:00:00 PM and a Change Intensity action to run at 3:00:01 PM, the Change Intensity action will run once the Start Mining action has completed (which takes more than one second), so you do not have to worry about timing actions depending on what they do.

In addition to setting a time to trigger the action, in many cases you can set a stop time. When the stop time is reached, CGWatcher reverts the miner back to the settings that were in use before the action was triggered.

When using Every... N hour(s) actions, the timer for each of these actions begins when CGWatcher is started. So creating an action to run every 4 hours would run first 4 hours after CGWatcher was started. Then it will run 4 hours after that, and so on. However, if you either edit an action or enable a disabled action, the timer's start time is reset.

Addition options:Start the miner for this action if it is not already running - this option is available for certain types of actions. If this option is enabled and the action causes the miner to be started, setting a stop time means the miner will be stopped when the stop time is reached.Persist through miner restarts until stopped by user or stop time - when miner restarts occur can be unpredictable depending on the monitoring options you use. If a scheduled action to increase intensities occurs and shortly after, for example, the hashrate drops and CGWatcher is set to restart the miner when this occurs, you may still want those increased intensities applied after the miner is restarted. This option allows for that, and will continue to re-apply the action after the miner is restarted until either the user stops the miner (by clicking the Stop button) or the action's stop time is reached (if one is set).Run this action once (action is deleted after running) - will delete the action immediately after running it.

If you move your mouse over a scheduled action in the Schedule tab of CGWatcher's main window, a tooltip will display the next time that action is set to run. (This only applies to enabled actions.)

Profitability Mining

So when using CGWatcher, profitability mining is using scheduled actions to automatically switch to mine the most profitable coin that you've setup to mine. It works by checking the current profitability of the various crypto-coins, and then switching to the profile with the most profitable coin (or whichever field you want it to base this decision on). This means that you'll want to create a separate profile for each coin that you mine, and assign a coin to each profile in Profile Manager. If you do not assign a coin to a profile, the profile is ignored when determining which profile is most profitable.

Profile Manager window

The Profile Manager now includes a drop-down list to select the coin to associate to that profile. The coin data is collected from http://www.coinchoose.com, so new coins added to the website will become available in CGWatcher after the coin data is refreshed. CGWatcher also uses the data from coinchoose to determine profile profitability. See more information on adding and removing coins manually in the Coin Manager section below.

You'll need to assign a coin to at least two profiles in order for profitability mining to work. Otherwise if you did not assign a coin to any profiles, it would be unable to determine which is most profitable; and if you assign a coin to only one profile, that profile would always be the most profitable because there is nothing else to compare it to.

You can check profitability at any time by clicking an Other Tools... button and then selecting Coin Profitability from the menu. There is also a Profitability button in the Settings tab. These open the Coin Profitability window, which displays current profitability data from CoinChoose, along with some other information about each coin like hashing algorithm, difficulty, network hashrate, best price, and which exchange is currently offering the best price. You can create scheduled actions based on any of the numeric fields in this window, as well as the rank (e.g. 2nd most profitable, or 1st lowest difficulty, or 3rd highest reward, etc.) You can also create your own custom field that uses a mathematical expression you create to set its values. This allows you to create your own profitability formula using the other field values and common mathematical functions and operators (more information below).

Coin Profitability window

In the Coin Profitability window, you can sort columns by clicking on the column header cell once to sort ascending, then again to sort descending.

Coin profitability can be based on Bitcoin (default) or Litecoin. If you mine a coin at 300% profitability of Bitcoin, you should, in theory, be able to convert those mined coins to 3x the Bitcoins you would have earned if you had mined Bitcoins. You can change this any time in Coin Manager's Settings tab. For the next section, we'll assume you've selected profitability based on Bitcoin.

There are three columns relating to the coin profitability. The first, "Profitability", is the current profitability compared to Bitcoin. If profitability is 200%, mining that coin will earn you twice as many Bitcoins as mining Bitcoin itself (once you exchange the coin to Bitcoins). Obviously this value can change at any time, and you would need to convert the mined coins to Bitcoin immediately in order to preserve this increase. If you hold the coin and decide to convert to Bitcoins the next day when the coin's profitability may be at only 50%, you've now lost the additional coins you made by profitability mining. Likewise, there is the possibility that holding the coins allows you to convert when the profitability is even higher, so it is a gamble. Yes, there are miners who are not interested in converting everything to Bitcoin. But that is an essential part of profitability mining, since all profitability is based on Bitcoin (or Litecoin).

The second column is "Adjusted Profitability". This value has been adjusted for stales and is intended to give a more accurate estimate of profitability.

The third column is "Average Profitability", which is based on a 7-day average. This is useful if you are looking to mine something more continuously instead of jumping on whatever happens to be most profitable every couple hours.

The other numeric data columns like "reward", "difficulty", and "network hashrate" can also be used. If you're interested in just mining as many coins as possible, you can create a custom formula using reward, difficulty, and network hashrate together to determine which coin you can mine the most of. Then hold the mined coins until that coin is the speculators' coin-of-the-day and increases in value.If you created your own custom profitability formula, you'll also see a 'Custom' field displayed in this window showing the value for each coin - calculated using the mathematical expression you created.

So back in the Scheduled Action window, you'll see that if you select the Switch Profile action, there are several profitability options in the profiles drop-down list matching the columns in the Coin Profitability window. Selecting one of these tells CGWatcher which profitability value you want it to use when determining which profile of yours is most profitable before switching to that profile.

By default, CGWatcher updates coin profitability data every 15 minutes. You can change this in Coin Manager's Settings tab. The minimum value is 5 minutes, and the maximum is 1380 (or 23 hours). When a scheduled action is triggered that switches profiles to most profitable, CGWatcher checks if the coin data has been refreshed in the past minute, and if it hasn't, it attempts to refresh it to ensure it is selecting the profile based on updated data. If that refresh should fail and CGWatcher finds that the coin profitability data has not been updated in the past 24 hours, it cancels the action (which is why the maximum refresh interval is 23 hours.)

[Run program] to [12] named [C:\Program Files\TeamViewer\TeamViewer.exe] when [program is not running] named [C:\Program Files\TeamViewer\TeamViewer.exe] (this would make sure TeamViewer is restarted if it crashes)

Coin Manager

As its name implies, Coin Manager allows you to manage coins and exchanges used in profitability mining and displayed in the Coin Profitability window. You can access Coin Manager by clicking the 'Other Tools...' button in the Settings tab (or Profile Manager) and selecting Manage Coins from the popup menu.

Coin Manager allows you to manage coins and exchanges, coin-related settings, and create a custom field that can be used in profitability mining.

Creating a Custom Profitability FormulaIf you think you have a better formula for calculating profitability than CoinChoose, or you just want to tweak it to increase the odds that you'll not be following the profitability-mining herd (and therefore, difficulty spikes), you can create your own formula in Coin Manager's Custom Field tab. Here you can use any of the existing coin data fields as variables along with common mathematical functions to create your own mathematical expression. Once you're happy with this formula, you can then create scheduled actions to switch profiles to the coin with the highest or lowest custom field value.

An example custom field expression (this is just an example and not thought-out, so I would not suggest using this particular expression) and a list of available values and functions. After creating the expression, you can click 'Test' to calculate it for a selected coin, or click 'Save' to see the results for all coins in the Coin Profitability window.

On the right are the variables for each existing coin data field. So using P in the expression means using the coin's profitability value. You can also select items from the drop-down (shown above) and click 'Insert' to insert them into the expression and they'll be automatically converted to their variable. Also listed in the drop-down are mathematical functions you can use. Note that some functions require parameters.

* When creating a custom field expression, you should also open the Coin Profitability window to see the values calculated for each coin. Depending on your expression, some coins may be calculated as 'Infinity', which may cause unwanted results when creating scheduled actions that switch to the coin with the highest custom field value. Each time you click Save in Coin Manager, the Coin Profitability window will be updated.

Things to Think About

I'm not suggesting you should or shouldn't mine based on profitability. I've provided the tools to do it because it has been one of the most requested features. There are some things you should keep in mind when deciding whether profitability mining is right for you:

Pool types: if you use PPLNS-type pools, switching pools often because of profitability changes could have a small negative effect on your earnings because these type of pools reward for consistent mining and try to penalize pool-hoppers, which is essentially what you are doing if you are constantly switching pools based on profitability. Therefore you should try to use PPS-type pools if you plan on switching profiles often.

If everyone is switching with you, the coin may not stay most profitable for long. I don't expect this to be a big problem because CGWatcher probably doesn't have enough users to make a big impact on sending a bunch of miners to the same coin at the same time. As of this post, CGWatcher has over 2,500 (est) users (in over 65 countries! maybe translations are in order) and averages 100+ downloads per day, so there is the chance it has an effect in the future. But this assumes that all users are mining all coins. If Bob is only mining Bitcoin and Litecoin, his most profitable coin might be Litecoin even though DigitalCoin is most profitable. Tom has a DigitalCoin profile so when DigitalCoin is most profitable, profitability mining would switch him to DigitalCoin but Bob will still be back on Litecoin. Then you have to consider that how often you switch profiles based on profitability depends on how you setup your scheduled actions, so while Tom might switch every few hours, Bob might only switch once per week. So these lessen the odds of sending a wave of miners to the same coin at the same time.

As I mentioned earlier, CGWatcher uses profitability values based on Bitcoin. So if you don't convert your more profitable coins to Bitcoin while they are still more profitable, you risk losing any gains you made by mining the more profitable coin.

Because of these things, there is no guarantee that profitability mining will actually be more profitable. It depends a lot on how you set up your pools and when and if you convert your mined coins to Bitcoin. CGWatcher makes it much easier to do, but there is still work before and after coins are mined that CGWatcher cannot do for you.

This is a new feature, so if you experience any problems with actions not running when they are supposed to, please let me know. I did quite a bit of testing, but there are always bugs that won't be found until it is released to users, especially with the wide range of setups miners use.

I will probably add this ability to CGRemote for non-Windows users by adding and switching pools via the API, but it is too early to say for sure. It may be limited to coins of the same algorithm since CGRemote will not have the same abilities as CGWatcher does if running on a remote computer. I'll have more info on this in the future as CGRemote progresses.

Only you can determine if profitability mining is a wise strategy for you. I am not suggesting it is or isn't. I take no responsibility for any losses, we all know how volatile prices can be. Likewise, I take no credit for gains... though you are still more than welcome to donate.

If you're not already using CGWatcher, you can find more info and download here:

If you are trying to buy bitcoins online, Paxful is the best source for bitcoins as it allows buying bitcoins by 100's of different payment methods, such as Western Union, MoneyGram, PayPal, Credit Card and they even allow exchanging your gift cards for bitcoins.