model

package
v2.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Kline_1min  KlinePeriod = "1min"
	Kline_5min              = "5min"
	Kline_15min             = "15min"
	Kline_30min             = "30min"
	Kline_60min             = "60min"
	Kline_1h                = "1h"
	Kline_4h                = "4h"
	Kline_6h                = "6h"
	Kline_1day              = "1day"
	Kline_1week             = "1week"
)
View Source
const (
	OrderStatus_Pending      OrderStatus = 1
	OrderStatus_Finished                 = 2
	OrderStatus_Canceled                 = 3
	OrderStatus_PartFinished             = 4
	OrderStatus_Canceling                = 5
)
View Source
const (
	ADA  = "ADA"
	ATOM = "ATOM"
	AAVE = "AAVE"
	ALGO = "ALGO"
	AR   = "AR"

	BTC  = "BTC"
	BNB  = "BNB"
	BSV  = "BSV"
	BCH  = "BCH"
	BUSD = "BUSD"

	CEL = "CEL"
	CRV = "CRV"

	DAI  = "DAI"
	DCR  = "DCR"
	DOT  = "DOT"
	DOGE = "DOGE"
	DASH = "DASH"
	DYDX = "DYDX"

	ETH  = "ETH"
	ETHW = "ETHW"
	ETC  = "ETC"
	EOS  = "EOS"
	ENJ  = "ENJ"
	ENS  = "ENS"

	FLOW = "FLOW"
	FIL  = "FIL"
	FLM  = "FLM"

	GALA = "GALA"
	GAS  = "GAS"

	HT = "HT"

	IOTA = "IOTA"
	IOST = "IOST"

	KSM = "KSM"

	LTC = "LTC"
	LDO = "LDO"

	MINA = "MINA"
	MEME = "MEME"

	NEO  = "NEO"
	NEAR = "NEAR"

	OP   = "OP"
	OKB  = "OKB"
	OKT  = "OKT"
	ORDI = "ORDI"

	PLG  = "PLG"
	PERP = "PERP"
	PEPE = "PEPE"

	QTUM = "QTUM"

	RACA = "RACA"
	RVN  = "RVN"

	STORJ = "STORJ"
	SOL   = "SOL"
	SHIB  = "SHIB"
	SC    = "SC"
	SAND  = "SAND"
	SUSHI = "SUSHI"
	SUI   = "SUI"

	TRX   = "TRX"
	TRADE = "TRADE"
	TRB   = "TRB"

	USD  = "USD"
	USDT = "USDT"
	USDC = "USDC"
	UNI  = "UNI"

	VELO = "VELO"

	WBTC  = "WBTC"
	WAVES = "WAVES"

	XRP = "XRP"
	XTZ = "XTZ"

	YFI  = "YFI"
	YFII = "YFII"

	ZEC  = "ZEC"
	ZYRO = "ZYRO"
)

coin const list a-z排序

View Source
const (
	OKX     = "okx.com"
	BINANCE = "binance.com"
)

exchange name const list

View Source
const (
	OKX_REAL_ENDPOINT      = "https://www.okx.com"
	OKX_SIMULATED_ENDPOINT = "https://www.okx.com/api/v5/trade-mock"
)
View Source
const (
	// 订单类型常量
	OrderType_Limit    OrderType = "limit"
	OrderType_Market   OrderType = "market"
	OrderType_PostOnly OrderType = "post_only"
	OrderType_FOK      OrderType = "fok"
	OrderType_IOC      OrderType = "ioc"

	// 订单方向常量
	Buy               OrderSide = "buy"
	Sell              OrderSide = "sell"
	Futures_OpenBuy   OrderSide = "open_buy"
	Futures_OpenSell  OrderSide = "open_sell"
	Futures_CloseBuy  OrderSide = "close_buy"
	Futures_CloseSell OrderSide = "close_sell"
)
View Source
const (
	Order_Client_ID__Opt_Key = "OrderClientID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Coin             string  `json:"coin,omitempty"`
	Balance          float64 `json:"balance,omitempty"`
	AvailableBalance float64 `json:"available_balance,omitempty"`
	FrozenBalance    float64 `json:"frozen_balance,omitempty"`
}

type CurrencyPair

type CurrencyPair struct {
	BaseSymbol     string // 基础货币符号
	QuoteSymbol    string // 计价货币符号
	Symbol         string // 交易对符号
	PricePrecision int    // 价格精度
	QtyPrecision   int    // 数量精度
}

CurrencyPair 表示交易对

type Depth

