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
myAccount = makeUserAccount
(makeBTC 0)
[
makeMiningContractSimple (makeHashrate SHA256 (4 * tera))
, makeMiningContractSimple (makeHashrate SHA256 (1 * tera))
, makeMiningContractSimple (makeHashrate SHA256 (0.35 * tera))
, makeMiningContractSimple (makeHashrate Scrypt (30 * mega))
]
todayRates :: ExchangeRates
todayRates = makeExchangeRates
[ ((typeOf USD, typeOf RUB), 59.24)
, ((typeOf BTC, typeOf USD), 900.0)
]
knownPayoutTable = makePayoutTable
[
(typeOf SHA256, (makeBTC 0.0007689, 1 * tera))
, (typeOf Scrypt, (makeBTC 0.00002417, 1 * mega))
]
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