rest

package
v0.0.0-...-d37026a Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountRatio

type AccountRatio struct {
	Symbol    string       `json:"symbol"`
	BuyRatio  sjson.Number `json:"buy_ratio"`
	SellRatio sjson.Number `json:"sell_ratio"`
	Timestamp sjson.Number `json:"timestamp"`
}

type Balance

type Balance struct {
	Equity           float64 `json:"equity"`
	AvailableBalance float64 `json:"available_balance"`
	UsedMargin       float64 `json:"used_margin"`
	OrderMargin      float64 `json:"order_margin"`
	PositionMargin   float64 `json:"position_margin"`
	OccClosingFee    float64 `json:"occ_closing_fee"`
	OccFundingFee    float64 `json:"occ_funding_fee"`
	WalletBalance    float64 `json:"wallet_balance"`
	RealisedPnl      float64 `json:"realised_pnl"`
	UnrealisedPnl    float64 `json:"unrealised_pnl"`
	CumRealisedPnl   float64 `json:"cum_realised_pnl"`
	GivenCash        float64 `json:"given_cash"`
	ServiceCash      float64 `json:"service_cash"`
}

type BaseResult

type BaseResult struct {
	RetCode          int         `json:"ret_code"`
	RetMsg           string      `json:"ret_msg"`
	ExtCode          string      `json:"ext_code"`
	ExtInfo          string      `json:"ext_info"`
	Result           interface{} `json:"result"`
	TimeNow          string      `json:"time_now"`
	RateLimitStatus  int         `json:"rate_limit_status"`
	RateLimitResetMs int64       `json:"rate_limit_reset_ms"`
	RateLimit        int         `json:"rate_limit"`
}

type ByBit

type ByBit struct {
	// contains filtered or unexported fields
}

Bybit

func New

func New(httpClient *http.Client, baseURL string, apiKey string, secretKey string, debugMode bool) *ByBit

New

func (*ByBit) CancelAllOrder

func (b *ByBit) CancelAllOrder(symbol string) (query string, resp []byte, result []Order, err error)

CancelAllOrder

func (*ByBit) CancelAllStopOrders

func (b *ByBit) CancelAllStopOrders(symbol string) (query string, resp []byte, result []StopOrder, err error)

CancelAllStopOrders

func (*ByBit) CancelOrder

func (b *ByBit) CancelOrder(orderID string, symbol string) (query string, resp []byte, result Order, err error)

CancelOrder

func (*ByBit) CancelStopOrder

func (b *ByBit) CancelStopOrder(orderID string, symbol string) (query string, resp []byte, result StopOrder, err error)

CancelStopOrder

func (*ByBit) CreateOrder

func (b *ByBit) CreateOrder(side string, orderType string, price float64,
	qty int, timeInForce string, takeProfit float64, stopLoss float64, reduceOnly bool,
	closeOnTrigger bool, orderLinkID string, symbol string) (query string, resp []byte, result Order, err error)

CreateOrder

func (*ByBit) CreateStopOrder

func (b *ByBit) CreateStopOrder(side string, orderType string, price float64, basePrice float64, stopPx float64,
	qty int, triggerBy string, timeInForce string, closeOnTrigger bool, symbol string) (query string, resp []byte, result StopOrder, err error)

CreateStopOrder

func (*ByBit) GetAccountRatio

func (b *ByBit) GetAccountRatio(symbol string, period string, limit int) (query string, resp []byte, result []AccountRatio, err error)

GetAccountRatio, limit max 200

func (*ByBit) GetActiveOrders

func (b *ByBit) GetActiveOrders(symbol string) (query string, resp []byte, result OrderArrayResponse, err error)

GetActiveOrders

func (*ByBit) GetActiveStopOrders

func (b *ByBit) GetActiveStopOrders(symbol string) (query string, resp []byte, result StopOrderArrayResponse, err error)

GetActiveStopOrders

func (*ByBit) GetFunding

func (b *ByBit) GetFunding(symbol string, page int, limit int) (query string, resp []byte, result []FundingData, e error)

