Documentation ¶
Index ¶
- Constants
- Variables
- func FormatTimestamp(t time.Time) int64
- func IsAPIError(e error) bool
- func WsMarketDataServe(symbols []string, handler WsMarketDataHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- func WsOHLCMarketDataServe(symbols []string, intervals []string, handler WsOHLCMarketDataHandler, ...) (doneC, stopC chan struct{}, err error)
- func WsTradesServe(symbols []string, handler WsTradesHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
- type APIError
- type Account
- type Ask
- type Balance
- type Bid
- type CancelOrderResponse
- type CancelOrderService
- type CandlestickInterval
- type Client
- func (c *Client) NewCancelOrderService() *CancelOrderService
- func (c *Client) NewCloseTradingPositionService() *CloseTradingPositionService
- func (c *Client) NewCreateOrderService() *CreateOrderService
- func (c *Client) NewDepthService() *DepthService
- func (c *Client) NewEditExchangeOrderService() *EditExchangeOrderService
- func (c *Client) NewExchangeInfoService() *ExchangeInfoService
- func (c *Client) NewFetchOrderService() *FetchOrderService
- func (c *Client) NewGetAccountService() *GetAccountService
- func (c *Client) NewKlinesService() *KlinesService
- func (c *Client) NewListHistoricalPositionsService() *ListHistoricalPositionsService
- func (c *Client) NewListOpenOrdersService() *ListOpenOrdersService
- func (c *Client) NewListTradingPositionsService() *ListTradingPositionsService
- func (c *Client) SetAPIEndpoint(endpoint string) *Client
- type CloseTradingPositionResponse
- type CloseTradingPositionService
- type CreateOrderResponse
- type CreateOrderService
- func (s *CreateOrderService) AccountID(accountID int64) *CreateOrderService
- func (s *CreateOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CreateOrderResponse, err error)
- func (s *CreateOrderService) ExpireTimestamp(expireTimestamp int64) *CreateOrderService
- func (s *CreateOrderService) GuaranteedStopLoss(guaranteedStopLoss bool) *CreateOrderService
- func (s *CreateOrderService) Leverage(leverage int32) *CreateOrderService
- func (s *CreateOrderService) NewOrderRespType(newOrderRespType NewOrderRespType) *CreateOrderService
- func (s *CreateOrderService) Price(price float64) *CreateOrderService
- func (s *CreateOrderService) ProfitDistance(profitDistance float64) *CreateOrderService
- func (s *CreateOrderService) Quantity(quantity float64) *CreateOrderService
- func (s *CreateOrderService) Side(side SideType) *CreateOrderService
- func (s *CreateOrderService) StopDistance(stopDistance float64) *CreateOrderService
- func (s *CreateOrderService) StopLoss(stopLoss float64) *CreateOrderService
- func (s *CreateOrderService) Symbol(symbol string) *CreateOrderService
- func (s *CreateOrderService) TakeProfit(takeProfit float64) *CreateOrderService
- func (s *CreateOrderService) TrailingStopLoss(trailingStopLoss bool) *CreateOrderService
- func (s *CreateOrderService) Type(orderType OrderType) *CreateOrderService
- type DepthResponse
- type DepthService
- type EditExchangeOrderResponse
- type EditExchangeOrderService
- func (s *EditExchangeOrderService) Do(ctx context.Context, opts ...RequestOption) (res *EditExchangeOrderResponse, err error)
- func (s *EditExchangeOrderService) ExpireTimestamp(expireTimestamp ExpireTimestampType) *EditExchangeOrderService
- func (s *EditExchangeOrderService) OrderID(orderID string) *EditExchangeOrderService
- func (s *EditExchangeOrderService) Price(price string) *EditExchangeOrderService
- type ErrHandler
- type ExchangeFilter
- type ExchangeInfo
- type ExchangeInfoService
- type ExchangeSymbolFilter
- type ExchangeSymbolInfo
- type ExpireTimestampType
- type FeeDetailsDto
- type FetchOrderResponse
- type FetchOrderService
- type GetAccountService
- type HistoricalPositionDto
- type Kline
- type KlinesService
- func (s *KlinesService) Do(ctx context.Context, opts ...RequestOption) (res []*Kline, err error)
- func (s *KlinesService) EndTime(endTime int64) *KlinesService
- func (s *KlinesService) Interval(interval string) *KlinesService
- func (s *KlinesService) Limit(limit int) *KlinesService
- func (s *KlinesService) PriceType(priceType string) *KlinesService
- func (s *KlinesService) StartTime(startTime int64) *KlinesService
- func (s *KlinesService) Symbol(symbol string) *KlinesService
- func (s *KlinesService) Type(ktype string) *KlinesService
- type ListHistoricalPositionsResponse
- type ListHistoricalPositionsService
- func (s *ListHistoricalPositionsService) Do(ctx context.Context, opts ...RequestOption) (res *ListHistoricalPositionsResponse, err error)
- func (s *ListHistoricalPositionsService) From(from int64) *ListHistoricalPositionsService
- func (s *ListHistoricalPositionsService) Limit(limit int) *ListHistoricalPositionsService
- func (s *ListHistoricalPositionsService) Symbol(symbol string) *ListHistoricalPositionsService
- func (s *ListHistoricalPositionsService) To(to int64) *ListHistoricalPositionsService
- type ListOpenOrdersService
- type ListTradingPositionsResponse
- type ListTradingPositionsService
- type NewOrderRespType
- type OrderStatusType
- type OrderType
- type PositionSideType
- type PriceLevel
- type PriceLevelList
- type QueryOrderResponse
- type RateLimit
- type RequestDto
- type RequestOption
- type SideType
- type TimeInForceType
- type TradingPositionDto
- type UpdateTradingOrderResponse
- type UpdateTradingOrderService
- func (s *UpdateTradingOrderService) Do(ctx context.Context, opts ...RequestOption) (res *UpdateTradingOrderResponse, err error)
- func (s *UpdateTradingOrderService) GuaranteedStopLoss(guaranteedStopLoss bool) *UpdateTradingOrderService
- func (s *UpdateTradingOrderService) NewPrice(newPrice float64) *UpdateTradingOrderService
- func (s *UpdateTradingOrderService) OrderID(orderID string) *UpdateTradingOrderService
- func (s *UpdateTradingOrderService) ProfitDistance(profitDistance float64) *UpdateTradingOrderService
- func (s *UpdateTradingOrderService) StopDistance(stopDistance float64) *UpdateTradingOrderService
- func (s *UpdateTradingOrderService) StopLoss(stopLoss float64) *UpdateTradingOrderService
- func (s *UpdateTradingOrderService) TakeProfit(takeProfit float64) *UpdateTradingOrderService
- func (s *UpdateTradingOrderService) TrailingStopLoss(trailingStopLoss bool) *UpdateTradingOrderService
- type UpdateTradingPositionResponse
- type UpdateTradingPositionService
- func (s *UpdateTradingPositionService) Do(ctx context.Context, opts ...RequestOption) (res *UpdateTradingPositionResponse, err error)
- func (s *UpdateTradingPositionService) GuaranteedStopLoss(guaranteedStopLoss bool) *UpdateTradingPositionService
- func (s *UpdateTradingPositionService) PositionID(positionID string) *UpdateTradingPositionService
- func (s *UpdateTradingPositionService) ProfitDistance(profitDistance float64) *UpdateTradingPositionService
- func (s *UpdateTradingPositionService) StopDistance(stopDistance float64) *UpdateTradingPositionService
- func (s *UpdateTradingPositionService) StopLoss(stopLoss float64) *UpdateTradingPositionService
- func (s *UpdateTradingPositionService) TakeProfit(takeProfit float64) *UpdateTradingPositionService
- func (s *UpdateTradingPositionService) TrailingStopLoss(trailingStopLoss bool) *UpdateTradingPositionService
- type WsConfig
- type WsHandler
- type WsMarketDataEvent
- type WsMarketDataHandler
- type WsOHLCMarketDataEvent
- type WsOHLCMarketDataHandler
- type WsRequest
- type WsTradesEvent
- type WsTradesHandler
Constants ¶
const ( // BaseURL is the base url of currency.com api BaseURL = "https://api-adapter.backend.currency.com/" // BaseDemoURL is the base url of currency.com demo api BaseDemoURL = "https://demo-api-adapter.backend.currency.com/" )
const ( SideTypeBuy SideType = "BUY" SideTypeSell SideType = "SELL" OrderTypeLimit OrderType = "LIMIT" OrderTypeMarket OrderType = "MARKET" OrderTypeStop OrderType = "STOP" OrderStatusTypeNew OrderStatusType = "NEW" OrderStatusTypePartiallyFilled OrderStatusType = "PARTIALLY_FILLED" OrderStatusTypeFilled OrderStatusType = "FILLED" OrderStatusTypeCanceled OrderStatusType = "CANCELED" OrderStatusTypeRejected OrderStatusType = "REJECTED" OrderStatusTypeExpired OrderStatusType = "EXPIRED" OrderStatusTypePendingCancel OrderStatusType = "PENDING_CANCEL" TimeInForceTypeGTC TimeInForceType = "GTC" TimeInForceTypeIOC TimeInForceType = "IOC" TimeInForceTypeFOK TimeInForceType = "FOK" NewOrderRespTypeACK NewOrderRespType = "ACK" NewOrderRespTypeRESULT NewOrderRespType = "RESULT" NewOrderRespTypeFULL NewOrderRespType = "FULL" ExpireTimestampTypeGTC ExpireTimestampType = "GTC" ExpireTimestampTypeFOK ExpireTimestampType = "FOK" CandlestickInterval1m CandlestickInterval = "1m" CandlestickInterval5m CandlestickInterval = "5m" CandlestickInterval15m CandlestickInterval = "15m" CandlestickInterval30m CandlestickInterval = "30m" CandlestickInterval1h CandlestickInterval = "1h" CandlestickInterval4h CandlestickInterval = "4h" CandlestickInterval1d CandlestickInterval = "1d" CandlestickInterval1w CandlestickInterval = "1w" )
Global enums
Variables ¶
var ( WebsocketTimeout = 30 * time.Second WebsocketKeepAlive = true CorrelationID = -1 )
var UseDemo = true
UseDemo is the flag to use demo api
Functions ¶
func FormatTimestamp ¶
func WsMarketDataServe ¶
func WsMarketDataServe(symbols []string, handler WsMarketDataHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
func WsOHLCMarketDataServe ¶
func WsOHLCMarketDataServe(symbols []string, intervals []string, handler WsOHLCMarketDataHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
func WsTradesServe ¶
func WsTradesServe(symbols []string, handler WsTradesHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)
Types ¶
type Account ¶
type Account struct { AffiliateID string `json:"affiliateId"` Balances []Balance `json:"balances"` BuyerCommission float32 `json:"buyerCommission"` CanDeposit bool `json:"canDeposit"` CanTrade bool `json:"canTrade"` CanWithdraw bool `json:"canWithdraw"` MakerCommission float32 `json:"makerCommission"` SellerCommission float32 `json:"sellerCommission"` TakerCommission float32 `json:"takerCommission"` UpdateTime int64 `json:"updateTime"` UserID int64 `json:"userId"` }
type CancelOrderResponse ¶
type CancelOrderResponse struct { ExecutedQty string `json:"executedQty"` OrderID string `json:"orderId"` OrigQty string `json:"origQty"` Price string `json:"price"` Side SideType `json:"side"` Status OrderStatusType `json:"status"` Symbol string `json:"symbol"` TimeInForce TimeInForceType `json:"timeInForce"` Type OrderType `json:"type"` }
type CancelOrderService ¶
type CancelOrderService struct {
// contains filtered or unexported fields
}
func (*CancelOrderService) Do ¶
func (s *CancelOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CancelOrderResponse, err error)
Do send request
func (*CancelOrderService) OrderID ¶
func (s *CancelOrderService) OrderID(orderID string) *CancelOrderService
OrderID set order id
func (*CancelOrderService) Symbol ¶
func (s *CancelOrderService) Symbol(symbol string) *CancelOrderService
Symbol set symbol
type CandlestickInterval ¶
type CandlestickInterval string
CandlestickInterval define interval of candlestick
type Client ¶
type Client struct { APIKey string SecretKey string BaseURL string UserAgent string HTTPClient *http.Client Debug bool Logger *log.Logger TimeOffset int64 // contains filtered or unexported fields }
func (*Client) NewCancelOrderService ¶
func (c *Client) NewCancelOrderService() *CancelOrderService
func (*Client) NewCloseTradingPositionService ¶
func (c *Client) NewCloseTradingPositionService() *CloseTradingPositionService
func (*Client) NewCreateOrderService ¶
func (c *Client) NewCreateOrderService() *CreateOrderService
func (*Client) NewDepthService ¶
func (c *Client) NewDepthService() *DepthService
func (*Client) NewEditExchangeOrderService ¶
func (c *Client) NewEditExchangeOrderService() *EditExchangeOrderService
func (*Client) NewExchangeInfoService ¶
func (c *Client) NewExchangeInfoService() *ExchangeInfoService
func (*Client) NewFetchOrderService ¶
func (c *Client) NewFetchOrderService() *FetchOrderService
func (*Client) NewGetAccountService ¶
func (c *Client) NewGetAccountService() *GetAccountService
func (*Client) NewKlinesService ¶
func (c *Client) NewKlinesService() *KlinesService
func (*Client) NewListHistoricalPositionsService ¶
func (c *Client) NewListHistoricalPositionsService() *ListHistoricalPositionsService
func (*Client) NewListOpenOrdersService ¶
func (c *Client) NewListOpenOrdersService() *ListOpenOrdersService
func (*Client) NewListTradingPositionsService ¶
func (c *Client) NewListTradingPositionsService() *ListTradingPositionsService
func (*Client) SetAPIEndpoint ¶
type CloseTradingPositionResponse ¶
type CloseTradingPositionResponse struct {
Request []RequestDto `json:"request"`
}
type CloseTradingPositionService ¶
type CloseTradingPositionService struct {
// contains filtered or unexported fields
}
func (*CloseTradingPositionService) Do ¶
func (s *CloseTradingPositionService) Do(ctx context.Context, opts ...RequestOption) (res *CloseTradingPositionResponse, err error)
Do send request
func (*CloseTradingPositionService) PositionID ¶
func (s *CloseTradingPositionService) PositionID(positionID string) *CloseTradingPositionService
type CreateOrderResponse ¶
type CreateOrderResponse struct { ExecutedQty string `json:"executedQty"` ExpireTimestamp int64 `json:"expireTimestamp"` GuaranteedStopLoss bool `json:"guaranteedStopLoss"` Margin float64 `json:"margin"` OrderID string `json:"orderId"` OrigQty string `json:"origQty"` Price string `json:"price"` ProfitDistance float64 `json:"profitDistance"` RejectMessage string `json:"rejectMessage"` Side SideType `json:"side"` Status OrderStatusType `json:"status"` StopDistance float64 `json:"stopDistance"` StopLoss float64 `json:"stopLoss"` Symbol string `json:"symbol"` TakeProfit float64 `json:"takeProfit"` TimeInForce TimeInForceType `json:"timeInForce"` TrailingStopLoss bool `json:"trailingStopLoss"` TransactTime int64 `json:"transactTime"` Type OrderType `json:"type"` }
type CreateOrderService ¶
type CreateOrderService struct {
// contains filtered or unexported fields
}
func (*CreateOrderService) AccountID ¶
func (s *CreateOrderService) AccountID(accountID int64) *CreateOrderService
AccountID set account id
func (*CreateOrderService) Do ¶
func (s *CreateOrderService) Do(ctx context.Context, opts ...RequestOption) (res *CreateOrderResponse, err error)
Do send request
func (*CreateOrderService) ExpireTimestamp ¶
func (s *CreateOrderService) ExpireTimestamp(expireTimestamp int64) *CreateOrderService
ExpireTimestamp set expire timestamp
func (*CreateOrderService) GuaranteedStopLoss ¶
func (s *CreateOrderService) GuaranteedStopLoss(guaranteedStopLoss bool) *CreateOrderService
GuaranteedStopLoss set guaranteed stop loss
func (*CreateOrderService) Leverage ¶
func (s *CreateOrderService) Leverage(leverage int32) *CreateOrderService
Leverage set leverage
func (*CreateOrderService) NewOrderRespType ¶
func (s *CreateOrderService) NewOrderRespType(newOrderRespType NewOrderRespType) *CreateOrderService
NewOrderRespType set new order response type
func (*CreateOrderService) Price ¶
func (s *CreateOrderService) Price(price float64) *CreateOrderService
Price set price
func (*CreateOrderService) ProfitDistance ¶
func (s *CreateOrderService) ProfitDistance(profitDistance float64) *CreateOrderService
ProfitDistance set profit distance
func (*CreateOrderService) Quantity ¶
func (s *CreateOrderService) Quantity(quantity float64) *CreateOrderService
Quantity set quantity
func (*CreateOrderService) Side ¶
func (s *CreateOrderService) Side(side SideType) *CreateOrderService
Side set side
func (*CreateOrderService) StopDistance ¶
func (s *CreateOrderService) StopDistance(stopDistance float64) *CreateOrderService
StopDistance set stop distance
func (*CreateOrderService) StopLoss ¶
func (s *CreateOrderService) StopLoss(stopLoss float64) *CreateOrderService
StopLoss set stop loss
func (*CreateOrderService) Symbol ¶
func (s *CreateOrderService) Symbol(symbol string) *CreateOrderService
Symbol set symbol
func (*CreateOrderService) TakeProfit ¶
func (s *CreateOrderService) TakeProfit(takeProfit float64) *CreateOrderService
TakeProfit set take profit
func (*CreateOrderService) TrailingStopLoss ¶
func (s *CreateOrderService) TrailingStopLoss(trailingStopLoss bool) *CreateOrderService
TrailingStopLoss set trailing stop loss
func (*CreateOrderService) Type ¶
func (s *CreateOrderService) Type(orderType OrderType) *CreateOrderService
Type set order type
type DepthResponse ¶
type DepthResponse struct { LastUpdateID int64 `json:"lastUpdateId"` Bids []Bid `json:"bids"` Asks []Ask `json:"asks"` }
DepthResponse define depth info with bids and asks
type DepthService ¶
type DepthService struct {
// contains filtered or unexported fields
}
func (*DepthService) Do ¶
func (s *DepthService) Do(ctx context.Context, opts ...RequestOption) (res *DepthResponse, err error)
Do send request
func (*DepthService) Symbol ¶
func (s *DepthService) Symbol(symbol string) *DepthService
Symbol set symbol
type EditExchangeOrderResponse ¶
type EditExchangeOrderResponse struct {
OrderID string `json:"orderId"`
}
type EditExchangeOrderService ¶
type EditExchangeOrderService struct {
// contains filtered or unexported fields
}
func (*EditExchangeOrderService) Do ¶
func (s *EditExchangeOrderService) Do(ctx context.Context, opts ...RequestOption) (res *EditExchangeOrderResponse, err error)
Do send request
func (*EditExchangeOrderService) ExpireTimestamp ¶
func (s *EditExchangeOrderService) ExpireTimestamp(expireTimestamp ExpireTimestampType) *EditExchangeOrderService
ExpireTimestamp set expire timestamp
func (*EditExchangeOrderService) OrderID ¶
func (s *EditExchangeOrderService) OrderID(orderID string) *EditExchangeOrderService
OrderID set order id
func (*EditExchangeOrderService) Price ¶
func (s *EditExchangeOrderService) Price(price string) *EditExchangeOrderService
Price set price
type ErrHandler ¶
type ErrHandler func(err error)
type ExchangeFilter ¶
type ExchangeInfo ¶
type ExchangeInfo struct { ExchangeFilters []ExchangeFilter `json:"exchangeFilters"` RateLimits []RateLimit `json:"rateLimits"` ServerTime int64 `json:"serverTime"` Symbols []ExchangeSymbolInfo `json:"symbols"` Timezone string `json:"timezone"` }
type ExchangeInfoService ¶
type ExchangeInfoService struct {
// contains filtered or unexported fields
}
func (*ExchangeInfoService) Do ¶
func (s *ExchangeInfoService) Do(ctx context.Context, opts ...RequestOption) (res *ExchangeInfo, err error)
type ExchangeSymbolFilter ¶
type ExchangeSymbolInfo ¶
type ExchangeSymbolInfo struct { AssetType string `json:"assetType"` BaseAsset string `json:"baseAsset"` BaseAssetPrecision int `json:"baseAssetPrecision"` Country string `json:"country"` ExchangeFee float64 `json:"exchangeFee"` Filters []ExchangeSymbolFilter `json:"filters"` Industry string `json:"industry"` LongRate float64 `json:"longRate"` MakerFee float64 `json:"makerFee"` MarketModes []string `json:"marketModes"` MarketType string `json:"marketType"` MaxSLGap float64 `json:"maxSLGap"` MaxTPGap float64 `json:"maxTPGap"` MinSLGap float64 `json:"minSLGap"` MinTPGap float64 `json:"minTPGap"` Name string `json:"name"` OrderTypes []OrderType `json:"orderTypes"` QuoteAsset string `json:"quoteAsset"` QuoteAssetID string `json:"quoteAssetId"` QuotePrecision int `json:"quotePrecision"` Sector string `json:"sector"` ShortRate float64 `json:"shortRate"` Status string `json:"status"` SwapChargeInterval int64 `json:"swapChargeInterval"` Symbol string `json:"symbol"` TakerFee float64 `json:"takerFee"` TickSize float64 `json:"tickSize"` TickValue float64 `json:"tickValue"` TradingFee float64 `json:"tradingFee"` TradingHours string `json:"tradingHours"` }
type ExpireTimestampType ¶
type ExpireTimestampType string
ExpireTimestampType define expire time of order
type FeeDetailsDto ¶
type FeeDetailsDto struct {
Commission float64 `json:"commission"`
}
type FetchOrderResponse ¶
type FetchOrderResponse struct { AccountID string `json:"accountId"` ExecPrice float64 `json:"execPrice"` ExecQuantity float64 `json:"execQuantity"` ExpireTime int64 `json:"expireTime"` GuaranteedStopLoss bool `json:"guaranteedStopLoss"` Margin float64 `json:"margin"` OrderID string `json:"orderId"` Price float64 `json:"price"` Quantity float64 `json:"quantity"` RejectReason string `json:"rejectReason"` Side SideType `json:"side"` Status OrderStatusType `json:"status"` StopLoss float64 `json:"stopLoss"` TakeProfit float64 `json:"takeProfit"` TimeInForceType TimeInForceType `json:"timeInForceType"` Timestamp int64 `json:"timestamp"` TrailingStopLoss bool `json:"trailingStopLoss"` Type OrderType `json:"type"` }
type FetchOrderService ¶
type FetchOrderService struct {
// contains filtered or unexported fields
}
func (*FetchOrderService) Do ¶
func (s *FetchOrderService) Do(ctx context.Context, opts ...RequestOption) (res *FetchOrderResponse, err error)
Do send request
func (*FetchOrderService) OrderID ¶
func (s *FetchOrderService) OrderID(orderID string) *FetchOrderService
OrderID set order id
func (*FetchOrderService) Symbol ¶
func (s *FetchOrderService) Symbol(symbol string) *FetchOrderService
Symbol set symbol
type GetAccountService ¶
type GetAccountService struct {
// contains filtered or unexported fields
}
func (*GetAccountService) Do ¶
func (s *GetAccountService) Do(ctx context.Context, opts ...RequestOption) (res *Account, err error)
Do send request
type HistoricalPositionDto ¶
type HistoricalPositionDto struct { AccountCurrency string `json:"accountCurrency"` AccountID int64 `json:"accountId"` CreatedTimestamp int64 `json:"createdTimestamp"` Currency string `json:"currency"` ExecID string `json:"execId"` ExecTimestamp int64 `json:"execTimestamp"` ExecutionTyp string `json:"executionType"` Fee float64 `json:"fee"` FeeDetails FeeDetailsDto `json:"feeDetails"` FxRate float64 `json:"fxRate"` GSL bool `json:"gSL"` InstrumentID int64 `json:"instrumentId"` PositionID string `json:"positionId"` Price float64 `json:"price"` Quantity float64 `json:"quantity"` RejectReason string `json:"rejectReason"` Rpl float64 `json:"rpl"` RplConverted float64 `json:"rplConverted"` Source string `json:"source"` Status string `json:"status"` StopLoss float64 `json:"stopLoss"` Swap float64 `json:"swap"` SwapConverted float64 `json:"swapConverted"` Symbol string `json:"symbol"` TakeProfit float64 `json:"takeProfit"` TrailingStopLoss bool `json:"trailingStopLoss"` }
type Kline ¶
type Kline struct { OpenTime int64 `json:"openTime"` Open string `json:"open"` High string `json:"high"` Low string `json:"low"` Close string `json:"close"` Volume string `json:"volume"` }
Kline define kline info
type KlinesService ¶
type KlinesService struct {
// contains filtered or unexported fields
}
func (*KlinesService) Do ¶
func (s *KlinesService) Do(ctx context.Context, opts ...RequestOption) (res []*Kline, err error)
func (*KlinesService) EndTime ¶
func (s *KlinesService) EndTime(endTime int64) *KlinesService
func (*KlinesService) Interval ¶
func (s *KlinesService) Interval(interval string) *KlinesService
func (*KlinesService) Limit ¶
func (s *KlinesService) Limit(limit int) *KlinesService
func (*KlinesService) PriceType ¶
func (s *KlinesService) PriceType(priceType string) *KlinesService
func (*KlinesService) StartTime ¶
func (s *KlinesService) StartTime(startTime int64) *KlinesService
func (*KlinesService) Symbol ¶
func (s *KlinesService) Symbol(symbol string) *KlinesService
func (*KlinesService) Type ¶
func (s *KlinesService) Type(ktype string) *KlinesService
type ListHistoricalPositionsResponse ¶
type ListHistoricalPositionsResponse struct {
History []HistoricalPositionDto `json:"history"`
}
type ListHistoricalPositionsService ¶
type ListHistoricalPositionsService struct {
// contains filtered or unexported fields
}
func (*ListHistoricalPositionsService) Do ¶
func (s *ListHistoricalPositionsService) Do(ctx context.Context, opts ...RequestOption) (res *ListHistoricalPositionsResponse, err error)
Do send request
func (*ListHistoricalPositionsService) From ¶
func (s *ListHistoricalPositionsService) From(from int64) *ListHistoricalPositionsService
func (*ListHistoricalPositionsService) Limit ¶
func (s *ListHistoricalPositionsService) Limit(limit int) *ListHistoricalPositionsService
func (*ListHistoricalPositionsService) Symbol ¶
func (s *ListHistoricalPositionsService) Symbol(symbol string) *ListHistoricalPositionsService
func (*ListHistoricalPositionsService) To ¶
func (s *ListHistoricalPositionsService) To(to int64) *ListHistoricalPositionsService
type ListOpenOrdersService ¶
type ListOpenOrdersService struct {
// contains filtered or unexported fields
}
func (*ListOpenOrdersService) Do ¶
func (s *ListOpenOrdersService) Do(ctx context.Context, opts ...RequestOption) (res []*QueryOrderResponse, err error)
Do send request
type ListTradingPositionsResponse ¶
type ListTradingPositionsResponse struct {
Positions []TradingPositionDto `json:"positions"`
}
type ListTradingPositionsService ¶
type ListTradingPositionsService struct {
// contains filtered or unexported fields
}
func (*ListTradingPositionsService) Do ¶
func (s *ListTradingPositionsService) Do(ctx context.Context, opts ...RequestOption) (res *ListTradingPositionsResponse, err error)
Do send request
type NewOrderRespType ¶
type NewOrderRespType string
NewOrderRespType define response JSON verbosity
type PositionSideType ¶
type PositionSideType string
PositionSideType define position side type of order
type PriceLevel ¶
type PriceLevelList ¶
type PriceLevelList []PriceLevel
func (PriceLevelList) Len ¶
func (p PriceLevelList) Len() int
func (PriceLevelList) Less ¶
func (p PriceLevelList) Less(i, j int) bool
func (PriceLevelList) Swap ¶
func (p PriceLevelList) Swap(i, j int)
type QueryOrderResponse ¶
type QueryOrderResponse struct { AccountID string `json:"accountId"` ExecutedQty string `json:"executedQty"` ExpireTimestamp int64 `json:"expireTimestamp"` GuaranteedStopLoss bool `json:"guaranteedStopLoss"` IcebergQty string `json:"icebergQty"` Leverage bool `json:"leverage"` Margin float64 `json:"margin"` OrderID string `json:"orderId"` OrigQty string `json:"origQty"` Price string `json:"price"` Side SideType `json:"side"` Status OrderStatusType `json:"status"` StopLoss float64 `json:"stopLoss"` Symbol string `json:"symbol"` TakeProfit float64 `json:"takeProfit"` Time int64 `json:"time"` TimeInForce TimeInForceType `json:"timeInForce"` TrailingStopLoss bool `json:"trailingStopLoss"` Type OrderType `json:"type"` UpdateTime int64 `json:"updateTime"` Working bool `json:"working"` }
type RequestDto ¶
type RequestDto struct { AccountID string `json:"accountId"` CreatedTimestamp int64 `json:"createdTimestamp"` ID int64 `json:"id"` OrderID string `json:"orderId"` PositionID string `json:"positionId"` RejectReason string `json:"rejectReason"` RqType string `json:"rqType"` State string `json:"state"` }
type TimeInForceType ¶
type TimeInForceType string
TimeInForceType define time in force type of order
type TradingPositionDto ¶
type TradingPositionDto struct { AccountID string `json:"accountId"` ClosePrice float64 `json:"closePrice"` CloseQuantity float64 `json:"closeQuantity"` CloseTimestamp int64 `json:"closeTimestamp"` Cost float64 `json:"cost"` CreatedTimestamp int64 `json:"createdTimestamp"` Currency string `json:"currency"` CurrentTrailingPrice float64 `json:"currentTrailingPrice"` CurrenTrailingPriceUpdatedTimestamp int64 `json:"currenTrailingPriceUpdatedTimestamp"` Dividend float64 `json:"dividend"` Fee float64 `json:"fee"` GuaranteedStopLoss bool `json:"guaranteedStopLoss"` ID string `json:"id"` InstrumentID int64 `json:"instrumentId"` Margin float64 `json:"margin"` OpenPrice float64 `json:"openPrice"` OpenQuantity float64 `json:"openQuantity"` OpenTimestamp int64 `json:"openTimestamp"` OrderID string `json:"orderId"` Rpl float64 `json:"rpl"` RplConverted float64 `json:"rplConverted"` State string `json:"state"` StopLoss float64 `json:"stopLoss"` Swap float64 `json:"swap"` SwapConverted float64 `json:"swapConverted"` Symbol string `json:"symbol"` TakeProfit float64 `json:"takeProfit"` TrailingQuotedPrice float64 `json:"trailingQuotedPrice"` TrailingStopLoss bool `json:"trailingStopLoss"` Type string `json:"type"` Upl float64 `json:"upl"` UplConverted float64 `json:"uplConverted"` }
type UpdateTradingOrderService ¶
type UpdateTradingOrderService struct {
// contains filtered or unexported fields
}
func (*UpdateTradingOrderService) Do ¶
func (s *UpdateTradingOrderService) Do(ctx context.Context, opts ...RequestOption) (res *UpdateTradingOrderResponse, err error)
Do send request
func (*UpdateTradingOrderService) GuaranteedStopLoss ¶
func (s *UpdateTradingOrderService) GuaranteedStopLoss(guaranteedStopLoss bool) *UpdateTradingOrderService
GuaranteedStopLoss set guaranteed stop loss
func (*UpdateTradingOrderService) NewPrice ¶
func (s *UpdateTradingOrderService) NewPrice(newPrice float64) *UpdateTradingOrderService
NewPrice set new price
func (*UpdateTradingOrderService) OrderID ¶
func (s *UpdateTradingOrderService) OrderID(orderID string) *UpdateTradingOrderService
OrderID set order id
func (*UpdateTradingOrderService) ProfitDistance ¶
func (s *UpdateTradingOrderService) ProfitDistance(profitDistance float64) *UpdateTradingOrderService
ProfitDistance set profit distance
func (*UpdateTradingOrderService) StopDistance ¶
func (s *UpdateTradingOrderService) StopDistance(stopDistance float64) *UpdateTradingOrderService
StopDistance set stop distance
func (*UpdateTradingOrderService) StopLoss ¶
func (s *UpdateTradingOrderService) StopLoss(stopLoss float64) *UpdateTradingOrderService
StopLoss set stop loss
func (*UpdateTradingOrderService) TakeProfit ¶
func (s *UpdateTradingOrderService) TakeProfit(takeProfit float64) *UpdateTradingOrderService
TakeProfit set take profit
func (*UpdateTradingOrderService) TrailingStopLoss ¶
func (s *UpdateTradingOrderService) TrailingStopLoss(trailingStopLoss bool) *UpdateTradingOrderService
TrailingStopLoss set trailing stop loss
type UpdateTradingPositionService ¶
type UpdateTradingPositionService struct {
// contains filtered or unexported fields
}
func (*UpdateTradingPositionService) Do ¶
func (s *UpdateTradingPositionService) Do(ctx context.Context, opts ...RequestOption) (res *UpdateTradingPositionResponse, err error)
Do send request
func (*UpdateTradingPositionService) GuaranteedStopLoss ¶
func (s *UpdateTradingPositionService) GuaranteedStopLoss(guaranteedStopLoss bool) *UpdateTradingPositionService
func (*UpdateTradingPositionService) PositionID ¶
func (s *UpdateTradingPositionService) PositionID(positionID string) *UpdateTradingPositionService
func (*UpdateTradingPositionService) ProfitDistance ¶
func (s *UpdateTradingPositionService) ProfitDistance(profitDistance float64) *UpdateTradingPositionService
func (*UpdateTradingPositionService) StopDistance ¶
func (s *UpdateTradingPositionService) StopDistance(stopDistance float64) *UpdateTradingPositionService
func (*UpdateTradingPositionService) StopLoss ¶
func (s *UpdateTradingPositionService) StopLoss(stopLoss float64) *UpdateTradingPositionService
func (*UpdateTradingPositionService) TakeProfit ¶
func (s *UpdateTradingPositionService) TakeProfit(takeProfit float64) *UpdateTradingPositionService
func (*UpdateTradingPositionService) TrailingStopLoss ¶
func (s *UpdateTradingPositionService) TrailingStopLoss(trailingStopLoss bool) *UpdateTradingPositionService
type WsMarketDataEvent ¶
type WsMarketDataHandler ¶
type WsMarketDataHandler func(event *WsMarketDataEvent)
type WsOHLCMarketDataEvent ¶
type WsOHLCMarketDataHandler ¶
type WsOHLCMarketDataHandler func(event *WsOHLCMarketDataEvent)
type WsTradesEvent ¶
type WsTradesHandler ¶
type WsTradesHandler func(event *WsTradesEvent)