market

package
v0.0.0-...-491e088 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: Apache-2.0 Imports: 23 Imported by: 18

Documentation

Index

Constants

View Source
const (
	UnlockedPrefix    = "unlock_"
	BalancePrefix     = "balance_"
	AllowancePrefix   = "allowance_"
	CustomTokenPrefix = "customtoken_"
)
View Source
const (
	OneHour  = "1Hr"
	TwoHour  = "2Hr"
	FourHour = "4Hr"
	OneDay   = "1Day"
	OneWeek  = "1Week"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountAllowances

type AccountAllowances struct {
	AccountBase
	Allowances map[common.Address]map[common.Address]Allowance //token -> spender
}

type AccountBalances

type AccountBalances struct {
	AccountBase
	Balances map[common.Address]Balance
}

type AccountBase

type AccountBase struct {
	Owner        common.Address
	CustomTokens []types.Token
}

type AccountManager

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

func NewAccountManager

func NewAccountManager(options config.AccountManagerOptions) AccountManager

func (*AccountManager) GetAllowanceWithSymbolResult

func (a *AccountManager) GetAllowanceWithSymbolResult(owner, spender common.Address) (map[string]*big.Int, error)

func (*AccountManager) GetBalanceAndAllowance

func (a *AccountManager) GetBalanceAndAllowance(owner, token, spender common.Address) (balance, allowance *big.Int, err error)

func (*AccountManager) GetBalanceWithSymbolResult

func (a *AccountManager) GetBalanceWithSymbolResult(owner common.Address) (map[string]*big.Int, error)

func (*AccountManager) GetCutoff

func (a *AccountManager) GetCutoff(contract, address string) (int, error)

func (*AccountManager) HasUnlocked

func (a *AccountManager) HasUnlocked(owner string) (exists bool, err error)

func (*AccountManager) Start

func (accountManager *AccountManager) Start()

func (*AccountManager) UnlockedWallet

func (a *AccountManager) UnlockedWallet(owner string) (err error)

type Allowance

type Allowance struct {
	LastBlock *types.Big `json:"last_block"`
	Allowance *types.Big `json:"allowance"`
}

type Balance

type Balance struct {
	LastBlock *types.Big `json:"last_block"`
	Balance   *types.Big `json:"balance"`
}

type BinanceTicker

type BinanceTicker struct {
	Symbol    string `json:"symbol"`
	Change    string `json:"priceChangePercent"`
	Close     string `json:"prevClosePrice"`
	Open      string `json:"openPrice"`
	High      string `json:"highPrice"`
	Low       string `json:"lowPrice"`
	LastPrice string `json:"lastPrice"`
	Amount    string `json:"volume"`
	Vol       string `json:"quoteVolume"`
	Ask       string `json:"askPrice"`
	Bid       string `json:"bidPrice"`
}

type Cache

type Cache struct {
	Trends []Trend
	Fills  []dao.FillEvent
}

type ChangedOfBlock

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

type Collector

type Collector interface {
	Start()
	// contains filtered or unexported methods
}

type CollectorImpl

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

func NewCollector

func NewCollector(cronJobLock bool) *CollectorImpl

func (*CollectorImpl) GetTickers

func (c *CollectorImpl) GetTickers(market string) ([]Ticker, error)

func (*CollectorImpl) Start

func (c *CollectorImpl) Start()

type Exchange

type Exchange interface {
	// contains filtered or unexported methods
}

type ExchangeImpl

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

func NewExchange

func NewExchange(name, tickerUrl string) ExchangeImpl

type ExchangeType

type ExchangeType string

type HuobiInnerTicker

type HuobiInnerTicker struct {
	Close  float64   `json:"close"`
	Open   float64   `json:"open"`
	High   float64   `json:"high"`
	Low    float64   `json:"low"`
	Amount float64   `json:"amount"`
	Count  int       `json:"count"`
	Vol    float64   `json:"vol"`
	Ask    []float64 `json:"ask"`
	Bid    []float64 `json:"bid"`
}

type HuobiTicker

type HuobiTicker struct {
	Timestamp int64            `json:"ts"`
	ErrorCode string           `json:"err-code"`
	Status    string           `json:"status"`
	Tick      HuobiInnerTicker `json:"tick"`
}

type OkexFullTicker

type OkexFullTicker struct {
	Code int              `json:"code"`
	Data []OkexTickerElem `json:"data"`
	Msg  string           `json:"msg"`
}

type OkexInnerTicker

type OkexInnerTicker struct {
	High      string `json:"high"`
	Low       string `json:"low"`
	LastPrice string `json:"last"`
	Vol       string `json:"vol"`
	Ask       string `json:"sell"`
	Bid       string `json:"buy"`
}

type OkexTicker

type OkexTicker struct {
	Date   string          `json:"date"`
	Ticker OkexInnerTicker `json:"ticker"`
}

type OkexTickerElem

type OkexTickerElem struct {
	Buy    string `json:"buy"`
	Last   string `json:"last"`
	Vol    string `json:"volume"`
	Symbol string `json:"symbol"`
	High   string `json:"high"`
	Low    string `json:"low"`
	Change string `json:"changePercentage"`
}

type Ticker

type Ticker struct {
	Market    string  `json:"market"`
	Exchange  string  `json:"exchange"`
	Intervals string  `json:"interval"`
	Amount    float64 `json:"amount"`
	Vol       float64 `json:"vol"`
	Open      float64 `json:"open"`
	Close     float64 `json:"close"`
	High      float64 `json:"high"`
	Low       float64 `json:"low"`
	Last      float64 `json:"last"`
	Buy       float64 `json:"buy"`
	Sell      float64 `json:"sell"`
	Change    string  `json:"change"`
}

func GetAllTickerFromBinance

func GetAllTickerFromBinance() (tickers []Ticker, err error)

func GetAllTickerFromOkex

func GetAllTickerFromOkex() (tickers []Ticker, err error)

func GetTickerFromBinance

func GetTickerFromBinance(market string) (ticker Ticker, err error)

func GetTickerFromHuobi

func GetTickerFromHuobi(market string) (ticker Ticker, err error)

func GetTickerFromOkex

func GetTickerFromOkex(market string) (ticker Ticker, err error)

type TickerField

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

type Trend

type Trend struct {
	Intervals  string  `json:"intervals"`
	Market     string  `json:"market"`
	Vol        float64 `json:"vol"`
	Amount     float64 `json:"amount"`
	CreateTime int64   `json:"createTime"`
	Open       float64 `json:"open"`
	Close      float64 `json:"close"`
	High       float64 `json:"high"`
	Low        float64 `json:"low"`
	Start      int64   `json:"start"`
	End        int64   `json:"end"`
}

func ConvertUp

func ConvertUp(src dao.Trend) Trend

type TrendManager

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

func NewTrendManager

func NewTrendManager(dao dao.RdsService, cronJobLock bool) TrendManager

func (*TrendManager) GetTicker

func (t *TrendManager) GetTicker() (tickers []Ticker, err error)

func (*TrendManager) GetTickerByMarket

func (t *TrendManager) GetTickerByMarket(mkt string) (ticker Ticker, err error)

func (*TrendManager) GetTrends

func (t *TrendManager) GetTrends(market, interval string) (trends []Trend, err error)

func (*TrendManager) HandleOrderFilled

func (t *TrendManager) HandleOrderFilled(input eventemitter.EventData) (err error)

func (*TrendManager) LoadCache

func (t *TrendManager) LoadCache()

func (*TrendManager) ProofRead

func (t *TrendManager) ProofRead()

func (*TrendManager) ScheduleUpdate

func (t *TrendManager) ScheduleUpdate()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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