business

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: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeleteStatusOk             = "ok"
	DeleteStatusConnected      = "connected"
	DeleteStatusDataProducts   = "dataProducts"
	DeleteStatusBrokerProducts = "brokerProducts"
)
View Source
const (
	ResponseStatusOk      = "ok"
	ResponseStatusSkipped = "skipped"
)

Variables

This section is empty.

Functions

func AddBrokerProduct

func AddBrokerProduct(tx *gorm.DB, c *auth.Context, bps *BrokerProductSpec) (*db.BrokerProduct, error)

func AddConnection

func AddConnection(tx *gorm.DB, c *auth.Context, cs *ConnectionSpec) (*db.Connection, error)

func AddDataProduct

func AddDataProduct(tx *gorm.DB, c *auth.Context, dps *DataProductSpec) (*db.DataProduct, error)

func AddTradingSystem

func AddTradingSystem(tx *gorm.DB, c *auth.Context, tss *TradingSystemSpec) (*db.TradingSystem, error)

func CollectTradingSystemsData

func CollectTradingSystemsData(tx *gorm.DB, c *auth.Context, ids []uint) (*importexport.TradingSystemsData, error)

func CreateImportOverview

func CreateImportOverview(tx *gorm.DB, c *auth.Context, spec *ImportOverviewSpec, data []byte) (*importexport.ImportOverviewResponse, error)

func DeleteConnection

func DeleteConnection(tx *gorm.DB, c *auth.Context, id uint) (string, error)

func DeleteTradingSystem

func DeleteTradingSystem(tx *gorm.DB, c *auth.Context, id uint) (*db.TradingSystem, error)

func ExecuteImportPlan

func ExecuteImportPlan(tx *gorm.DB, c *auth.Context, spec *ImportExecutionSpec, data []byte) error

func ExportTradingSystems

func ExportTradingSystems(c *auth.Context, data *importexport.TradingSystemsData) ([]byte, error)

func GetAgentProfiles

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

func GetBrokerProducts

func GetBrokerProducts(tx *gorm.DB, c *auth.Context, filter map[string]any, offset int, limit int, details bool) (*[]db.BrokerProductFull, error)

func GetConnections

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

func GetCurrencies

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

func GetDataProducts

func GetDataProducts(tx *gorm.DB, c *auth.Context, filter map[string]any, offset int, limit int, details bool) (*[]db.DataProductFull, error)

func GetExchanges

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

func GetExternalRefs

func GetExternalRefs(tx *gorm.DB, c *auth.Context, id uint) ([]string, error)

func GetTradingSessions

func GetTradingSessions(tx *gorm.DB, c *auth.Context, filter map[string]any, offset int, limit int) (*[]*TradingSession, error)

func GetTradingSystems

func GetTradingSystems(tx *gorm.DB, c *auth.Context, filter map[string]any, offset int, limit int, details bool) (*[]db.TradingSystemFull, error)

func UpdateBrokerProduct

func UpdateBrokerProduct(tx *gorm.DB, c *auth.Context, id uint, pbs *BrokerProductSpec) (*db.BrokerProduct, error)

func UpdateConnection

func UpdateConnection(tx *gorm.DB, c *auth.Context, id uint, cs *ConnectionSpec) (*db.Connection, error)

func UpdateDataProduct

func UpdateDataProduct(tx *gorm.DB, c *auth.Context, id uint, dps *DataProductSpec) (*db.DataProduct, error)

func UpdateTradingSystem

func UpdateTradingSystem(tx *gorm.DB, c *auth.Context, id uint, tss *TradingSystemSpec) (*db.TradingSystem, error)

Types

type BrokerProductExt

type BrokerProductExt struct {
	db.BrokerProduct
	Connection db.Connection `json:"connection"`
	Exchange   db.Exchange   `json:"exchange"`
}

func GetBrokerProductById

func GetBrokerProductById(tx *gorm.DB, c *auth.Context, id uint) (*BrokerProductExt, error)

type BrokerProductSpec

