database

package
v0.0.0-...-3618ce5 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDatabaseFromFilePath

func CreateDatabaseFromFilePath(filePath string) (*gorm.DB, error)

func GetClosingPrices

func GetClosingPrices(db *gorm.DB, symbol string) []float64

func GetClosingPricesOnDate

func GetClosingPricesOnDate(db *gorm.DB, symbol, date string) []float64

func InsertHistoricalData

func InsertHistoricalData(db *gorm.DB, data *HistoricalData)

InsertHistoricalData inserts historical data into the database.

func InsertHistoricalDatas

func InsertHistoricalDatas(db *gorm.DB, datas []HistoricalData)

Types

type HistoricalData

type HistoricalData struct {
	Symbol    string `gorm:"primaryKey"`
	Date      string `gorm:"primaryKey"`
	Open      float64
	High      float64
	Low       float64
	Close     float64
	AdjClose  float64
	Volume    int64
	CreatedAt time.Time // Automatically managed by GORM for creation time
	UpdatedAt time.Time // Automatically managed by GORM for update time
}

func GetHistoricalDatas

func GetHistoricalDatas(db *gorm.DB, symbol, date string) []HistoricalData

Jump to

Keyboard shortcuts

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