GetFunding https://api2.bybit.com/funding-rate/list?symbol=BTCUSD&date=&export=false&page=1&limit=20

func (*ByBit) GetKLine

func (b *ByBit) GetKLine(symbol string, interval string, from int64, limit int) (query string, resp []byte, result []OHLC, err error)

GetKLine

func (*ByBit) GetOpenInterest

func (b *ByBit) GetOpenInterest(symbol string, period string, limit int) (query string, resp []byte, result []OpenInterest, err error)

GetOpenInterest, limit max 200

func (*ByBit) GetOrderBook

func (b *ByBit) GetOrderBook(symbol string) (query string, resp []byte, result OrderBook, err error)

GetOrderBook Get the orderbook. Each side has a depth of 50.

func (*ByBit) GetOrders

func (b *ByBit) GetOrders(symbol string, orderStatus string, direction string, limit int, cursor string) (query string, resp []byte, result OrderListResponseResult, err error)

GetOrders

func (*ByBit) GetPosition

func (b *ByBit) GetPosition(symbol string) (query string, resp []byte, result Position, err error)

GetPosition

func (*ByBit) GetPositions

func (b *ByBit) GetPositions() (query string, resp []byte, result []PositionData, err error)

GetPositions

func (*ByBit) GetPremiumIndex

func (b *ByBit) GetPremiumIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error)

GetPremiumIndex https://api2.bybit.com/api/premium-index-price/index?symbol=BTCUSD&from=1605087277&resolution=1&to=1605173738

func (*ByBit) GetPriceIndex

func (b *ByBit) GetPriceIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error)

GetPriceIndex https://api2.bybit.com/api/price/index?symbol=BTCUSD&resolution=1&from=1605087277&to=1605173738

func (*ByBit) GetServerTime

func (b *ByBit) GetServerTime() (query string, resp []byte, timeNow int64, err error)

GetServerTime

func (*ByBit) GetStopOrders

func (b *ByBit) GetStopOrders(symbol string, stopOrderStatus string, direction string, limit int, cursor string) (query string, resp []byte, result StopOrderListResponseResult, err error)

GetStopOrders

func (*ByBit) GetSymbols

func (b *ByBit) GetSymbols() (query string, resp []byte, result []SymbolInfo, err error)

GetSymbols

func (*ByBit) GetTickers

func (b *ByBit) GetTickers() (query string, resp []byte, result []Ticker, err error)

GetTickers

func (*ByBit) GetTradingRecords

func (b *ByBit) GetTradingRecords(symbol string, from int64, limit int) (query string, resp []byte, result []TradingRecord, err error)

GetTradingRecords

func (*ByBit) GetWalletBalance

func (b *ByBit) GetWalletBalance(coin string) (query string, resp []byte, result Balance, err error)

GetWalletBalance

func (*ByBit) LinearCancelAllOrder

func (b *ByBit) LinearCancelAllOrder(symbol string) (query string, resp []byte, result []string, err error)

LinearCancelAllOrder

func (*ByBit) LinearCancelAllStopOrders

func (b *ByBit) LinearCancelAllStopOrders(symbol string) (query string, resp []byte, result []string, err error)

CancelAllStopOrders

func (*ByBit) LinearCancelOrder

func (b *ByBit) LinearCancelOrder(orderID string, orderLinkId string, symbol string) (query string, resp []byte, result Order, err error)

LinearCancelOrder orderID: Order ID. Required if not passing order_link_id orderLinkId: Unique user-set order ID. Required if not passing order_id

func (*ByBit) LinearCancelStopOrder

func (b *ByBit) LinearCancelStopOrder(orderID string, symbol string) (query string, resp []byte, result StopOrder, err error)

CancelStopOrder

func (*ByBit) LinearCreateOrder

func (b *ByBit) LinearCreateOrder(side string, orderType string, price float64,
	qty float64, timeInForce string, takeProfit float64, stopLoss float64, reduceOnly bool,
	closeOnTrigger bool, orderLinkID string, symbol string) (query string, resp []byte, result Order, err error)

