Documentation ¶
Index ¶
- Variables
- func NewOrm() (*gorm.DB, error)
- type Algorithm
- type Exchange
- type Log
- type Logger
- type Trader
- type TraderExchange
- type User
- func (user User) GetTrader(id interface{}) (trader Trader, err error)
- func (user User) GetTraderExchanges(id interface{}) (traderExchanges []TraderExchange, err error)
- func (user User) ListAlgorithm(size, page int64, order string) (total int64, algorithms []Algorithm, err error)
- func (user User) ListExchange(size, page int64, order string) (total int64, exchanges []Exchange, err error)
- func (user User) ListLog(id, size, page int64) (total int64, logs []Log, err error)
- func (user User) ListTrader(algorithmID int64) (traders []Trader, err error)
- func (user User) ListUser(size, page int64, order string) (total int64, users []User, err error)
- func (user User) UpdateTrader(req Trader) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DB Database DB *gorm.DB )
Functions ¶
Types ¶
type Algorithm ¶
type Algorithm struct { ID int64 `gorm:"primary_key" json:"id"` UserID int64 `gorm:"index" json:"userId"` Name string `gorm:"type:varchar(200)" json:"name"` Description string `gorm:"type:text" json:"description"` Script string `gorm:"type:text" json:"script"` EvnDefault string `gorm:"type:text" json:"evnDefault"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt *time.Time `sql:"index" json:"-"` Traders []Trader `gorm:"-" json:"traders"` }
Algorithm struct
type Exchange ¶
type Exchange struct { ID int64 `gorm:"primary_key" json:"id"` UserID int64 `gorm:"index" json:"userId"` Name string `gorm:"type:varchar(50)" json:"name"` Type string `gorm:"type:varchar(50)" json:"type"` AccessKey string `gorm:"type:varchar(200)" json:"accessKey"` SecretKey string `gorm:"type:varchar(200)" json:"secretKey"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt *time.Time `sql:"index" json:"-"` }
Exchange struct
type Log ¶
type Log struct { ID int64 `gorm:"primary_key;AUTO_INCREMENT" json:"id"` TraderID int64 `gorm:"index" json:"-"` Timestamp int64 `json:"-"` ExchangeType string `gorm:"type:varchar(50)" json:"exchangeType"` Type string `json:"type"` // [-1"error", 0"info", 1"profit", 2"buy", 3"sell", 4"cancel", 5"long", 6"short", 7"long_close", 8"short_close"] StockType string `gorm:"type:varchar(20)" json:"stockType"` Price float64 `json:"price"` Amount float64 `json:"amount"` Message string `gorm:"type:text" json:"message"` Time time.Time `gorm:"-" json:"time"` }
Log struct
type Trader ¶
type Trader struct { ID int64 `gorm:"primary_key" json:"id"` UserID int64 `gorm:"index" json:"userId"` AlgorithmID int64 `gorm:"index" json:"algorithmId"` Name string `gorm:"type:varchar(200)" json:"name"` Environment string `gorm:"type:text" json:"environment"` LastRunAt time.Time `json:"lastRunAt"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt *time.Time `sql:"index" json:"-"` Exchanges []Exchange `gorm:"-" json:"exchanges"` Status int64 `gorm:"-" json:"status"` Algorithm Algorithm `gorm:"-" json:"algorithm"` }
Trader struct
type TraderExchange ¶
type TraderExchange struct { ID int64 `gorm:"primary_key"` TraderID int64 `gorm:"index"` ExchangeID int64 `gorm:"index"` Exchange `gorm:"-"` }
TraderExchange struct
type User ¶
type User struct { ID int64 `gorm:"primary_key" json:"id"` Username string `gorm:"type:varchar(25);unique_index" json:"username"` Password string `gorm:"not null" json:"-"` Level int64 `json:"level"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt *time.Time `sql:"index" json:"-"` }
User struct
func (User) GetTraderExchanges ¶
func (user User) GetTraderExchanges(id interface{}) (traderExchanges []TraderExchange, err error)
GetTraderExchanges ...
func (User) ListAlgorithm ¶
func (user User) ListAlgorithm(size, page int64, order string) (total int64, algorithms []Algorithm, err error)
ListAlgorithm ...
func (User) ListExchange ¶
func (user User) ListExchange(size, page int64, order string) (total int64, exchanges []Exchange, err error)
ListExchange ...
func (User) ListTrader ¶
ListTrader ...
Source Files ¶
Click to show internal directories.
Click to hide internal directories.