Documentation ¶
Overview ¶
Package phemex is a Golang SDK for binance APIs.
Index ¶
- Constants
- Variables
- type Account
- type AccountPosition
- type BaseResponse
- type BaseTickerResponse
- type CancelOrderService
- type Client
- func (c *Client) NewCancelOrderService() *CancelOrderService
- func (c *Client) NewCreateOrderService() *CreateOrderService
- func (c *Client) NewCreateReplaceOrderService() *CreateReplaceOrderService
- func (c *Client) NewExchangeMarginService() *ExchangeMarginService
- func (c *Client) NewExchangeProductsService() *ExchangeProductsService
- func (c *Client) NewGetAccountPositionService() *GetAccountPositionService
- func (c *Client) NewGetUserWalletService() *GetUserWalletService
- func (c *Client) NewListOpenOrdersService() *ListOpenOrdersService
- func (c *Client) NewListPriceChangeStatsService() *ListPriceChangeStatsService
- func (c *Client) NewPositionsAssignService() *PositionsAssignService
- func (c *Client) NewPositionsLeverageService() *PositionsLeverageService
- func (c *Client) NewQueryOrderService() *QueryOrderService
- func (c *Client) NewStartWsAOPService() *StartWsAOPService
- func (c *Client) NewStartWsOrderBookService() *StartWsOrderBookService
- func (c *Client) NewStartWsTradeService() *StartWsTradeService
- func (c *Client) NewWsAuthService() *WsAuthService
- type CreateOrderService
- func (s *CreateOrderService) ActionBy(actionBy string) *CreateOrderService
- func (s *CreateOrderService) ClOrdID(clOrdID string) *CreateOrderService
- func (s *CreateOrderService) CloseOnTrigger(closeOnTrigger bool) *CreateOrderService
- func (s *CreateOrderService) Do(ctx context.Context, opts ...RequestOption) (res *OrderResponse, err error)
- func (s *CreateOrderService) OrdType(ordType OrderType) *CreateOrderService
- func (s *CreateOrderService) OrderQty(orderQty float64) *CreateOrderService
- func (s *CreateOrderService) PegOffsetValueEp(pegOffsetValueEp int64) *CreateOrderService
- func (s *CreateOrderService) PegPriceType(pegPriceType string) *CreateOrderService
- func (s *CreateOrderService) PriceEp(priceEp int64) *CreateOrderService
- func (s *CreateOrderService) ReduceOnly(reduceOnly bool) *CreateOrderService
- func (s *CreateOrderService) Side(side SideType) *CreateOrderService
- func (s *CreateOrderService) StopLossEp(stopLossEp int64) *CreateOrderService
- func (s *CreateOrderService) StopPxEp(stopPxEp int64) *CreateOrderService
- func (s *CreateOrderService) Symbol(symbol string) *CreateOrderService
- func (s *CreateOrderService) TakeProfitEp(takeProfitEp int64) *CreateOrderService
- func (s *CreateOrderService) Text(text string) *CreateOrderService
- func (s *CreateOrderService) TimeInForce(timeInForce TimeInForceType) *CreateOrderService
- func (s *CreateOrderService) TriggerType(triggerType TriggerType) *CreateOrderService
- type CreateReplaceOrderService
- func (s *CreateReplaceOrderService) ClOrdID(clOrdID string) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) Do(ctx context.Context, opts ...RequestOption) (res *OrderResponse, err error)
- func (s *CreateReplaceOrderService) OrderID(orderID string) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) OrderQty(orderQty float64) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) OrigClOrdID(origClOrdID string) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) PegOffset(pegOffset float64) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) PegOffsetEp(pegOffsetEp int64) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) Price(price float64) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) PriceEp(priceEp int64) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) StopLoss(stopLoss float64) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) StopLossEp(stopLossEp int64) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) StopPx(stopPx float64) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) StopPxEp(stopPxEp int64) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) Symbol(symbol string) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) TakeProfit(takeProfit float64) *CreateReplaceOrderService
- func (s *CreateReplaceOrderService) TakeProfitEp(takeProfitEp int64) *CreateReplaceOrderService
- type ErrHandler
- type Error
- type ExchangeCurrency
- type ExchangeLeverage
- type ExchangeMargin
- type ExchangeMarginService
- func (s *ExchangeMarginService) BtcAmount(btcAmount float64) *ExchangeMarginService
- func (s *ExchangeMarginService) BtcAmountEv(btcAmountEv int64) *ExchangeMarginService
- func (s *ExchangeMarginService) Do(ctx context.Context, opts ...RequestOption) (*ExchangeMargin, error)
- func (s *ExchangeMarginService) LinkKey(linkKey string) *ExchangeMarginService
- func (s *ExchangeMarginService) MoveOp(moveOp ExchangeMarginType) *ExchangeMarginService
- func (s *ExchangeMarginService) UsdAmount(usdAmount float64) *ExchangeMarginService
- func (s *ExchangeMarginService) UsdAmountEv(usdAmountEv int64) *ExchangeMarginService
- type ExchangeMarginType
- type ExchangeProduct
- type ExchangeProductsService
- type ExchangeProductsServiceResponse
- type ExchangeRiskLimit
- type GetAccountPositionService
- type GetUserWalletService
- func (s *GetUserWalletService) Do(ctx context.Context, opts ...RequestOption) ([]*UserWallet, error)
- func (s *GetUserWalletService) Limit(limit int64) *GetUserWalletService
- func (s *GetUserWalletService) Offset(offset int64) *GetUserWalletService
- func (s *GetUserWalletService) WithCount(withCount int64) *GetUserWalletService
- type ListOpenOrdersService
- type ListPriceChangeStatsService
- type OrderResponse
- type OrderType
- type Position
- type PositionInfo
- type PositionsAssignService
- func (s *PositionsAssignService) Do(ctx context.Context, opts ...RequestOption) (res *BaseResponse, err error)
- func (s *PositionsAssignService) PosBalance(posBalance float64) *PositionsAssignService
- func (s *PositionsAssignService) PosBalanceEr(posBalanceEv int64) *PositionsAssignService
- func (s *PositionsAssignService) Symbol(symbol string) *PositionsAssignService
- type PositionsLeverageService
- func (s *PositionsLeverageService) Do(ctx context.Context, opts ...RequestOption) (res *BaseResponse, err error)
- func (s *PositionsLeverageService) Leverage(leverage int64) *PositionsLeverageService
- func (s *PositionsLeverageService) LeverageEr(leverageEr int64) *PositionsLeverageService
- func (s *PositionsLeverageService) Symbol(symbol string) *PositionsLeverageService
- type PriceChangeStats
- type QueryOrderService
- func (s *QueryOrderService) ClOrderID(clOrderID string) *QueryOrderService
- func (s *QueryOrderService) Do(ctx context.Context, opts ...RequestOption) (res []*OrderResponse, err error)
- func (s *QueryOrderService) OrderID(orderID string) *QueryOrderService
- func (s *QueryOrderService) Symbol(symbol string) *QueryOrderService
- type RequestOption
- type RowsOrderResponse
- type SideType
- type StartWsAOPService
- type StartWsOrderBookService
- type StartWsTradeService
- type Status
- type TimeInForceType
- type TriggerType
- type UserMarginUserWalletVo
- type UserWallet
- type WalletUserWallet
- type WsAOP
- type WsAccount
- type WsAuthService
- type WsError
- type WsHandler
- type WsOrder
- type WsOrderBook
- type WsOrderBookEvent
- type WsPosition
- type WsPositionInfo
- type WsTrade
- type WsTradeEvent
Constants ¶
const ( ExchangeMarginTypeBTCToWallet ExchangeMarginType = 1 ExchangeMarginTypeWalletToBTC ExchangeMarginType = 2 ExchangeMarginTypeWalletToUSD ExchangeMarginType = 3 ExchangeMarginTypeUSDToWallet ExchangeMarginType = 4 SideTypeBuy SideType = "Buy" SideTypeSell SideType = "Sell" OrderTypeLimit OrderType = "Limit" OrderTypeMarket OrderType = "Market" OrderTypeStop OrderType = "Stop" OrderTypeStopLimit OrderType = "StopLimit" OrderTypeMarketIfTouched OrderType = "MarketIfTouched" OrderTypeLimitIfTouched OrderType = "LimitIfTouched" OrderTypePegged OrderType = "Pegged" TimeInForceTypeDAY TimeInForceType = "Day" TimeInForceTypeGTC TimeInForceType = "GoodTillCancel" TimeInForceTypeIOC TimeInForceType = "ImmediateOrCancel" TimeInForceTypeFOK TimeInForceType = "FillOrKill" TriggerTypeByMarkPrice TriggerType = "ByMarkPrice" TriggerTypeByLastPrice TriggerType = "ByLastPrice" )
Global enums
Variables ¶
var ( // WebsocketTimeout is an interval for sending ping/pong messages if WebsocketKeepalive is enabled WebsocketTimeout = 5 * time.Second // WebsocketKeepalive enables sending ping/pong messages to check the connection stability WebsocketKeepalive = true )
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { AccountID int64 `json:"accountId"` Currency string `json:"currency"` AccountBalanceEv float64 `json:"accountBalanceEv"` TotalUsedBalanceEv float64 `json:"totalUsedBalanceEv"` }
Account account detail
type AccountPosition ¶
type AccountPosition struct { Account Account `json:"account"` Positions []*Position `json:"positions"` }
AccountPosition define account position info
type BaseResponse ¶
type BaseResponse struct { Code int64 `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
BaseResponse base response for all requests
type BaseTickerResponse ¶
type BaseTickerResponse struct { Error int64 `json:"error"` ID int64 `json:"id"` Result interface{} `json:"result"` }
BaseTickerResponse base ticker response
type CancelOrderService ¶
type CancelOrderService struct {
// contains filtered or unexported fields
}
CancelOrderService cancel an order
func (*CancelOrderService) Do ¶
func (s *CancelOrderService) Do(ctx context.Context, opts ...RequestOption) (res *OrderResponse, err error)
Do send request
func (*CancelOrderService) OrderID ¶
func (s *CancelOrderService) OrderID(orderID string) *CancelOrderService
OrderID set orderID
func (*CancelOrderService) Symbol ¶
func (s *CancelOrderService) Symbol(symbol string) *CancelOrderService
Symbol set symbol
type Client ¶
type Client struct { APIKey string SecretKey string BaseURL string UserAgent string HTTPClient *http.Client Debug bool Logger *log.Logger // contains filtered or unexported fields }
Client define API client
func NewClient ¶
NewClient initialize an API client instance with API key and secret key. You should always call this function before using this SDK. Services will be created by the form client.NewXXXService().
func (*Client) NewCancelOrderService ¶
func (c *Client) NewCancelOrderService() *CancelOrderService
NewCancelOrderService init cancel order service
func (*Client) NewCreateOrderService ¶
func (c *Client) NewCreateOrderService() *CreateOrderService
NewCreateOrderService init create order service
func (*Client) NewCreateReplaceOrderService ¶
func (c *Client) NewCreateReplaceOrderService() *CreateReplaceOrderService
NewCreateReplaceOrderService init replace order service
func (*Client) NewExchangeMarginService ¶
func (c *Client) NewExchangeMarginService() *ExchangeMarginService
NewExchangeMarginService transfer funds between main wallet and margin account
func (*Client) NewExchangeProductsService ¶
func (c *Client) NewExchangeProductsService() *ExchangeProductsService
NewExchangeProductsService init exchange info service
func (*Client) NewGetAccountPositionService ¶
func (c *Client) NewGetAccountPositionService() *GetAccountPositionService
NewGetAccountPositionService init getting account position service
func (*Client) NewGetUserWalletService ¶
func (c *Client) NewGetUserWalletService() *GetUserWalletService
NewGetUserWalletService getting wallet service
func (*Client) NewListOpenOrdersService ¶
func (c *Client) NewListOpenOrdersService() *ListOpenOrdersService
NewListOpenOrdersService init list open orders service
func (*Client) NewListPriceChangeStatsService ¶
func (c *Client) NewListPriceChangeStatsService() *ListPriceChangeStatsService
NewListPriceChangeStatsService init list prices change stats service
func (*Client) NewPositionsAssignService ¶
func (c *Client) NewPositionsAssignService() *PositionsAssignService
NewPositionsAssignService init positions assign service
func (*Client) NewPositionsLeverageService ¶
func (c *Client) NewPositionsLeverageService() *PositionsLeverageService
NewPositionsLeverageService init positions leverage service
func (*Client) NewQueryOrderService ¶
func (c *Client) NewQueryOrderService() *QueryOrderService
NewQueryOrderService init query order service
func (*Client) NewStartWsAOPService ¶
func (c *Client) NewStartWsAOPService() *StartWsAOPService
NewStartWsAOPService AOP service
func (*Client) NewStartWsOrderBookService ¶
func (c *Client) NewStartWsOrderBookService() *StartWsOrderBookService
NewStartWsOrderBookService OrderBook service
func (*Client) NewStartWsTradeService ¶
func (c *Client) NewStartWsTradeService() *StartWsTradeService
NewStartWsTradeService Trade service
func (*Client) NewWsAuthService ¶
func (c *Client) NewWsAuthService() *WsAuthService
NewWsAuthService init starting auth ws service
type CreateOrderService ¶
type CreateOrderService struct {
// contains filtered or unexported fields
}
CreateOrderService create order
func (*CreateOrderService) ActionBy ¶
func (s *CreateOrderService) ActionBy(actionBy string) *CreateOrderService
ActionBy set actionBy
func (*CreateOrderService) ClOrdID ¶
func (s *CreateOrderService) ClOrdID(clOrdID string) *CreateOrderService
ClOrdID set clOrID
func (*CreateOrderService) CloseOnTrigger ¶
func (s *CreateOrderService) CloseOnTrigger(closeOnTrigger bool) *CreateOrderService
CloseOnTrigger set closeOnTrigger
func (*CreateOrderService) Do ¶
func (s *CreateOrderService) Do(ctx context.Context, opts ...RequestOption) (res *OrderResponse, err error)
Do send request
func (*CreateOrderService) OrdType ¶
func (s *CreateOrderService) OrdType(ordType OrderType) *CreateOrderService
OrdType set ordType
func (*CreateOrderService) OrderQty ¶
func (s *CreateOrderService) OrderQty(orderQty float64) *CreateOrderService
OrderQty set orderQty
func (*CreateOrderService) PegOffsetValueEp ¶
func (s *CreateOrderService) PegOffsetValueEp(pegOffsetValueEp int64) *CreateOrderService
PegOffsetValueEp set pegOffsetValueEp
func (*CreateOrderService) PegPriceType ¶
func (s *CreateOrderService) PegPriceType(pegPriceType string) *CreateOrderService
PegPriceType set pegPriceType
func (*CreateOrderService) PriceEp ¶
func (s *CreateOrderService) PriceEp(priceEp int64) *CreateOrderService
PriceEp set priceEp
func (*CreateOrderService) ReduceOnly ¶
func (s *CreateOrderService) ReduceOnly(reduceOnly bool) *CreateOrderService
ReduceOnly set reduceOnly
func (*CreateOrderService) Side ¶
func (s *CreateOrderService) Side(side SideType) *CreateOrderService
Side set side
func (*CreateOrderService) StopLossEp ¶
func (s *CreateOrderService) StopLossEp(stopLossEp int64) *CreateOrderService
StopLossEp set stopLossEp
func (*CreateOrderService) StopPxEp ¶
func (s *CreateOrderService) StopPxEp(stopPxEp int64) *CreateOrderService
StopPxEp set stopPxEp
func (*CreateOrderService) Symbol ¶
func (s *CreateOrderService) Symbol(symbol string) *CreateOrderService
Symbol set symbol
func (*CreateOrderService) TakeProfitEp ¶
func (s *CreateOrderService) TakeProfitEp(takeProfitEp int64) *CreateOrderService
TakeProfitEp set takeProfitEp
func (*CreateOrderService) Text ¶
func (s *CreateOrderService) Text(text string) *CreateOrderService
Text set text
func (*CreateOrderService) TimeInForce ¶
func (s *CreateOrderService) TimeInForce(timeInForce TimeInForceType) *CreateOrderService
TimeInForce set timeInForce
func (*CreateOrderService) TriggerType ¶
func (s *CreateOrderService) TriggerType(triggerType TriggerType) *CreateOrderService
TriggerType set triggerType
type CreateReplaceOrderService ¶
type CreateReplaceOrderService struct {
// contains filtered or unexported fields
}
CreateReplaceOrderService create order
func (*CreateReplaceOrderService) ClOrdID ¶
func (s *CreateReplaceOrderService) ClOrdID(clOrdID string) *CreateReplaceOrderService
ClOrdID set clOrID
func (*CreateReplaceOrderService) Do ¶
func (s *CreateReplaceOrderService) Do(ctx context.Context, opts ...RequestOption) (res *OrderResponse, err error)
Do send request
func (*CreateReplaceOrderService) OrderID ¶
func (s *CreateReplaceOrderService) OrderID(orderID string) *CreateReplaceOrderService
OrderID set orderID
func (*CreateReplaceOrderService) OrderQty ¶
func (s *CreateReplaceOrderService) OrderQty(orderQty float64) *CreateReplaceOrderService
OrderQty set orderQty
func (*CreateReplaceOrderService) OrigClOrdID ¶
func (s *CreateReplaceOrderService) OrigClOrdID(origClOrdID string) *CreateReplaceOrderService
OrigClOrdID set origClOrdID
func (*CreateReplaceOrderService) PegOffset ¶
func (s *CreateReplaceOrderService) PegOffset(pegOffset float64) *CreateReplaceOrderService
PegOffset set pegOffset
func (*CreateReplaceOrderService) PegOffsetEp ¶
func (s *CreateReplaceOrderService) PegOffsetEp(pegOffsetEp int64) *CreateReplaceOrderService
PegOffsetEp set pegOffsetEp
func (*CreateReplaceOrderService) Price ¶
func (s *CreateReplaceOrderService) Price(price float64) *CreateReplaceOrderService
Price set price
func (*CreateReplaceOrderService) PriceEp ¶
func (s *CreateReplaceOrderService) PriceEp(priceEp int64) *CreateReplaceOrderService
PriceEp set priceEp
func (*CreateReplaceOrderService) StopLoss ¶
func (s *CreateReplaceOrderService) StopLoss(stopLoss float64) *CreateReplaceOrderService
StopLoss set stopLoss
func (*CreateReplaceOrderService) StopLossEp ¶
func (s *CreateReplaceOrderService) StopLossEp(stopLossEp int64) *CreateReplaceOrderService
StopLossEp set stopLossEp
func (*CreateReplaceOrderService) StopPx ¶
func (s *CreateReplaceOrderService) StopPx(stopPx float64) *CreateReplaceOrderService
StopPx set stopPx
func (*CreateReplaceOrderService) StopPxEp ¶
func (s *CreateReplaceOrderService) StopPxEp(stopPxEp int64) *CreateReplaceOrderService
StopPxEp set stopPxEp
func (*CreateReplaceOrderService) Symbol ¶
func (s *CreateReplaceOrderService) Symbol(symbol string) *CreateReplaceOrderService
Symbol set symbol
func (*CreateReplaceOrderService) TakeProfit ¶
func (s *CreateReplaceOrderService) TakeProfit(takeProfit float64) *CreateReplaceOrderService
TakeProfit set takeProfit
func (*CreateReplaceOrderService) TakeProfitEp ¶
func (s *CreateReplaceOrderService) TakeProfitEp(takeProfitEp int64) *CreateReplaceOrderService
TakeProfitEp set takeProfitEp
type ExchangeCurrency ¶
type ExchangeCurrency struct { }
type ExchangeLeverage ¶
type ExchangeLeverage struct{}
type ExchangeMargin ¶
type ExchangeMargin struct { MoveOp int `json:"moveOp"` FromCurrencyName string `json:"fromCurrencyName"` ToCurrencyName string `json:"toCurrencyName"` FromAmount string `json:"fromAmount"` ToAmount string `json:"toAmount"` LinkKey string `json:"linkKey"` Status int64 `json:"status"` }
ExchangeMargin exchange margin
type ExchangeMarginService ¶
type ExchangeMarginService struct {
// contains filtered or unexported fields
}
ExchangeMarginService get account info
func (*ExchangeMarginService) BtcAmount ¶
func (s *ExchangeMarginService) BtcAmount(btcAmount float64) *ExchangeMarginService
BtcAmount set btcAmount
func (*ExchangeMarginService) BtcAmountEv ¶
func (s *ExchangeMarginService) BtcAmountEv(btcAmountEv int64) *ExchangeMarginService
BtcAmountEv set btcAmountEv
func (*ExchangeMarginService) Do ¶
func (s *ExchangeMarginService) Do(ctx context.Context, opts ...RequestOption) (*ExchangeMargin, error)
Do send request
func (*ExchangeMarginService) LinkKey ¶
func (s *ExchangeMarginService) LinkKey(linkKey string) *ExchangeMarginService
LinkKey set linkKey
func (*ExchangeMarginService) MoveOp ¶
func (s *ExchangeMarginService) MoveOp(moveOp ExchangeMarginType) *ExchangeMarginService
MoveOp set moveOp
func (*ExchangeMarginService) UsdAmount ¶
func (s *ExchangeMarginService) UsdAmount(usdAmount float64) *ExchangeMarginService
UsdAmount set usdAmount
func (*ExchangeMarginService) UsdAmountEv ¶
func (s *ExchangeMarginService) UsdAmountEv(usdAmountEv int64) *ExchangeMarginService
UsdAmountEv set usdAmountEv
type ExchangeMarginType ¶
type ExchangeMarginType int
ExchangeMarginType define exchange margin type
type ExchangeProduct ¶
type ExchangeProduct struct { Symbol string `json:"symbol"` Code int64 `json:"code"` DisplaySymbol string `json:"displaySymbol"` IndexSymbol string `json:"indexSymbol"` MarkSymbol string `json:"markSymbol"` FundingRateSymbol string `json:"fundingRateSymbol"` FundingRate8HSymbol string `json:"fundingRate8hSymbol"` ContractUnderlyingAssets string `json:"contractUnderlyingAssets"` SettleCurrency string `json:"settleCurrency"` QuoteCurrency string `json:"quoteCurrency"` ContractSize float64 `json:"contractSize"` LotSize int64 `json:"lotSize"` TickSize float64 `json:"tickSize"` PriceScale int64 `json:"priceScale"` RatioScale int64 `json:"ratioScale"` PricePrecision int64 `json:"pricePrecision"` MinPriceEp int64 `json:"minPriceEp"` MaxPriceEp int64 `json:"maxPriceEp"` MaxOrderQty int64 `json:"maxOrderQty"` Type string `json:"type"` Status string `json:"status"` TipOrderQty int64 `json:"tipOrderQty"` Description string `json:"description"` }
type ExchangeProductsService ¶
type ExchangeProductsService struct {
// contains filtered or unexported fields
}
ExchangeProductsService exchange info service
func (*ExchangeProductsService) Do ¶
func (s *ExchangeProductsService) Do(ctx context.Context, opts ...RequestOption) (res *ExchangeProductsServiceResponse, err error)
Do send request
type ExchangeProductsServiceResponse ¶
type ExchangeProductsServiceResponse struct { Currencies []ExchangeCurrency `json:"currencies"` Products []ExchangeProduct `json:"products"` RiskLimits []ExchangeRiskLimit `json:"riskLimitsV2"` Leverages []ExchangeLeverage `json:"leverages"` }
type ExchangeRiskLimit ¶
type ExchangeRiskLimit struct{}
type GetAccountPositionService ¶
type GetAccountPositionService struct {
// contains filtered or unexported fields
}
GetAccountPositionService get account info
func (*GetAccountPositionService) Currency ¶
func (s *GetAccountPositionService) Currency(currency string) *GetAccountPositionService
Currency set currency
func (*GetAccountPositionService) Do ¶
func (s *GetAccountPositionService) Do(ctx context.Context, opts ...RequestOption) (*AccountPosition, error)
Do send request
type GetUserWalletService ¶
type GetUserWalletService struct {
// contains filtered or unexported fields
}
GetUserWalletService get account info
func (*GetUserWalletService) Do ¶
func (s *GetUserWalletService) Do(ctx context.Context, opts ...RequestOption) ([]*UserWallet, error)
Do send request
func (*GetUserWalletService) Limit ¶
func (s *GetUserWalletService) Limit(limit int64) *GetUserWalletService
Limit set limit
func (*GetUserWalletService) Offset ¶
func (s *GetUserWalletService) Offset(offset int64) *GetUserWalletService
Offset set offset
func (*GetUserWalletService) WithCount ¶
func (s *GetUserWalletService) WithCount(withCount int64) *GetUserWalletService
WithCount set with count
type ListOpenOrdersService ¶
type ListOpenOrdersService struct {
// contains filtered or unexported fields
}
ListOpenOrdersService list opened orders
func (*ListOpenOrdersService) Do ¶
func (s *ListOpenOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*OrderResponse, err error)
Do send request
func (*ListOpenOrdersService) Symbol ¶
func (s *ListOpenOrdersService) Symbol(symbol string) *ListOpenOrdersService
Symbol set symbol
type ListPriceChangeStatsService ¶
type ListPriceChangeStatsService struct {
// contains filtered or unexported fields
}
ListPriceChangeStatsService show stats of price change in last 24 hours for all symbols
func (*ListPriceChangeStatsService) Do ¶
func (s *ListPriceChangeStatsService) Do(ctx context.Context, opts ...RequestOption) (res *PriceChangeStats, err error)
Do send request
func (*ListPriceChangeStatsService) Symbol ¶
func (s *ListPriceChangeStatsService) Symbol(symbol string) *ListPriceChangeStatsService
Symbol set symbol
type OrderResponse ¶
type OrderResponse struct { BizError int `json:"bizError"` OrderID string `json:"orderID"` ClOrdID string `json:"clOrdID"` Symbol string `json:"symbol"` Side SideType `json:"side"` ActionTimeNs int64 `json:"actionTimeNs"` TransactTimeNs int64 `json:"transactTimeNs"` OrderType OrderType `json:"orderType"` PriceEp int64 `json:"priceEp"` Price float64 `json:"price"` OrderQty float64 `json:"orderQty"` DisplayQty float64 `json:"displayQty"` TimeInForce TimeInForceType `json:"timeInForce"` ReduceOnly bool `json:"reduceOnly"` TakeProfitEp int64 `json:"takeProfitEp"` TakeProfit float64 `json:"takeProfit"` StopPxEp int64 `json:"stopPxEp"` StopPx float64 `json:"stopPx"` StopLossEp int64 `json:"stopLossEp"` ClosedPnlEv int64 `json:"closedPnlEv"` ClosedPnl float64 `json:"closedPnl"` ClosedSize float64 `json:"closedSize"` CumQty float64 `json:"cumQty"` CumValueEv int64 `json:"cumValueEv"` CumValue float64 `json:"cumValue"` LeavesQty float64 `json:"leavesQty"` LeavesValueEv int64 `json:"leavesValueEv"` LeavesValue float64 `json:"leavesValue"` StopLoss float64 `json:"stopLoss"` StopDirection string `json:"stopDirection"` OrdStatus string `json:"ordStatus"` Trigger string `json:"trigger"` }
OrderResponse define create order response
type Position ¶
type Position struct { AccountID int64 `json:"accountID"` Symbol string `json:"symbol"` Currency string `json:"currency"` Side string `json:"side"` PositionStatus string `json:"positionStatus"` CrossMargin bool `json:"crossMargin"` LeverageEr float64 `json:"leverageEr"` Leverage float64 `json:"leverage"` InitMarginReqEr float64 `json:"initMarginReqEr"` InitMarginReq float64 `json:"initMarginReq"` MaintMarginReqEr float64 `json:"maintMarginReqEr"` MaintMarginReq float64 `json:"maintMarginReq"` RiskLimitEv float64 `json:"riskLimitEv"` RiskLimit float64 `json:"riskLimit"` Size float64 `json:"size"` Value float64 `json:"value"` ValueEv float64 `json:"valueEv"` AvgEntryPriceEp float64 `json:"avgEntryPriceEp"` AvgEntryPrice float64 `json:"avgEntryPrice"` PosCostEv float64 `json:"posCostEv"` PosCost float64 `json:"posCost"` AssignedPosBalanceEv float64 `json:"assignedPosBalanceEv"` AssignedPosBalance float64 `json:"assignedPosBalance"` BankruptCommEv float64 `json:"bankruptCommEv"` BankruptComm float64 `json:"bankruptComm"` BankruptPriceEp float64 `json:"bankruptPriceEp"` BankruptPrice float64 `json:"bankruptPrice"` PositionMarginEv float64 `json:"positionMarginEv"` PositionMargin float64 `json:"positionMargin"` LiquidationPriceEp float64 `json:"liquidationPriceEp"` LiquidationPrice float64 `json:"liquidationPrice"` DeleveragePercentileEr float64 `json:"deleveragePercentileEr"` DeleveragePercentile float64 `json:"deleveragePercentile"` BuyValueToCostEr float64 `json:"buyValueToCostEr"` BuyValueToCost float64 `json:"buyValueToCost"` SellValueToCostEr float64 `json:"sellValueToCostEr"` SellValueToCost float64 `json:"sellValueToCost"` MarkPriceEp float64 `json:"markPriceEp"` MarkPrice float64 `json:"markPrice"` MarkValueEv float64 `json:"markValueEv"` MarkValue float64 `json:"markValue"` UnRealisedPosLossEv float64 `json:"unRealisedPosLossEv"` UnRealisedPosLoss float64 `json:"unRealisedPosLoss"` EstimatedOrdLossEv float64 `json:"estimatedOrdLossEv"` EstimatedOrdLoss float64 `json:"estimatedOrdLoss"` UsedBalanceEv float64 `json:"usedBalanceEv"` UsedBalance float64 `json:"usedBalance"` TakeProfitEp float64 `json:"takeProfitEp"` TakeProfit float64 `json:"takeProfit"` StopLossEp float64 `json:"stopLossEp"` StopLoss float64 `json:"stopLoss"` RealisedPnlEv float64 `json:"realisedPnlEv"` RealisedPnl float64 `json:"realisedPnl"` CumRealisedPnlEv float64 `json:"cumRealisedPnlEv"` CumRealisedPnl float64 `json:"cumRealisedPnl"` }
Position position detail
type PositionInfo ¶
type PositionInfo struct { AccountID int64 `json:"accountID"` Light float64 `json:"light"` Symbol string `json:"symbol"` UserID int64 `json:"userID"` }
PositionInfo position info
type PositionsAssignService ¶
type PositionsAssignService struct {
// contains filtered or unexported fields
}
PositionsAssignService cancel an order
func (*PositionsAssignService) Do ¶
func (s *PositionsAssignService) Do(ctx context.Context, opts ...RequestOption) (res *BaseResponse, err error)
Do send request
func (*PositionsAssignService) PosBalance ¶
func (s *PositionsAssignService) PosBalance(posBalance float64) *PositionsAssignService
PosBalance set posBalance
func (*PositionsAssignService) PosBalanceEr ¶
func (s *PositionsAssignService) PosBalanceEr(posBalanceEv int64) *PositionsAssignService
PosBalanceEr set posBalanceEv
func (*PositionsAssignService) Symbol ¶
func (s *PositionsAssignService) Symbol(symbol string) *PositionsAssignService
Symbol set symbol
type PositionsLeverageService ¶
type PositionsLeverageService struct {
// contains filtered or unexported fields
}
PositionsLeverageService cancel an order
func (*PositionsLeverageService) Do ¶
func (s *PositionsLeverageService) Do(ctx context.Context, opts ...RequestOption) (res *BaseResponse, err error)
Do send request
func (*PositionsLeverageService) Leverage ¶
func (s *PositionsLeverageService) Leverage(leverage int64) *PositionsLeverageService
Leverage set leverage
func (*PositionsLeverageService) LeverageEr ¶
func (s *PositionsLeverageService) LeverageEr(leverageEr int64) *PositionsLeverageService
LeverageEr set leverageEr
func (*PositionsLeverageService) Symbol ¶
func (s *PositionsLeverageService) Symbol(symbol string) *PositionsLeverageService
Symbol set symbol
type PriceChangeStats ¶
type PriceChangeStats struct { AskEp int64 `json:"askEp"` BidEp int64 `json:"bidEp"` OpenEp int64 `json:"openEp"` HighEp int64 `json:"highEp"` LowEp int64 `json:"lowEp"` LastEp int64 `json:"lastEp"` IndexEp int64 `json:"indexEp"` MarkEp int64 `json:"markEp"` OpenInterest float64 `json:"openInterest"` FundingRateEr float64 `json:"fundingRateEr"` PredFundingRateEr float64 `json:"predFundingRateEr"` Timestamp int64 `json:"timestamp"` Symbol string `json:"symbol"` TurnoverEv int64 `json:"turnoverEv"` Volume float64 `json:"volume"` }
PriceChangeStats define price change stats
type QueryOrderService ¶
type QueryOrderService struct {
// contains filtered or unexported fields
}
QueryOrderService cancel an order
func (*QueryOrderService) ClOrderID ¶
func (s *QueryOrderService) ClOrderID(clOrderID string) *QueryOrderService
ClOrderID set clOrderID
func (*QueryOrderService) Do ¶
func (s *QueryOrderService) Do(ctx context.Context, opts ...RequestOption) (res []*OrderResponse, err error)
Do send request
func (*QueryOrderService) OrderID ¶
func (s *QueryOrderService) OrderID(orderID string) *QueryOrderService
OrderID set orderID
func (*QueryOrderService) Symbol ¶
func (s *QueryOrderService) Symbol(symbol string) *QueryOrderService
Symbol set symbol
type RequestOption ¶
type RequestOption func(*request)
RequestOption define option type for request
func WithRecvWindow ¶
func WithRecvWindow(recvWindow int64) RequestOption
WithRecvWindow set recvWindow param for the request
type RowsOrderResponse ¶
type RowsOrderResponse struct {
Rows []*OrderResponse `json:"rows"`
}
RowsOrderResponse rows order response
type StartWsAOPService ¶
type StartWsAOPService struct {
// contains filtered or unexported fields
}
StartWsAOPService create listen key for user stream service
func (*StartWsAOPService) Do ¶
func (s *StartWsAOPService) Do(c *websocket.Conn, handler WsHandler, errHandler ErrHandler, opts ...RequestOption) (err error)
Do send request
func (*StartWsAOPService) SetID ¶
func (s *StartWsAOPService) SetID(id int64) *StartWsAOPService
SetID set id
type StartWsOrderBookService ¶
type StartWsOrderBookService struct {
// contains filtered or unexported fields
}
StartWsOrderBookService :
func (*StartWsOrderBookService) Do ¶
func (s *StartWsOrderBookService) Do(c *websocket.Conn, handler WsHandler, errHandler ErrHandler, opts ...RequestOption) (err error)
Do :
func (*StartWsOrderBookService) ID ¶
func (s *StartWsOrderBookService) ID(id int64) *StartWsOrderBookService
ID :
func (*StartWsOrderBookService) Symbols ¶
func (s *StartWsOrderBookService) Symbols(symbols []string) *StartWsOrderBookService
Symbols :
type StartWsTradeService ¶
type StartWsTradeService struct {
// contains filtered or unexported fields
}
StartWsTradeService :
func (*StartWsTradeService) Do ¶
func (s *StartWsTradeService) Do(c *websocket.Conn, handler WsHandler, errHandler ErrHandler, opts ...RequestOption) (err error)
Do :
func (*StartWsTradeService) ID ¶
func (s *StartWsTradeService) ID(id int64) *StartWsTradeService
ID :
func (*StartWsTradeService) Symbols ¶
func (s *StartWsTradeService) Symbols(symbols []string) *StartWsTradeService
Symbols :
type TimeInForceType ¶
type TimeInForceType string
TimeInForceType define time in force type of order
type UserMarginUserWalletVo ¶
type UserMarginUserWalletVo struct { Currency string `json:"currency"` AccountBalance string `json:"accountBalance"` TotalUsedBalance string `json:"totalUsedBalance"` AccountBalanceEv float64 `json:"accountBalanceEv"` TotalUsedBalanceEv float64 `json:"totalUsedBalanceEv"` BonusBalanceEv float64 `json:"bonusBalanceEv"` BonusBalance string `json:"bonusBalance"` }
UserMarginUserWalletVo user margin UserWalletvo
type UserWallet ¶
type UserWallet struct { UserID int `json:"userId"` Email string `json:"email"` NickName string `json:"nickName"` PasswordState float64 `json:"passwordState"` ClientCnt float64 `json:"clientCnt"` Totp float64 `json:"totp"` Logon float64 `json:"logon"` ParentID float64 `json:"parentId"` ParentEmail string `json:"parentEmail"` Status float64 `json:"status"` Wallet *WalletUserWallet `json:"wallet"` UserMarginVo []*UserMarginUserWalletVo `json:"userMarginVo"` }
UserWallet user wallet
type WalletUserWallet ¶
type WalletUserWallet struct { TotalBalance string `json:"totalBalance"` TotalBalanceEv float64 `json:"totalBalanceEv"` AvailBalance string `json:"availBalance"` AvailBalanceEv float64 `json:"availBalanceEv"` FreezeBalance string `json:"freezeBalance"` FreezeBalanceEv float64 `json:"freezeBalanceEv"` Currency string `json:"currency"` CurrencyCode float64 `json:"currencyCode"` }
WalletUserWallet wallet user wallet
type WsAOP ¶
type WsAOP struct { Accounts []*WsAccount `json:"accounts"` Orders []*WsOrder `json:"orders"` Positions []*WsPosition `json:"positions"` Sequence int64 `json:"sequence"` Timestamp int64 `json:"timestamp"` Type string `json:"type"` }
WsAOP ws AOP
type WsAccount ¶
type WsAccount struct { AccountBalanceEv int64 `json:"accountBalanceEv"` AccountID int64 `json:"accountID"` BonusBalanceEv int64 `json:"bonusBalanceEv"` Currency string `json:"currency"` TotalUsedBalanceEv int64 `json:"totalUsedBalanceEv"` UserID int64 `json:"userID"` }
WsAccount ws account
type WsAuthService ¶
type WsAuthService struct {
// contains filtered or unexported fields
}
WsAuthService create listen key for user stream service
func (*WsAuthService) Do ¶
func (s *WsAuthService) Do(ctx context.Context, opts ...RequestOption) (c *websocket.Conn, err error)
Do send request
func (*WsAuthService) URL ¶
func (s *WsAuthService) URL(url string) *WsAuthService
URL set url. wss://testnet.phemex.com/ws for test net
type WsError ¶
type WsError struct { Error *Error `json:"error"` Result *Status `json:"result"` ID int `json:"id"` }
WsError ws error
type WsOrder ¶
type WsOrder struct { AccountID int64 `json:"accountID"` Action string `json:"action"` ActionBy string `json:"actionBy"` ActionTimeNs int64 `json:"actionTimeNs"` AddedSeq int64 `json:"addedSeq"` BonusChangedAmountEv int64 `json:"bonusChangedAmountEv"` ClOrdID string `json:"clOrdID"` ClosedPnlEv int64 `json:"closedPnlEv"` ClosedSize float64 `json:"closedSize"` Code int64 `json:"code"` CumQty float64 `json:"cumQty"` CurAccBalanceEv int64 `json:"curAccBalanceEv"` CurAssignedPosBalanceEv int64 `json:"curAssignedPosBalanceEv"` CurLeverageEr int64 `json:"curLeverageEr"` CurPosSide string `json:"curPosSide"` CurPosSize float64 `json:"curPosSize"` CurPosTerm int64 `json:"curPosTerm"` CurPosValueEv int64 `json:"curPosValueEv"` CurRiskLimitEv int64 `json:"curRiskLimitEv"` Currency string `json:"currency"` CxlRejReason int64 `json:"cxlRejReason"` DisplayQty float64 `json:"displayQty"` ExecFeeEv int64 `json:"execFeeEv"` ExecID string `json:"execID"` ExecInst string `json:"execInst"` ExecPriceEp int64 `json:"execPriceEp"` ExecQty float64 `json:"execQty"` ExecSeq float64 `json:"execSeq"` ExecStatus string `json:"execStatus"` ExecValueEv int64 `json:"execValueEv"` FeeRateEr int64 `json:"feeRateEr"` LeavesQty float64 `json:"leavesQty"` LeavesValueEv int64 `json:"leavesValueEv"` Message string `json:"message"` OrdStatus string `json:"ordStatus"` OrdType string `json:"ordType"` OrderID string `json:"orderID"` OrderQty float64 `json:"orderQty"` PegOffsetValueEp int64 `json:"pegOffsetValueEp"` Platform string `json:"platform"` PriceEp int64 `json:"priceEp"` RelatedPosTerm int64 `json:"relatedPosTerm"` RelatedReqNum int64 `json:"relatedReqNum"` Side string `json:"side"` StopDirection string `json:"stopDirection"` StopLossEp int64 `json:"stopLossEp"` StopPxEp int64 `json:"stopPxEp"` Symbol string `json:"symbol"` TakeProfitEp int64 `json:"takeProfitEp"` TimeInForce string `json:"timeInForce"` TransactTimeNs int64 `json:"transactTimeNs"` Trigger TriggerType `json:"trigger"` UserID int64 `json:"userID"` }
WsOrder ws order
type WsOrderBook ¶
WsOrderBook ws OrderBook
type WsOrderBookEvent ¶
type WsOrderBookEvent struct { Book WsOrderBook `json:"book"` Depth int `json:"depth"` Sequence int `json:"sequence"` Symbol string `json:"symbol"` Timestamp int `json:"timestamp"` Type string `json:"type"` }
WsOrderBookEvent ws OrderBookEvent
type WsPosition ¶
type WsPosition struct { AccountID int64 `json:"accountID"` ActionTimeNs int64 `json:"actionTimeNs"` AssignedPosBalanceEv int64 `json:"assignedPosBalanceEv"` AvgEntryPriceEp int64 `json:"avgEntryPriceEp"` BankruptCommEv int64 `json:"bankruptCommEv"` BankruptPriceEp int64 `json:"bankruptPriceEp"` BuyLeavesQty float64 `json:"buyLeavesQty"` BuyLeavesValueEv int64 `json:"buyLeavesValueEv"` BuyValueToCostEr int64 `json:"buyValueToCostEr"` CreatedAtNs int64 `json:"createdAtNs"` CumClosedPnlEv int64 `json:"cumClosedPnlEv"` CumFundingFeeEv int64 `json:"cumFundingFeeEv"` CumTransactFeeEv int64 `json:"cumTransactFeeEv"` CurTermRealisedPnlEv int64 `json:"curTermRealisedPnlEv"` Currency string `json:"currency"` DataVer float64 `json:"dataVer"` DeleveragePercentileEr int64 `json:"deleveragePercentileEr"` DisplayLeverageEr int64 `json:"displayLeverageEr"` EstimatedOrdLossEv int64 `json:"estimatedOrdLossEv"` ExecSeq int64 `json:"execSeq"` FreeCostEv int64 `json:"freeCostEv"` FreeQty float64 `json:"freeQty"` InitMarginReqEr int64 `json:"initMarginReqEr"` LastFundingTime int64 `json:"lastFundingTime"` LastTermEndTime int64 `json:"lastTermEndTime"` LeverageEr int64 `json:"leverageEr"` LiquidationPriceEp int64 `json:"liquidationPriceEp"` MaintMarginReqEr int64 `json:"maintMarginReqEr"` MakerFeeRateEr int64 `json:"makerFeeRateEr"` MarkPriceEp int64 `json:"markPriceEp"` OrderCostEv int64 `json:"orderCostEv"` PosCostEv int64 `json:"posCostEv"` PositionMarginEv int64 `json:"positionMarginEv"` PositionStatus string `json:"positionStatus"` RiskLimitEv int64 `json:"riskLimitEv"` SellLeavesQty float64 `json:"sellLeavesQty"` SellLeavesValueEv int64 `json:"sellLeavesValueEv"` SellValueToCostEr int64 `json:"sellValueToCostEr"` Side string `json:"side"` Size float64 `json:"size"` Symbol string `json:"symbol"` TakerFeeRateEr int64 `json:"takerFeeRateEr"` Term int64 `json:"term"` UnrealisedPnlEv int64 `json:"unrealisedPnlEv"` UpdatedAtNs int64 `json:"updatedAtNs"` UsedBalanceEv int64 `json:"usedBalanceEv"` UserID int64 `json:"userID"` ValueEv int64 `json:"valueEv"` }
WsPosition ws position
type WsPositionInfo ¶
type WsPositionInfo struct { PositionInfo *PositionInfo `json:"position_info"` Sequence int64 `json:"sequence"` }
WsPositionInfo ws position info