types

package
v0.0.0-...-1d71415 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractAsset

type ContractAsset struct {
	Currency         string  `json:"currency"`
	PositionMargin   float64 `json:"positionMargin"`
	AvailableBalance float64 `json:"availableBalance"`
	CashBalance      float64 `json:"cachBalance"`
	FrozenBalance    float64 `json:"frozenBalance"`
	Equity           float64 `json:"equity"`
	Unrealized       float64 `json:"unrealized"`
	Bonus            float64 `json:"bonus"`
}

type GetAccountAsset

type GetAccountAsset struct {
	Response
	Data *ContractAsset `json:"data"`
}

type GetAccountAssets

type GetAccountAssets struct {
	Response
	Data []*ContractAsset `json:"data"`
}

type GetLeverageParams

type GetLeverageParams struct {
	Symbol string `url:"symbol,omitempty" validate:"required"`
}

type GetLeverageResp

type GetLeverageResp struct {
	Response
	Data struct {
		PositionType int     `json:"positionType"`
		Level        int     `json:"level"`
		Imr          float64 `json:"imr"`
		Mmr          float64 `json:"mmr"`
		Leverage     int     `json:"leverage"`
	} `json:"data"`
}

type GetOpenPositions

type GetOpenPositions struct {
	Response
	Data []*OpenPosition `json:"data"`
}

type GetOpenPositionsParams

type GetOpenPositionsParams struct {
	Symbol string `url:"symbol,omitempty" validate:"omitempty"`
}

type NewOrderParam

type NewOrderParam struct {
	Symbol   string    `url:"symbol" validate:"required"`
	Price    float64   `url:"price,omitempty" validate:"omitempty"`
	Vol      float64   `url:"vol,omitempty" validate:"required"`
	Leverage int       `url:"leverage,omitempty" validate:"omitempty"`
	Side     OrderSide `url:"side" validate:"required,oneof=1 2 3 4"`
	Type     OrderType `url:"type" validate:"required,oneof=1 2 3 4 5 6"`
	OpenType OpenType  `url:"openType" validate:"required,oneof=1 2"`

	PositionId      int64   `url:"positionId,omitempty" validate:"omitempty"`
	StopLossPrice   float64 `url:"stopLossPrice,omitempty" validate:"omitempty"`
	TakeProfitPrice float64 `url:"takeProfitPrice,omitempty" validate:"omitempty"`
	PositionMode    int     `url:"positionMode,omitempty" validate:"omitempty"`
}

type OpenPosition

type OpenPosition struct {
	PositionID   int64  `json:"positionId"`
	Symbol       string `json:"symbol"`
	PositionType int    `json:"positionType"`
	OpenType     int    `json:"openType"`
	State        int    `json:"state"`

	FrozenVol      float64 `json:"frozenVol"`
	CloseVol       float64 `json:"closeVol"`
	HoldAvgPrice   float64 `json:"holdAvgPrice"`
	CloseAvgPrice  float64 `json:"closeAvgPrice"`
	OpenAvgPrice   float64 `json:"openAvgPrice"`
	LiquidatePrice float64 `json:"liquidatePrice"`
	Oim            float64 `json:"oim"`
	Im             float64 `json:"im"`
	HoldFee        float64 `json:"holdFee"`
	Realised       float64 `json:"realised"`

	HoldVol    float64 `json:"holdVol"`
	Leverage   int     `json:"leverage"`
	CreateTime int64   `json:"createTime"`
	UpdateTime int64   `json:"updateTime"`
	AutoAddIm  bool    `json:"autoAddIm"`
}

type OpenType

type OpenType = int

type OrderSide

type OrderSide = int
var (
	OpenLong   OrderSide = 1
	CloseShort OrderSide = 2
	OpenShort  OrderSide = 3
	CloseLong  OrderSide = 4
)

type OrderType

type OrderType = int
var (
	LimitOrder             OrderType = 1
	PostOnlyMaker          OrderType = 2
	TransactOrCancel       OrderType = 3
	TransactAllOrCancelAll OrderType = 4
	MarketOrder            OrderType = 5
	ConvertToCurrentPrice  OrderType = 6
)

type Response

type Response struct {
	Success bool `json:"success"`
	Code    int  `json:"code"`
}

type SetLeverageParams

type SetLeverageParams struct {
	PositionId   int64  `url:"positionId,omitempty" validate:"omitempty"`
	Leverage     int    `url:"positionId,omitempty" validate:"required"`
	OpenType     int    `url:"openType,omitempty" validate:"omitempty"`
	Symbol       string `url:"symbol,omitempty" validate:"omitempty"`
	PositionType int    `url:"positionType,omitempty" validate:"omitempty"`
}

type SetLeverageResp

type SetLeverageResp struct {
	Response
	Data struct {
		PositionId   int64  `json:"positionId"`
		Leverage     int    `json:"leverage"`
		Symbol       string `json:"symbol"`
		PositionType int    `json:"positionType"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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