LinearCreateOrder CreateOrder side: Buy/Sell orderType: Limit/Market timeInForce: GoodTillCancel/ImmediateOrCancel/FillOrKill/PostOnly

func (*ByBit) LinearCreateStopOrder

func (b *ByBit) LinearCreateStopOrder(side string, orderType string, price float64, basePrice float64, stopPx float64,
	qty float64, triggerBy string, timeInForce string, closeOnTrigger bool, symbol string, reduceOnly bool) (query string, resp []byte, result StopOrder, err error)

CreateStopOrder

func (*ByBit) LinearGetActiveOrder

func (b *ByBit) LinearGetActiveOrder(symbol string, orderId string, orderLinkId string) (query string, resp []byte, result OrderResponse, err error)

LinearGetActiveOrder Query real-time active order information. If only order_id or order_link_id are passed, a single order will be returned; otherwise, returns up to 500 unfilled orders.

func (*ByBit) LinearGetActiveOrders

func (b *ByBit) LinearGetActiveOrders(symbol string) (query string, resp []byte, result OrderArrayResponse, err error)

LinearGetActiveOrders Query real-time active order information. If only order_id or order_link_id are passed, a single order will be returned; otherwise, returns up to 500 unfilled orders.

func (*ByBit) LinearGetActiveStopOrders

func (b *ByBit) LinearGetActiveStopOrders(symbol string) (query string, resp []byte, result StopOrderArrayResponse, err error)

LinearGetActiveStopOrders

func (*ByBit) LinearGetFunding

func (b *ByBit) LinearGetFunding(symbol string, page int, limit int) (query string, resp []byte, result []FundingData, e error)

LinearGetFunding https://api2.bybit.com/linear/funding-rate/list?symbol=BTCUSDT&date=&export=false&page=1

func (*ByBit) LinearGetKLine

func (b *ByBit) LinearGetKLine(symbol string, interval string, from int64, limit int) (query string, resp []byte, result []OHLCLinear, err error)

LinearGetKLine

func (*ByBit) LinearGetOrders

func (b *ByBit) LinearGetOrders(symbol string, orderStatus string, limit int, page int) (query string, resp []byte, result OrderListResponseResultPaginated, err error)

LinearGetOrders GetOrders orderStatus: Created - order has been accepted by the system but not yet put through the matching engine Rejected - order has been triggered but failed to be placed (e.g. due to insufficient margin) New - order has been placed successfully PartiallyFilled Filled Cancelled PendingCancel - matching engine has received the cancelation request but it may not be canceled successfully

func (*ByBit) LinearGetPosition

func (b *ByBit) LinearGetPosition(symbol string) (query string, resp []byte, result []LinearPosition, err error)

LinearGetPosition

func (*ByBit) LinearGetPositions

func (b *ByBit) LinearGetPositions() (query string, resp []byte, result []LinearPositionData, err error)

LinearGetPositions

func (*ByBit) LinearGetPremiumIndex

func (b *ByBit) LinearGetPremiumIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error)

LinearGetPremiumIndex https://api2.bybit.com/api/linear/public/kline/premium-price?symbol=BTCUSDT&from=1607364960&to=1610011020&resolution=30

func (*ByBit) LinearGetPriceIndex

func (b *ByBit) LinearGetPriceIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error)

LinearGetPriceIndex https://api2.bybit.com/api/linear/public/kline/price?symbol=BTCUSDT&from=1607360460&to=1610006520&resolution=30

func (*ByBit) LinearGetStopOrders

func (b *ByBit) LinearGetStopOrders(symbol string, stopOrderStatus string, limit int, page int) (query string, resp []byte, result StopOrderListResponseResult, err error)

LinearGetStopOrders

func (*ByBit) LinearReplaceOrder

func (b *ByBit) LinearReplaceOrder(symbol string, orderID string, orderLinkId string, qty float64, price float64,
	takeProfit float64, stopLoss float64, tpTriggerBy string, slTriggerBy string) (query string, resp []byte, orderId string, err error)

