Documentation ¶
Index ¶
- Variables
- func BoolPtr(v bool) *bool
- func BoolValue(v *bool) bool
- func Float32Ptr(v float32) *float32
- func Float32Value(v *float32) float32
- func Float64Ptr(v float64) *float64
- func Float64Value(v *float64) float64
- func Int32Ptr(v int32) *int32
- func Int32alue(v *int32) int32
- func Int64Ptr(v int64) *int64
- func Int64Value(v *int64) int64
- func IntPtr(v int) *int
- func IntValue(v *int) int
- func StringPtr(v string) *string
- func StringValue(v *string) string
- func TimePtr(v time.Time) *time.Time
- func TimeValue(v *time.Time) time.Time
- func Uint32Ptr(v uint32) *uint32
- func Uint32Value(v *uint32) uint32
- func Uint64Ptr(v uint64) *uint64
- func Uint64Value(v *uint64) uint64
- func UintPtr(v uint) *uint
- func UintValue(v *uint) uint
- type AccountingType
- type BlockBuilder
- type Deposit
- type Difficulty
- func (d *Difficulty) Bits() uint32
- func (d *Difficulty) Mul(factor int64) *Difficulty
- func (d *Difficulty) SetFromBig(targetBig *big.Int, maxDiffBig *big.Int) *Difficulty
- func (d *Difficulty) SetFromBits(bits uint32, maxDiffBig *big.Int) *Difficulty
- func (d *Difficulty) SetFromValue(value uint64, maxDiffBig *big.Int) *Difficulty
- func (d *Difficulty) TargetBig() *big.Int
- func (d *Difficulty) TargetHex() string
- func (d *Difficulty) TargetPrefixedHex() string
- func (d *Difficulty) Value() uint64
- type EarningMetric
- type Exchange
- type ExchangeID
- type Hash
- func (h *Hash) Big() *big.Int
- func (h *Hash) Bytes() []byte
- func (h *Hash) Difficulty(maxDiff *big.Int) uint64
- func (h *Hash) Hex() string
- func (h *Hash) MeetsDifficulty(diff *Difficulty) bool
- func (h *Hash) PrefixedHex() string
- func (h *Hash) SetFromBytes(value []byte) *Hash
- func (h *Hash) SetFromHex(value string) (*Hash, error)
- func (h *Hash) UnmarshalJSON(data []byte) error
- type Market
- type MiningNode
- type NetworkMetric
- type Number
- func (n *Number) Big() *big.Int
- func (n *Number) BytesBE() []byte
- func (n *Number) BytesLE() []byte
- func (n *Number) Hex() string
- func (n *Number) PrefixedHex() string
- func (n *Number) SetFromBytes(value []byte) *Number
- func (n *Number) SetFromHex(value string) (*Number, error)
- func (n *Number) SetFromString(value string) (*Number, error)
- func (n *Number) SetFromValue(value uint64) *Number
- func (n *Number) UnmarshalJSON(data []byte) error
- func (n *Number) Value() uint64
- type PayoutNode
- type PeriodType
- type ShareMetric
- type ShareStatus
- type Solution
- func (s *Solution) Data() []uint64
- func (s *Solution) Hex() string
- func (s *Solution) PrefixedHex() string
- func (s *Solution) SetFromData(data []uint64) *Solution
- func (s *Solution) SetFromHex(raw string) (*Solution, error)
- func (s *Solution) Size() int
- func (s *Solution) UnmarshalJSON(data []byte) error
- type StratumJob
- type StratumWork
- type Trade
- type TradeDirection
- type TradeStrategy
- type TransactionType
- type TxInput
- type TxOutput
- type TxResponse
- type UTXOResponse
- type Withdrawal
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUnknownInputType = fmt.Errorf("unknown input type")
)
Functions ¶
func Float32Ptr ¶
func Float32Value ¶
func Float64Ptr ¶
func Float64Value ¶
func Int64Value ¶
func StringValue ¶
func Uint32Value ¶
func Uint64Value ¶
Types ¶
type AccountingType ¶
type AccountingType int
const ( UTXOStructure AccountingType = iota AccountStructure )
type BlockBuilder ¶
type BlockBuilder interface { SerializeHeader(work *StratumWork) ([]byte, []byte, error) SerializeBlock(work *StratumWork) ([]byte, error) PartialJob() []interface{} }
type Difficulty ¶
type Difficulty struct {
// contains filtered or unexported fields
}
func (*Difficulty) Bits ¶
func (d *Difficulty) Bits() uint32
func (*Difficulty) Mul ¶
func (d *Difficulty) Mul(factor int64) *Difficulty
func (*Difficulty) SetFromBig ¶
func (d *Difficulty) SetFromBig(targetBig *big.Int, maxDiffBig *big.Int) *Difficulty
func (*Difficulty) SetFromBits ¶
func (d *Difficulty) SetFromBits(bits uint32, maxDiffBig *big.Int) *Difficulty
func (*Difficulty) SetFromValue ¶
func (d *Difficulty) SetFromValue(value uint64, maxDiffBig *big.Int) *Difficulty
func (*Difficulty) TargetBig ¶
func (d *Difficulty) TargetBig() *big.Int
func (*Difficulty) TargetHex ¶
func (d *Difficulty) TargetHex() string
func (*Difficulty) TargetPrefixedHex ¶
func (d *Difficulty) TargetPrefixedHex() string
func (*Difficulty) Value ¶
func (d *Difficulty) Value() uint64
type EarningMetric ¶
type EarningMetric string
const ( EarningValue EarningMetric = "value" EarningAverageValue EarningMetric = "avg_value" )
func ParseEarningMetric ¶
func ParseEarningMetric(raw string) (EarningMetric, error)
type Exchange ¶
type Exchange interface { ID() ExchangeID GetTradeTimeout() time.Duration // account GetAccountStatus() error // rate GetRate(string) (float64, error) GetHistoricalRates(string, time.Time, time.Time, bool) (map[time.Time]float64, error) GetOutputThresholds() map[string]*big.Int GetPrices(map[string]map[string]*big.Int) (map[string]map[string]float64, error) // wallet GetWalletStatus(string) (bool, bool, error) GetWalletBalance(string) (float64, float64, error) // deposit GetDepositAddress(string) (string, error) GetDepositByTxID(string, string) (*Deposit, error) GetDepositByID(string, string) (*Deposit, error) // transfer TransferToTradeAccount(string, float64) error TransferToMainAccount(string, float64) error // trade GenerateTradePath(string, string) ([]*Trade, error) CreateTrade(string, TradeDirection, float64) (string, error) GetTradeByID(string, string, float64) (*Trade, error) CancelTradeByID(string, string) error // withdrawal CreateWithdrawal(string, string, float64) (string, error) GetWithdrawalByID(string, string) (*Withdrawal, error) NeedsWithdrawalFeeSubtraction() bool }
type ExchangeID ¶
type ExchangeID int
const ( BinanceID ExchangeID = iota KucoinID BittrexID MEXCGlobalID )
type Hash ¶
type Hash struct {
// contains filtered or unexported fields
}
func (*Hash) MeetsDifficulty ¶
func (h *Hash) MeetsDifficulty(diff *Difficulty) bool
func (*Hash) PrefixedHex ¶
func (*Hash) SetFromBytes ¶
func (*Hash) UnmarshalJSON ¶
type Market ¶
type Market struct { Market string Base string Quote string Direction TradeDirection }
type MiningNode ¶
type MiningNode interface { PayoutNode Mocked() bool HandleHostPoolInfoRequest(http.ResponseWriter, *http.Request) // constants GetMaxDifficulty() *big.Int GetImmatureDepth() uint64 GetMatureDepth() uint64 CalculateHashrate(float64, float64) float64 // stratum helpers GetSubscribeResponses([]byte, string, string) ([]interface{}, error) GetAuthorizeResponses(int) ([]interface{}, error) GetSetDifficultyResponse(int) (interface{}, error) GetClientType(string) int MarshalJob(interface{}, *StratumJob, bool, int, int) (interface{}, error) ParseWork([]json.RawMessage, string) (*StratumWork, error) // mining helpers GetBlockExplorerURL(*pooldb.Round) string GetStatus() (uint64, bool, error) PingHosts() ([]string, []uint64, []bool, []error) GetBlocks(uint64, uint64) ([]*tsdb.RawBlock, error) GetBlocksByHash(string, uint64) ([]*tsdb.RawBlock, error) JobNotify(context.Context, time.Duration) chan *StratumJob SubmitWork(*StratumJob, *StratumWork, int) (ShareStatus, *Hash, *pooldb.Round, error) UnlockRound(*pooldb.Round) error MatureRound(*pooldb.Round) ([]*pooldb.UTXO, error) }
type NetworkMetric ¶
type NetworkMetric string
const ( NetworkValue NetworkMetric = "value" NetworkDifficulty NetworkMetric = "difficulty" NetworkBlockTime NetworkMetric = "block_time" NetworkHashrate NetworkMetric = "hashrate" NetworkProfitability NetworkMetric = "profitability" NetworkEmission NetworkMetric = "emission" )
func ParseNetworkMetric ¶
func ParseNetworkMetric(raw string) (NetworkMetric, error)
type Number ¶
type Number struct {
// contains filtered or unexported fields
}
func (*Number) PrefixedHex ¶
func (*Number) SetFromBytes ¶
note that the uint64 will not fit if the value is greater than a uint64, even though we allow the full precision to be stored in the big int
func (*Number) SetFromValue ¶
func (*Number) UnmarshalJSON ¶
type PayoutNode ¶
type PayoutNode interface { Name() string Chain() string Address() string GetUnits() *Number GetAccountingType() AccountingType GetAddressPrefix() string ShouldMergeUTXOs() bool ValidateAddress(string) bool // tx helpers GetTxExplorerURL(string) string GetAddressExplorerURL(string) string GetBalance() (*big.Int, error) GetTx(string) (*TxResponse, error) CreateTx([]*TxInput, []*TxOutput) (string, string, error) BroadcastTx(string) (string, error) }
type PeriodType ¶
type PeriodType int
const ( Period15m PeriodType = iota Period1h Period4h Period1d )
func ParsePeriodType ¶
func ParsePeriodType(raw string) (PeriodType, error)
func (PeriodType) Average ¶
func (t PeriodType) Average() time.Duration
func (PeriodType) AverageWindow ¶
func (t PeriodType) AverageWindow() int
func (PeriodType) GenerateRange ¶
func (PeriodType) Retention ¶
func (t PeriodType) Retention() time.Duration
func (PeriodType) RetentionWindow ¶
func (t PeriodType) RetentionWindow() int
func (PeriodType) Rollup ¶
func (t PeriodType) Rollup() time.Duration
type ShareMetric ¶
type ShareMetric string
const ()
func ParseShareMetric ¶
func ParseShareMetric(raw string) (ShareMetric, error)
type ShareStatus ¶
type ShareStatus int
const ()
func (ShareStatus) String ¶
func (status ShareStatus) String() string
type Solution ¶
type Solution struct {
// contains filtered or unexported fields
}
func (*Solution) PrefixedHex ¶
func (*Solution) SetFromData ¶
func (*Solution) UnmarshalJSON ¶
type StratumJob ¶
type StratumJob struct { HostID string ID string Header *Hash HeaderHash *Hash Seed *Hash Height *Number Difficulty *Difficulty Timestamp time.Time Version *Number BlockBuilder BlockBuilder CoinbaseTxID *Hash Data interface{} // @TODO: fix this (allow you to store a struct of a lot of data [for AE/KAS]) }
type StratumWork ¶
type TradeDirection ¶
type TradeDirection int
const ( TradeBuy TradeDirection = iota TradeSell )
func (TradeDirection) String ¶
func (d TradeDirection) String() string
type TradeStrategy ¶
type TradeStrategy int
const ( TradeMarket TradeStrategy = iota TradeLimit TradeLimitMarket TradeExpiringLimitToLimitMarket )
type TransactionType ¶
type TransactionType int
const ( DepositTx TransactionType = iota PayoutTx MergeTx )
type TxResponse ¶
type UTXOResponse ¶
Click to show internal directories.
Click to hide internal directories.