types

package
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CrossedAccount

type CrossedAccount struct {
	CanWithdraw       string `json:"can_withdraw"`        // 可划转数量
	Currency          string `json:"currency"`            // 账户余额币种
	Equity            string `json:"equity"`              // 账户权益
	LiquiFeeRate      string `json:"liqui_fee_rate"`      // 强平手续费
	LiquiMode         string `json:"liqui_mode"`          // 强平模式:tier(梯度强平)
	MaintMarginRatio  string `json:"maint_margin_ratio"`  // 维持保证金率
	Margin            string `json:"margin"`              // 保证金(挂单冻结+持仓已用)
	MarginForUnfilled string `json:"margin_for_unfilled"` // 挂单冻结保证金
	MarginFrozen      string `json:"margin_frozen"`       // 持仓已用保证金
	MarginMode        string `json:"margin_mode"`         // 账户类型全仓:crossed
	MarginRatio       string `json:"margin_ratio"`        // 保证金率
	RealizedPnl       string `json:"realized_pnl"`        // 已实现盈亏
	TotalAvailBalance string `json:"total_avail_balance"` // 账户余额
	Underlying        string `json:"underlying"`          // 标的指数,如:BTC-USD,BTC-USDT
	UnrealizedPnl     string `json:"unrealized_pnl"`      // 未实现盈亏
}

CrossedAccount 交割合约全仓账户信息

type FixedAccount

type FixedAccount struct {
	Contracts []struct {
		AvailableQty      string `json:"available_qty"`       // 逐仓可用余额
		FixedBalance      string `json:"fixed_balance"`       // 逐仓账户余额
		InstrumentID      string `json:"instrument_id"`       // 合约ID,如BTC-USD-180213,BTC-USDT-191227
		MarginForUnfilled string `json:"margin_for_unfilled"` // 挂单冻结保证金
		MarginFrozen      string `json:"margin_frozen"`       // 持仓已用保证金
		RealizedPnl       string `json:"realized_pnl"`        // 已实现盈亏
		UnrealizedPnl     string `json:"unrealized_pnl"`      // 未实现盈亏
	} `json:"contracts"`
	TotalAvailBalance string `json:"total_avail_balance"` // 账户余额(账户静态权益)
	Equity            string `json:"equity"`              // 账户权益(账户动态权益)
	MarginMode        string `json:"margin_mode"`         // 账户类型逐仓:fixed
	AutoMargin        string `json:"auto_margin"`         // 是否自动追加保证金1: 自动追加已开启0: 自动追加未开启
	LiquiMode         string `json:"liqui_mode"`          // 强平模式:tier(梯度强平)
	CanWithdraw       string `json:"can_withdraw"`        // 可划转数量
	Currency          string `json:"currency"`            // 账户余额币种
}

FixedAccount 交割合约逐仓账户信息

type Instrument

type Instrument struct {
	InstrumentID        string          `json:"instrument_id"`         // 合约ID,如BTC-USD-180213,BTC-USDT-191227
	Underlying          string          `json:"underlying"`            // 标的指数,如:BTC-USD
	BaseCurrency        string          `json:"base_currency"`         // 交易货币,如:BTC-USD中的BTC ,BTC-USDT中的BTC
	QuoteCurrency       string          `json:"quote_currency"`        // 计价货币币种,如:BTC-USD中的USD ,BTC-USDT中的USDT
	SettlementCurrency  string          `json:"settlement_currency"`   // 盈亏结算和保证金币种,如BTC
	ContractVal         decimal.Decimal `json:"contract_val"`          // 合约面值(美元)
	Listing             string          `json:"listing"`               // 上线日期
	Delivery            string          `json:"delivery"`              // 交割日期
	TickSize            decimal.Decimal `json:"tick_size"`             // 下单价格精度
	TradeIncrement      decimal.Decimal `json:"trade_increment"`       // 下单数量精度
	Alias               string          `json:"alias"`                 // 本周 this_week   次周 next_week   季度 quarter   次季度 bi_quarter
	IsInverse           string          `json:"is_inverse"`            // true  or  false  ,是否 币本位保证金合约
	ContractValCurrency string          `json:"contract_val_currency"` // 合约面值计价币种  如  usd,btc,ltc,etc xrp  eos
}

