Documentation ¶
Overview ¶
Package middlecoin is a package which contains structures for decoding Middlecoin JSON data in Go.
Index ¶
Constants ¶
const Url = "http://www.middlecoin.com/json"
Url is the url that middlecoin uses to expose the json API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressMap ¶
type AddressMap map[string]*AddressReport
AddressMap maps bitcoin addresses from middlecoin to reports on their progress.
func (*AddressMap) UnmarshalJSON ¶
func (m *AddressMap) UnmarshalJSON(data []byte) error
type AddressReport ¶
type AddressReport struct { ImmatureBalance ReportFloat64 PaidOut ReportFloat64 UnexchangedBalance ReportFloat64 MegahashesPerSecond ReportFloat64 BitcoinBalance ReportFloat64 RejectedMegahashesPerSecond ReportFloat64 }
AddressReport the report of what the middlecoin miner has been up to for the last hour.
func (*AddressReport) Add ¶
func (r *AddressReport) Add(o *AddressReport) *AddressReport
Add is a simple addition operator for AddressReports for easier aggregation.
func (*AddressReport) Profit ¶
func (r *AddressReport) Profit() float64
Profit returns the total potential profit as the sum of the balance, immature balance, paid balance, and unexchanged balance.
func (*AddressReport) String ¶
func (r *AddressReport) String() string
type OverviewReport ¶
type OverviewReport struct { TotalPaidOut ReportFloat64 TotalRejectedMegahashesPerSecond ReportFloat64 TotalImmatureBalance ReportFloat64 TotalMegahashesPerSecond ReportFloat64 TotalBalance ReportFloat64 Time ReportTime Report AddressMap }
OverviewReport is the top level report on middlecoin and the totals for all of the miners.
func Decode ¶
func Decode(reader io.Reader) (*OverviewReport, error)
Decode is a method that you can use on a reader to parse it into an overview report.
func Fetch ¶
func Fetch() (*OverviewReport, error)
Fetch is a method that fetches the package from the url and decodes it.
type ReportElement ¶
type ReportElement struct { Address string Report *AddressReport }
ReportElement is a simple pair that contains a bitcoin address for a miner and the report on its progress.
func (*ReportElement) UnmarshalJSON ¶
func (r *ReportElement) UnmarshalJSON(data []byte) error
type ReportFloat64 ¶
type ReportFloat64 float64
ReportFloat64 is a simple type on which I defined Unmarshal.
func (*ReportFloat64) UnmarshalJSON ¶
func (r *ReportFloat64) UnmarshalJSON(data []byte) error
type ReportTime ¶
ReportTime is a custom defined type so that I could easily unmarshal the json into the time according to a format.
func (*ReportTime) String ¶
func (r *ReportTime) String() string
func (*ReportTime) UnmarshalJSON ¶
func (r *ReportTime) UnmarshalJSON(data []byte) error