type Depth struct {
	Pair  CurrencyPair `json:"pair"`
	UTime time.Time    `json:"ut"`
	Asks  DepthItems   `json:"asks"`
	Bids  DepthItems   `json:"bids"`
}

type DepthItem

type DepthItem struct {
	Price  float64 `json:"price"`
	Amount float64 `json:"amount"`
}

type DepthItems

type DepthItems []DepthItem

func (DepthItems) Len

func (dr DepthItems) Len() int

func (DepthItems) Less

func (dr DepthItems) Less(i, j int) bool

func (DepthItems) Swap

func (dr DepthItems) Swap(i, j int)

type FundingRate

type FundingRate struct {
	Symbol string  `json:"symbol"`
	Rate   float64 `json:"rate"`
	Tm     int64   `json:"tm"` //资金费收取时间
}

type FuturesAccount

type FuturesAccount struct {
	Coin      string  `json:"coin,omitempty"` //币种
	Eq        float64 `json:"eq,omitempty"`   //总权益
	AvailEq   float64 `json:"avail_eq,omitempty"`
	FrozenBal float64 `json:"frozen_bal,omitempty"`
	MgnRatio  float64 `json:"mgn_ratio,omitempty"`
	Upl       float64 `json:"upl,omitempty"`
	RiskRate  float64 `json:"risk_rate,omitempty"`
}

type FuturesPosition

type FuturesPosition struct {
	Pair     CurrencyPair `json:"pair,omitempty"`
	PosSide  OrderSide    `json:"pos_side,omitempty"`  //开仓方向
	Qty      float64      `json:"qty,omitempty"`       // 持仓数量
	AvailQty float64      `json:"avail_qty,omitempty"` //可平仓数量
	AvgPx    float64      `json:"avg_px,omitempty"`    //开仓均价
	LiqPx    float64      `json:"liq_px,omitempty"`    // 爆仓价格
	Upl      float64      `json:"upl,omitempty"`       //盈亏
	UplRatio float64      `json:"upl_ratio,omitempty"` // 盈亏率
	Lever    float64      `json:"lever,omitempty"`     //杠杆倍数
}

type Kline

type Kline struct {
	Pair      CurrencyPair `json:"pair"`
	Timestamp int64        `json:"t"`
	Open      float64      `json:"o"`
	Close     float64      `json:"s"`
	High      float64      `json:"h"`
	Low       float64      `json:"l"`
	Vol       float64      `json:"v"`
}

type KlinePeriod

type KlinePeriod string

type OptionParameter

type OptionParameter struct {
	Key   string
	Value string
}

OptionParameter 表示可选参数

func (OptionParameter) OrderClientID

func (OptionParameter) OrderClientID(cid string) OptionParameter

type Order

type Order struct {
	Id        string       // 订单ID
	ClientId  string       // 客户端订单ID
	Pair      CurrencyPair // 交易对
	Price     float64      // 价格
	Qty       float64      // 数量
	Side      OrderSide    // 订单方向
	OrderTy   OrderType    // 订单类型
	Status    OrderStatus  // 订单状态
	Fee       float64      // 手续费
	Timestamp int64        // 时间戳
}

Order 表示一个订单

type OrderSide

type OrderSide string

OrderSide 表示订单方向

const (
	Spot_Buy          OrderSide = "buy"
	Spot_Sell         OrderSide = "sell"
	Futures_OpenBuy   OrderSide = "futures_open_buy"
	Futures_OpenSell  OrderSide = "futures_open_sell"
	Futures_CloseBuy  OrderSide = "futures_close_buy"
	Futures_CloseSell OrderSide = "futures_close_sell"
)

type OrderStatus

type OrderStatus int

OrderStatus 表示订单状态

const (
	OrderStatus_Unknown OrderStatus = iota
	OrderStatus_New
	OrderStatus_PartialFilled
	OrderStatus_Filled
	OrderStatus_Canceled
	OrderStatus_Rejected
	OrderStatus_Pending
)

func (OrderStatus) String

func (s OrderStatus) String() string

type OrderType

type OrderType string

OrderType 表示订单类型

const (
	OrderType_Limit    OrderType = "limit"
	OrderType_Market   OrderType = "market"
	OrderType_opponent OrderType = "opponent"
)

type Ticker

type Ticker struct {
	Pair      CurrencyPair `json:"pair"`
	Last      float64      `json:"l"`
	Buy       float64      `json:"b"`
	Sell      float64      `json:"s"`
	High      float64      `json:"h"`
	Low       float64      `json:"lw"`
	Vol       float64      `json:"v"`
	Percent   float64      `json:"percent"`
	Timestamp int64        `json:"t"`
}

Jump to

Keyboard shortcuts

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