services

package
v0.0.0-...-e9fdc67 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UpdateFiatRatesTimeFrame is the time frame to update fiat rates
	UpdateFiatRatesTimeFrame = 60 * 60 * 24 // 24 Hour timeframe
	UpdateBtcRatesTimeFrame  = 60 * 15      // 15 minutes
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BtcRates

type BtcRates struct {
	LastUpdated int64
	Rates       map[string]models.RateV2
}

type Exchange

type Exchange interface {
	CoinMarketOrders(coin string) (orders map[string][]models.MarketOrder, err error)
}

Exchange is the interface to make sure all exchange services have the same properties

type RateSevice

type RateSevice struct {
	FiatRates           *models.FiatRates
	FiatRatesToken      string
	BtcRates            BtcRates
	BittrexService      *bittrex.Service
	BinanceService      *binance.Service
	Crex24Service       *crex24.Service
	StexService         *stex.Service
	SouthXChangeService *southxhcange.Service
	KuCoinService       *kucoin.Service
	GraviexService      *graviex.Service
	BitrueService       *bitrue.Service
	HitBTCService       *hitbtc.Service
	LukkiService        *lukki.Service
	BithumbService      *bithumb.Service
	BirakeService       *birake.Service
	PancakeService      *pancake.Service
}

RateSevice is the main wrapper for all different exchanges and fiat rates data

func (*RateSevice) GetBtcEURRate

func (rs *RateSevice) GetBtcEURRate() (float64, error)

GetBtcEURRate will return the price of BTC on EUR

func (*RateSevice) GetBtcRates

func (rs *RateSevice) GetBtcRates() (map[string]models.RateV2, error)

GetBtcRates will return the Bitcoin rates using the OpenRates structure

func (*RateSevice) GetCoinLiquidity

func (rs *RateSevice) GetCoinLiquidity(coin *coins.Coin, exchange string) (float64, error)

func (*RateSevice) GetCoinOrdersWall

func (rs *RateSevice) GetCoinOrdersWall(coin *coins.Coin, exchange string) (orders map[string][]models.MarketOrder, err error)

GetCoinOrdersWall will return the buy/sell orders from selected or fallback exchange

func (*RateSevice) GetCoinRates

func (rs *RateSevice) GetCoinRates(coin *coins.Coin, exchange string, buyWall bool, isSimple bool) (map[string]models.RateV2, error)

GetCoinRates is the main function to get the rates of a coin using the OpenRates structure

func (*RateSevice) GetCoinToCoinRates

func (rs *RateSevice) GetCoinToCoinRates(coinFrom *coins.Coin, coinTo *coins.Coin, exchange string) (rate float64, err error)

GetCoinToCoinRates will return the rates from a crypto to a crypto using the exchanges data

func (*RateSevice) GetCoinToCoinRatesWithAmount

func (rs *RateSevice) GetCoinToCoinRatesWithAmount(coinFrom *coins.Coin, coinTo *coins.Coin, amountReq float64, exchange string) (obol.CoinToCoinWithAmountResponse, error)

GetCoinToCoinRatesWithAmount is used to get the rates from crypto to crypto using a specified amount to convert

func (*RateSevice) GetUsdEurRate

func (rs *RateSevice) GetUsdEurRate() (float64, error)

GetUSD-URRate will return the price of BTC on EUR

func (*RateSevice) GetUsdRates

func (rs *RateSevice) GetUsdRates() (map[string]models.RateV2, error)

TODO RATES FOR USDT GTH GetUsdRates will return the USD rates using the OpenRates structure

func (*RateSevice) LoadFiatRates

func (rs *RateSevice) LoadFiatRates() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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