db

package
v0.0.0-...-45a0acb Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2017 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoinDB

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

func Default

func Default() *CoinDB

func New

func New(config Config) *CoinDB

func (*CoinDB) GetCurrencyPairs

func (driver *CoinDB) GetCurrencyPairs(market string) (data []Pair)

GetMarkets return the list of GetCurrencyPair from market

func (*CoinDB) GetFirstDate

func (driver *CoinDB) GetFirstDate(market string, pair Pair) time.Time

func (*CoinDB) GetLastDate

func (driver *CoinDB) GetLastDate(market string, pair Pair) time.Time

func (*CoinDB) GetMarkets

func (driver *CoinDB) GetMarkets() (data []string)

GetMarkets return the list of market name

func (*CoinDB) GetOHLC

func (driver *CoinDB) GetOHLC(market string, pair Pair, start, end time.Time, period string) (data []OHLC)

GetOHLC return the list of OHLC from CurrencyPair TODO : This function is not tested.

func (*CoinDB) PutMarketTake

func (db *CoinDB) PutMarketTake(market string, pair Pair, data MarketTake)

func (*CoinDB) PutMarketTakes

func (db *CoinDB) PutMarketTakes(market string, pair Pair, data []MarketTake)

func (*CoinDB) PutOHLC

func (db *CoinDB) PutOHLC(market string, pair Pair, data OHLC, date time.Time)

data insert

func (*CoinDB) PutOHLCs

func (db *CoinDB) PutOHLCs(market string, pair Pair, data ...OHLC)

type Config

type Config struct {
	Host     string
	UserName string
	Password string
}

type Fields

type Fields map[string]interface{}

type MarketTake

type MarketTake struct {
	TradeID int
	Amount  float64
	Rate    float64
	Total   float64
	Buy     int
	Sell    int
	Time    time.Time
}

type OHLC

type OHLC struct {
	Open   float64
	High   float64
	Low    float64
	Close  float64
	Volume float64
	Time   time.Time
	Minute int
}

type Pair

type Pair struct {
	Quote string
	Base  string
}

func (Pair) MarshalText

func (pair Pair) MarshalText() ([]byte, error)

func (Pair) ToString

func (pair Pair) ToString() string

type Tags

type Tags map[string]string

for influx db

type TickerValue

type TickerValue []float64

ticker

func (TickerValue) Before

func (value TickerValue) Before(offset int) float64

func (TickerValue) Ema

func (value TickerValue) Ema(period int) TickerValue

To-Do..

func (TickerValue) Last

func (value TickerValue) Last() float64

func (TickerValue) Size

func (value TickerValue) Size() int

func (TickerValue) Sma

func (value TickerValue) Sma(period int) TickerValue

math

type TikerData

type TikerData map[string]interface{}

func (TikerData) Avg

func (ticker TikerData) Avg() TickerValue

func (TikerData) Close

func (ticker TikerData) Close() TickerValue

func (TikerData) High

func (ticker TikerData) High() TickerValue

func (TikerData) Low

func (ticker TikerData) Low() TickerValue

func (TikerData) Open

func (ticker TikerData) Open() TickerValue

func (TikerData) Time

func (ticker TikerData) Time() []int64

func (TikerData) Volume

func (ticker TikerData) Volume() TickerValue

func (TikerData) WeightedAvg

func (ticker TikerData) WeightedAvg() TickerValue

type TradeData

type TradeData struct {
	ID     int64
	Type   string
	Amount float64
	Price  float64
	Total  float64
	Date   time.Time
}

Jump to

Keyboard shortcuts

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