models

package
v0.0.0-...-fac5e33 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 5 Imported by: 4

Documentation

Overview

Specific use for database

All quotes data from any sources, will be converted to global struct

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGroupString

func GetGroupString(groups Groups) (g string)

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 Database

type Database struct {
	IDatabase
}

Database -

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 Groups

type Groups int
const (
	//GroupForex -
	GroupForex Groups = iota + 1
	//GroupEquities -
	GroupEquities
	//GroupStocks -
	GroupStocks
	//GroupCommodities -
	GroupCommodities
	//GroupCrypto -
	GroupCrypto
)

func MatchGroupString

func MatchGroupString(s string) (groups Groups)

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

type PointStore struct {
	Candle sync.Map
}

PointStore -

func NewPointStore

func NewPointStore(candle []int) *PointStore

NewPointStore -

func (*PointStore) Count

func (cc *PointStore) Count(candle int) (c int)

Count -

func (*PointStore) CountTicks

func (cc *PointStore) CountTicks() (c int)

CountTicks -

func (*PointStore) Delete

func (cc *PointStore) Delete(candle int, key int64)

Delete -

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) LoadAll

func (cc *PointStore) LoadAll(candle int) (c []Points)

LoadAll -

func (*PointStore) LoadTicks

func (cc *PointStore) LoadTicks(key int64) (value Points, ok bool)

LoadTicks -

func (*PointStore) MakeMap

func (cc *PointStore) MakeMap() (c map[int][]Points)

MakeMap -

func (*PointStore) MakeMapOption

func (cc *PointStore) MakeMapOption(from, to int64, limit int) (c map[int][]Points)

MakeMapOption -

func (*PointStore) Store

func (cc *PointStore) Store(candle int, key int64, data Points)

Store -

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 SourceConfig

type SourceConfig struct {
	Key     string
	Value   string
	Example string
}

type SourceStatus

type SourceStatus int

SourceStatus -

const (
	SourceStatusCreating SourceStatus = iota + 1
	SourceStatusReset
	SourceStatusGeInitCandle
	SourceStatusInitCandleComplete
)

type Sources

type Sources struct {
	ISources
}

Sources -

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 -

type SyncMap

type SyncMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

SyncMap -

func NewSyncMap

func NewSyncMap() *SyncMap

NewSyncMap -

func (*SyncMap) Count

func (rm *SyncMap) Count() (value int)

Count -

func (*SyncMap) CountTicks

func (rm *SyncMap) CountTicks() (value int)

CountTicks -

func (*SyncMap) Delete

func (rm *SyncMap) Delete(key int64)

Delete -

func (*SyncMap) DeleteMultiple

func (rm *SyncMap) DeleteMultiple(key []int64)

DeleteMultiple -

func (*SyncMap) GetFirst

func (rm *SyncMap) GetFirst() (result Points, ok bool)

GetFirst -

func (*SyncMap) GetFirstKeyN

func (rm *SyncMap) GetFirstKeyN(num int) (result []int64)

GetFirstKeyN -

func (*SyncMap) GetLast

func (rm *SyncMap) GetLast() (result Points, ok bool)

GetLast -

func (*SyncMap) Load

func (rm *SyncMap) Load(key int64) (value Points, ok bool)

Load -

func (*SyncMap) LoadAll

func (rm *SyncMap) LoadAll() (value []Points)

LoadAll -

func (*SyncMap) LoadAllOptions

func (rm *SyncMap) LoadAllOptions(from, to int64, limit int) (value []Points)

LoadAllOptions -

func (*SyncMap) LoadTicks

func (rm *SyncMap) LoadTicks(key int64) (value Points, ok bool)

LoadTicks -

func (*SyncMap) Store

func (rm *SyncMap) Store(key int64, value Points)

Store -

func (*SyncMap) StoreTicks

func (rm *SyncMap) StoreTicks(key int64, value Points)

StoreTicks -

type WebserverOptions

type WebserverOptions struct {
	Database *Database
	Logger   *logging.Logger
	Host     string
	Files    string
	Port     int
	Dev      bool
}

WebserverOptions -

Directories

Path Synopsis
Specific use for iqoption source
Specific use for iqoption source

Jump to

Keyboard shortcuts

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