database

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDatabaseServerAddress = "localhost:3306"
	SibylDBUser                  = "sibyl"
	SibylDBUserPassword          = "pa$$word"
	SibylDatabaseName            = "sibyl"
	CredsTableName               = "creds"
	StocksTableName              = "stocks"
	OptionQuotesTableName        = "optionQuotes"
	StockQuotesTableName         = "stockQuotes"
	StableOptionQuotesTableName  = "stableOptionQuotes"
	StableStockQuotesTableName   = "stableStockQuotes"
	HistoryTableName             = "history"
	OptionsTableName             = "options"
	IntradayTableName            = "intraday"
	TableVersionsTableName       = "tableVersions"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseStringer

type DatabaseStringer interface {
	StringBlindWithDelimiter(delimiter string, nullString string, stringEscapes bool) string
}

type LoadDupAction

type LoadDupAction string
const (
	Replace  LoadDupAction = "REPLACE"
	Ignore   LoadDupAction = "IGNORE"
	NoAction LoadDupAction = ""
)

type SibylDatabase

type SibylDatabase struct {
	DBConn *sql.DB
}

func ConnectAndEnsureSibylDatabase

func ConnectAndEnsureSibylDatabase(ctx context.Context, address string) (*SibylDatabase, error)

func (*SibylDatabase) Close

func (sd *SibylDatabase) Close()

func (*SibylDatabase) DumpCredsToFile

func (sd *SibylDatabase) DumpCredsToFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) DumpHistoryRecordsToFile

func (sd *SibylDatabase) DumpHistoryRecordsToFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) DumpIntradayRecordsToFile

func (sd *SibylDatabase) DumpIntradayRecordsToFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) DumpOptionQuoteRecordsToFile

func (sd *SibylDatabase) DumpOptionQuoteRecordsToFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) DumpRangeHistoryRecordsToBuffer added in v0.0.6

func (sd *SibylDatabase) DumpRangeHistoryRecordsToBuffer(ctx context.Context, lastID string, count int) (string, string, error)

func (*SibylDatabase) DumpRangeHistoryRecordsToFile

func (sd *SibylDatabase) DumpRangeHistoryRecordsToFile(ctx context.Context, filePathname string, lastID string, count int) (string, error)

func (*SibylDatabase) DumpRangeIntradayRecordsToBuffer added in v0.0.6

func (sd *SibylDatabase) DumpRangeIntradayRecordsToBuffer(ctx context.Context, lastId string, count int) (string, string, error)

func (*SibylDatabase) DumpRangeIntradayRecordsToFile

func (sd *SibylDatabase) DumpRangeIntradayRecordsToFile(ctx context.Context, filePathname string, lastId string, count int) (string, error)

func (*SibylDatabase) DumpRangeOptionQuoteRecordsToBuffer added in v0.0.6

func (sd *SibylDatabase) DumpRangeOptionQuoteRecordsToBuffer(ctx context.Context, lastID string, count int) (string, string, error)

func (*SibylDatabase) DumpRangeOptionQuoteRecordsToFile

func (sd *SibylDatabase) DumpRangeOptionQuoteRecordsToFile(ctx context.Context, filePathname string, lastID string, count int) (string, error)

func (*SibylDatabase) DumpRangeStableOptionQuoteRecordsToBuffer added in v0.0.6

func (sd *SibylDatabase) DumpRangeStableOptionQuoteRecordsToBuffer(ctx context.Context, lastID string, count int) (string, string, error)

func (*SibylDatabase) DumpRangeStableOptionQuoteRecordsToFile

func (sd *SibylDatabase) DumpRangeStableOptionQuoteRecordsToFile(ctx context.Context, filePathname string, lastID string, count int) (string, error)

func (*SibylDatabase) DumpRangeStableStockQuoteRecordsToBuffer added in v0.0.6

func (sd *SibylDatabase) DumpRangeStableStockQuoteRecordsToBuffer(ctx context.Context, lastID string, count int) (string, string, error)

func (*SibylDatabase) DumpRangeStableStockQuoteRecordsToFile

func (sd *SibylDatabase) DumpRangeStableStockQuoteRecordsToFile(ctx context.Context, filePathname string, lastID string, count int) (string, error)

func (*SibylDatabase) DumpRangeStockQuoteRecordsToBuffer added in v0.0.6

func (sd *SibylDatabase) DumpRangeStockQuoteRecordsToBuffer(ctx context.Context, lastID string, count int) (string, string, error)

func (*SibylDatabase) DumpRangeStockQuoteRecordsToFile

func (sd *SibylDatabase) DumpRangeStockQuoteRecordsToFile(ctx context.Context, filePathname string, lastID string, count int) (string, error)