Instrument 合约信息

type Order

type Order struct {
	InstrumentID string          `json:"instrument_id"` // 合约ID,如BTC-USD-180213,BTC-USDT-191227
	ClientOid    string          `json:"client_oid"`    // 由您设置的订单ID来识别您的订单
	Size         decimal.Decimal `json:"size"`          // 委托数量
	Timestamp    time.Time       `json:"timestamp"`     // 委托时间
	FilledQty    decimal.Decimal `json:"filled_qty"`    // 成交数量
	Fee          decimal.Decimal `json:"fee"`           // 手续费
	OrderID      string          `json:"order_id"`      // 订单ID
	Price        decimal.Decimal `json:"price"`         // 委托价格
	PriceAvg     decimal.Decimal `json:"price_avg"`     // 成交均价
	Type         decimal.Decimal `json:"type"`          // 订单类型1:开多2:开空3:平多4:平空
	ContractVal  decimal.Decimal `json:"contract_val"`  // 合约面值
	Leverage     decimal.Decimal `json:"leverage"`      // 杠杆倍数,1-100的数值
	OrderType    decimal.Decimal `json:"order_type"`    // 0:普通委托 1:只做Maker(Post only) 2:全部成交或立即取消(FOK) 3:立即成交并取消剩余(IOC)   4:市价委托
	Pnl          decimal.Decimal `json:"pnl"`           // 收益
	State        decimal.Decimal `json:"state"`         // 订单状态-2:失败 -1:撤单成功 0:等待成交 1:部分成交  2:完全成交 3:下单中 4:撤单中
}

Order 交割合约订单信息

type Position

type Position struct {
	CreatedAt             time.Time       `json:"created_at"`               // 创建时间
	InstrumentID          string          `json:"instrument_id"`            // 合约ID,如BTC-USD-180213
	Last                  decimal.Decimal `json:"last"`                     // 最新成交价
	Leverage              decimal.Decimal `json:"leverage"`                 // 杠杆倍数 全仓字段
	LiquidationPrice      decimal.Decimal `json:"liquidation_price"`        // 预估强平价 全仓字段
	LongAvailQty          decimal.Decimal `json:"long_avail_qty"`           // 多仓可平仓数量
	LongAvgCost           decimal.Decimal `json:"long_avg_cost"`            // 开仓平均价
	LongLeverage          decimal.Decimal `json:"long_leverage"`            // 多仓杠杆倍数 逐仓字段
	LongLiquiPrice        decimal.Decimal `json:"long_liqui_price"`         // 多仓强平价格 逐仓字段
	LongMaintMarginRatio  decimal.Decimal `json:"long_maint_margin_ratio"`  // 多仓维持保证金率 逐仓字段
	LongMargin            decimal.Decimal `json:"long_margin"`              // 多仓保证金
	LongMarginRatio       decimal.Decimal `json:"long_margin_ratio"`        // 多仓保证金率 逐仓字段
	LongPnl               decimal.Decimal `json:"long_pnl"`                 // 多仓收益
	LongPnlRatio          decimal.Decimal `json:"long_pnl_ratio"`           // 多仓收益率
	LongQty               decimal.Decimal `json:"long_qty"`                 // 多仓数量
	LongSettledPnl        decimal.Decimal `json:"long_settled_pnl"`         // 多仓已结算收益
	LongSettlementPrice   decimal.Decimal `json:"long_settlement_price"`    // 多仓结算基准价
	LongUnrealisedPnl     decimal.Decimal `json:"long_unrealised_pnl"`      // 多仓未实现盈亏
	MarginMode            string          `json:"margin_mode"`              // 账户类型 逐仓:fixed, 全仓:crossed
	RealisedPnl           decimal.Decimal `json:"realised_pnl"`             // 已实现盈余
	ShortAvailQty         decimal.Decimal `json:"short_avail_qty"`          // 空仓可平仓数量
	ShortAvgCost          decimal.Decimal `json:"short_avg_cost"`           // 开仓平均价
	ShortLeverage         decimal.Decimal `json:"short_leverage"`           // 空仓杠杆倍数 逐仓字段
	ShortLiquiPrice       decimal.Decimal `json:"short_liqui_price"`        // 空仓强平价格 逐仓字段
	ShortMaintMarginRatio decimal.Decimal `json:"short_maint_margin_ratio"` // 空仓维持保证金率 逐仓字段
	ShortMargin           decimal.Decimal `json:"short_margin"`             // 空仓保证金
	ShortMarginRatio      decimal.Decimal `json:"short_margin_ratio"`       // 空仓保证金率 逐仓字段
	ShortPnl              decimal.Decimal `json:"short_pnl"`                // 空仓收益
	ShortPnlRatio         decimal.Decimal `json:"short_pnl_ratio"`          // 空仓收益率
	ShortQty              decimal.Decimal `json:"short_qty"`                // 空仓数量
	ShortSettledPnl       decimal.Decimal `json:"short_settled_pnl"`        // 空仓已结算收益
	ShortSettlementPrice  decimal.Decimal `json:"short_settlement_price"`   // 空仓结算基准价
	ShortUnrealisedPnl    decimal.Decimal `json:"short_unrealised_pnl"`     // 空仓未实现盈亏
	UpdatedAt             time.Time       `json:"updated_at"`               // 最近一次加减仓的更新时间
}