LinearReplaceOrder Replace order can modify/amend your active orders.

func (*ByBit) LinearReplaceStopOrder

func (b *ByBit) LinearReplaceStopOrder(symbol string, orderID string, qty float64, price float64, triggerPrice float64) (query string, resp []byte, result StopOrder, err error)

ReplaceStopOrder

func (*ByBit) PublicRequest

func (b *ByBit) PublicRequest(method string, apiURL string, params map[string]interface{}, result interface{}) (fullURL string, resp []byte, err error)

PublicRequest

func (*ByBit) ReplaceOrder

func (b *ByBit) ReplaceOrder(symbol string, orderID string, qty int, price float64) (query string, resp []byte, result Order, err error)

ReplaceOrder

func (*ByBit) ReplaceStopOrder

func (b *ByBit) ReplaceStopOrder(symbol string, orderID string, qty int, price float64, triggerPrice float64) (query string, resp []byte, result StopOrder, err error)

ReplaceStopOrder

func (*ByBit) SetCorrectServerTime

func (b *ByBit) SetCorrectServerTime() (err error)

SetCorrectServerTime

func (*ByBit) SetLeverage

func (b *ByBit) SetLeverage(leverage int, symbol string) (query string, resp []byte, err error)

SetLeverage

func (*ByBit) SignedRequest

func (b *ByBit) SignedRequest(method string, apiURL string, params map[string]interface{}, result interface{}) (fullURL string, resp []byte, err error)

SignedRequest

func (*ByBit) WalletRecords

func (b *ByBit) WalletRecords(symbol string, page int, limit int) (query string, resp []byte, result []WalletFundRecord, err error)

WalletRecords

type Funding

type Funding struct {
	CurrentPage  int           `json:"current_page"`
	Data         []FundingData `json:"data"`
	FirstPageUrl string        `json:"first_page_url"`
	From         int           `json:"from"`
	LastPage     int           `json:"last_page"`
	LastPageUrl  string        `json:"last_page_url"`
	NextPageUrl  string        `json:"next_page_url"`
	Path         string        `json:"path"`
	PerPage      sjson.Number  `json:"per_page"`
	PrevPageUrl  string        `json:"prev_page_url"`
	To           int           `json:"to"`
	Total        int           `json:"total"`
}

type FundingData

type FundingData struct {
	Id     int          `json:"id"`
	Symbol string       `json:"symbol"`
	Value  sjson.Number `json:"value"`
	Time   string       `json:"time"`
}

type FundingResult

type FundingResult struct {
	BaseResult
	Result Funding `json:"result"`
}

type GetAccountRatioResult

type GetAccountRatioResult struct {
	BaseResult
	Result []AccountRatio `json:"result"`
}

type GetBalanceResult

type GetBalanceResult struct {
	RetCode          int                  `json:"ret_code"`
	RetMsg           string               `json:"ret_msg"`
	ExtCode          string               `json:"ext_code"`
	ExtInfo          string               `json:"ext_info"`
	Result           GetBalanceResultData `json:"result"`
	TimeNow          string               `json:"time_now"`
	RateLimitStatus  int                  `json:"rate_limit_status"`
	RateLimitResetMs int64                `json:"rate_limit_reset_ms"`
	RateLimit        int                  `json:"rate_limit"`
}

type GetBalanceResultData

type GetBalanceResultData struct {
	BTC  Balance `json:"BTC"`
	ETH  Balance `json:"ETH"`
	EOS  Balance `json:"EOS"`
	XRP  Balance `json:"XRP"`
	USDT Balance `json:"USDT"`
}

type GetKlineResult

type GetKlineResult struct {
	BaseResult
	Result []OHLC `json:"result"`
}

type GetLinearKlineResult

type GetLinearKlineResult struct {
	BaseResult
	Result []OHLCLinear `json:"result"`
}

type GetOpenInterestResult