type BrokerProductSpec struct {
	ConnectionId     uint    `json:"connectionId"     binding:"required"`
	ExchangeId       uint    `json:"exchangeId"       binding:"required"`
	Symbol           string  `json:"symbol"           binding:"required"`
	Name             string  `json:"name"             binding:"required"`
	PointValue       float32 `json:"pointValue"       binding:"min=0,max=1000000"`
	CostPerOperation float32 `json:"costPerOperation" binding:"min=0,max=10000"`
	MarginValue      float32 `json:"marginValue"      binding:"min=0,max=1000000"`
	Increment        float64 `json:"increment"        binding:"min=0,max=1"`
	MarketType       string  `json:"marketType"       binding:"required"`
	ProductType      string  `json:"productType"      binding:"required"`
}

type ConnectionExt

type ConnectionExt struct {
	db.Connection
	DataProducts   []db.DataProductFull   `json:"dataProducts"`
	BrokerProducts []db.BrokerProductFull `json:"brokerProducts"`
}

func GetConnectionById

func GetConnectionById(tx *gorm.DB, c *auth.Context, id uint) (*ConnectionExt, error)

type ConnectionSpec

type ConnectionSpec struct {
	Code               string `json:"code"       binding:"required"`
	Name               string `json:"name"       binding:"required"`
	SystemCode         string `json:"systemCode" binding:"required"`
	SystemConfigParams string `json:"systemConfigParams"`
}

type DataProductExt

type DataProductExt struct {
	db.DataProduct
	Connection db.Connection `json:"connection,omitempty"`
	Exchange   db.Exchange   `json:"exchange,omitempty"`
}

func GetDataProductById

func GetDataProductById(tx *gorm.DB, c *auth.Context, id uint) (*DataProductExt, error)

type DataProductSpec

type DataProductSpec struct {
	ConnectionId    uint             `json:"connectionId"   binding:"required"`
	ExchangeId      uint             `json:"exchangeId"     binding:"required"`
	Symbol          string           `json:"symbol"         binding:"required"`
	Name            string           `json:"name"           binding:"required"`
	MarketType      string           `json:"marketType"     binding:"required"`
	ProductType     string           `json:"productType"    binding:"required"`
	Months          string           `json:"months"`
	RolloverTrigger db.DPRollTrigger `json:"rolloverTrigger"`
	SessionId       uint             `json:"sessionId"      binding:"required"`
}

type FinalizationResponse

type FinalizationResponse struct {
	Status string `json:"status"`
}

func FinalizeTradingSystem

func FinalizeTradingSystem(tx *gorm.DB, c *auth.Context, id uint) (*FinalizationResponse, error)

type ImportExecutionSpec

type ImportExecutionSpec struct {
	Plan *importexport.ImportPlan
}

type ImportOverviewSpec

type ImportOverviewSpec struct {
}

type TradingSession

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

type TradingSystemReloadRequest

type TradingSystemReloadRequest struct {
	Name string `json:"name"`
}

type TradingSystemReloadResponse

type TradingSystemReloadResponse struct {
	TradeCount map[string]int `json:"tradeCount"`
}

func NewTradingSystemReloadResponse

func NewTradingSystemReloadResponse() *TradingSystemReloadResponse

func ReloadTradesFromAgent

func ReloadTradesFromAgent(tx *gorm.DB, c *auth.Context, id uint) (*TradingSystemReloadResponse, error)

type TradingSystemSpec

type TradingSystemSpec struct {
	DataProductId    uint       `json:"dataProductId"     binding:"required"`
	BrokerProductId  uint       `json:"brokerProductId"   binding:"required"`
	TradingSessionId uint       `json:"tradingSessionId"  binding:"required"`
	AgentProfileId   *uint      `json:"agentProfileId"`
	Name             string     `json:"name"              binding:"required"`
	Timeframe        int        `json:"timeframe"         binding:"min=1,max=1440"`
	StrategyType     string     `json:"strategyType"      binding:"required"`
	Overnight        bool       `json:"overnight"`
	Tags             string     `json:"tags"`
	ExternalRef      string     `json:"externalRef"`
	InSampleFrom     types.Date `json:"inSampleFrom"      binding:"required"`
	InSampleTo       types.Date `json:"inSampleTo"        binding:"required"`
	EngineCode       string     `json:"engineCode"        binding:"required"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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