db

package
v0.0.0-...-9f6c243 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DPRollTriggerSD4  = "sd4"
	DPRollTriggerSD6  = "sd6"
	DPRollTriggerSD30 = "sd30"
)

Variables

This section is empty.

Functions

func AddAgentProfile

func AddAgentProfile(tx *gorm.DB, ap *AgentProfile) error

func AddBrokerProduct

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

func AddConnection

func AddConnection(tx *gorm.DB, conn *Connection) error

func AddCurrencyHistory

func AddCurrencyHistory(tx *gorm.DB, ci *CurrencyHistory) error

func AddDataProduct

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

func AddTradingSession

func AddTradingSession(tx *gorm.DB, s *TradingSession) error

func AddTradingSystem

func AddTradingSystem(tx *gorm.DB, ts *TradingSystem) error

func DeleteConnection

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

func DeleteTradingSystem

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

func DisconnectAll

func DisconnectAll(tx *gorm.DB) error

func GetAgentProfiles

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

func GetBrokerInstrumentsByBrokerId

func GetBrokerInstrumentsByBrokerId(tx *gorm.DB, id uint) (*[]BrokerInstrument, error)

func GetBrokerProducts

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

func GetBrokerProductsFull

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

func GetConnections

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

func GetCurrencies

func GetCurrencies(tx *gorm.DB) (*[]Currency, error)

func GetCurrenciesAsMap

func GetCurrenciesAsMap(tx *gorm.DB) (map[uint]*Currency, error)

func GetDataProducts

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

func GetDataProductsFull

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

func GetExchanges

func GetExchanges(tx *gorm.DB) (*[]Exchange, error)

func GetExchangesAsMap

func GetExchangesAsMap(tx *gorm.DB) (map[uint]*Exchange, error)

func GetTradingSessions

func GetTradingSessions(tx *gorm.DB, username string) (*[]TradingSession, error)

func GetTradingSystems

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

func GetTradingSystemsById

func GetTradingSystemsById(tx *gorm.DB, username string, ids []uint) (*[]TradingSystem, error)

func GetTradingSystemsFull

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

func SetConnectionStatus

func SetConnectionStatus(tx *gorm.DB, user, code string, flag bool) error

func UpdateBrokerProduct

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

func UpdateConnection

func UpdateConnection(tx *gorm.DB, conn *Connection) error

func UpdateCurrency

func UpdateCurrency(tx *gorm.DB, c *Currency) error

func UpdateDataProduct

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

func UpdateTradingSystem

func UpdateTradingSystem(tx *gorm.DB, ts *TradingSystem) error

Types

type AgentProfile

type AgentProfile struct {
	Common
	Username     string `json:"username"`
	Name         string `json:"name"`
	RemoteUrl    string `json:"remoteUrl"`
	SslKeyRef    string `json:"sslKeyRef"`
	SslCertRef   string `json:"sslCertRef"`
	ScanInterval int    `json:"scanInterval"`
}

func GetAgentProfileById

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

func (AgentProfile) TableName

func (AgentProfile) TableName() string

type BrokerInstrument

type BrokerInstrument struct {
	Id              uint   `json:"id" gorm:"primaryKey"`
	BrokerProductId uint   `json:"brokerProductId"`
	Symbol          string `json:"symbol"`
	Name            string `json:"name"`
	ExpirationDate  int    `json:"expirationDate"`
}

func (BrokerInstrument) TableName

func (BrokerInstrument) TableName() string

type BrokerProduct

type BrokerProduct struct {
	Common
	ConnectionId     uint    `json:"connectionId"`
	ExchangeId       uint    `json:"exchangeId"`
	Username         string  `json:"username"`
	Symbol           string  `json:"symbol"`
	Name             string  `json:"name"`
	PointValue       float32 `json:"pointValue"`
	CostPerOperation float32 `json:"costPerOperation"`
	MarginValue      float32 `json:"marginValue"`
	Increment        float64 `json:"increment"`
	MarketType       string  `json:"marketType"`
	ProductType      string  `json:"productType"`
}

func GetBrokerProductById

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

func (BrokerProduct) TableName

func (BrokerProduct) TableName() string

type BrokerProductFull

type BrokerProductFull struct {
	BrokerProduct
	CurrencyCode   string `json:"currencyCode,omitempty"`
	ConnectionCode string `json:"connectionCode,omitempty"`
	ConnectionName string `json:"connectionName,omitempty"`
	SystemCode     string `json:"systemCode,omitempty"`
	ExchangeCode   string `json:"exchangeCode,omitempty"`
}

type Common

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

type Connection

