nicehash

package module
v0.0.0-...-c65ec73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2018 License: MIT Imports: 12 Imported by: 4

README

go-nicehash-api

NiceHash Api library for golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlgoType

type AlgoType int
const (
	AlgoTypeScrypt AlgoType = iota
	AlgoTypeSHA256
	AlgoTypeScryptNf
	AlgoTypeX11
	AlgoTypeX13
	AlgoTypeKeccak
	AlgoTypeX15
	AlgoTypeNist5
	AlgoTypeNeoScrypt
	AlgoTypeLyra2RE
	AlgoTypeWhirlpoolX
	AlgoTypeQubit
	AlgoTypeQuark
	AlgoTypeAxiom
	AlgoTypeLyra2REv2
	AlgoTypeScryptJaneNf16
	AlgoTypeBlake256r8
	AlgoTypeBlake256r14
	AlgoTypeBlake256r8vnl
	AlgoTypeHodl
	AlgoTypeDaggerHashimoto
	AlgoTypeDecred
	AlgoTypeCryptoNight
	AlgoTypeLbry
	AlgoTypeEquihash
	AlgoTypePascal
	AlgoTypeX11Gost
	AlgoTypeSia
	AlgoTypeBlake2s
	AlgoTypeMAX
)

func (AlgoType) EncodeValues

func (t AlgoType) EncodeValues(key string, v *url.Values) error

func (AlgoType) ToString

func (t AlgoType) ToString() string

type Balance

type Balance struct {
	Confirmed float64 `json:"balance_confirmed,string"`
	Pending   float64 `json:"balance_pending,string"`
}

type GlobalStats

type GlobalStats struct {
	Algo                  AlgoType `json:"algo"`
	ProfitabilityAboveBtc float32  `json:"profitability_above_btc,string"`
	ProfitabilityAboveLtc float32  `json:"profitability_above_ltc,string"`
	Price                 float64  `json:"price,string"`
	ProfitabilityBtc      float32  `json:"profitability_btc,string"`
	ProfitabilityLtc      float32  `json:"profitability_ltc,string"`
	Speed                 float64  `json:"speed,string"`
}

type Location

type Location int
const (
	LocationNiceHash Location = iota
	LocationWestHash
	LocationMAX
)

func (Location) EncodeValues

func (t Location) EncodeValues(key string, v *url.Values) error

func (Location) ToString

func (t Location) ToString() string

type MyOrders

type MyOrders struct {
	Id            uint64    `json:"id"`
	Type          OrderType `json:"type"`
	Algo          AlgoType  `json:"algo"`
	Price         float64   `json:"price,string"`
	BtcAvail      float64   `json:"btc_avail,string"`
	BtcPaid       float64   `json:"btc_paid,string"`
	PoolHost      string    `json:"pool_host"`
	PoolPort      uint16    `json:"pool_port"`
	PoolUser      string    `json:"pool_user"`
	PoolPass      string    `json:"pool_pass"`
	Alive         bool      `json:"alive"`
	LimitSpeed    float64   `json:"limit_speed,string"`
	AcceptedSpeed float64   `json:"accepted_speed,string"`
	Workers       uint64    `json:"workers"`
	End           uint64    `json:"end"`
}

type NewOrder

type NewOrder struct {
	Algo       AlgoType `json:"algo" url:"algo"`
	Price      float64  `json:"price,string" url:"price"`
	Amount     float64  `json:"amount,string" url:"amount"`
	PoolHost   string   `json:"pool_host" url:"pool_host"`
	PoolPort   uint16   `json:"pool_port" url:"pool_port"`
	PoolUser   string   `json:"pool_user" url:"pool_user"`
	PoolPass   string   `json:"pool_pass" url:"pool_pass"`
	Alive      bool     `json:"alive" url:"alive"`
	LimitSpeed float64  `json:"limit,string" url:"limit,omitempty"`
	Code       string   `json:"code" url:"code,omitempty"`
}

type NicehashClient

type NicehashClient struct {
	// contains filtered or unexported fields
}

func NewNicehashClient

func NewNicehashClient(client *http.Client, BaseURL string, ApiId string, ApiKey string, UserAgent string) *NicehashClient

func (*NicehashClient) GetBalance

func (client *NicehashClient) GetBalance() (Balance, error)

func (*NicehashClient) GetMyOrders

func (client *NicehashClient) GetMyOrders(algo AlgoType, location Location) ([]MyOrders, error)

func (*NicehashClient) GetOrders

func (client *NicehashClient) GetOrders(algo AlgoType, location Location) ([]Orders, error)

func (*NicehashClient) GetStatsGlobalCurrent

func (client *NicehashClient) GetStatsGlobalCurrent() ([]GlobalStats, error)

func (*NicehashClient) GetStatsGlobalDay

func (client *NicehashClient) GetStatsGlobalDay() ([]GlobalStats, error)

func (*NicehashClient) GetStatsProvider

func (client *NicehashClient) GetStatsProvider(addr string) ([]ProviderStats, []ProviderPayments, error)

func (*NicehashClient) GetStatsProviderEx

func (client *NicehashClient) GetStatsProviderEx(addr string) (StatsProviderEx, error)

func (*NicehashClient) GetStatsProviderWorkers

func (client *NicehashClient) GetStatsProviderWorkers(addr string, algo AlgoType) ([]ProviderWorker, error)

