Documentation
¶
Index ¶
- func AddTrade(tx *gorm.DB, tr *Trade) error
- func FindTradesByTsId(tx *gorm.DB, tsId uint) (*[]Trade, error)
- func FindTradesByTsIds(tx *gorm.DB, ids []uint) (*[]Trade, error)
- func FindTradesFromTime(tx *gorm.DB, tsIds []uint, fromTime time.Time) (*[]Trade, error)
- func GetTradingSystems(tx *gorm.DB, filter map[string]any, offset int, limit int) (*[]TradingSystem, error)
- func GetTradingSystemsByIdsAsMap(tx *gorm.DB, ids []uint) (map[uint]*TradingSystem, error)
- func GetTradingSystemsByUser(tx *gorm.DB, name string) (*[]TradingSystem, error)
- func GetTradingSystemsInIdle(tx *gorm.DB, days int) (*[]TradingSystem, error)
- func GetUsersWithTradingSystems(tx *gorm.DB) ([]string, error)
- func InitDatabase(cfg *core.Database)
- func RunInTransaction(f func(tx *gorm.DB) error) error
- func SetTradingFilter(tx *gorm.DB, tf *TradingFilter) error
- func UpdateBrokerProductInfo(tx *gorm.DB, brokerProductId uint, values map[string]interface{}) error
- func UpdateTradingSystem(tx *gorm.DB, ts *TradingSystem) error
- type ParamMap
- type Trade
- type TradeType
- type TradingFilter
- type TradingSystem
- type TsActivation
- type TsStatus
- type TsSuggAction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindTradesFromTime ¶
func GetTradingSystems ¶
func GetTradingSystemsByUser ¶
func GetTradingSystemsByUser(tx *gorm.DB, name string) (*[]TradingSystem, error)
func GetTradingSystemsInIdle ¶
func GetTradingSystemsInIdle(tx *gorm.DB, days int) (*[]TradingSystem, error)
func InitDatabase ¶
func SetTradingFilter ¶
func SetTradingFilter(tx *gorm.DB, tf *TradingFilter) error
func UpdateBrokerProductInfo ¶
func UpdateTradingSystem ¶
func UpdateTradingSystem(tx *gorm.DB, ts *TradingSystem) error
Types ¶
type Trade ¶
type Trade struct { Id uint `json:"id" gorm:"primaryKey"` TradingSystemId uint `json:"tradingSystemId"` TradeType TradeType `json:"tradeType"` EntryTime *time.Time `json:"entryTime"` EntryValue float64 `json:"entryValue"` ExitTime *time.Time `json:"exitTime"` ExitValue float64 `json:"exitValue"` GrossProfit float64 `json:"grossProfit"` NumContracts int `json:"numContracts"` }
type TradingFilter ¶
type TradingFilter struct { TradingSystemId uint `json:"tradingSystemId" gorm:"primaryKey"` EquAvgEnabled bool `json:"equAvgEnabled"` EquAvgLen int `json:"equAvgLen"` PosProEnabled bool `json:"posProEnabled"` PosProLen int `json:"posProLen"` WinPerEnabled bool `json:"winPerEnabled"` WinPerLen int `json:"winPerLen"` WinPerValue int `json:"winPerValue"` OldNewEnabled bool `json:"oldNewEnabled"` OldNewOldLen int `json:"oldNewOldLen"` OldNewOldPerc int `json:"oldNewOldPerc"` OldNewNewLen int `json:"oldNewNewLen"` TrendlineEnabled bool `json:"trendlineEnabled"` TrendlineLen int `json:"trendlineLen"` TrendlineValue int `json:"trendlineValue"` }
func GetTradingFilterByTsId ¶
func GetTradingFilterByTsId(tx *gorm.DB, tsId uint) (*TradingFilter, error)
func (TradingFilter) TableName ¶
func (TradingFilter) TableName() string
type TradingSystem ¶
type TradingSystem struct { Id uint `json:"id" gorm:"primaryKey"` Username string `json:"username"` WorkspaceCode string `json:"workspaceCode"` Name string `json:"name"` Running bool `json:"running"` Activation TsActivation `json:"activation"` Active bool `json:"active"` Status TsStatus `json:"status"` SuggestedAction TsSuggAction `json:"suggestedAction"` FirstTrade *time.Time `json:"firstTrade"` LastTrade *time.Time `json:"lastTrade"` LastUpdate *time.Time `json:"lastUpdate"` LmNetProfit float64 `json:"lmNetProfit"` LmNetAvgTrade float64 `json:"lmNetAvgTrade"` LmNumTrades int `json:"lmNumTrades"` BrokerProductId uint `json:"brokerProductId"` BrokerSymbol string `json:"brokerSymbol"` PointValue float32 `json:"pointValue"` CostPerOperation float32 `json:"costPerOperation"` MarginValue float32 `json:"marginValue"` Increment float64 `json:"increment"` CurrencyId uint `json:"currencyId"` CurrencyCode string `json:"currencyCode"` }
func GetTradingSystemById ¶
func GetTradingSystemById(tx *gorm.DB, id uint) (*TradingSystem, error)
func GetTradingSystemByName ¶
func GetTradingSystemByName(tx *gorm.DB, name string) (*TradingSystem, error)
func (TradingSystem) TableName ¶
func (TradingSystem) TableName() string
type TsActivation ¶
type TsActivation int8
const ( TsActivationManual TsActivation = 0 TsActivationAuto TsActivation = 1 )
type TsSuggAction ¶
type TsSuggAction int8
const ( TsActionNone TsSuggAction = 0 TsActionTurnOff TsSuggAction = 1 TsActionTurnOn TsSuggAction = 2 TsActionCheck TsSuggAction = 3 TsActionTurnOffAndCheck TsSuggAction = 4 TsActionNoneTurnedOff TsSuggAction = 5 TsActionNoneTurnedOn TsSuggAction = 6 )
Click to show internal directories.
Click to hide internal directories.