Documentation
¶
Overview ¶
Specific use for database
All quotes data from any sources, will be converted to global struct
Index ¶
- func GetGroupString(groups Groups) (g string)
- type Asset
- type Database
- type GetHistoryOptions
- type GetSrc
- type Groups
- type IDatabase
- type ISources
- type PointStore
- func (cc *PointStore) Count(candle int) (c int)
- func (cc *PointStore) CountTicks() (c int)
- func (cc *PointStore) Delete(candle int, key int64)
- func (cc *PointStore) DeleteMultiple(candle int, key []int64)
- func (cc *PointStore) GetFirst(candle int) (result Points, ok bool)
- func (cc *PointStore) GetFirstKeyN(candle, num int) (result []int64)
- func (cc *PointStore) GetLast(candle int) (result Points, ok bool)
- func (cc *PointStore) Load(candle int, key int64) (value Points, ok bool)
- func (cc *PointStore) LoadAll(candle int) (c []Points)
- func (cc *PointStore) LoadTicks(key int64) (value Points, ok bool)
- func (cc *PointStore) MakeMap() (c map[int][]Points)
- func (cc *PointStore) MakeMapOption(from, to int64, limit int) (c map[int][]Points)
- func (cc *PointStore) Store(candle int, key int64, data Points)
- type Points
- type Response
- type SendMessage
- type SourceConfig
- type SourceStatus
- type Sources
- type StackError
- type SubMsg
- type SubsLiveCandle
- type SyncMap
- func (rm *SyncMap) Count() (value int)
- func (rm *SyncMap) CountTicks() (value int)
- func (rm *SyncMap) Delete(key int64)
- func (rm *SyncMap) DeleteMultiple(key []int64)
- func (rm *SyncMap) GetFirst() (result Points, ok bool)
- func (rm *SyncMap) GetFirstKeyN(num int) (result []int64)
- func (rm *SyncMap) GetLast() (result Points, ok bool)
- func (rm *SyncMap) Load(key int64) (value Points, ok bool)
- func (rm *SyncMap) LoadAll() (value []Points)
- func (rm *SyncMap) LoadAllOptions(from, to int64, limit int) (value []Points)
- func (rm *SyncMap) LoadTicks(key int64) (value Points, ok bool)
- func (rm *SyncMap) Store(key int64, value Points)
- func (rm *SyncMap) StoreTicks(key int64, value Points)
- type WebserverOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Asset ¶
type Asset struct {
ID string `json:"id"`
Name string `json:"name"`
SourceID interface{} `json:"sourceID"`
Group Groups `json:"group"`
IsOTC bool `json:"isOTC"`
}
Asset -
type GetHistoryOptions ¶
type GetHistoryOptions struct {
ID string `json:"id"`
Start string `json:"start"`
End string `json:"end"`
Candle []int `json:"candle"`
Latest bool `json:"latest"`
Minsize int `json:"minsize"`
}
GetHistoryOptions -
type GetSrc ¶
type GetSrc struct {
ID string `json:"id"`
ActiveAsset map[string]bool `json:"activeAsset"`
ActiveCandles []int `json:"activeCandles"`
}
GetSrc -
type IDatabase ¶
type IDatabase interface {
Init() (err error)
Reload() (err error)
Set(bucket string, key string, data []byte) (err error)
Get(bucket string, key string) (data []byte, err error)
Del(bucket, key string) (err error)
}
IDatabase interfaces
type ISources ¶
type ISources interface {
GetID() string
GetName() string
Start() error
SetConfig(key, value string) error
GetConfig() []SourceConfig
ListPairs(func([]Asset, error)) error
GetHistory(opt GetHistoryOptions, cb func(*PointStore, error)) error
GetActiveAsset() map[string]bool
GetActiveCandles() []int
GetLatestCandles(asset string, candle int) ([]Points, SourceStatus)
OnSourceLiveUpdate(id string, callback func(asset string, candle int, data Points))
OnTicksUpdate(id string, callback func(asset string, serverTime int64, data map[int][]Points))
}
ISources interfaces
type PointStore ¶
PointStore -
func (*PointStore) DeleteMultiple ¶
func (cc *PointStore) DeleteMultiple(candle int, key []int64)
DeleteMultiple -
func (*PointStore) GetFirst ¶
func (cc *PointStore) GetFirst(candle int) (result Points, ok bool)
GetFirst -
func (*PointStore) GetFirstKeyN ¶
func (cc *PointStore) GetFirstKeyN(candle, num int) (result []int64)
GetFirstKeyN -
func (*PointStore) GetLast ¶
func (cc *PointStore) GetLast(candle int) (result Points, ok bool)
GetLast -
func (*PointStore) Load ¶
func (cc *PointStore) Load(candle int, key int64) (value Points, ok bool)
Load -
func (*PointStore) LoadTicks ¶
func (cc *PointStore) LoadTicks(key int64) (value Points, ok bool)
LoadTicks -
type Points ¶
type Points struct {
Close float64 `json:"close"`
Open float64 `json:"open"`
High float64 `json:"high"`
Low float64 `json:"low"`
Ask float64 `json:"ask"`
Bid float64 `json:"bid"`
To int64 `json:"to"`
From int64 `json:"from"`
At int64 `json:"at"`
Size int `json:"size"`
}
Points -
type Response ¶
type Response struct {
Code int `json:"code" xml:"code"`
Status string `json:"status" xml:"status"`
Error interface{} `json:"error" xml:"error"`
RequestID string `json:"requestId" xml:"requestId"`
ExcutionTime string `json:"excutionTime" xml:"excutionTime"`
Data interface{} `json:"data" xml:"data"`
}
Response - user for webserver default response
type SendMessage ¶
type SendMessage struct {
Channel string `json:"channel"`
Time int64 `json:"time"`
Msg interface{} `json:"msg"`
}
SendMessage -
type SourceStatus ¶
type SourceStatus int
SourceStatus -
const ( SourceStatusCreating SourceStatus = iota + 1 SourceStatusReset SourceStatusGeInitCandle SourceStatusInitCandleComplete )
type StackError ¶
type StackError struct {
Function string `json:"function" xml:"function"`
File string `json:"file" xml:"file"`
LineNumber int `json:"lineNumber" xml:"lineNumber"`
}
StackError -
type SubMsg ¶
type SubMsg struct {
SubChannel string `json:"subChannel"`
Data interface{} `json:"data"`
}
SubMsg -
type SubsLiveCandle ¶
type SubsLiveCandle struct {
Candle int `json:"candle"`
Asset string `json:"asset"`
Data Points `json:"data"`
}
SubsLiveCandle -
Source Files
¶
- database.go
- maps.go
- models.go
- sources.go
- webserver.go
Click to show internal directories.
Click to hide internal directories.