db

package
v0.0.0-...-4a8abee Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetVersionDB

func GetVersionDB(db *sql.DB) (int, error)

func InitDB

func InitDB() error

func InitInMemory

func InitInMemory() error

func UpdateSchema

func UpdateSchema(db *sql.DB, targetVersion int) error

Types

type Database

type Database interface {
	InitDB() (*sql.DB, error)
	LogTrade(db *sql.DB, symbol, side string, amount, price float64) error
}

type SQLite

type SQLite struct {
	DB *sql.DB
	// contains filtered or unexported fields
}
var SQLiteDB SQLite

func (*SQLite) GetActiveTrade

func (s *SQLite) GetActiveTrade(symbol string) (*models.ActiveTrade, error)

func (*SQLite) GetActiveTrades

func (s *SQLite) GetActiveTrades(symbol string) ([]*models.ActiveTrade, error)

func (*SQLite) GetActiveTradesCount

func (s *SQLite) GetActiveTradesCount() (int, error)

func (*SQLite) GetAllActiveTrades

func (s *SQLite) GetAllActiveTrades() ([]*models.ActiveTrade, error)

func (*SQLite) GetAth

func (s *SQLite) GetAth(symbol string) (float64, error)

func (*SQLite) GetAtl

func (s *SQLite) GetAtl(symbol string) (float64, error)

func (*SQLite) GetLastATHTimestamp

func (s *SQLite) GetLastATHTimestamp(symbol string) (time.Time, error)

func (*SQLite) GetLastBuySymbol

func (s *SQLite) GetLastBuySymbol(symbol string) (time.Time, error)

func (*SQLite) GetLastSellSymbol

func (s *SQLite) GetLastSellSymbol(symbol string) (time.Time, error)

func (*SQLite) GetTodaysTradeCount

func (s *SQLite) GetTodaysTradeCount() (int, error)

func (*SQLite) IsCurrentlyActiveTrade

func (s *SQLite) IsCurrentlyActiveTrade(symbol string) (bool, error)

func (*SQLite) LogActiveTrade

func (s *SQLite) LogActiveTrade(symbol string, buyPrice, quantity float64, orderID int64, rsi, macd, stochastic, lowerBound, middleBound, upperBound, mfi, cci, ichimokuTenkan, ichimokuKijun float64) error

func (*SQLite) LogCompletedTrade

func (s *SQLite) LogCompletedTrade(symbol string, buyPrice, sellPrice, quantity, profitLoss, rsi, macd, stochastic, lowerBound, middleBound, upperBound, mfi, cci, ichimokuTenkan, ichimokuKijun float64, buyTimestamp, orderID int64) error

func (*SQLite) LogTrade

func (s *SQLite) LogTrade(symbol, side string, amount, price float64) error

func (*SQLite) RemoveActiveTrade

func (s *SQLite) RemoveActiveTrade(id int) error

func (*SQLite) RemoveAth

func (s *SQLite) RemoveAth(symbol string) error

func (*SQLite) RemoveAtl

func (s *SQLite) RemoveAtl(symbol string) error

func (*SQLite) RenameAllSymbolsUSDTtoUSDC

func (s *SQLite) RenameAllSymbolsUSDTtoUSDC() error

func (*SQLite) SetUpdateAth

func (s *SQLite) SetUpdateAth(symbol string, ath float64) error

func (*SQLite) SetUpdateAtl

func (s *SQLite) SetUpdateAtl(symbol string, atl float64) error

func (*SQLite) WasLastTradeLoss

func (s *SQLite) WasLastTradeLoss(symbol string) (bool, time.Time, error)

Jump to

Keyboard shortcuts

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