Position 交割合约仓位信息

type TableDepth5

type TableDepth5 struct {
	Asks         [][4]decimal.Decimal `json:"asks"`
	Bids         [][4]decimal.Decimal `json:"bids"`
	InstrumentID string               `json:"instrument_id"`
	Timestamp    time.Time            `json:"timestamp"`
}

TableDepth5 交割合约websocket推送5档深度频道

type TableOrder

type TableOrder struct {
	InstrumentID string          `json:"instrument_id"`  // 合约ID,如BTC-USDT-180213,BTC-USDT-191227
	ClientOid    string          `json:"client_oid"`     // 由用户设置的订单ID
	Size         decimal.Decimal `json:"size"`           // 委托数量
	Timestamp    time.Time       `json:"timestamp"`      // 订单状态变化时间
	FilledQty    decimal.Decimal `json:"filled_qty"`     // 成交数量
	Fee          decimal.Decimal `json:"fee"`            // 手续费
	OrderID      string          `json:"order_id"`       // 订单ID
	Price        decimal.Decimal `json:"price"`          // 委托价格
	ErrorCode    string          `json:"error_code"`     // 错误码
	Pnl          decimal.Decimal `json:"pnl"`            // 收益
	PriceAvg     decimal.Decimal `json:"price_avg"`      // 成交均价
	Type         decimal.Decimal `json:"type"`           // 订单类型1:开多2:开空3:平多4:平空
	ContractVal  decimal.Decimal `json:"contract_val"`   // 合约面值
	Leverage     decimal.Decimal `json:"leverage"`       // 杠杆倍数
	OrderType    decimal.Decimal `json:"order_type"`     // 0:普通委托 1:只做Maker(Post only) 2:全部成交或立即取消(FOK) 3:立即成交并取消剩余(IOC)  4:市价委托
	LastFillPx   decimal.Decimal `json:"last_fill_px"`   // 最新成交价格(如果没有,推0)
	LastFillID   string          `json:"last_fill_id"`   // 最新成交id(如果没有,推0),和trade频道推送的trade_id一致
	LastFillQty  decimal.Decimal `json:"last_fill_qty"`  // 最新成交数量(如果没有,推0)
	LastFillTime time.Time       `json:"last_fill_time"` // 最新成交时间(如果没有,推1970-01-01T00:00:00.000Z)
	State        decimal.Decimal `json:"state"`          // -2:失败-1:撤单成功0:等待成交1:部分成交2:完全成交3:下单中4:撤单中
}

TableOrder websocket交割合约用户交易频道返回参数

type TablePosition