type GetOpenInterestResult struct {
	BaseResult
	Result []OpenInterest `json:"result"`
}

type GetOrderBookResult

type GetOrderBookResult struct {
	BaseResult
	Result []RawItem `json:"result"`
}

type GetSymbolsResult

type GetSymbolsResult struct {
	RetCode int          `json:"ret_code"`
	RetMsg  string       `json:"ret_msg"`
	ExtCode string       `json:"ext_code"`
	ExtInfo string       `json:"ext_info"`
	Result  []SymbolInfo `json:"result"`
	TimeNow string       `json:"time_now"`
}

type GetTickersResult

type GetTickersResult struct {
	RetCode int      `json:"ret_code"`
	RetMsg  string   `json:"ret_msg"`
	ExtCode string   `json:"ext_code"`
	ExtInfo string   `json:"ext_info"`
	Result  []Ticker `json:"result"`
	TimeNow string   `json:"time_now"`
}

type GetTradingRecordsResult

type GetTradingRecordsResult struct {
	RetCode int             `json:"ret_code"`
	RetMsg  string          `json:"ret_msg"`
	ExtCode string          `json:"ext_code"`
	ExtInfo string          `json:"ext_info"`
	Result  []TradingRecord `json:"result"`
	TimeNow string          `json:"time_now"`
}

type IndexOHLC

type IndexOHLC struct {
	Id      int          `json:"id"`
	Symbol  string       `json:"symbol"`
	Open    sjson.Number `json:"open"`
	High    sjson.Number `json:"high"`
	Low     sjson.Number `json:"low"`
	Close   sjson.Number `json:"close"`
	StartAt int          `json:"start_at"`
	Period  string       `json:"period"`
}

type IndexOHLCResult

type IndexOHLCResult struct {
	BaseResult
	Result []IndexOHLC `json:"result"`
}

type Item

type Item struct {
	Price float64 `json:"price,string"`
	Size  float64 `json:"size"`
}

type LeverageFilter

type LeverageFilter struct {
	MinLeverage  int     `json:"min_leverage"`
	MaxLeverage  int     `json:"max_leverage"`
	LeverageStep float64 `json:"leverage_step,string"`
}

type LinearPosition

type LinearPosition struct {
	UserID              int     `json:"user_id"`
	Symbol              string  `json:"symbol"`
	Side                string  `json:"side"`
	Size                float64 `json:"size"`
	PositionValue       float64 `json:"position_value"`
	EntryPrice          float64 `json:"entry_price"`
	LiqPrice            float64 `json:"liq_price"`
	BustPrice           float64 `json:"bust_price"`
	Leverage            float64 `json:"leverage"`
	AutoAddMargin       float64 `json:"auto_add_margin"`
	IsIsolated          bool    `json:"is_isolated"`
	PositionMargin      float64 `json:"position_margin"`
	OccClosingFee       float64 `json:"occ_closing_fee"`
	RealisedPnl         float64 `json:"realised_pnl"`
	CumRealisedPnl      float64 `json:"cum_realised_pnl"`
	FreeQty             float64 `json:"free_qty"`
	TpSlMode            string  `json:"tp_sl_mode"`
	UnrealisedPnl       float64 `json:"unrealised_pnl"`
	DeleverageIndicator float64 `json:"deleverage_indicator"`
	RiskID              int     `json:"risk_id"`
	StopLoss            float64 `json:"stop_loss"`
	TakeProfit          float64 `json:"take_profit"`
	TrailingStop        float64 `json:"trailing_stop"`
	PositionIdx         int     `json:"position_idx"`
	Mode                string  `json:"mode"`
}

type LinearPositionArrayResponse

type LinearPositionArrayResponse struct {
	BaseResult
	Result []LinearPosition `json:"result"`
}

type LinearPositionData

type LinearPositionData struct {
	IsValid bool           `json:"is_valid"`
	Data    LinearPosition `json:"data"`
}

type LinearPositionDataArrayResponse

type LinearPositionDataArrayResponse struct {
	BaseResult
	Result []LinearPositionData `json:"result"`
}

