rig-monitor
rig-monitor copied to clipboard
MODULE: profitability
I'm having some issues with your profitability script. I'm not sure if it's my data, the script, or a combination of both. I haven't had the time to try and debug it as there is a lot going on, I'll leave this up here in case you have a second to look at it. I noticed that the EST earnings sections seem to be barfing on some of the values. Also I have multiple workers in some pools, I'm not sure the script is setup to handle that? Here's a full trace on a single pool.
+ SAVEIFS='
'
+ for POOL_LINE in '"${POOL_LIST[@]}"'
+ IFS=,
+ read POOL_TYPE CRYPTO LABEL BASE_API_URL API_TOKEN WALLET_ADDR
+ (( DEBUG == 1 ))
+ echo ''
+ echo 'Pool info in conf file: NANOPOOL ETH NANO_ETH'
Pool info in conf file: NANOPOOL ETH NANO_ETH
+ PRICE=price_usd
+ VOLUME=24h_volume_usd
+ MARKET=market_cap_usd
+ COIN_DATA_SQL='select * from coin_data where crypto='\''ETH'\'''
++ jq -r '.results[0].series[0].values[0] | "\(.[1]) \(.[2]) \(.[3]) \(.[5]) \(.[6]) \(.[7]) \(.[8]) \(.[9])" '
++ curl -sG 'http://localhost:8086/query?pretty=true' --data-urlencode db=rigdata --data-urlencode epoch=ns --data-urlencode 'q=select * from coin_data where crypto='\''ETH'\'''
+ COIN_DATA='267836000 4.85 30.0785 2920928752921000 28656896451 0.0692888 301.707 USD'
+ IFS=' '
+ read VOLUME_24H_QC BLOCK_REWARD BLOCK_TIME DIFFICULTY MARKET_CAP_QC PRICE_BTC PRICE_QC QUOTE_CURRENCY
+ (( DEBUG == 1 ))
+ echo 'SQL: select * from coin_data where crypto='\''ETH'\'''
SQL: select * from coin_data where crypto='ETH'
+ echo 'HTTP QUERY: curl -sG '\''http://'\''localhost'\'':8086/query?pretty=true'\'' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode "q=select * from coin_data where crypto='\''ETH'\''"'
HTTP QUERY: curl -sG 'http://'localhost':8086/query?pretty=true' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode "q=select * from coin_data where crypto='ETH'"
+ echo 'OUTPUT: 267836000 4.85 30.0785 2920928752921000 28656896451 0.0692888 301.707 USD'
OUTPUT: 267836000 4.85 30.0785 2920928752921000 28656896451 0.0692888 301.707 USD
+ echo -e 'VOLUME_24H_QC:267836000\nBLOCK_REWARD:4.85\nBLOCK_TIME:30.0785\nDIFFICULTY:2920928752921000\nMARKET_CAP_QC:28656896451\nPRICE_BTC:0.0692888\nPRICE_QC:301.707\nQUOTE_CURRENCY:USD'
VOLUME_24H_QC:267836000
BLOCK_REWARD:4.85
BLOCK_TIME:30.0785
DIFFICULTY:2920928752921000
MARKET_CAP_QC:28656896451
PRICE_BTC:0.0692888
PRICE_QC:301.707
QUOTE_CURRENCY:USD
+ [[ 301.707 == \n\u\l\l ]]
+ SQL='SELECT last(revenue_24h) from pool_profitability where label='\''NANO_ETH'\'''
++ get_last_record 'SELECT last(revenue_24h) from pool_profitability where label='\''NANO_ETH'\'''
+++ curl -sG 'http://localhost:8086/query?pretty=true' --data-urlencode db=rigdata --data-urlencode epoch=ns --data-urlencode 'q=SELECT last(revenue_24h) from pool_profitability where label='\''NANO_ETH'\'''
+++ sed s/null/0/g
+++ jq -r '.results[0].series[0].values[0][0]'
++ local _LAST_RECORD=1509148800000000000
++ (( _LAST_RECORD == 0 ))
++ echo 1509148800000000000
+ LAST_RECORD=1509148800000000000
+ (( DEBUG == 1 ))
+ echo 'SQL: SELECT last(revenue_24h) from pool_profitability where label='\''NANO_ETH'\'''
SQL: SELECT last(revenue_24h) from pool_profitability where label='NANO_ETH'
+ echo 'HTTP QUERY: curl -sG '\''http://'\''localhost'\'':8086/query?pretty=true'\'' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode "q=SELECT last(revenue_24h) from pool_profitability where label='\''NANO_ETH'\''"'
HTTP QUERY: curl -sG 'http://'localhost':8086/query?pretty=true' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode "q=SELECT last(revenue_24h) from pool_profitability where label='NANO_ETH'"
+ echo 'LAST RECORD FROM SQL:1509148800000000000'
LAST RECORD FROM SQL:1509148800000000000
+ echo 'calculating profitability from 1509148800000000000 until 1509223225398479712 (now)'
calculating profitability from 1509148800000000000 until 1509223225398479712 (now)
+ [[ NANOPOOL == \M\P\O\S ]]
+ REVENUE_24H_SQL='select sum(amount) from pool_payments where time >= 1509148800000000000 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by time(24h)'
++ curl -sG 'http://localhost:8086/query?pretty=true' --data-urlencode db=rigdata --data-urlencode epoch=ns --data-urlencode 'q=select sum(amount) from pool_payments where time >= 1509148800000000000 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by time(24h)'
++ sed -e s/null/0/g
++ jq -r '.results[0].series[0].values[]? | "\(.[0]) \(.[1])"'
+ REVENUE_24H=
+ (( DEBUG == 1 ))
+ echo 'SQL: select sum(amount) from pool_payments where time >= 1509148800000000000 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by time(24h)'
SQL: select sum(amount) from pool_payments where time >= 1509148800000000000 and time <= 1509223225398479712 and label='NANO_ETH' group by time(24h)
+ echo 'HTTP QUERY: curl -sG '\''http://'\''localhost'\'':8086/query?pretty=true'\'' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode q="select sum(amount) from pool_payments where time >= 1509148800000000000 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by time(24h)"'
HTTP QUERY: curl -sG 'http://'localhost':8086/query?pretty=true' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode q="select sum(amount) from pool_payments where time >= 1509148800000000000 and time <= 1509223225398479712 and label='NANO_ETH' group by time(24h)"
+ echo 'OUTPUT (DATE REVENUE): '
OUTPUT (DATE REVENUE):
+ SQL='select sum(power_usage)/1440*24 from env_data where time >= 1509148800000000000 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by time(24h)'
++ curl -sG 'http://localhost:8086/query?pretty=true' --data-urlencode db=rigdata --data-urlencode epoch=ns --data-urlencode 'q=select sum(power_usage)/1440*24 from env_data where time >= 1509148800000000000 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by time(24h)'
++ jq -r '.results[0].series[0].values[]? | "\(.[0]) \(.[1])"'
++ sed -e s/null/0/g
+ POWER_USAGE=
+ (( DEBUG == 1 ))
+ echo 'SQL: select sum(power_usage)/1440*24 from env_data where time >= 1509148800000000000 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by time(24h)'
SQL: select sum(power_usage)/1440*24 from env_data where time >= 1509148800000000000 and time <= 1509223225398479712 and label='NANO_ETH' group by time(24h)
+ echo 'HTTP QUERY: curl -sG '\''http://'\''localhost'\'':8086/query?pretty=true'\'' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode "q=select sum(power_usage)/1440*24 from env_data where time >= 1509148800000000000 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by time(24h)"'
HTTP QUERY: curl -sG 'http://'localhost':8086/query?pretty=true' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode "q=select sum(power_usage)/1440*24 from env_data where time >= 1509148800000000000 and time <= 1509223225398479712 and label='NANO_ETH' group by time(24h)"
+ '[' '!' -z '' ']'
+ MEASUREMENT=pool_profitability
+ TAGS=pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH
+ read _DATE _REVENUE
++ awk 'BEGIN {print * 0.0692888}'
awk: line 1: syntax error at or near *
+ REVENUE_BTC=
++ awk 'BEGIN {print * 301.707}'
awk: line 1: syntax error at or near *
+ REVENUE_QC=
+ LINE='pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=,revenue_btc_24h=,revenue_qc_24h=,power_costs_24h=0 '
+ (( DEBUG == 1 ))
+ echo 'pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=,revenue_btc_24h=,revenue_qc_24h=,power_costs_24h=0 '
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=,revenue_btc_24h=,revenue_qc_24h=,power_costs_24h=0
+ DATA_BINARY='
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=,revenue_btc_24h=,revenue_qc_24h=,power_costs_24h=0 '
+ read _DATE _REVENUE
+ SQL='select mean(power_usage) from env_data where time >= 1509136825404882292 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by rig_id'
++ jq -r '.results[0].series[]? | "\(.tags.rig_id) \(.values[0][1])"'
++ curl -sG 'http://localhost:8086/query?pretty=true' --data-urlencode db=rigdata --data-urlencode epoch=ns --data-urlencode 'q=select mean(power_usage) from env_data where time >= 1509136825404882292 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by rig_id'
+ POWER_USAGE=
+ (( DEBUG == 1 ))
+ echo 'SQL: select mean(power_usage) from env_data where time >= 1509136825404882292 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by rig_id'
SQL: select mean(power_usage) from env_data where time >= 1509136825404882292 and time <= 1509223225398479712 and label='NANO_ETH' group by rig_id
+ echo 'HTTP QUERY: curl -sG '\''http://localhost:8086/query?pretty=true'\'' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode "q=select mean(power_usage) from env_data where time >= 1509136825404882292 and time <= 1509223225398479712 and label='\''NANO_ETH'\'' group by rig_id"'
HTTP QUERY: curl -sG 'http://localhost:8086/query?pretty=true' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode "q=select mean(power_usage) from env_data where time >= 1509136825404882292 and time <= 1509223225398479712 and label='NANO_ETH' group by rig_id"
+ echo ''
+ '[' '!' -z '' ']'
+ [[ NANOPOOL == \M\P\O\S ]]
+ [[ NANOPOOL == \C\R\Y\P\T\O\N\O\T\E ]]
+ SQL='select mean(avg_hr_24h) from worker_stats where time >= 1509136825404882292 and label='\''NANO_ETH'\'' group by rig_id'
++ curl -sG 'http://localhost:8086/query?pretty=true' --data-urlencode db=rigdata --data-urlencode epoch=ns --data-urlencode 'q=select mean(avg_hr_24h) from worker_stats where time >= 1509136825404882292 and label='\''NANO_ETH'\'' group by rig_id'
++ jq -r '.results[0].series[]? | "\(.tags.rig_id) \(.values[0][0]) \(.values[0][1])"'
+ RIG_HR_LAST_24H='Kinko1 1509136825404882200 190.96610169491518
rekt 1509136825404882200 4.022033898305086'
+ (( DEBUG == 1 ))
+ echo 'SQL: select mean(avg_hr_24h) from worker_stats where time >= 1509136825404882292 and label='\''NANO_ETH'\'' group by rig_id'
SQL: select mean(avg_hr_24h) from worker_stats where time >= 1509136825404882292 and label='NANO_ETH' group by rig_id
+ echo 'HTTP QUERY: curl -sG '\''http://'\''localhost'\'':8086/query?pretty=true'\'' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode "q=select mean(avg_hr_24h) from worker_stats where time >= 1509136825404882292 and label='\''NANO_ETH'\'' group by rig_id" '
HTTP QUERY: curl -sG 'http://'localhost':8086/query?pretty=true' --data-urlencode "db=rigdata" --data-urlencode "epoch=ns" --data-urlencode "q=select mean(avg_hr_24h) from worker_stats where time >= 1509136825404882292 and label='NANO_ETH' group by rig_id"
+ echo 'Kinko1 1509136825404882200 190.96610169491518
rekt 1509136825404882200 4.022033898305086'
Kinko1 1509136825404882200 190.96610169491518
rekt 1509136825404882200 4.022033898305086
+ read _RIG_ID _TIME _HR
+ [[ -z 190.96610169491518 ]]
++ awk 'BEGIN {print (190.96610169491518/(2920928752921000/30.0785))*((60/30.0785)*4.85)*(60*24)*(301.707)}'
+ EST_EARNINGS_DAY=8.26563e-06
+ EST_POWER_COSTS_DAY=
++ awk 'BEGIN {print (8.26563e-06-)}'
awk: line 1: syntax error at or near )
+ EST_PROFIT_DAY=
+ MEASUREMENT=future_profitability
+ TAGS=pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=Kinko1
+ LINE='future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=Kinko1 est_revenue_qc_24h=8.26563e-06,est_power_costs_24h=,est_profit_24h= 1509223225398479712'
+ DATA_BINARY='
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=,revenue_btc_24h=,revenue_qc_24h=,power_costs_24h=0
future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=Kinko1 est_revenue_qc_24h=8.26563e-06,est_power_costs_24h=,est_profit_24h= 1509223225398479712'
+ (( DEBUG == 1 ))
+ echo 'EARNINGS PER DAY CALC: (190.96610169491518/(2920928752921000/30.0785))*((60/30.0785)*4.85)*(60*24)*(301.707)'
EARNINGS PER DAY CALC: (190.96610169491518/(2920928752921000/30.0785))*((60/30.0785)*4.85)*(60*24)*(301.707)
+ echo 'future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=Kinko1 est_revenue_qc_24h=8.26563e-06,est_power_costs_24h=,est_profit_24h= 1509223225398479712'
future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=Kinko1 est_revenue_qc_24h=8.26563e-06,est_power_costs_24h=,est_profit_24h= 1509223225398479712
+ read _RIG_ID _TIME _HR
+ [[ -z 4.022033898305086 ]]
++ awk 'BEGIN {print (4.022033898305086/(2920928752921000/30.0785))*((60/30.0785)*4.85)*(60*24)*(301.707)}'
+ EST_EARNINGS_DAY=1.74087e-07
+ EST_POWER_COSTS_DAY=
++ awk 'BEGIN {print (1.74087e-07-)}'
awk: line 1: syntax error at or near )
+ EST_PROFIT_DAY=
+ MEASUREMENT=future_profitability
+ TAGS=pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=rekt
+ LINE='future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=rekt est_revenue_qc_24h=1.74087e-07,est_power_costs_24h=,est_profit_24h= 1509223225398479712'
+ DATA_BINARY='
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=,revenue_btc_24h=,revenue_qc_24h=,power_costs_24h=0
future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=Kinko1 est_revenue_qc_24h=8.26563e-06,est_power_costs_24h=,est_profit_24h= 1509223225398479712
future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=rekt est_revenue_qc_24h=1.74087e-07,est_power_costs_24h=,est_profit_24h= 1509223225398479712'
+ (( DEBUG == 1 ))
+ echo 'EARNINGS PER DAY CALC: (4.022033898305086/(2920928752921000/30.0785))*((60/30.0785)*4.85)*(60*24)*(301.707)'
EARNINGS PER DAY CALC: (4.022033898305086/(2920928752921000/30.0785))*((60/30.0785)*4.85)*(60*24)*(301.707)
+ echo 'future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=rekt est_revenue_qc_24h=1.74087e-07,est_power_costs_24h=,est_profit_24h= 1509223225398479712'
future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=rekt est_revenue_qc_24h=1.74087e-07,est_power_costs_24h=,est_profit_24h= 1509223225398479712
+ read _RIG_ID _TIME _HR
+ echo '
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=,revenue_btc_24h=,revenue_qc_24h=,power_costs_24h=0
future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=Kinko1 est_revenue_qc_24h=8.26563e-06,est_power_costs_24h=,est_profit_24h= 1509223225398479712
future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=rekt est_revenue_qc_24h=1.74087e-07,est_power_costs_24h=,est_profit_24h= 1509223225398479712'
+ (( NO_WRITE == 1 ))
+ curl -s -i -XPOST 'http://localhost:8086/write?db=rigdata' --data-binary @tmp/profitability_binary_data.tmp
HTTP/1.1 400 Bad Request
Content-Type: application/json
Request-Id: 3aa3824b-bc20-11e7-a9aa-000000000000
X-Influxdb-Version: 1.3.6
Date: Sat, 28 Oct 2017 20:40:26 GMT
Content-Length: 594
{"error":"unable to parse 'pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=,revenue_btc_24h=,revenue_qc_24h=,power_costs_24h=0 ': missing field value\nunable to parse 'future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=Kinko1 est_revenue_qc_24h=8.26563e-06,est_power_costs_24h=,est_profit_24h= 1509223225398479712': missing field value\nunable to parse 'future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=rekt est_revenue_qc_24h=1.74087e-07,est_power_costs_24h=,est_profit_24h= 1509223225398479712': missing field value"}
+ IFS='
'
+ rm /home/pi/src/rig-monitor_dev_influxdb/run/PROFIT_LOCK
I'll take a look at it later today
I had this problem some days ago. Are you using the latest version? This issue was fixed here: https://github.com/rodneymo/rig-monitor/commit/0195df6ffaa68d9909716aa9c4f368e745768527
Using the latest on a brand new DB just to test out. A few observations. Your 24hr profit based on pool_payments doesnt' seem to work well for cases in which you are not being paid out daily? I get a lot of zeros for certain days. Here's the SQL I use for 24hr earnings, which may be more accurate, but can potentially miss a peak balance if you have long periods between hitting the pool.
select sum(non_negative_difference) from (select non_negative_difference(balance) from pool_stats where time > now() - 24h AND "crypto"='ETH')
Here's my output with just -d that might be a little clearer. Future profits coudl be choking on multiple workers?
Pool info in conf file: NANOPOOL ETH NANO_ETH
SQL: select * from coin_data where crypto='ETH'
HTTP QUERY: curl -sG 'http://'localhost':8086/query?pretty=true' --data-urlencode "db=rigdata_test" --data-urlencode "epoch=ns" --data-urlencode "q=select * from coin_data where crypto='ETH'"
OUTPUT: 581333000 2.91 14.0702 1449646787561560 29442302294 0.0501165 308.599 USD
VOLUME_24H_QC:581333000
BLOCK_REWARD:2.91
BLOCK_TIME:14.0702
DIFFICULTY:1449646787561560
MARKET_CAP_QC:29442302294
PRICE_BTC:0.0501165
PRICE_QC:308.599
QUOTE_CURRENCY:USD
SQL: SELECT last(revenue_24h) from pool_profitability where label='NANO_ETH'
HTTP QUERY: curl -sG 'http://'localhost':8086/query?pretty=true' --data-urlencode "db=rigdata_test" --data-urlencode "epoch=ns" --data-urlencode "q=SELECT last(revenue_24h) from pool_profitability where label='NANO_ETH'"
LAST RECORD FROM SQL:1506729600000000000
calculating profitability from 1506729600000000000 until 1509330219534968886 (now)
SQL: select sum(amount) from pool_payments where time >= 1506729600000000000 and time <= 1509330219534968886 and label='NANO_ETH' group by time(24h)
HTTP QUERY: curl -sG 'http://'localhost':8086/query?pretty=true' --data-urlencode "db=rigdata_test" --data-urlencode "epoch=ns" --data-urlencode q="select sum(amount) from pool_payments where time >= 1506729600000000000 and time <= 1509330219534968886 and label='NANO_ETH' group by time(24h)"
OUTPUT (DATE REVENUE): 1506729600000000000 0
1506816000000000000 0
1506902400000000000 0
1506988800000000000 0
1507075200000000000 0
1507161600000000000 0.200635712628
1507248000000000000 0
1507334400000000000 0
1507420800000000000 0
1507507200000000000 0
1507593600000000000 0
1507680000000000000 0
1507766400000000000 0
1507852800000000000 0.2062085759
1507939200000000000 0
1508025600000000000 0
1508112000000000000 0
1508198400000000000 0
1508284800000000000 0
1508371200000000000 0
1508457600000000000 0.200932442204
1508544000000000000 0
1508630400000000000 0
1508716800000000000 0
1508803200000000000 0
1508889600000000000 0
1508976000000000000 0.200388764634
1509062400000000000 0
1509148800000000000 0
1509235200000000000 0
1509321600000000000 0
SQL: select sum(power_usage)/1440*24 from env_data where time >= 1506729600000000000 and time <= 1509330219534968886 and label='NANO_ETH' group by time(24h)
HTTP QUERY: curl -sG 'http://'localhost':8086/query?pretty=true' --data-urlencode "db=rigdata_test" --data-urlencode "epoch=ns" --data-urlencode "q=select sum(power_usage)/1440*24 from env_data where time >= 1506729600000000000 and time <= 1509330219534968886 and label='NANO_ETH' group by time(24h)"
DATE:1506729600000000000, POWER USAGE:0, POWER COSTS:0
DATE:1506816000000000000, POWER USAGE:0, POWER COSTS:0
DATE:1506902400000000000, POWER USAGE:0, POWER COSTS:0
DATE:1506988800000000000, POWER USAGE:0, POWER COSTS:0
DATE:1507075200000000000, POWER USAGE:0, POWER COSTS:0
DATE:1507161600000000000, POWER USAGE:0, POWER COSTS:0
DATE:1507248000000000000, POWER USAGE:0, POWER COSTS:0
DATE:1507334400000000000, POWER USAGE:0, POWER COSTS:0
DATE:1507420800000000000, POWER USAGE:0, POWER COSTS:0
DATE:1507507200000000000, POWER USAGE:0, POWER COSTS:0
DATE:1507593600000000000, POWER USAGE:0, POWER COSTS:0
DATE:1507680000000000000, POWER USAGE:0, POWER COSTS:0
DATE:1507766400000000000, POWER USAGE:0, POWER COSTS:0
DATE:1507852800000000000, POWER USAGE:0, POWER COSTS:0
DATE:1507939200000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508025600000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508112000000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508198400000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508284800000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508371200000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508457600000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508544000000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508630400000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508716800000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508803200000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508889600000000000, POWER USAGE:0, POWER COSTS:0
DATE:1508976000000000000, POWER USAGE:0, POWER COSTS:0
DATE:1509062400000000000, POWER USAGE:0, POWER COSTS:0
DATE:1509148800000000000, POWER USAGE:0, POWER COSTS:0
DATE:1509235200000000000, POWER USAGE:0, POWER COSTS:0
DATE:1509321600000000000, POWER USAGE:29.700000000000003, POWER COSTS:0.0031779
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1506729600000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1506816000000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1506902400000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1506988800000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1507075200000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0.200635712628,revenue_btc_24h=0.0100552,revenue_qc_24h=61.916,power_costs_24h=0 1507161600000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1507248000000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1507334400000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1507420800000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1507507200000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1507593600000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1507680000000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1507766400000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0.2062085759,revenue_btc_24h=0.0103345,revenue_qc_24h=63.6358,power_costs_24h=0 1507852800000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1507939200000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1508025600000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1508112000000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1508198400000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1508284800000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1508371200000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0.200932442204,revenue_btc_24h=0.01007,revenue_qc_24h=62.0076,power_costs_24h=0 1508457600000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1508544000000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1508630400000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1508716800000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1508803200000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1508889600000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0.200388764634,revenue_btc_24h=0.0100428,revenue_qc_24h=61.8398,power_costs_24h=0 1508976000000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1509062400000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1509148800000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0 1509235200000000000
pool_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH revenue_24h=0,revenue_btc_24h=0,revenue_qc_24h=0,power_costs_24h=0.0031779 1509321600000000000
SQL: select mean(power_usage) from env_data where time >= 1509243819541294333 and time <= 1509330219534968886 and label='NANO_ETH' group by rig_id
HTTP QUERY: curl -sG 'http://localhost:8086/query?pretty=true' --data-urlencode "db=rigdata_test" --data-urlencode "epoch=ns" --data-urlencode "q=select mean(power_usage) from env_data where time >= 1509243819541294333 and time <= 1509330219534968886 and label='NANO_ETH' group by rig_id"
kinko1 891
RIG_ID:kinko1, POWER USAGE:891, POWER COSTS:2.28809
SQL: select mean(avg_hr_24h) from worker_stats where time >= 1509243819541294333 and label='NANO_ETH' group by rig_id
HTTP QUERY: curl -sG 'http://'localhost':8086/query?pretty=true' --data-urlencode "db=rigdata_test" --data-urlencode "epoch=ns" --data-urlencode "q=select mean(avg_hr_24h) from worker_stats where time >= 1509243819541294333 and label='NANO_ETH' group by rig_id"
Kinko1 1509243819541294300 186.525
rekt 1509243819541294300 3.9
awk: line 1: syntax error at or near )
EARNINGS PER DAY CALC: (186.525/(1449646787561560/14.0702))*((60/14.0702)*2.91)*(60*24)*(308.599)
future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=Kinko1 est_revenue_qc_24h=9.98335e-06,est_power_costs_24h=,est_profit_24h= 1509330219534968886
awk: line 1: syntax error at or near )
EARNINGS PER DAY CALC: (3.9/(1449646787561560/14.0702))*((60/14.0702)*2.91)*(60*24)*(308.599)
future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=rekt est_revenue_qc_24h=2.08739e-07,est_power_costs_24h=,est_profit_24h= 1509330219534968886
HTTP/1.1 100 Continue
HTTP/1.1 400 Bad Request
Content-Type: application/json
Request-Id: 57cb8141-bd19-11e7-8d49-000000000000
X-Influxdb-Version: 1.3.6
Date: Mon, 30 Oct 2017 02:23:40 GMT
Content-Length: 450
{"error":"partial write: unable to parse 'future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=Kinko1 est_revenue_qc_24h=9.98335e-06,est_power_costs_24h=,est_profit_24h= 1509330219534968886': missing field value\nunable to parse 'future_profitability,pool_type=NANOPOOL,crypto=ETH,label=NANO_ETH,rig_id=rekt est_revenue_qc_24h=2.08739e-07,est_power_costs_24h=,est_profit_24h= 1509330219534968886': missing field value dropped=0"}
So instead of monitoring payments you are monitoring the pool balance. So your influxQL below
select sum(non_negative_difference) from (select non_negative_difference(balance) from pool_stats where time > now() - 24h AND "crypto"='ETH')
adds up small balance increments between subsequent records, right?
Before updating the profitability script we might need to harmonise the "balance" field across all pool scripts (similar to what I have done for the miners). Thoughts?
Correct, so it adds up the difference of every entry in the last 24 hours (non negative if it reduces to 0 for payout). It can miss a small increment, so that's the limitation.
Before updating the profitability script we might need to harmonise the "balance" field across all pool scripts (similar to what I have done for the miners). Thoughts?
Does balance not report the same across pools? At this time, I'm only using nanopool with our script. I still need to dig into the changes you made on the miners.
I think it does. I will give it a try tomorrow or the day after.