db

package
v0.0.0-...-3f3263e Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const InstrumentStatusError = -1
View Source
const InstrumentStatusProcessing = 1
View Source
const InstrumentStatusReady = 0
View Source
const UploadJobStatusAdding = 1
View Source
const UploadJobStatusAggregating = 2
View Source
const UploadJobStatusError = -1
View Source
const UploadJobStatusReady = 3
View Source
const UploadJobStatusWaiting = 0

Variables

This section is empty.

Functions

func AddBiasAnalysis

func AddBiasAnalysis(tx *gorm.DB, ba *BiasAnalysis) error

func AddBiasConfig

func AddBiasConfig(tx *gorm.DB, bc *BiasConfig) error

func AddBrokerProduct

func AddBrokerProduct(tx *gorm.DB, p *BrokerProduct) error

func AddDataInstrument

func AddDataInstrument(tx *gorm.DB, i *DataInstrument) error

func AddDataProduct

func AddDataProduct(tx *gorm.DB, p *DataProduct) error

func AddUploadJob

func AddUploadJob(tx *gorm.DB, job *UploadJob) error

func DeleteBiasConfig

func DeleteBiasConfig(tx *gorm.DB, id uint) error

func GetBiasAnalyses

func GetBiasAnalyses(tx *gorm.DB, filter map[string]any, offset int, limit int) (*[]BiasAnalysisFull, error)

func GetBiasAnalysesFull

func GetBiasAnalysesFull(tx *gorm.DB, filter map[string]any, offset int, limit int) (*[]BiasAnalysisFull, error)

func GetBiasConfigsByAnalysisId

func GetBiasConfigsByAnalysisId(tx *gorm.DB, id uint) (*[]BiasConfig, error)

func GetDataInstrumentsByProductId

func GetDataInstrumentsByProductId(tx *gorm.DB, pId uint) (*[]DataInstrument, error)

func GetDataInstrumentsFull

func GetDataInstrumentsFull(tx *gorm.DB, filter map[string]any) (*[]DataInstrumentFull, error)

func InitDatabase

func InitDatabase(cfg *core.Database)

func RunInTransaction

func RunInTransaction(f func(tx *gorm.DB) error) error

func UpdateBiasAnalysis

func UpdateBiasAnalysis(tx *gorm.DB, ba *BiasAnalysis) error

func UpdateBiasConfig

func UpdateBiasConfig(tx *gorm.DB, bc *BiasConfig) error

func UpdateBrokerProduct

func UpdateBrokerProduct(tx *gorm.DB, p *BrokerProduct) error

func UpdateDataInstrument

func UpdateDataInstrument(tx *gorm.DB, i *DataInstrument) error

func UpdateDataProduct

func UpdateDataProduct(tx *gorm.DB, p *DataProduct) error

func UpdateUploadJob

func UpdateUploadJob(tx *gorm.DB, job *UploadJob) error

Types

type BiasAnalysis

type BiasAnalysis struct {
	Common
	Username         string `json:"username"`
	DataInstrumentId uint   `json:"dataInstrumentId"`
	BrokerProductId  uint   `json:"brokerProductId"`
	Name             string `json:"name"`
	Notes            string `json:"notes"`
}

func GetBiasAnalysisById

func GetBiasAnalysisById(tx *gorm.DB, id uint) (*BiasAnalysis, error)

func (BiasAnalysis) TableName

func (BiasAnalysis) TableName() string

type BiasAnalysisFull

type BiasAnalysisFull struct {
	BiasAnalysis
	DataSymbol   string `json:"dataSymbol"`
	DataName     string `json:"dataName"`
	BrokerSymbol string `json:"brokerSymbol"`
	BrokerName   string `json:"brokerName"`
}

type BiasConfig