type LotSizeFilter

type LotSizeFilter struct {
	MaxTradingQty int `json:"max_trading_qty"`
	MinTradingQty int `json:"min_trading_qty"`
	QtyStep       int `json:"qty_step"`
}

type OHLC

type OHLC struct {
	Symbol   string  `json:"symbol"`
	Interval string  `json:"interval"`
	OpenTime int64   `json:"open_time"`
	Open     float64 `json:"open,string"`
	High     float64 `json:"high,string"`
	Low      float64 `json:"low,string"`
	Close    float64 `json:"close,string"`
	Volume   float64 `json:"volume,string"`
	Turnover float64 `json:"turnover,string"`
}

type OHLCLinear

type OHLCLinear struct {
	Symbol   string  `json:"symbol"`
	Period   string  `json:"period"`
	OpenTime int64   `json:"open_time"`
	Open     float64 `json:"open"`
	High     float64 `json:"high"`
	Low      float64 `json:"low"`
	Close    float64 `json:"close"`
	Volume   float64 `json:"volume"`
	Turnover float64 `json:"turnover"`
}

type OpenInterest

type OpenInterest struct {
	Symbol       string       `json:"symbol"`
	OpenInterest sjson.Number `json:"open_interest"`
	Timestamp    sjson.Number `json:"timestamp"`
}

type Order

type Order struct {
	UserId        int          `json:"user_id"`
	OrderId       string       `json:"order_id"`
	Symbol        string       `json:"symbol"`
	Side          string       `json:"side"`
	OrderType     string       `json:"order_type"`
	Price         sjson.Number `json:"price"`
	Qty           sjson.Number `json:"qty"`
	TimeInForce   string       `json:"time_in_force"`
	OrderStatus   string       `json:"order_status"`
	LastExecTime  sjson.Number `json:"last_exec_time"`
	LastExecPrice sjson.Number `json:"last_exec_price"`
	LeavesQty     sjson.Number `json:"leaves_qty"`
	CumExecQty    sjson.Number `json:"cum_exec_qty"`
	CumExecValue  sjson.Number `json:"cum_exec_value"`
	CumExecFee    sjson.Number `json:"cum_exec_fee"`
	RejectReason  string       `json:"reject_reason"`
	OrderLinkID   string       `json:"order_link_id"`
	CreatedAt     time.Time    `json:"created_at"`
	UpdatedAt     time.Time    `json:"updated_at"`
}

type OrderArrayResponse

type OrderArrayResponse struct {
	BaseResult
	Result []Order `json:"result"`
}

type OrderBook

type OrderBook struct {
	Asks []Item    `json:"asks"`
	Bids []Item    `json:"bids"`
	Time time.Time `json:"time"`
}

type OrderListResponse

type OrderListResponse struct {
	BaseResult
	Result OrderListResponseResult `json:"result"`
}

type OrderListResponseArray

type OrderListResponseArray struct {
	Data []WalletFundRecord `json:"data"`
}

type OrderListResponsePaginated

type OrderListResponsePaginated struct {
	BaseResult
	Result OrderListResponseResultPaginated `json:"result"`
}

type OrderListResponseResult

type OrderListResponseResult struct {
	Data   []Order `json:"data"`
	Cursor string  `json:"cursor"`
}

type OrderListResponseResultPaginated

type OrderListResponseResultPaginated struct {
	CurrentPage sjson.Number `json:"current_page"`
	LastPage    sjson.Number `json:"last_page"`
	Data        []Order      `json:"data"`
}

type OrderResponse

type OrderResponse struct {
	BaseResult
	Result Order `json:"result"`
}

type Position

