Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
A simple model of HashFlare.io services
- type MEFTable = Map TypeRep (Money USD, Double)
- makeMEFTable :: [(TypeRep, (Money USD, Double))] -> MEFTable
- type PayoutTable = Map TypeRep (Money BTC, Double)
- makePayoutTable :: [(TypeRep, (Money BTC, Double))] -> PayoutTable
- data MiningContract
- makeMiningContract :: MiningAlgorithm a => Hashrate a -> Money USD -> Int -> MiningContract
- makeMiningContractSimple :: MiningAlgorithm a => Hashrate a -> MiningContract
- data UserAccount
- makeUserAccount :: Money BTC -> [MiningContract] -> UserAccount
- contractHashrate :: MiningContract -> Hashrate a
- contractCost :: MiningContract -> Money USD
- contractExpiration :: MiningContract -> Int
- contractMEF :: MEFTable -> MiningContract -> Money USD
- contractPayout :: PayoutTable -> MiningContract -> Money BTC
- accountBalance :: UserAccount -> Money BTC
- accountContracts :: UserAccount -> [MiningContract]
- userAccountMEF :: MEFTable -> UserAccount -> Money USD
- userAccountPayout :: PayoutTable -> UserAccount -> Money BTC
- infoUserAccount :: UserAccount -> String
- defaultMEFTable :: MEFTable
Documentation
type MEFTable = Map TypeRep (Money USD, Double) Source #
Type representing costs for the hardware MEFs: key is algo type, value is (costs, rate quantity)
type PayoutTable = Map TypeRep (Money BTC, Double) Source #
Type representing actual (or projected) payouts wrt algo from mining pools XXX
makePayoutTable :: [(TypeRep, (Money BTC, Double))] -> PayoutTable Source #
Construct mining payouts table
makeMiningContract :: MiningAlgorithm a => Hashrate a -> Money USD -> Int -> MiningContract Source #
Construct a new mining contract with hashrate, cost and expiration days
makeMiningContractSimple :: MiningAlgorithm a => Hashrate a -> MiningContract Source #
Make the contract without costs and expiration (suppose you didn't invest your money..)
makeUserAccount :: Money BTC -> [MiningContract] -> UserAccount Source #
Construct a new HashFlare.io user account model with start balance and the list of mining contracts
contractHashrate :: MiningContract -> Hashrate a Source #
Hashrate provided by the contract
contractCost :: MiningContract -> Money USD Source #
Base cost of the contract
contractExpiration :: MiningContract -> Int Source #
Contract expiration, in days (or 0 for n/a)
contractMEF :: MEFTable -> MiningContract -> Money USD Source #
Calculate MEF costs for the contract
contractPayout :: PayoutTable -> MiningContract -> Money BTC Source #
Calculate contract's hashrate payout
accountBalance :: UserAccount -> Money BTC Source #
Current account balance (in Bitcoins)
accountContracts :: UserAccount -> [MiningContract] Source #
List of current mining contracts
userAccountMEF :: MEFTable -> UserAccount -> Money USD Source #
Total MEF for the account (in USD)
userAccountPayout :: PayoutTable -> UserAccount -> Money BTC Source #
Total payout for the account
infoUserAccount :: UserAccount -> String Source #
Pretty-print info on the user account
defaultMEFTable :: MEFTable Source #
Default HashFlare.io MEF prices (no record means no MEF)