Documentation ¶
Overview ¶
Package db contains candle related CRUD functionality.
Index ¶
- type Agent
- func (s Agent) Create(ctx context.Context, cdl Candle) error
- func (s Agent) Query(ctx context.Context, pageNumber int, rowsPerPage int) ([]Candle, error)
- func (s Agent) QueryByID(ctx context.Context, cdlID string) (Candle, error)
- func (s Agent) QueryBySymbolAndInterval(ctx context.Context, pageNumber int, rowsPerPage int, smbID string, itv string) ([]Candle, error)
- func (s Agent) Tran(tx sqlx.ExtContext) Agent
- func (s Agent) WithinTran(ctx context.Context, fn func(sqlx.ExtContext) error) error
- type Candle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent manages the set of API's for candle access.
func NewAgent ¶
func NewAgent(log *zap.SugaredLogger, db *sqlx.DB) Agent
NewAgent constructs a data for api access.
func (Agent) QueryBySymbolAndInterval ¶
func (s Agent) QueryBySymbolAndInterval(ctx context.Context, pageNumber int, rowsPerPage int, smbID string, itv string) ([]Candle, error)
QueryBySymbolAndInterval gets the specified candles from the database.
func (Agent) Tran ¶
func (s Agent) Tran(tx sqlx.ExtContext) Agent
Tran return new Agent with transaction in it.
func (Agent) WithinTran ¶
WithinTran runs passed function and do commit/rollback at the end.
type Candle ¶
type Candle struct { ID string `db:"candle_id"` SymbolID string `db:"symbol_id"` Symbol string `db:"symbol"` Interval string `db:"interval"` OpenTime time.Time `db:"open_time"` OpenPrice float64 `db:"open_price"` ClosePrice float64 `db:"close_price"` CloseTime time.Time `db:"close_time"` Low float64 `db:"low"` High float64 `db:"high"` Volume float64 `db:"volume"` }
Candle is a type of price chart used in technical analysis that displays the high, low, open, and closing prices of a security for a specific period
Click to show internal directories.
Click to hide internal directories.