type Position struct {
	Id                  int       `json:"id"`
	UserId              int       `json:"user_id"`
	RiskId              int       `json:"risk_id"`
	Symbol              string    `json:"symbol"`
	Size                float64   `json:"size"`
	Side                string    `json:"side"`
	EntryPrice          float64   `json:"entry_price,string"`
	LiqPrice            float64   `json:"liq_price,string"`
	BustPrice           float64   `json:"bust_price,string"`
	TakeProfit          float64   `json:"take_profit,string"`
	StopLoss            float64   `json:"stop_loss,string"`
	TrailingStop        float64   `json:"trailing_stop,string"`
	PositionValue       float64   `json:"position_value,string"`
	Leverage            float64   `json:"leverage,string"`
	PositionStatus      string    `json:"position_status"`
	AutoAddMargin       float64   `json:"auto_add_margin"`
	OrderMargin         float64   `json:"order_margin,string"`
	PositionMargin      float64   `json:"position_margin,string"`
	OccClosingFee       float64   `json:"occ_closing_fee,string"`
	OccFundingFee       float64   `json:"occ_funding_fee,string"`
	WalletBalance       float64   `json:"wallet_balance,string"`
	CumRealisedPnl      float64   `json:"cum_realised_pnl,string"`
	CumCommission       float64   `json:"cum_commission,string"`
	RealisedPnl         float64   `json:"realised_pnl,string"`
	DeleverageIndicator float64   `json:"deleverage_indicator"`
	OcCalcData          string    `json:"oc_calc_data"`
	CrossSeq            float64   `json:"cross_seq"`
	PositionSeq         float64   `json:"position_seq"`
	CreatedAt           time.Time `json:"created_at"`
	UpdatedAt           time.Time `json:"updated_at"`
	UnrealisedPnl       float64   `json:"unrealised_pnl"`
}

type PositionArrayResponse

type PositionArrayResponse struct {
	BaseResult
	Result []PositionData `json:"result"`
}

type PositionData

type PositionData struct {
	IsValid bool     `json:"is_valid"`
	Data    Position `json:"data"`
}

type PositionResponse

type PositionResponse struct {
	BaseResult
	Result Position `json:"result"`
}

type PriceFilter

type PriceFilter struct {
	MinPrice float64 `json:"min_price,string"`
	MaxPrice float64 `json:"max_price,string"`
	TickSize float64 `json:"tick_size,string"`
}

type RawItem

type RawItem struct {
	Symbol string  `json:"symbol"`
	Price  float64 `json:"price,string"`
	Size   float64 `json:"size"`
	Side   string  `json:"side"` // Buy/Sell
}

type ResultStringArrayResponse

type ResultStringArrayResponse struct {
	BaseResult
	Result []string `json:"result"`
}

type StopOrder

type StopOrder struct {
	OrderId           string       `json:"order_id"`
	OrderType         string       `json:"order_type"`
	OrderStatus       string       `json:"order_status"`
	StopOrderId       string       `json:"stop_order_id"`
	StopOrderType     string       `json:"stop_order_type"`
	StopOrderStatus   string       `json:"stop_order_status"`
	StopPx            sjson.Number `json:"stop_px"`
	UserId            int64        `json:"user_id"`
	Symbol            string       `json:"symbol"`
	Side              string       `json:"side"`
	Price             sjson.Number `json:"price"`
	Qty               sjson.Number `json:"qty"`
	TimeInForce       string       `json:"time_in_force"`
	CreateType        string       `json:"create_type"`
	CancelType        string       `json:"cancel_type"`
	LeavesQty         sjson.Number `json:"leaves_qty"`
	LeavesValue       string       `json:"leaves_value"`
	CreatedAt         time.Time    `json:"created_at"`
	UpdatedAt         time.Time    `json:"updated_at"`
	CrossStatus       string       `json:"cross_status"`
	CrossSeq          sjson.Number `json:"cross_seq"`
	TriggerBy         string       `json:"trigger_by"`
	BasePrice         sjson.Number `json:"base_price"`
	ExpectedDirection string       `json:"expected_direction"`
}

type StopOrderArrayResponse

type StopOrderArrayResponse struct {
	BaseResult
	Result []StopOrder `json:"result"`
}

type StopOrderListResponse