type TablePosition struct {
	CreatedAt             time.Time       `json:"created_at"`               // 创建时间
	InstrumentID          string          `json:"instrument_id"`            // 合约ID
	Last                  decimal.Decimal `json:"last"`                     // 最新成交价
	Leverage              decimal.Decimal `json:"leverage"`                 // 杠杆倍数 全仓字段
	LiquidationPrice      decimal.Decimal `json:"liquidation_price"`        // 预估强平价 全仓字段
	LongAvailQty          decimal.Decimal `json:"long_avail_qty"`           // 多仓可平仓数量
	LongAvgCost           decimal.Decimal `json:"long_avg_cost"`            // 开仓平均价
	LongLeverage          decimal.Decimal `json:"long_leverage"`            // 多仓杠杆倍数 逐仓字段
	LongLiquiPrice        decimal.Decimal `json:"long_liqui_price"`         // 多仓强平价格 逐仓字段
	LongMaintMarginRatio  decimal.Decimal `json:"long_maint_margin_ratio"`  // 多仓维持保证金率 逐仓字段
	LongMargin            decimal.Decimal `json:"long_margin"`              // 多仓保证金
	LongMarginRatio       decimal.Decimal `json:"long_margin_ratio"`        // 多仓保证金率 逐仓字段
	LongOpenOutstanding   decimal.Decimal `json:"long_open_outstanding"`    // 多仓开仓冻结张数
	LongPnl               decimal.Decimal `json:"long_pnl"`                 // 多仓收益
	LongPnlRatio          decimal.Decimal `json:"long_pnl_ratio"`           // 多仓收益率
	LongQty               decimal.Decimal `json:"long_qty"`                 // 多仓数量
	LongSettledPnl        decimal.Decimal `json:"long_settled_pnl"`         // 多仓已结算收益
	LongSettlementPrice   decimal.Decimal `json:"long_settlement_price"`    // 结算基准价
	LongUnrealisedPnl     decimal.Decimal `json:"long_unrealised_pnl"`      // 多仓未实现盈亏
	MarginMode            string          `json:"margin_mode"`              // 账户类型 逐仓:fixed, 全仓:crossed
	RealisedPnl           decimal.Decimal `json:"realised_pnl"`             // 已实现盈余
	ShortAvailQty         decimal.Decimal `json:"short_avail_qty"`          // 空仓可平仓数量
	ShortAvgCost          decimal.Decimal `json:"short_avg_cost"`           // 开仓平均价
	ShortLeverage         decimal.Decimal `json:"short_leverage"`           // 空仓杠杆倍数 逐仓字段
	ShortLiquiPrice       decimal.Decimal `json:"short_liqui_price"`        // 空仓强平价格 逐仓字段
	ShortMaintMarginRatio decimal.Decimal `json:"short_maint_margin_ratio"` // 空仓维持保证金率 逐仓字段
	ShortMargin           decimal.Decimal `json:"short_margin"`             // 空仓保证金
	ShortMarginRatio      decimal.Decimal `json:"short_margin_ratio"`       // 空仓保证金率 逐仓字段
	ShortOpenOutstanding  decimal.Decimal `json:"short_open_outstanding"`   // 空仓开仓冻结张数
	ShortPnl              decimal.Decimal `json:"short_pnl"`                // 空仓收益
	ShortPnlRatio         decimal.Decimal `json:"short_pnl_ratio"`          // 空仓收益率
	ShortQty              decimal.Decimal `json:"short_qty"`                // 空仓数量
	ShortSettledPnl       decimal.Decimal `json:"short_settled_pnl"`        // 空仓已结算收益
	ShortSettlementPrice  decimal.Decimal `json:"short_settlement_price"`   // 结算基准价
	ShortUnrealisedPnl    decimal.Decimal `json:"short_unrealised_pnl"`     // 空仓未实现盈亏
	Timestamp             time.Time       `json:"timestamp"`                // 账户数据更新时间
	UpdatedAt             time.Time       `json:"updated_at"`               // 更新时间
}

TablePosition websocket交割合约用户持仓频道返回参数

type TablePriceRange

type TablePriceRange struct {
	Highest      decimal.Decimal `json:"highest"`
	Lowest       decimal.Decimal `json:"lowest"`
	InstrumentID string          `json:"instrument_id"`
	Timestamp    time.Time       `json:"timestamp"`
}

TablePriceRange ws推送格式

Jump to

Keyboard shortcuts

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