module Data.HashFlare.Projection.Example where

import Data.Money
import Data.Hashrate
import Data.HashFlare
import Data.HashFlare.Projection
import Data.Typeable
import Data.Maybe


-- CHANGE ME
-- | Describe your HashFlare.io account here
myAccount = makeUserAccount
  (makeBTC 0) -- start balance
  [ -- mining contracts
    makeMiningContractSimple (makeHashrate SHA256 (4 * tera))
  , makeMiningContractSimple (makeHashrate SHA256 (1 * tera))
  , makeMiningContractSimple (makeHashrate SHA256 (0.35 * tera))  
  , makeMiningContractSimple (makeHashrate Scrypt (30 * mega))
  ]

-- CHANGE ME
-- | Some cryptocurrency exchange rates, the main thing is BTC/USD entry (19 Jan 2017)
todayRates :: ExchangeRates
todayRates = makeExchangeRates
  [ ((typeOf USD, typeOf RUB), 59.24)
  , ((typeOf BTC, typeOf USD), 900.0)
  ]


-- | Known pools payout table, do not depends on actual contracts (~18 Jan 2017)
knownPayoutTable = makePayoutTable
  [
    (typeOf SHA256, (makeBTC 0.0007689, 1 * tera))
  , (typeOf Scrypt, (makeBTC 0.00002417, 1 * mega))
  ]

-- | Display the profit
myProfitIO =
  return daily >>= putStrLn >>
  return weekly >>= putStrLn >>
  return monthly >>= putStrLn >>
  return year1 >>= putStrLn >>
  return year2 >>= putStrLn
  where
    daily = "Daily profit of the account: " ++ pf 1
    weekly = "Weekly profit of the account: " ++ pf 7
    monthly = "Monthly profit of the account: " ++ pf 30
    year1 = "1 year profit of the account: " ++ pf 365
    year2 = "2 year profit of the account: " ++ pf 730
    pf n = show $ fromJust $ projectAccountUSD n todayRates defaultMEFTable knownPayoutTable myAccount