type Connection struct {
	Common
	Username             string `json:"username"`
	Code                 string `json:"code"`
	Name                 string `json:"name"`
	SystemCode           string `json:"systemCode"`
	SystemName           string `json:"systemName"`
	SystemConfigParams   string `json:"systemConfigParams"`
	Connected            bool   `json:"connected"`
	SupportsData         bool   `json:"supportsData"`
	SupportsBroker       bool   `json:"supportsBroker"`
	SupportsMultipleData bool   `json:"supportsMultipleData"`
	SupportsInventory    bool   `json:"supportsInventory"`
}

func GetConnectionByCode

func GetConnectionByCode(tx *gorm.DB, user, code string) (*Connection, error)

func GetConnectionById

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

func (Connection) TableName

func (Connection) TableName() string

type Currency

type Currency struct {
	Id           uint       `json:"id"`
	Code         string     `json:"code"`
	Name         string     `json:"name"`
	Symbol       string     `json:"symbol"`
	FirstDate    types.Date `json:"firstDate"`
	LastDate     types.Date `json:"lastDate"`
	LastValue    float64    `json:"lastValue"`
	HistoryEnded bool       `json:"historyEnded"`
}

func GetCurrencyById

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

func (Currency) TableName

func (Currency) TableName() string

type CurrencyHistory

type CurrencyHistory struct {
	Id         uint       `json:"id"`
	CurrencyId uint       `json:"currencyId"`
	Date       types.Date `json:"date"`
	Value      float64    `json:"value"`
}

func (CurrencyHistory) TableName

func (CurrencyHistory) TableName() string

type DPRollTrigger

type DPRollTrigger string

type DataProduct

type DataProduct struct {
	Common
	ConnectionId    uint          `json:"connectionId"`
	ExchangeId      uint          `json:"exchangeId"`
	Username        string        `json:"username"`
	Symbol          string        `json:"symbol"`
	Name            string        `json:"name"`
	MarketType      string        `json:"marketType"`
	ProductType     string        `json:"productType"`
	Months          string        `json:"months"`
	RolloverTrigger DPRollTrigger `json:"rolloverTrigger"`
	SessionId       uint          `json:"sessionId"`
}

func GetDataProductById

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

func (DataProduct) TableName

func (DataProduct) TableName() string

type DataProductFull

type DataProductFull struct {
	DataProduct
	ConnectionCode string `json:"connectionCode,omitempty"`
	ConnectionName string `json:"connectionName,omitempty"`
	SystemCode     string `json:"systemCode,omitempty"`
	ExchangeCode   string `json:"exchangeCode,omitempty"`
}

type Exchange

type Exchange struct {
	Id         uint   `json:"id"`
	CurrencyId uint   `json:"currencyId"`
	Code       string `json:"code"`
	Name       string `json:"name"`
	Timezone   string `json:"timezone"`
	Url        string `json:"url"`
}

func GetExchangeById

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

func (Exchange) TableName

func (Exchange) TableName() string

type TradingSession

type TradingSession struct {
	Common
	Username string `json:"username"`
	Name     string `json:"name"`
	Session  string `json:"session"`
}

func GetTradingSessionById

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

func (TradingSession) TableName

func (TradingSession) TableName() string

type TradingSystem

type TradingSystem struct {
	Common
	Username         string     `json:"username"`
	DataProductId    uint       `json:"dataProductId"`
	BrokerProductId  uint       `json:"brokerProductId"`
	TradingSessionId uint       `json:"tradingSessionId"`
	AgentProfileId   *uint      `json:"agentProfileId"`
	Name             string     `json:"name"`
	Timeframe        int        `json:"timeframe"`
	StrategyType     string     `json:"strategyType"`
	Overnight        bool       `json:"overnight"`
	Tags             string     `json:"tags"`
	ExternalRef      string     `json:"externalRef"`
	Finalized        bool       `json:"finalized"`
	InSampleFrom     types.Date `json:"inSampleFrom"`
	InSampleTo       types.Date `json:"inSampleTo"`
	EngineCode       string     `json:"engineCode"`
}

func GetTradingSystemByExtRef

func GetTradingSystemByExtRef(tx *gorm.DB, username string, externalRef string) (*TradingSystem, error)

func GetTradingSystemById

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

func (TradingSystem) TableName

func (TradingSystem) TableName() string

type TradingSystemFull

type TradingSystemFull struct {
	TradingSystem
	DataSymbol     string `json:"dataSymbol,omitempty"`
	BrokerSymbol   string `json:"brokerSymbol,omitempty"`
	TradingSession string `json:"tradingSession,omitempty"`
}

Jump to

Keyboard shortcuts

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