func (*SibylDatabase) DumpStableOptionQuoteRecordsToFile

func (sd *SibylDatabase) DumpStableOptionQuoteRecordsToFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) DumpStableStockQuoteRecordsToFile

func (sd *SibylDatabase) DumpStableStockQuoteRecordsToFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) DumpStockQuoteRecordsToFile

func (sd *SibylDatabase) DumpStockQuoteRecordsToFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) FirstIntradayHistoryDate added in v0.0.17

func (sd *SibylDatabase) FirstIntradayHistoryDate(ctx context.Context, symbol core.StockSymbolType) (core.TimestampType, error)

func (*SibylDatabase) GetAgent

func (sd *SibylDatabase) GetAgent(ctx context.Context) (core.SibylAgent, error)

func (*SibylDatabase) GetAllStockRecords

func (sd *SibylDatabase) GetAllStockRecords(ctx context.Context) ([]*core.SibylStockRecord, error)

func (*SibylDatabase) GetCreds

func (sd *SibylDatabase) GetCreds(ctx context.Context) (*core.SibylCreds, error)

func (*SibylDatabase) GetHistory

func (sd *SibylDatabase) GetHistory(ctx context.Context, stockSymbol core.StockSymbolType, startTimestamp core.DateType, endTimestamp core.DateType) ([]*core.SibylHistoryRecord, error)

func (*SibylDatabase) GetIntraday

func (sd *SibylDatabase) GetIntraday(ctx context.Context, symbol core.StockSymbolType, startTimestamp core.TimestampType, endTimestamp core.TimestampType) ([]*core.SibylIntradayRecord, error)

func (*SibylDatabase) GetOptionsFor

func (sd *SibylDatabase) GetOptionsFor(ctx context.Context, symbols map[core.StockSymbolType]bool) ([]*core.OptionSymbolType, error)

func (*SibylDatabase) LastHistoryDate

func (sd *SibylDatabase) LastHistoryDate(ctx context.Context, symbol core.StockSymbolType) (core.DateType, error)

func (*SibylDatabase) LastHistoryRecordID

func (sd *SibylDatabase) LastHistoryRecordID(ctx context.Context) (string, error)

func (*SibylDatabase) LastIntradayHistoryDate

func (sd *SibylDatabase) LastIntradayHistoryDate(ctx context.Context, symbol core.StockSymbolType) (core.TimestampType, error)

func (*SibylDatabase) LastIntradayRecordID

func (sd *SibylDatabase) LastIntradayRecordID(ctx context.Context) (string, error)

func (*SibylDatabase) LastOptionQuoteRecordID

func (sd *SibylDatabase) LastOptionQuoteRecordID(ctx context.Context) (string, error)

func (*SibylDatabase) LastStableOptionQuoteRecordID

func (sd *SibylDatabase) LastStableOptionQuoteRecordID(ctx context.Context) (string, error)

func (*SibylDatabase) LastStableStockQuoteRecordID

func (sd *SibylDatabase) LastStableStockQuoteRecordID(ctx context.Context) (string, error)

func (*SibylDatabase) LastStockQuoteRecordID

func (sd *SibylDatabase) LastStockQuoteRecordID(ctx context.Context) (string, error)

func (*SibylDatabase) LoadCreds

func (sd *SibylDatabase) LoadCreds(ctx context.Context, creds *core.SibylCreds) error

func (*SibylDatabase) LoadCredsFromFile

func (sd *SibylDatabase) LoadCredsFromFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) LoadHistoryRecords

func (sd *SibylDatabase) LoadHistoryRecords(ctx context.Context, histories []*core.SibylHistoryRecord) error

func (*SibylDatabase) LoadHistoryRecordsFromFile

func (sd *SibylDatabase) LoadHistoryRecordsFromFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) LoadHistoryRecordsFromFileContents added in v0.0.6

func (sd *SibylDatabase) LoadHistoryRecordsFromFileContents(ctx context.Context, fileContents string) error

func (*SibylDatabase) LoadIntradayRecords

func (sd *SibylDatabase) LoadIntradayRecords(ctx context.Context, intradays []*core.SibylIntradayRecord) error

func (*SibylDatabase) LoadIntradayRecordsFromFile

func (sd *SibylDatabase) LoadIntradayRecordsFromFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) LoadIntradayRecordsFromFileContents added in v0.0.6

func (sd *SibylDatabase) LoadIntradayRecordsFromFileContents(ctx context.Context, fileContents string) error

func (*SibylDatabase) LoadOptionQuoteRecords

func (sd *SibylDatabase) LoadOptionQuoteRecords(ctx context.Context, quotes []*core.SibylOptionQuoteRecord) error

