model

package
v2.0.0-...-ef162b0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 1 Imported by: 11

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 (
	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 {
	Symbol               string  `json:"symbol,omitempty"`          //交易对
	BaseSymbol           string  `json:"base_symbol,omitempty"`     //币种
	QuoteSymbol          string  `json:"quote_symbol,omitempty"`    //交易区:usdt/usdc/btc ...
	PricePrecision       int     `json:"price_precision,omitempty"` //价格小数点位数
	QtyPrecision         int     `json:"qty_precision,omitempty"`   //数量小数点位数
	MinQty               float64 `json:"min_qty,omitempty"`
	MaxQty               float64 `json:"max_qty,omitempty"`
	MarketQty            float64 `json:"market_qty,omitempty"`
	ContractVal          float64 `json:"contract_val,omitempty"`           //1张合约价值
	ContractValCurrency  string  `json:"contract_val_currency,omitempty"`  //合约面值计价币
	SettlementCurrency   string  `json:"settlement_currency,omitempty"`    //结算币
	ContractAlias        string  `json:"contract_alias,omitempty"`         //交割合约alias
	ContractDeliveryDate int64   `json:"contract_delivery_date,omitempty"` //合约交割日期
}

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 is api option parameter

func (OptionParameter) OrderClientID

func (OptionParameter) OrderClientID(cid string) OptionParameter

type Order

type Order struct {
	Pair        CurrencyPair `json:"pair,omitempty"`
	Id          string       `json:"id,omitempty"`       //订单ID
	CId         string       `json:"c_id,omitempty"`     //客户端自定义ID
	Side        OrderSide    `json:"side,omitempty"`     //交易方向: sell,buy
	OrderTy     OrderType    `json:"order_ty,omitempty"` //类型: limit , market , ...
	Status      OrderStatus  `json:"status,omitempty"`   //状态
	Price       float64      `json:"price,omitempty"`
	Qty         float64      `json:"qty,omitempty"`
	ExecutedQty float64      `json:"executed_qty,omitempty"`
	PriceAvg    float64      `json:"price_avg,omitempty"`
	Fee         float64      `json:"fee,omitempty"`
	FeeCcy      string       `json:"fee_ccy,omitempty"` //收取交易手续费币种
	CreatedAt   int64        `json:"created_at,omitempty"`
	FinishedAt  int64        `json:"finished_at,omitempty"` //订单完成时间
	CanceledAt  int64        `json:"canceled_at,omitempty"`
}

type OrderSide

type OrderSide string
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

func (OrderStatus) String

func (s OrderStatus) String() string

type OrderType

type OrderType string
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