Versions in this module Expand all Collapse all v3 v3.1.0 Jun 22, 2022 v3.0.0 Sep 3, 2021 Changes in this version + const Binance + const Bittrex + const BittrexMsgBookUpdate + const BittrexMsgHeartbeat + const Coinbase + const Coindesk + const DefaultCurrency + const DefaultDataExpiry + const DefaultRequestExpiry + const DexDotDecred + const DragonEx + const Huobi + const Poloniex + var BinanceURLs = URLs + var BittrexURLs = URLs + var BtcIndices = map[string]func(*http.Client, *BotChannels) (Exchange, error) + var CoinbaseURLs = URLs + var CoindeskURLs = URLs + var DcrExchanges = map[string]func(*http.Client, *BotChannels) (Exchange, error) + var DragonExURLs = URLs + var HuobiURLs = URLs + var PoloniexURLs = URLs + func DisableLog() + func IsBtcIndex(token string) bool + func IsDcrExchange(token string) bool + func NewDecredDEXConstructor(cfg *DEXConfig) func(*http.Client, *BotChannels) (Exchange, error) + func Tokens() []string + func UseLogger(logger slog.Logger) + type BaseState struct + BaseVolume float64 + Change float64 + Price float64 + Stamp int64 + Volume float64 + type BinanceCandlestickResponse [][]interface + type BinanceDepthResponse struct + Asks [][2]string + Bids [][2]string + UpdateID int64 + type BinanceExchange struct + func (binance *BinanceExchange) Refresh() + type BinancePriceResponse struct + AskPrice string + AskQty string + BidPrice string + BidQty string + CloseTime int64 + Count int64 + FirstID int64 + HighPrice string + LastID int64 + LastPrice string + LastQty string + LowPrice string + OpenPrice string + OpenTime int64 + PrevClosePrice string + PriceChange string + PriceChangePercent string + QuoteVolume string + Symbol string + Volume string + WeightedAvgPrice string + type BittrexCandlestick struct + Close StringFloat + High StringFloat + Low StringFloat + Open StringFloat + QuoteVolume StringFloat + StartsAt time.Time + Volume StringFloat + type BittrexDepthResponse struct + Ask []*BittrexRateQty + Bid []*BittrexRateQty + Seq uint64 + type BittrexExchange struct + MarketName string + func (bittrex *BittrexExchange) Refresh() + type BittrexMarketSummary struct + High StringFloat + Low StringFloat + PercentChange StringFloat + QuoteVolume StringFloat + Symbol string + UpdatedAt time.Time + Volume StringFloat + type BittrexOrderbookDelta struct + Qty StringFloat + Rate StringFloat + type BittrexOrderbookUpdate struct + AskDeltas []*BittrexOrderbookDelta + BidDeltas []*BittrexOrderbookDelta + Depth int64 + MarketSymbol string + Sequence uint64 + type BittrexPriceResponse struct + AskRate StringFloat + BidRate StringFloat + LastTradeRate StringFloat + type BittrexRateQty struct + Qty StringFloat + Rate StringFloat + type BittrexWSMsg struct + Name string + Updates []*BittrexOrderbookUpdate + type BotChannels struct + type Candlestick struct + Close float64 + High float64 + Low float64 + Open float64 + Start time.Time + Volume float64 + type Candlesticks []Candlestick + type CoinbaseExchange struct + func (coinbase *CoinbaseExchange) Refresh() + type CoinbaseResponse struct + Data CoinbaseResponseData + type CoinbaseResponseData struct + Currency string + Rates map[string]string + type CoindeskExchange struct + func (coindesk *CoindeskExchange) Refresh() + type CoindeskResponse struct + Bpi map[string]CoindeskResponseBpi + ChartName string + Disclaimer string + Time CoindeskResponseTime + type CoindeskResponseBpi struct + Code string + Description string + Rate string + RateFloat float64 + Symbol string + type CoindeskResponseTime struct + Updated string + UpdatedIso time.Time + Updateduk string + type CommonExchange struct + URL string + func (xc *CommonExchange) Hurry(d time.Duration) + func (xc *CommonExchange) IsFailed() bool + func (xc *CommonExchange) LastFail() time.Time + func (xc *CommonExchange) LastTry() time.Time + func (xc *CommonExchange) LastUpdate() time.Time + func (xc *CommonExchange) LogRequest() + func (xc *CommonExchange) SilentUpdate(state *ExchangeState) + func (xc *CommonExchange) Token() string + func (xc *CommonExchange) Update(state *ExchangeState) + func (xc *CommonExchange) UpdateIndices(indices FiatIndices) + type Conversion struct + Index string + Value float64 + func (c *Conversion) TwoDecimals() string + type DEXConfig struct + Cert []byte + CertHost string + Host string + Token string + type DecredDEX struct + func (dcr *DecredDEX) Refresh() + type DepthData struct + Asks []DepthPoint + Bids []DepthPoint + Time int64 + func (depth *DepthData) IsFresh() bool + func (depth *DepthData) MidGap() float64 + type DepthPoint struct + Price float64 + Quantity float64 + type Doer interface + Do func(*http.Request) (*http.Response, error) + type DragonExCandlestickColumns []string + type DragonExCandlestickData struct + Columns DragonExCandlestickColumns + Lists DragonExCandlestickPts + type DragonExCandlestickList []interface + type DragonExCandlestickPts []DragonExCandlestickList + type DragonExCandlestickResponse struct + Data DragonExCandlestickData + type DragonExDepthArray []DragonExDepthPt + type DragonExDepthPt struct + Price string + Volume string + type DragonExDepthResponse struct + Data DragonExDepthArray + type DragonExPriceResponse struct + Data []DragonExPriceResponseData + type DragonExPriceResponseData struct + ClosePrice string + CurrentVolume string + MaxPrice string + MinPrice string + OpenPrice string + PriceBase string + PriceChange string + PriceChangeRate string + SymbolID int + Timestamp int64 + TotalAmount string + TotalVolume string + UsdtVolume string + type DragonExResponse struct + Code int + Msg string + Ok bool + type DragonExchange struct + SymbolID int + func (dragonex *DragonExchange) Refresh() + type Exchange interface + Hurry func(time.Duration) + IsFailed func() bool + LastFail func() time.Time + LastTry func() time.Time + LastUpdate func() time.Time + Refresh func() + SilentUpdate func(*ExchangeState) + Token func() string + Update func(*ExchangeState) + UpdateIndices func(FiatIndices) + func NewBinance(client *http.Client, channels *BotChannels) (binance Exchange, err error) + func NewBittrex(client *http.Client, channels *BotChannels) (bittrex Exchange, err error) + func NewCoinbase(client *http.Client, channels *BotChannels) (coinbase Exchange, err error) + func NewCoindesk(client *http.Client, channels *BotChannels) (coindesk Exchange, err error) + func NewDragonEx(client *http.Client, channels *BotChannels) (dragonex Exchange, err error) + func NewHuobi(client *http.Client, channels *BotChannels) (huobi Exchange, err error) + func NewPoloniex(client *http.Client, channels *BotChannels) (poloniex Exchange, err error) + type ExchangeBot struct + BtcIndex string + DataExpiry time.Duration + DcrBtcExchanges map[string]Exchange + Exchanges map[string]Exchange + IndexExchanges map[string]Exchange + RequestExpiry time.Duration + TLSCredentials credentials.TransportCredentials + func NewExchangeBot(config *ExchangeBotConfig) (*ExchangeBot, error) + func (bot *ExchangeBot) AvailableIndices() []string + func (bot *ExchangeBot) Conversion(dcrVal float64) *Conversion + func (bot *ExchangeBot) ConvertedRates(code string) (*ExchangeRates, error) + func (bot *ExchangeBot) ConvertedState(code string) (*ExchangeBotState, error) + func (bot *ExchangeBot) ConvertedStateBytes(symbol string) ([]byte, error) + func (bot *ExchangeBot) Cycle() + func (bot *ExchangeBot) Indices(token string) FiatIndices + func (bot *ExchangeBot) IsFailed() bool + func (bot *ExchangeBot) Price() float64 + func (bot *ExchangeBot) QuickDepth(token string) (chart []byte, err error) + func (bot *ExchangeBot) QuickSticks(token string, rawBin string) ([]byte, error) + func (bot *ExchangeBot) Rates() *ExchangeRates + func (bot *ExchangeBot) Start(ctx context.Context, wg *sync.WaitGroup) + func (bot *ExchangeBot) State() *ExchangeBotState + func (bot *ExchangeBot) StateBytes() []byte + func (bot *ExchangeBot) UpdateChannels() *UpdateChannels + type ExchangeBotConfig struct + BtcIndex string + DataExpiry string + Disabled []string + Indent bool + MasterBot string + MasterCertFile string + RequestExpiry string + type ExchangeBotState struct + BtcIndex string + BtcPrice float64 + DcrBtc map[string]*ExchangeState + FiatIndices map[string]*ExchangeState + Price float64 + Volume float64 + func (state *ExchangeBotState) BtcToFiat(btc float64) float64 + func (state *ExchangeBotState) FiatToBtc(fiat float64) float64 + func (state *ExchangeBotState) VolumeOrderedExchanges() []*tokenedExchange + type ExchangeRates struct + BtcIndex string + BtcPrice float64 + DcrPrice float64 + Exchanges map[string]BaseState + type ExchangeState struct + Candlesticks map[candlestickKey]Candlesticks + Depth *DepthData + func (state *ExchangeState) HasCandlesticks() bool + func (state *ExchangeState) HasDepth() bool + func (state *ExchangeState) StickList() string + type ExchangeUpdate struct + State *ExchangeState + Token string + type FiatIndices map[string]float64 + type HuobiCandlestickData []*HuobiCandlestickPt + type HuobiCandlestickPt struct + Amount float64 + Close float64 + Count int64 + High float64 + ID int64 + Low float64 + Open float64 + Vol float64 + type HuobiCandlestickResponse struct + Data HuobiCandlestickData + type HuobiDepthPts [][2]float64 + type HuobiDepthResponse struct + Tick HuobiDepthTick + type HuobiDepthTick struct + Asks HuobiDepthPts + Bids HuobiDepthPts + ID int64 + Ts int64 + type HuobiExchange struct + Ok string + func (huobi *HuobiExchange) Refresh() + type HuobiPriceResponse struct + Tick HuobiPriceTick + type HuobiPriceTick struct + Amount float64 + Ask []float64 + Bid []float64 + Close float64 + Count int64 + High float64 + ID int64 + Low float64 + Open float64 + Version int64 + Vol float64 + type HuobiResponse struct + Ch string + Status string + Ts int64 + type IndexUpdate struct + Indices FiatIndices + Token string + type PoloniexCandlestickPt struct + Close float64 + Date int64 + High float64 + Low float64 + Open float64 + QuoteVolume float64 + Volume float64 + WeightedAverage float64 + type PoloniexCandlestickResponse []*PoloniexCandlestickPt + type PoloniexDepthArray []*PoloniexDepthPt + type PoloniexDepthPt [2]interface + type PoloniexDepthResponse struct + Asks PoloniexDepthArray + Bids PoloniexDepthArray + IsFrozen string + Seq int64 + type PoloniexExchange struct + CurrencyPair string + func (poloniex *PoloniexExchange) Refresh() + type PoloniexPair struct + BaseVolume string + High24hr string + HighestBid string + ID int + IsFrozen string + Last string + Low24hr string + LowestAsk string + PercentChange string + QuoteVolume string + type StringFloat float64 + func (v *StringFloat) UnmarshalJSON(b []byte) error + func (v StringFloat) MarshalJSON() ([]byte, error) + type URLs struct + Candlesticks map[candlestickKey]string + Depth string + Price string + Stats string + Websocket string + type UpdateChannels struct + Exchange chan *ExchangeUpdate + Index chan *IndexUpdate + Quit chan struct{} + type WebsocketProcessor func([]byte) Other modules containing this package github.com/decred/dcrdata/exchanges github.com/decred/dcrdata/exchanges/v2 github.com/decred/dcrdata/v4