type StopOrderListResponse struct {
	BaseResult
	Result StopOrderListResponseResult `json:"result"`
}

type StopOrderListResponsePaginated

type StopOrderListResponsePaginated struct {
	BaseResult
	Result StopOrderListResponseResultPaginated `json:"result"`
}

type StopOrderListResponseResult

type StopOrderListResponseResult struct {
	Data   []StopOrder `json:"data"`
	Cursor string      `json:"cursor"`
}

type StopOrderListResponseResultPaginated

type StopOrderListResponseResultPaginated struct {
	CurrentPage string      `json:"current_page"`
	LastPage    string      `json:"last_page"`
	Data        []StopOrder `json:"data"`
}

type StopOrderResponse

type StopOrderResponse struct {
	BaseResult
	Result StopOrder `json:"result"`
}

type SymbolInfo

type SymbolInfo struct {
	Name           string         `json:"name"`
	BaseCurrency   string         `json:"base_currency"`
	QuoteCurrency  string         `json:"quote_currency"`
	PriceScale     int            `json:"price_scale"`
	TakerFee       float64        `json:"taker_fee,string"`
	MakerFee       float64        `json:"maker_fee,string"`
	LeverageFilter LeverageFilter `json:"leverage_filter"`
	PriceFilter    PriceFilter    `json:"price_filter"`
	LotSizeFilter  LotSizeFilter  `json:"lot_size_filter"`
}

type Ticker

type Ticker struct {
	Symbol               string       `json:"symbol"`
	BidPrice             sjson.Number `json:"bid_price"`
	AskPrice             sjson.Number `json:"ask_price"`
	LastPrice            float64      `json:"last_price,string"`
	LastTickDirection    string       `json:"last_tick_direction"`
	PrevPrice24H         float64      `json:"prev_price_24h,string"`
	Price24HPcnt         float64      `json:"price_24h_pcnt,string"`
	HighPrice24H         float64      `json:"high_price_24h,string"`
	LowPrice24H          float64      `json:"low_price_24h,string"`
	PrevPrice1H          float64      `json:"prev_price_1h,string"`
	Price1HPcnt          float64      `json:"price_1h_pcnt,string"`
	MarkPrice            float64      `json:"mark_price,string"`
	IndexPrice           float64      `json:"index_price,string"`
	OpenInterest         float64      `json:"open_interest"`
	OpenValue            float64      `json:"open_value,string"`
	TotalTurnover        float64      `json:"total_turnover,string"`
	Turnover24H          float64      `json:"turnover_24h,string"`
	TotalVolume          float64      `json:"total_volume"`
	Volume24H            float64      `json:"volume_24h"`
	FundingRate          float64      `json:"funding_rate,string"`
	PredictedFundingRate float64      `json:"predicted_funding_rate,string"`
	NextFundingTime      string       `json:"next_funding_time"` // string because can be empty, parse it with "2006-01-02T15:04:05Z07:00"
	CountdownHour        int          `json:"countdown_hour"`
}

type TradingRecord

type TradingRecord struct {
	ID     int       `json:"id"`
	Symbol string    `json:"symbol"`
	Price  float64   `json:"price"`
	Qty    int       `json:"qty"`
	Side   string    `json:"side"`
	Time   time.Time `json:"time"`
}

type WalletFundRecord

type WalletFundRecord struct {
	Id            int          `json:"id"`
	UserId        int          `json:"user_id"`
	Coin          string       `json:"coin"`
	WalletId      int          `json:"wallet_id"`
	Type          string       `json:"type"`
	Amount        sjson.Number `json:"amount"`
	TxId          string       `json:"tx_id"`
	Address       string       `json:"address"`
	WalletBalance sjson.Number `json:"wallet_balance"`
	ExecTime      sjson.Number `json:"exec_time"`
	CrossSeq      sjson.Number `json:"cross_seq"`
}

type WalletFundRecordResponse

type WalletFundRecordResponse struct {
	BaseResult
	Result OrderListResponseArray `json:"result"`
}

Jump to

Keyboard shortcuts

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