period

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetYesterdayClose

func GetYesterdayClose(symbol string) (string, bool)

Types

type Period

type Period struct {
	Symbol     string     `xorm:"-" json:"-"`
	OpenAt     utils.Time `xorm:"notnull timestamp unique(open_at) default CURRENT_TIMESTAMP" json:"open_at"` //开盘时间
	CloseAt    utils.Time `xorm:"notnull timestamp default CURRENT_TIMESTAMP" json:"close_at"`                // 收盘时间
	Open       string     `xorm:"decimal(30, 10) notnull" json:"open"`                                        //开盘价
	High       string     `xorm:"decimal(30, 10) notnull" json:"high"`                                        // 最高价
	Low        string     `xorm:"decimal(30, 10) notnull" json:"low"`                                         //最低价
	Close      string     `xorm:"decimal(30, 10) notnull" json:"close"`                                       //收盘价(当前K线未结束的即为最新价)
	Volume     string     `xorm:"decimal(30, 10) notnull" json:"volume"`                                      //成交量
	Amount     string     `xorm:"decimal(30, 10) notnull" json:"amount"`                                      //成交额
	CreateTime utils.Time `xorm:"timestamp created" json:"-"`
	UpdateTime utils.Time `xorm:"timestamp updated" json:"-"`
	Interval   PeriodType `xorm:"-" json:"-"`

	LastOpenTime  int64 `xorm:"-" json:"last_open_time"`
	LastCloseTime int64 `xorm:"-" json:"last_close_time"`
	// contains filtered or unexported fields
}

func GetTodyStats added in v0.1.7

func GetTodyStats(symbol string) (Period, error)

func NewPeriod

func NewPeriod(symbol string, p PeriodType, tr trading_core.TradeResult) *Period

func (*Period) CreateTable

func (p *Period) CreateTable(db *xorm.Session) error

func (*Period) TableName

func (p *Period) TableName() string

type PeriodType

type PeriodType string
const (
	PERIOD_M1  PeriodType = "m1"
	PERIOD_M3  PeriodType = "m3"
	PERIOD_M5  PeriodType = "m5"
	PERIOD_M15 PeriodType = "m15"
	PERIOD_M30 PeriodType = "m30"
	PERIOD_H1  PeriodType = "h1"
	PERIOD_H2  PeriodType = "h2"
	PERIOD_H4  PeriodType = "h4"
	PERIOD_H6  PeriodType = "h6"
	PERIOD_H8  PeriodType = "h8"
	PERIOD_H12 PeriodType = "h12"
	PERIOD_D1  PeriodType = "d1"
	PERIOD_D3  PeriodType = "d3"
	PERIOD_W1  PeriodType = "w1"
	PERIOD_MN  PeriodType = "mn"
)

func Periods

func Periods() []PeriodType

Jump to

Keyboard shortcuts

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