PACMICV2 PROFIT CALC


SUBMITTED BY: Guest

DATE: July 30, 2015, 12:20 p.m.

FORMAT: Python

SIZE: 4.0 kB

HITS: 543

  1. """
  2. DONATION 16RdQZ86NUWQbE6rM86JbxnnaCDcAKqa9
  3. AUTHOR http://steal1982.altervista.org/hashnest.php
  4. """
  5. ####PACMIC PROFIT CALCULATOR####
  6. #####EDIT THIS VALUES#########
  7. #number of BTC/CONTRACTS/UNPAID BALANCE
  8. principal=1
  9. #AutoReBuy option values True/False
  10. autobuy=True
  11. #autobuy=False
  12. #how many days AutoReBuy will be active 0=Entire Contract Duration(infinite)
  13. autobuy_days=0
  14. #difficulty increase https://bitcoinwisdom.com/bitcoin/difficulty
  15. diff_increase=1.02
  16. #################################################
  17. sat=1*10**-8
  18. yeld=0.45*sat
  19. ghs=1000*principal
  20. balance=0
  21. profit=0
  22. blocks=0
  23. """
  24. code to get btc per block
  25. """
  26. import urllib2
  27. import math
  28. import json
  29. def get_btc_block(difficulty,ghs):
  30. #assuming 100% luck antpool will find 144block daily
  31. return (25/((difficulty*49710.2696)/((ghs*10**9))))/6/24
  32. def openjsonurl(url):
  33. res = urllib2.urlopen(url)
  34. r=res.read()
  35. return json.loads(r)
  36. def get_diff():
  37. data=openjsonurl('http://btc.blockr.io/api/v1/coin/info')['data']
  38. return float(data['last_block']['difficulty'])
  39. ##########################################################################
  40. difficulty=get_diff()
  41. btc_block=get_btc_block(difficulty,ghs)
  42. start=principal #principal become unpaid balance (sorry)
  43. #while principal>=0:
  44. for i in range(0,10):
  45. blocks+=1
  46. #difficulty retarget each 2600 blocks
  47. if blocks %2600==0:
  48. difficulty*=diff_increase #constant
  49. #calculate new amount of btc per block
  50. btc_block=get_btc_block(difficulty,ghs)
  51. """
  52. FROM HASHNEST DOC https://www.hashnest.com/contracts/new?contract_id=2
  53. Profit Calculation Method
  54. Unpaid principal (BTC) * 0.45 (satoshis per BTC per second) * time to find a block (seconds)
  55. For every block found, the remaining payout after the profit is paid will count towards the principal payment. After each principal payment is made, the amount is subtracted from the amount of remaining principal.
  56. Please note: information on blocks found will only be transfered to Hashnest.com from AntPool after receiving six network confirmations. Because of this, profit and principal payments will be on a slight delay from the network.
  57. """
  58. #temp var to store profit reward
  59. t=principal*yeld*10*60
  60. #store to cumulative profit(it is only for stats purposes as principal and balance are really important for the workflow)
  61. profit+=t
  62. #temp var to store principal reward
  63. p=(btc_block-t)
  64. #I will subtract principal reward from unpaid principal
  65. principal -=p
  66. #total balance paid to my wallet
  67. balance+= btc_block
  68. #days gone block found/144 assuming luck 100%
  69. days=blocks/6/24
  70. print blocks,days,balance,principal,profit,ghs,btc_block,t,p
  71. #if autobuy is enabled
  72. if autobuy:
  73. #rebuy= number of ghs... I can see from screenshots that hashnest also sell fractions of ghs in autorebuy contracts so no round
  74. # 1BTC=1THS -> 0.001BTC=1GHS
  75. rebuy=balance/0.001
  76. #I HOPE THAT THAT'S FUNDAMENTAL. WHEN I PERFORM AUTOREBUY AUTOREBUY AMOUNT GO TO UNPAID PRINCIPAL
  77. principal+=balance
  78. #IM WASTING EVERYTHING IN AUTOREBUY SO BALANCE BECOME 0
  79. balance=0
  80. print "buy:",rebuy
  81. #INCREASE GHS AMOUNT
  82. ghs=ghs+rebuy
  83. #CALCULATE NEW AMOUNT OF BTC PER BLOCK AFTER REBUY
  84. btc_block=get_btc_block(difficulty,ghs)
  85. #EXIT FROM AUTOBUY AFTER autobuy_days DAYS
  86. if autobuy_days>0 and blocks>autobuy_days*144:
  87. autobuy=False
  88. #THAT'S ONLY FOR STATS PURPOSE
  89. profit=balance-start
  90. print blocks,days,balance,principal,profit,profit/days,365/days*profit*100
  91. print "Blocks:",blocks
  92. print "Days:",days
  93. print "Profit:",profit
  94. print "Average Daily Profit:",profit/days
  95. print "APR:",365/days*profit*100

comments powered by Disqus