func (*NicehashClient) GetVersion

func (client *NicehashClient) GetVersion() (string, error)

func (*NicehashClient) OrderCreate

func (client *NicehashClient) OrderCreate(order NewOrder) (string, error)

func (*NicehashClient) OrderRefill

func (client *NicehashClient) OrderRefill(algo AlgoType, location Location, order uint, amount float64) (string, error)

func (*NicehashClient) OrderRemove

func (client *NicehashClient) OrderRemove(algo AlgoType, location Location, order uint) (string, error)

func (*NicehashClient) OrderSetLimit

func (client *NicehashClient) OrderSetLimit(algo AlgoType, location Location, order uint, limit float32) (string, error)

func (*NicehashClient) OrderSetPrice

func (client *NicehashClient) OrderSetPrice(algo AlgoType, location Location, order uint, price float32) (string, error)

func (*NicehashClient) OrderSetPriceDecrease

func (client *NicehashClient) OrderSetPriceDecrease(algo AlgoType, location Location, order uint) (string, error)

func (NicehashClient) SetDebug

func (client NicehashClient) SetDebug(debug bool)

type OrderType

type OrderType int
const (
	OrderTypeStandard OrderType = iota
	OrderTypeFixed
	OrderTypeMAX
)

func (OrderType) ToString

func (t OrderType) ToString() string

type Orders

type Orders struct {
	Id            uint64    `json:"id"`
	Type          OrderType `json:"type"`
	Algo          AlgoType  `json:"algo"`
	Price         float64   `json:"price,string"`
	Alive         bool      `json:"alive"`
	LimitSpeed    float64   `json:"limit_speed,string"`
	AcceptedSpeed float64   `json:"accepted_speed,string"`
	Workers       uint64    `json:"workers"`
}

type Params

type Params struct {
	Method   string   `url:"method"`
	ApiId    string   `url:"id,omitempty"`
	ApiKey   string   `url:"key,omitempty"`
	Addr     string   `url:"addr,omitempty"`
	Algo     AlgoType `url:"algo"`
	Location Location `url:"location"`
	My       bool     `url:"my,omitempty"`

	Order  uint    `url:"order,omitempty"`
	Limit  float32 `url:"limit,omitempty"`
	Price  float32 `url:"price,omitempty"`
	Amount float64 `url:"amount,omitempty"`
}

type ProviderExHistory

type ProviderExHistory struct {
	Algo AlgoType                            `json:"algo"`
	Data map[time.Time]ProviderExHistoryItem `json:"data"`
}

func (*ProviderExHistory) UnmarshalJSON

func (t *ProviderExHistory) UnmarshalJSON(data []byte) error

type ProviderExHistoryItem

type ProviderExHistoryItem struct {
	Unpaid        float64 `json:"balance,string"`
	AcceptedSpeed float64 `json:"accepted_speed,string"`
	RejectedSpeed float64 `json:"rejected_speed,string"`
}

type ProviderExPayments

type ProviderExPayments struct {
	Amount float64   `json:"amount,string"`
	Fee    float64   `json:"fee,string"`
	TxID   string    `json:"TXID"`
	Time   time.Time `json:"time"`
}

func (*ProviderExPayments) UnmarshalJSON

func (t *ProviderExPayments) UnmarshalJSON(data []byte) error

type ProviderExStats

type ProviderExStats struct {
	Algo          AlgoType `json:"algo"`
	Suffix        string   `json:"suffix"`
	Name          string   `json:"name"`
	Profitability float64  `json:"profitability,string"`
	Unpaid        float64  `json:"balance,string"`
	AcceptedSpeed float64  `json:"accepted_speed,string"`
	RejectedSpeed float64  `json:"rejected_speed,string"`
}

func (*ProviderExStats) UnmarshalJSON

func (t *ProviderExStats) UnmarshalJSON(data []byte) error

type ProviderPayments

type ProviderPayments struct {
	Amount float64   `json:"amount,string"`
	Fee    float64   `json:"fee,string"`
	TxID   string    `json:"TXID"`
	Time   time.Time `json:"time"`
}

func (*ProviderPayments) UnmarshalJSON

func (t *ProviderPayments) UnmarshalJSON(data []byte) error

type ProviderStats

type ProviderStats struct {
	Algo          AlgoType `json:"algo"`
	Balance       float64  `json:"balance,string"`
	AcceptedSpeed float64  `json:"accepted_speed,string"`
	RejectedSpeed float64  `json:"rejected_speed,string"`
}

type ProviderWorker

type ProviderWorker struct {
	Name          string   `json:"name"`
	AcceptedSpeed float64  `json:"accepted_speed,string"`
	RejectedSpeed float64  `json:"rejected_speed,string"`
	Connected     uint64   `json:"connected"`
	XnSubEnabled  bool     `json:"xnsub"`
	Difficulty    float64  `json:"difficulty"`
	Location      Location `json:"location"`
}

func (*ProviderWorker) UnmarshalJSON

func (t *ProviderWorker) UnmarshalJSON(data []byte) error

type StatsProviderEx

type StatsProviderEx struct {
	Error    string               `json:"error"`
	Current  []ProviderExStats    `json:"current"`
	Past     []ProviderExHistory  `json:"past"`
	Payments []ProviderExPayments `json:"payments"`
}

type Version

type Version struct {
	ApiVersion string `json:"api_version"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL