model

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TableNameMatchedOrder = "matched_order"

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List struct {
	// contains filtered or unexported fields
}

List holds the elements, where each element points to the next element

func NewSinglyList

func NewSinglyList() *List

NewSinglyList instantiates a new list and adds the passed values, if any, to the list

func (*List) Add

func (list *List) Add(values ...*MatchData)

Add appends a value (one or more) at the end of the list (same as Append())

func (*List) Clear

func (list *List) Clear()

Clear removes all elements from the list.

func (*List) Empty

func (list *List) Empty() bool

Empty returns true if list does not contain any elements.

func (*List) Get

func (list *List) Get(index int) (*element, bool)

Get returns the element at index. Second return parameter is true if index is within bounds of the array and array is not empty, otherwise false.

func (*List) ResetHead

func (list *List) ResetHead(index int) error

ResetHead 重置头指针到指定的位置。

func (*List) Size

func (list *List) Size() int

Size returns number of elements within the list.

type MatchData

type MatchData struct {
	MessageID  pulsar.MessageID
	MatchTime  int64           //撮合时间
	Volume     decimal.Decimal //成交额
	Amount     decimal.Decimal //成交量
	StartPrice decimal.Decimal //本次撮合开始的价格
	EndPrice   decimal.Decimal //本次撮合结束的价格
	Low        decimal.Decimal //本次撮合的最低
	High       decimal.Decimal //本次撮合的最高价

}

type MatchedOrder

type MatchedOrder struct {
	ID           int64  `gorm:"column:id;primaryKey;autoIncrement:true;comment:雪花算法id" json:"id"`                        // 雪花算法id
	MatchID      string `gorm:"column:match_id;not null;comment:撮合id" json:"match_id"`                                   // 撮合id
	MatchSubID   string `gorm:"column:match_sub_id;not null;comment:本次匹配的id,一次撮合会多次匹配" json:"match_sub_id"`              // 本次匹配的id,一次撮合会多次匹配
	SymbolID     int32  `gorm:"column:symbol_id;not null;comment:交易对id" json:"symbol_id"`                                // 交易对id
	SymbolName   string `gorm:"column:symbol_name;not null;comment:交易对名称" json:"symbol_name"`                            // 交易对名称
	TakerOrderID string `gorm:"column:taker_order_id;not null;comment:taker订单id" json:"taker_order_id"`                  // taker订单id
	MakerOrderID string `gorm:"column:maker_order_id;not null;comment:maker订单id" json:"maker_order_id"`                  // maker订单id
	TakerIsBuyer int32  `gorm:"column:taker_is_buyer;not null;default:2;comment:taker是否是买单 1是 2否" json:"taker_is_buyer"` // taker是否是买单 1是 2否
	Price        string `gorm:"column:price;not null;comment:价格" json:"price"`                                           // 价格
	Qty          string `gorm:"column:qty;not null;comment:数量(基础币)" json:"qty"`                                          // 数量(基础币)
	Amount       string `gorm:"column:amount;not null;comment:金额(计价币)" json:"amount"`                                    // 金额(计价币)
	MatchTime    int64  `gorm:"column:match_time;not null;comment:撮合时间" json:"match_time"`                               // 撮合时间
	CreatedAt    int64  `gorm:"column:created_at;not null;comment:创建时间" json:"created_at"`                               // 创建时间
	UpdatedAt    int64  `gorm:"column:updated_at;not null;comment:修改时间" json:"updated_at"`                               // 修改时间
}

MatchedOrder mapped from table <matched_order>

func (*MatchedOrder) TableName

func (*MatchedOrder) TableName() string

TableName MatchedOrder's table name

type Ticker

type Ticker struct {
	TimeUnix   int64           //最近的一笔的数据
	Volume     decimal.Decimal //成交额 计价币数量
	High       decimal.Decimal //最高价
	Low        decimal.Decimal //最低价
	Last24     decimal.Decimal //24小时之前
	Price      decimal.Decimal //当前
	Amount     decimal.Decimal //成交量 基础币数量
	Range      decimal.Decimal //变化百分比
	PriceDelta decimal.Decimal //变化数量
}

func (*Ticker) CastToTickerRedisData

func (t *Ticker) CastToTickerRedisData(symbolInfo *define.SymbolInfo) TickerRedisData

func (*Ticker) CastToTickerWsData

func (t *Ticker) CastToTickerWsData(symbolInfo *define.SymbolInfo) ws.Ticker

type TickerRedisData

type TickerRedisData struct {
	Amount     string `json:"amount"`      //成交量
	TimeUnix   int64  `json:"time"`        //成交量
	High       string `json:"high"`        //最高价
	Low        string `json:"low"`         //最低价
	Last24     string `json:"last24price"` //24小时之前
	Price      string `json:"price"`       //当前
	Volume     string `json:"volume"`      //成交额
	Range      string `json:"range"`       //涨跌幅
	Symbol     string `json:"symbol"`
	PriceDelta string `json:"priceDelta"` //变化数量
}

TickerRedisData 用来存储的结构体

func (TickerRedisData) CastToTicker

func (t TickerRedisData) CastToTicker() Ticker

Jump to

Keyboard shortcuts

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