pacmicv2 calc


SUBMITTED BY: Guest

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

FORMAT: Python

SIZE: 4.0 kB

HITS: 444

  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))))/144
  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. blocks+=1
  45. #difficulty retarget each 2600 blocks
  46. if blocks %2600==0:
  47. difficulty*=diff_increase #constant
  48. #calculate new amount of btc per block
  49. btc_block=get_btc_block(difficulty,ghs)
  50. """
  51. FROM HASHNEST DOC https://www.hashnest.com/contracts/new?contract_id=2
  52. Profit Calculation Method
  53. Unpaid principal (BTC) * 0.45 (satoshis per BTC per second) * time to find a block (seconds)
  54. 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.
  55. 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.
  56. """
  57. #temp var to store profit reward
  58. t=principal*yeld*10*60
  59. #store to cumulative profit(it is only for stats purposes as principal and balance are really important for the workflow)
  60. profit+=t
  61. #temp var to store principal reward
  62. p=(btc_block-t)
  63. #I will subtract principal reward from unpaid principal
  64. principal -=p
  65. #total balance paid to my wallet
  66. balance+= btc_block
  67. #days gone block found/144 assuming luck 100%
  68. days=blocks/144
  69. print blocks,days,balance,principal,profit,ghs,btc_block,t,p
  70. #if autobuy is enabled
  71. if autobuy:
  72. #rebuy= number of ghs... I can see from screenshots that hashnest also sell fractions of ghs in autorebuy contracts so no round
  73. # 1BTC=1THS => 0.001BTC=1GHS
  74. rebuy=balance/0.001
  75. #I HOPE THAT THAT'S FUNDAMENTAL. WHEN I PERFORM AUTOREBUY AUTOREBUY AMOUNT GO TO UNPAID PRINCIPAL
  76. principal+=balance
  77. #IM WASTING EVERYTHING IN AUTOREBUY SO BALANCE BECOME 0
  78. balance=0
  79. #INCREASE GHS AMOUNT
  80. ghs=ghs+rebuy
  81. #CALCULATE NEW AMOUNT OF BTC PER BLOCK AFTER REBUY
  82. btc_block=get_btc_block(difficulty,ghs)
  83. #EXIT FROM AUTOBUY AFTER autobuy_days DAYS
  84. if autobuy_days>0 and blocks>autobuy_days*144:
  85. autobuy=False
  86. #THAT'S ONLY FOR STATS PURPOSE
  87. profit=balance-start
  88. print blocks,days,balance,principal,profit,profit/days,365/days*profit*100
  89. print "Blocks:",blocks
  90. print "Days:",days
  91. print "Profit:",profit
  92. print "Average Daily Profit:",profit/days
  93. print "APR:",365/days*profit*100

comments powered by Disqus