Documentation
¶
Index ¶
- type AccountRatio
- type Balance
- type BaseResult
- type ByBit
- func (b *ByBit) CancelAllOrder(symbol string) (query string, resp []byte, result []Order, err error)
- func (b *ByBit) CancelAllStopOrders(symbol string) (query string, resp []byte, result []StopOrder, err error)
- func (b *ByBit) CancelOrder(orderID string, symbol string) (query string, resp []byte, result Order, err error)
- func (b *ByBit) CancelStopOrder(orderID string, symbol string) (query string, resp []byte, result StopOrder, err error)
- func (b *ByBit) CreateOrder(side string, orderType string, price float64, qty int, timeInForce string, ...) (query string, resp []byte, result Order, err error)
- func (b *ByBit) CreateStopOrder(side string, orderType string, price float64, basePrice float64, ...) (query string, resp []byte, result StopOrder, err error)
- func (b *ByBit) GetAccountRatio(symbol string, period string, limit int) (query string, resp []byte, result []AccountRatio, err error)
- func (b *ByBit) GetActiveOrders(symbol string) (query string, resp []byte, result OrderArrayResponse, err error)
- func (b *ByBit) GetActiveStopOrders(symbol string) (query string, resp []byte, result StopOrderArrayResponse, err error)
- func (b *ByBit) GetFunding(symbol string, page int, limit int) (query string, resp []byte, result []FundingData, e error)
- func (b *ByBit) GetKLine(symbol string, interval string, from int64, limit int) (query string, resp []byte, result []OHLC, err error)
- func (b *ByBit) GetOpenInterest(symbol string, period string, limit int) (query string, resp []byte, result []OpenInterest, err error)
- func (b *ByBit) GetOrderBook(symbol string) (query string, resp []byte, result OrderBook, err error)
- func (b *ByBit) GetOrders(symbol string, orderStatus string, direction string, limit int, cursor string) (query string, resp []byte, result OrderListResponseResult, err error)
- func (b *ByBit) GetPosition(symbol string) (query string, resp []byte, result Position, err error)
- func (b *ByBit) GetPositions() (query string, resp []byte, result []PositionData, err error)
- func (b *ByBit) GetPremiumIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error)
- func (b *ByBit) GetPriceIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error)
- func (b *ByBit) GetServerTime() (query string, resp []byte, timeNow int64, err error)
- func (b *ByBit) GetStopOrders(symbol string, stopOrderStatus string, direction string, limit int, ...) (query string, resp []byte, result StopOrderListResponseResult, err error)
- func (b *ByBit) GetSymbols() (query string, resp []byte, result []SymbolInfo, err error)
- func (b *ByBit) GetTickers() (query string, resp []byte, result []Ticker, err error)
- func (b *ByBit) GetTradingRecords(symbol string, from int64, limit int) (query string, resp []byte, result []TradingRecord, err error)
- func (b *ByBit) GetWalletBalance(coin string) (query string, resp []byte, result Balance, err error)
- func (b *ByBit) LinearCancelAllOrder(symbol string) (query string, resp []byte, result []string, err error)
- func (b *ByBit) LinearCancelAllStopOrders(symbol string) (query string, resp []byte, result []string, err error)
- func (b *ByBit) LinearCancelOrder(orderID string, orderLinkId string, symbol string) (query string, resp []byte, result Order, err error)
- func (b *ByBit) LinearCancelStopOrder(orderID string, symbol string) (query string, resp []byte, result StopOrder, err error)
- func (b *ByBit) LinearCreateOrder(side string, orderType string, price float64, qty float64, timeInForce string, ...) (query string, resp []byte, result Order, err error)
- func (b *ByBit) LinearCreateStopOrder(side string, orderType string, price float64, basePrice float64, ...) (query string, resp []byte, result StopOrder, err error)
- func (b *ByBit) LinearGetActiveOrder(symbol string, orderId string, orderLinkId string) (query string, resp []byte, result OrderResponse, err error)
- func (b *ByBit) LinearGetActiveOrders(symbol string) (query string, resp []byte, result OrderArrayResponse, err error)
- func (b *ByBit) LinearGetActiveStopOrders(symbol string) (query string, resp []byte, result StopOrderArrayResponse, err error)
- func (b *ByBit) LinearGetFunding(symbol string, page int, limit int) (query string, resp []byte, result []FundingData, e error)
- func (b *ByBit) LinearGetKLine(symbol string, interval string, from int64, limit int) (query string, resp []byte, result []OHLCLinear, err error)
- func (b *ByBit) LinearGetOrders(symbol string, orderStatus string, limit int, page int) (query string, resp []byte, result OrderListResponseResultPaginated, err error)
- func (b *ByBit) LinearGetPosition(symbol string) (query string, resp []byte, result []LinearPosition, err error)
- func (b *ByBit) LinearGetPositions() (query string, resp []byte, result []LinearPositionData, err error)
- func (b *ByBit) LinearGetPremiumIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error)
- func (b *ByBit) LinearGetPriceIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error)
- func (b *ByBit) LinearGetStopOrders(symbol string, stopOrderStatus string, limit int, page int) (query string, resp []byte, result StopOrderListResponseResult, err error)
- func (b *ByBit) LinearReplaceOrder(symbol string, orderID string, orderLinkId string, qty float64, price float64, ...) (query string, resp []byte, orderId string, err error)
- func (b *ByBit) LinearReplaceStopOrder(symbol string, orderID string, qty float64, price float64, ...) (query string, resp []byte, result StopOrder, err error)
- func (b *ByBit) PublicRequest(method string, apiURL string, params map[string]interface{}, ...) (fullURL string, resp []byte, err error)
- func (b *ByBit) ReplaceOrder(symbol string, orderID string, qty int, price float64) (query string, resp []byte, result Order, err error)
- func (b *ByBit) ReplaceStopOrder(symbol string, orderID string, qty int, price float64, triggerPrice float64) (query string, resp []byte, result StopOrder, err error)
- func (b *ByBit) SetCorrectServerTime() (err error)
- func (b *ByBit) SetLeverage(leverage int, symbol string) (query string, resp []byte, err error)
- func (b *ByBit) SignedRequest(method string, apiURL string, params map[string]interface{}, ...) (fullURL string, resp []byte, err error)
- func (b *ByBit) WalletRecords(symbol string, page int, limit int) (query string, resp []byte, result []WalletFundRecord, err error)
- type Funding
- type FundingData
- type FundingResult
- type GetAccountRatioResult
- type GetBalanceResult
- type GetBalanceResultData
- type GetKlineResult
- type GetLinearKlineResult
- type GetOpenInterestResult
- type GetOrderBookResult
- type GetSymbolsResult
- type GetTickersResult
- type GetTradingRecordsResult
- type IndexOHLC
- type IndexOHLCResult
- type Item
- type LeverageFilter
- type LinearPosition
- type LinearPositionArrayResponse
- type LinearPositionData
- type LinearPositionDataArrayResponse
- type LotSizeFilter
- type OHLC
- type OHLCLinear
- type OpenInterest
- type Order
- type OrderArrayResponse
- type OrderBook
- type OrderListResponse
- type OrderListResponseArray
- type OrderListResponsePaginated
- type OrderListResponseResult
- type OrderListResponseResultPaginated
- type OrderResponse
- type Position
- type PositionArrayResponse
- type PositionData
- type PositionResponse
- type PriceFilter
- type RawItem
- type ResultStringArrayResponse
- type StopOrder
- type StopOrderArrayResponse
- type StopOrderListResponse
- type StopOrderListResponsePaginated
- type StopOrderListResponseResult
- type StopOrderListResponseResultPaginated
- type StopOrderResponse
- type SymbolInfo
- type Ticker
- type TradingRecord
- type WalletFundRecord
- type WalletFundRecordResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountRatio ¶ added in v1.0.4
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 ¶ added in v1.0.1
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 ¶ added in v1.0.4
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 ¶ added in v1.0.4
func (b *ByBit) GetActiveOrders(symbol string) (query string, resp []byte, result OrderArrayResponse, err error)
GetActiveOrders
func (*ByBit) GetActiveStopOrders ¶ added in v1.0.4
func (b *ByBit) GetActiveStopOrders(symbol string) (query string, resp []byte, result StopOrderArrayResponse, err error)
GetActiveStopOrders
func (*ByBit) GetFunding ¶ added in v1.0.4
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 ¶ added in v1.0.4
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 ¶
GetPosition
func (*ByBit) GetPositions ¶
func (b *ByBit) GetPositions() (query string, resp []byte, result []PositionData, err error)
GetPositions
func (*ByBit) GetPremiumIndex ¶ added in v1.0.4
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 ¶ added in v1.0.4
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 ¶
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 ¶
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 ¶ added in v1.0.4
func (b *ByBit) LinearCancelAllOrder(symbol string) (query string, resp []byte, result []string, err error)
LinearCancelAllOrder
func (*ByBit) LinearCancelAllStopOrders ¶ added in v1.0.4
func (b *ByBit) LinearCancelAllStopOrders(symbol string) (query string, resp []byte, result []string, err error)
CancelAllStopOrders
func (*ByBit) LinearCancelOrder ¶ added in v1.0.4
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 ¶ added in v1.0.4
func (b *ByBit) LinearCancelStopOrder(orderID string, symbol string) (query string, resp []byte, result StopOrder, err error)
CancelStopOrder
func (*ByBit) LinearCreateOrder ¶ added in v1.0.4
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 ¶ added in v1.0.4
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 ¶ added in v1.0.6
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 ¶ added in v1.0.4
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 ¶ added in v1.0.4
func (b *ByBit) LinearGetActiveStopOrders(symbol string) (query string, resp []byte, result StopOrderArrayResponse, err error)
LinearGetActiveStopOrders
func (*ByBit) LinearGetFunding ¶ added in v1.0.4
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 ¶ added in v1.0.4
func (b *ByBit) LinearGetKLine(symbol string, interval string, from int64, limit int) (query string, resp []byte, result []OHLCLinear, err error)
LinearGetKLine
func (*ByBit) LinearGetOrders ¶ added in v1.0.4
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 ¶ added in v1.0.4
func (b *ByBit) LinearGetPosition(symbol string) (query string, resp []byte, result []LinearPosition, err error)
LinearGetPosition
func (*ByBit) LinearGetPositions ¶ added in v1.0.4
func (b *ByBit) LinearGetPositions() (query string, resp []byte, result []LinearPositionData, err error)
LinearGetPositions
func (*ByBit) LinearGetPremiumIndex ¶ added in v1.0.4
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 ¶ added in v1.0.4
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 ¶ added in v1.0.4
func (b *ByBit) LinearGetStopOrders(symbol string, stopOrderStatus string, limit int, page int) (query string, resp []byte, result StopOrderListResponseResult, err error)
LinearGetStopOrders
func (*ByBit) LinearReplaceOrder ¶ added in v1.0.4
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 ¶ added in v1.0.4
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 ¶ added in v1.0.4
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 ¶
SetCorrectServerTime
func (*ByBit) SetLeverage ¶
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 ¶ added in v1.0.4
func (b *ByBit) WalletRecords(symbol string, page int, limit int) (query string, resp []byte, result []WalletFundRecord, err error)
WalletRecords
type Funding ¶ added in v1.0.4
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 ¶ added in v1.0.4
type FundingResult ¶ added in v1.0.4
type FundingResult struct {
BaseResult
Result Funding `json:"result"`
}
type GetAccountRatioResult ¶ added in v1.0.4
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 GetKlineResult ¶
type GetKlineResult struct {
BaseResult
Result []OHLC `json:"result"`
}
type GetLinearKlineResult ¶ added in v1.0.4
type GetLinearKlineResult struct {
BaseResult
Result []OHLCLinear `json:"result"`
}
type GetOpenInterestResult ¶ added in v1.0.4
type GetOpenInterestResult struct {
BaseResult
Result []OpenInterest `json:"result"`
}
type GetOrderBookResult ¶
type GetOrderBookResult struct {
BaseResult
Result []RawItem `json:"result"`
}
type GetSymbolsResult ¶
type GetTickersResult ¶
type GetTradingRecordsResult ¶
type IndexOHLCResult ¶ added in v1.0.4
type IndexOHLCResult struct {
BaseResult
Result []IndexOHLC `json:"result"`
}
type LeverageFilter ¶
type LinearPosition ¶ added in v1.0.4
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 ¶ added in v1.0.4
type LinearPositionArrayResponse struct {
BaseResult
Result []LinearPosition `json:"result"`
}
type LinearPositionData ¶ added in v1.0.4
type LinearPositionData struct {
IsValid bool `json:"is_valid"`
Data LinearPosition `json:"data"`
}
type LinearPositionDataArrayResponse ¶ added in v1.0.4
type LinearPositionDataArrayResponse struct {
BaseResult
Result []LinearPositionData `json:"result"`
}
type LotSizeFilter ¶
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 ¶ added in v1.0.4
type OpenInterest ¶ added in v1.0.4
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 ¶ added in v1.0.4
type OrderArrayResponse struct {
BaseResult
Result []Order `json:"result"`
}
type OrderListResponse ¶ added in v1.0.4
type OrderListResponse struct {
BaseResult
Result OrderListResponseResult `json:"result"`
}
type OrderListResponseArray ¶ added in v1.0.4
type OrderListResponseArray struct {
Data []WalletFundRecord `json:"data"`
}
type OrderListResponsePaginated ¶ added in v1.0.4
type OrderListResponsePaginated struct {
BaseResult
Result OrderListResponseResultPaginated `json:"result"`
}
type OrderListResponseResult ¶ added in v1.0.4
type OrderListResponseResultPaginated ¶ added in v1.0.4
type OrderResponse ¶ added in v1.0.4
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 ¶ added in v1.0.4
type PositionArrayResponse struct {
BaseResult
Result []PositionData `json:"result"`
}
type PositionData ¶ added in v1.0.4
type PositionResponse ¶ added in v1.0.4
type PositionResponse struct {
BaseResult
Result Position `json:"result"`
}
type PriceFilter ¶
type ResultStringArrayResponse ¶ added in v1.0.4
type ResultStringArrayResponse struct {
BaseResult
Result []string `json:"result"`
}
type StopOrder ¶ added in v1.0.1
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 ¶ added in v1.0.4
type StopOrderArrayResponse struct {
BaseResult
Result []StopOrder `json:"result"`
}
type StopOrderListResponse ¶ added in v1.0.4
type StopOrderListResponse struct {
BaseResult
Result StopOrderListResponseResult `json:"result"`
}
type StopOrderListResponsePaginated ¶ added in v1.0.4
type StopOrderListResponsePaginated struct {
BaseResult
Result StopOrderListResponseResultPaginated `json:"result"`
}
type StopOrderListResponseResult ¶ added in v1.0.4
type StopOrderListResponseResultPaginated ¶ added in v1.0.4
type StopOrderResponse ¶ added in v1.0.4
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 WalletFundRecord ¶ added in v1.0.4
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 ¶ added in v1.0.4
type WalletFundRecordResponse struct {
BaseResult
Result OrderListResponseArray `json:"result"`
}