type BiasConfig struct {
	Id             uint    `json:"id" gorm:"primaryKey"`
	BiasAnalysisId uint    `json:"biasAnalysisId"`
	StartDay       int16   `json:"startDay"`
	StartSlot      int16   `json:"startSlot"`
	EndDay         int16   `json:"endDay"`
	EndSlot        int16   `json:"endSlot"`
	Months         int16   `json:"months"`
	Excludes       string  `json:"excludes"`
	Operation      int8    `json:"operation"`
	GrossProfit    float64 `json:"grossProfit"`
	NetProfit      float64 `json:"netProfit"`
}

func (BiasConfig) TableName

func (BiasConfig) TableName() string

type BrokerProduct

type BrokerProduct struct {
	Id               uint    `json:"id" gorm:"primaryKey"`
	Symbol           string  `json:"symbol"`
	Username         string  `json:"username"`
	Name             string  `json:"name"`
	PointValue       float32 `json:"pointValue"`
	CostPerOperation float32 `json:"costPerOperation"`
	CurrencyCode     string  `json:"currencyCode"`
}

func GetBrokerProductById

func GetBrokerProductById(tx *gorm.DB, id uint) (*BrokerProduct, error)

func (BrokerProduct) TableName

func (BrokerProduct) TableName() string

type Common

type Common struct {
	Id        uint      `json:"id" gorm:"primaryKey"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type DataInstrument

type DataInstrument struct {
	Id             uint   `json:"id" gorm:"primaryKey"`
	DataProductId  uint   `json:"dataProductId"`
	Symbol         string `json:"symbol"`
	Name           string `json:"name"`
	ExpirationDate int    `json:"expirationDate,omitempty"`
	IsContinuous   bool   `json:"isContinuous"`
	Status         int8   `json:"status"`
	DataFrom       int    `json:"dataFrom"`
	DataTo         int    `json:"dataTo"`
}

func GetDataInstrumentById

func GetDataInstrumentById(tx *gorm.DB, id uint) (*DataInstrument, error)

func GetDataInstrumentBySymbol

func GetDataInstrumentBySymbol(tx *gorm.DB, productId uint, symbol string) (*DataInstrument, error)

func (DataInstrument) TableName

func (DataInstrument) TableName() string

type DataInstrumentFull

type DataInstrumentFull struct {
	DataInstrument
	ProductSymbol  string `json:"productSymbol"`
	SystemCode     string `json:"systemCode"`
	ConnectionCode string `json:"connectionCode"`
}

type DataProduct

type DataProduct struct {
	Id                   uint   `json:"id" gorm:"primaryKey"`
	Symbol               string `json:"symbol"`
	Username             string `json:"username"`
	SystemCode           string `json:"systemCode"`
	ConnectionCode       string `json:"connectionCode"`
	SupportsMultipleData bool   `json:"supportsMultipleData"`
	Timezone             string `json:"timezone"`
}

func GetDataProductById

func GetDataProductById(tx *gorm.DB, id uint) (*DataProduct, error)

func (DataProduct) TableName

func (DataProduct) TableName() string

type LoadedPeriod

type LoadedPeriod struct {
	Id               uint `json:"id" gorm:"primaryKey"`
	DataInstrumentId uint `json:"dataInstrumentId"`
	Day              int  `json:"day"`
	Status           int  `json:"status"`
}

func (LoadedPeriod) TableName

func (LoadedPeriod) TableName() string

type UploadJob

type UploadJob struct {
	Id               uint   `json:"id" gorm:"primaryKey"`
	DataInstrumentId uint   `json:"dataInstrumentId"`
	Status           int8   `json:"status"`
	Filename         string `json:"filename"`
	Error            string `json:"error"`
	Progress         int8   `json:"progress"`
	Records          int    `json:"records"`
	Bytes            int64  `json:"bytes"`
	Timezone         string `json:"timezone"`
	Parser           string `json:"parser"`
}

func (UploadJob) TableName

func (UploadJob) TableName() string

Jump to

Keyboard shortcuts

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