types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRateLimit  = errors.New("rate limit")
	ErrRateBanned = errors.New("rate banned")
)

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Coin   string
	Free   float64
	Frozen float64
	Total  float64
}

type Assets

type Assets struct {
	Assets     map[string]Asset
	TotalUsdEq float64
}

type BookTicker

type BookTicker struct {
	Symbol     string
	Exchange   constant.ExchangeType
	AskPrice   float64
	AskQty     float64
	BidPrice   float64
	BidQty     float64
	ExchangeTs int64
	Ts         int64
	TraceId    string
}

func (*BookTicker) Hash

func (e *BookTicker) Hash() uint32

type ExchangeParameters

type ExchangeParameters struct {
	DebugMode  bool
	ProxyURL   string // example: socks5://127.0.0.1:1080 | http://127.0.0.1:1080
	AccessKey  string
	SecretKey  string
	Passphrase string
}

type FundingRate

type FundingRate struct {
	Symbol          string
	Method          string
	FundingRate     float64
	FundingTime     int64
	NextFundingRate float64
	NextFundingTime int64
}

type Kline

type Kline struct {
	Open    float64
	High    float64
	Low     float64
	Close   float64
	Vol     float64
	Ts      int64
	Confirm int64
}

type Order

type Order struct {
	Symbol        string             `json:"symbol"`
	Type          constant.OrderType `json:"type"`
	OrderID       string             `json:"orderId"`
	ClientID      string             `json:"clientID"`
	Side          constant.OrderSide `json:"side"`
	Price         string             `json:"price"`
	OrigQty       string             `json:"origQty"`
	Amount        string             `json:"amount"` // 订单quote额度
	ExecutedQty   string             `json:"executedQty"`
	ExecutedAmt   string
	AvgPrice      string                `json:"avgPrice"`
	Fee           string                `json:"fee"`
	Status        constant.OrderStatus  `json:"status"` // 自定义的订单状态,统一各交易所订单状态
	ExchangeType  constant.ExchangeType `json:"exchangeType"`
	HedgeClientId string
	HedgingPrice  string
	ExpectSpred   float64
	CreateAt      int64 `gorm:"column:createAt;" json:"createAt"`
	UpdateAt      int64 `gorm:"column:updateAt;" json:"updateAt"`
}

func (*Order) IsOver

func (order *Order) IsOver() bool

func (*Order) UpdateByTradeEvent

func (order *Order) UpdateByTradeEvent(trade *Trade) (float64, float64)

type OrderBook

type OrderBook struct {
	Symbol     string
	Exchange   constant.ExchangeType
	Asks       []OrderBookItem
	Bids       []OrderBookItem
	ExchangeTs int64
	Ts         int64
	TraceId    string
}

type OrderBookItem

type OrderBookItem struct {
	Price float64
	Qty   float64
}

type Position

type Position struct {
	Symbol    string // BTC_USDT_PERP
	Exchange  constant.ExchangeType
	Size      float64
	AvgPrice  float64
	MarkPrice float64
	UnPnl     float64
	UpdateAt  int64
}

type Trade

type Trade struct {
	Symbol       string
	ClientID     string
	Exchange     constant.ExchangeType
	Size         string
	FilledSize   string
	FilledAmount string
	Fee          string
	Side         constant.OrderSide
	Status       constant.OrderStatus
	Type         constant.OrderType
	ExchangeTs   int64
	Ts           int64
}

Jump to

Keyboard shortcuts

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