func (*SibylDatabase) LoadOptionQuoteRecordsFromFile

func (sd *SibylDatabase) LoadOptionQuoteRecordsFromFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) LoadOptionQuoteRecordsFromFileContents added in v0.0.6

func (sd *SibylDatabase) LoadOptionQuoteRecordsFromFileContents(ctx context.Context, fileContents string) error

func (*SibylDatabase) LoadStableOptionQuoteRecords

func (sd *SibylDatabase) LoadStableOptionQuoteRecords(ctx context.Context, quotes []*core.SibylStableOptionQuoteRecord) error

func (*SibylDatabase) LoadStableOptionQuoteRecordsFromFile

func (sd *SibylDatabase) LoadStableOptionQuoteRecordsFromFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) LoadStableOptionQuoteRecordsFromFileContents added in v0.0.6

func (sd *SibylDatabase) LoadStableOptionQuoteRecordsFromFileContents(ctx context.Context, fileContents string) error

func (*SibylDatabase) LoadStableStockQuoteRecords

func (sd *SibylDatabase) LoadStableStockQuoteRecords(ctx context.Context, quotes []*core.SibylStableStockQuoteRecord) error

func (*SibylDatabase) LoadStableStockQuoteRecordsFromFile

func (sd *SibylDatabase) LoadStableStockQuoteRecordsFromFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) LoadStableStockQuoteRecordsFromFileContents added in v0.0.6

func (sd *SibylDatabase) LoadStableStockQuoteRecordsFromFileContents(ctx context.Context, fileContents string) error

func (*SibylDatabase) LoadStockQuoteRecords

func (sd *SibylDatabase) LoadStockQuoteRecords(ctx context.Context, quotes []*core.SibylStockQuoteRecord) error

func (*SibylDatabase) LoadStockQuoteRecordsFromFile

func (sd *SibylDatabase) LoadStockQuoteRecordsFromFile(ctx context.Context, filePathname string) error

func (*SibylDatabase) LoadStockQuoteRecordsFromFileContents added in v0.0.6

func (sd *SibylDatabase) LoadStockQuoteRecordsFromFileContents(ctx context.Context, fileContents string) error

func (*SibylDatabase) SetOptionsForStock

func (sd *SibylDatabase) SetOptionsForStock(ctx context.Context, symbol core.StockSymbolType, optionsSymbols []*core.OptionSymbolType) error

func (*SibylDatabase) StockAdd

func (sd *SibylDatabase) StockAdd(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockDelete

func (sd *SibylDatabase) StockDelete(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockDisableAll

func (sd *SibylDatabase) StockDisableAll(ctx context.Context) error

func (*SibylDatabase) StockDisableDownloading

func (sd *SibylDatabase) StockDisableDownloading(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockDisableHistory

func (sd *SibylDatabase) StockDisableHistory(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockDisableIntradayHistory

func (sd *SibylDatabase) StockDisableIntradayHistory(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockDisableQuotes

func (sd *SibylDatabase) StockDisableQuotes(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockDisableStableQuotes

func (sd *SibylDatabase) StockDisableStableQuotes(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockEnableAll

func (sd *SibylDatabase) StockEnableAll(ctx context.Context) error

func (*SibylDatabase) StockEnableDownloading

func (sd *SibylDatabase) StockEnableDownloading(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockEnableHistory

func (sd *SibylDatabase) StockEnableHistory(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockEnableIntradayHistory

func (sd *SibylDatabase) StockEnableIntradayHistory(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockEnableQuotes

func (sd *SibylDatabase) StockEnableQuotes(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockEnableStableQuotes

func (sd *SibylDatabase) StockEnableStableQuotes(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockIntradayHistorySetScanned added in v0.0.17

func (sd *SibylDatabase) StockIntradayHistorySetScanned(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockIntradayHistorySetScanning added in v0.0.17

func (sd *SibylDatabase) StockIntradayHistorySetScanning(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockIntradayHistorySetUnknown added in v0.0.17

func (sd *SibylDatabase) StockIntradayHistorySetUnknown(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockInvalidate

func (sd *SibylDatabase) StockInvalidate(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockRevalidate

func (sd *SibylDatabase) StockRevalidate(ctx context.Context, symbol core.StockSymbolType) error

func (*SibylDatabase) StockSetExchangeInfoAndName

func (sd *SibylDatabase) StockSetExchangeInfoAndName(killCtx context.Context, symbol core.StockSymbolType, hasOptions bool, exchange string, exchangeDescription string, name string) error

func (*SibylDatabase) StockValidate

func (sd *SibylDatabase) StockValidate(ctx context.Context, symbol core.StockSymbolType) error

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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