ftxapi

package
v1.39.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const RestBaseURL = "https://ftx.com/api"

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	Success     bool            `json:"success"`
	Result      json.RawMessage `json:"result,omitempty"`
	HasMoreData bool            `json:"hasMoreData,omitempty"`
}

type Account

type Account struct {
	BackstopProvider             bool             `json:"backstopProvider"`
	Collateral                   fixedpoint.Value `json:"collateral"`
	FreeCollateral               fixedpoint.Value `json:"freeCollateral"`
	Leverage                     fixedpoint.Value `json:"leverage"`
	InitialMarginRequirement     fixedpoint.Value `json:"initialMarginRequirement"`
	MaintenanceMarginRequirement fixedpoint.Value `json:"maintenanceMarginRequirement"`
	Liquidating                  bool             `json:"liquidating"`
	MakerFee                     fixedpoint.Value `json:"makerFee"`
	MarginFraction               fixedpoint.Value `json:"marginFraction"`
	OpenMarginFraction           fixedpoint.Value `json:"openMarginFraction"`
	TakerFee                     fixedpoint.Value `json:"takerFee"`
	TotalAccountValue            fixedpoint.Value `json:"totalAccountValue"`
	TotalPositionSize            fixedpoint.Value `json:"totalPositionSize"`
	Username                     string           `json:"username"`
	Positions                    []Position       `json:"positions"`
}

type Balance

type Balance struct {
	Coin                   string           `json:"coin"`
	Free                   fixedpoint.Value `json:"free"`
	SpotBorrow             fixedpoint.Value `json:"spotBorrow"`
	Total                  fixedpoint.Value `json:"total"`
	UsdValue               fixedpoint.Value `json:"usdValue"`
	AvailableWithoutBorrow fixedpoint.Value `json:"availableWithoutBorrow"`
}

type CancelAllOrderRequest

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

func (*CancelAllOrderRequest) Do

func (*CancelAllOrderRequest) GetParameters

func (c *CancelAllOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CancelAllOrderRequest) GetParametersJSON

func (c *CancelAllOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CancelAllOrderRequest) GetParametersQuery

func (c *CancelAllOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CancelAllOrderRequest) GetQueryParameters

func (c *CancelAllOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CancelAllOrderRequest) GetSlugParameters

func (c *CancelAllOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CancelAllOrderRequest) GetSlugsMap

func (c *CancelAllOrderRequest) GetSlugsMap() (map[string]string, error)

func (*CancelAllOrderRequest) Market

type CancelOrderByClientOrderIdRequest

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

func (*CancelOrderByClientOrderIdRequest) ClientOrderId

func (*CancelOrderByClientOrderIdRequest) Do

func (*CancelOrderByClientOrderIdRequest) GetParameters

func (c *CancelOrderByClientOrderIdRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CancelOrderByClientOrderIdRequest) GetParametersJSON

func (c *CancelOrderByClientOrderIdRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CancelOrderByClientOrderIdRequest) GetParametersQuery

func (c *CancelOrderByClientOrderIdRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CancelOrderByClientOrderIdRequest) GetQueryParameters

func (c *CancelOrderByClientOrderIdRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CancelOrderByClientOrderIdRequest) GetSlugParameters

func (c *CancelOrderByClientOrderIdRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CancelOrderByClientOrderIdRequest) GetSlugsMap

func (c *CancelOrderByClientOrderIdRequest) GetSlugsMap() (map[string]string, error)

type CancelOrderRequest

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

func (*CancelOrderRequest) Do

func (*CancelOrderRequest) GetParameters

func (c *CancelOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CancelOrderRequest) GetParametersJSON

func (c *CancelOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CancelOrderRequest) GetParametersQuery

func (c *CancelOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CancelOrderRequest) GetQueryParameters

func (c *CancelOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CancelOrderRequest) GetSlugParameters

func (c *CancelOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CancelOrderRequest) GetSlugsMap

func (c *CancelOrderRequest) GetSlugsMap() (map[string]string, error)

func (*CancelOrderRequest) OrderID

func (c *CancelOrderRequest) OrderID(orderID string) *CancelOrderRequest

type Coin

type Coin struct {
	Bep2Asset        *string          `json:"bep2Asset"`
	CanConvert       bool             `json:"canConvert"`
	CanDeposit       bool             `json:"canDeposit"`
	CanWithdraw      bool             `json:"canWithdraw"`
	Collateral       bool             `json:"collateral"`
	CollateralWeight fixedpoint.Value `json:"collateralWeight"`
	CreditTo         *string          `json:"creditTo"`
	Erc20Contract    string           `json:"erc20Contract"`
	Fiat             bool             `json:"fiat"`
	HasTag           bool             `json:"hasTag"`
	Id               string           `json:"id"`
	IsToken          bool             `json:"isToken"`
	Methods          []string         `json:"methods"`
	Name             string           `json:"name"`
	SplMint          string           `json:"splMint"`
	Trc20Contract    string           `json:"trc20Contract"`
	UsdFungible      bool             `json:"usdFungible"`
}

type Fill

type Fill struct {
	// Id is fill ID
	Id            uint64           `json:"id"`
	Future        string           `json:"future"`
	Liquidity     Liquidity        `json:"liquidity"`
	Market        string           `json:"market"`
	BaseCurrency  string           `json:"baseCurrency"`
	QuoteCurrency string           `json:"quoteCurrency"`
	OrderId       uint64           `json:"orderId"`
	TradeId       uint64           `json:"tradeId"`
	Price         fixedpoint.Value `json:"price"`
	Side          Side             `json:"side"`
	Size          fixedpoint.Value `json:"size"`
	Time          time.Time        `json:"time"`
	Type          string           `json:"type"` // always = "order"
	Fee           fixedpoint.Value `json:"fee"`
	FeeCurrency   string           `json:"feeCurrency"`
	FeeRate       fixedpoint.Value `json:"feeRate"`
}

type GetAccountRequest

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

func (*GetAccountRequest) Do

func (*GetAccountRequest) GetParameters

func (g *GetAccountRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountRequest) GetParametersJSON

func (g *GetAccountRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountRequest) GetParametersQuery

func (g *GetAccountRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountRequest) GetQueryParameters

func (g *GetAccountRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountRequest) GetSlugParameters

func (g *GetAccountRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountRequest) GetSlugsMap

func (g *GetAccountRequest) GetSlugsMap() (map[string]string, error)

type GetBalancesRequest

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

func (*GetBalancesRequest) Do

func (*GetBalancesRequest) GetParameters

func (g *GetBalancesRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetBalancesRequest) GetParametersJSON

func (g *GetBalancesRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetBalancesRequest) GetParametersQuery

func (g *GetBalancesRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetBalancesRequest) GetQueryParameters

func (g *GetBalancesRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetBalancesRequest) GetSlugParameters

func (g *GetBalancesRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetBalancesRequest) GetSlugsMap

func (g *GetBalancesRequest) GetSlugsMap() (map[string]string, error)

type GetCoinsRequest

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

func (*GetCoinsRequest) Do

func (g *GetCoinsRequest) Do(ctx context.Context) ([]Coin, error)

func (*GetCoinsRequest) GetParameters

func (g *GetCoinsRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetCoinsRequest) GetParametersJSON

func (g *GetCoinsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetCoinsRequest) GetParametersQuery

func (g *GetCoinsRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetCoinsRequest) GetQueryParameters

func (g *GetCoinsRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetCoinsRequest) GetSlugParameters

func (g *GetCoinsRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetCoinsRequest) GetSlugsMap

func (g *GetCoinsRequest) GetSlugsMap() (map[string]string, error)

type GetFillsRequest

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

func (*GetFillsRequest) Do

func (g *GetFillsRequest) Do(ctx context.Context) ([]Fill, error)

func (*GetFillsRequest) EndTime

func (g *GetFillsRequest) EndTime(endTime time.Time) *GetFillsRequest

func (*GetFillsRequest) GetParameters

func (g *GetFillsRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetFillsRequest) GetParametersJSON

func (g *GetFillsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetFillsRequest) GetParametersQuery

func (g *GetFillsRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetFillsRequest) GetQueryParameters

func (g *GetFillsRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetFillsRequest) GetSlugParameters

func (g *GetFillsRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetFillsRequest) GetSlugsMap

func (g *GetFillsRequest) GetSlugsMap() (map[string]string, error)

func (*GetFillsRequest) Market

func (g *GetFillsRequest) Market(market string) *GetFillsRequest

func (*GetFillsRequest) Order

func (g *GetFillsRequest) Order(order string) *GetFillsRequest

func (*GetFillsRequest) OrderID

func (g *GetFillsRequest) OrderID(orderID int) *GetFillsRequest

func (*GetFillsRequest) StartTime

func (g *GetFillsRequest) StartTime(startTime time.Time) *GetFillsRequest

type GetMarketRequest

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

func (*GetMarketRequest) Do

func (g *GetMarketRequest) Do(ctx context.Context) (*Market, error)

func (*GetMarketRequest) GetParameters

func (g *GetMarketRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetMarketRequest) GetParametersJSON

func (g *GetMarketRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetMarketRequest) GetParametersQuery

func (g *GetMarketRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetMarketRequest) GetQueryParameters

func (g *GetMarketRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetMarketRequest) GetSlugParameters

func (g *GetMarketRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetMarketRequest) GetSlugsMap

func (g *GetMarketRequest) GetSlugsMap() (map[string]string, error)

func (*GetMarketRequest) Market

func (g *GetMarketRequest) Market(market string) *GetMarketRequest

type GetMarketsRequest

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

func (*GetMarketsRequest) Do

func (g *GetMarketsRequest) Do(ctx context.Context) ([]Market, error)

func (*GetMarketsRequest) GetParameters

func (g *GetMarketsRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetMarketsRequest) GetParametersJSON

func (g *GetMarketsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetMarketsRequest) GetParametersQuery

func (g *GetMarketsRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetMarketsRequest) GetQueryParameters

func (g *GetMarketsRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetMarketsRequest) GetSlugParameters

func (g *GetMarketsRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetMarketsRequest) GetSlugsMap

func (g *GetMarketsRequest) GetSlugsMap() (map[string]string, error)

type GetOpenOrdersRequest

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

func (*GetOpenOrdersRequest) Do

func (*GetOpenOrdersRequest) GetParameters

func (g *GetOpenOrdersRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetOpenOrdersRequest) GetParametersJSON

func (g *GetOpenOrdersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOpenOrdersRequest) GetParametersQuery

func (g *GetOpenOrdersRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetOpenOrdersRequest) GetQueryParameters

func (g *GetOpenOrdersRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetOpenOrdersRequest) GetSlugParameters

func (g *GetOpenOrdersRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetOpenOrdersRequest) GetSlugsMap

func (g *GetOpenOrdersRequest) GetSlugsMap() (map[string]string, error)

func (*GetOpenOrdersRequest) Market

type GetOrderHistoryRequest

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

func (*GetOrderHistoryRequest) Do

func (*GetOrderHistoryRequest) EndTime

func (*GetOrderHistoryRequest) GetParameters

func (g *GetOrderHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetOrderHistoryRequest) GetParametersJSON

func (g *GetOrderHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderHistoryRequest) GetParametersQuery

func (g *GetOrderHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetOrderHistoryRequest) GetQueryParameters

func (g *GetOrderHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetOrderHistoryRequest) GetSlugParameters

func (g *GetOrderHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetOrderHistoryRequest) GetSlugsMap

func (g *GetOrderHistoryRequest) GetSlugsMap() (map[string]string, error)

func (*GetOrderHistoryRequest) Market

func (*GetOrderHistoryRequest) StartTime

func (g *GetOrderHistoryRequest) StartTime(startTime time.Time) *GetOrderHistoryRequest

type GetOrderStatusRequest

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

func (*GetOrderStatusRequest) Do

func (*GetOrderStatusRequest) GetParameters

func (g *GetOrderStatusRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetOrderStatusRequest) GetParametersJSON

func (g *GetOrderStatusRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetOrderStatusRequest) GetParametersQuery

func (g *GetOrderStatusRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetOrderStatusRequest) GetQueryParameters

func (g *GetOrderStatusRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetOrderStatusRequest) GetSlugParameters

func (g *GetOrderStatusRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetOrderStatusRequest) GetSlugsMap

func (g *GetOrderStatusRequest) GetSlugsMap() (map[string]string, error)

func (*GetOrderStatusRequest) OrderID

func (g *GetOrderStatusRequest) OrderID(orderID uint64) *GetOrderStatusRequest

type GetPositionsRequest

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

func (*GetPositionsRequest) Do

func (*GetPositionsRequest) GetParameters

func (g *GetPositionsRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetPositionsRequest) GetParametersJSON

func (g *GetPositionsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetPositionsRequest) GetParametersQuery

func (g *GetPositionsRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetPositionsRequest) GetQueryParameters

func (g *GetPositionsRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetPositionsRequest) GetSlugParameters

func (g *GetPositionsRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetPositionsRequest) GetSlugsMap

func (g *GetPositionsRequest) GetSlugsMap() (map[string]string, error)

type Liquidity

type Liquidity string
const (
	LiquidityTaker Liquidity = "taker"
	LiquidityMaker Liquidity = "maker"
)

type Market

type Market struct {
	Name                  string           `json:"name"`
	BaseCurrency          string           `json:"baseCurrency"`
	QuoteCurrency         string           `json:"quoteCurrency"`
	QuoteVolume24H        fixedpoint.Value `json:"quoteVolume24h"`
	Change1H              fixedpoint.Value `json:"change1h"`
	Change24H             fixedpoint.Value `json:"change24h"`
	ChangeBod             fixedpoint.Value `json:"changeBod"`
	VolumeUsd24H          fixedpoint.Value `json:"volumeUsd24h"`
	HighLeverageFeeExempt bool             `json:"highLeverageFeeExempt"`
	MinProvideSize        fixedpoint.Value `json:"minProvideSize"`
	Type                  string           `json:"type"`
	Underlying            string           `json:"underlying"`
	Enabled               bool             `json:"enabled"`
	Ask                   fixedpoint.Value `json:"ask"`
	Bid                   fixedpoint.Value `json:"bid"`
	Last                  fixedpoint.Value `json:"last"`
	PostOnly              bool             `json:"postOnly"`
	Price                 fixedpoint.Value `json:"price"`
	PriceIncrement        fixedpoint.Value `json:"priceIncrement"`
	SizeIncrement         fixedpoint.Value `json:"sizeIncrement"`
	Restricted            bool             `json:"restricted"`
}

type Order

type Order struct {
	CreatedAt     time.Time        `json:"createdAt"`
	Future        string           `json:"future"`
	Id            int64            `json:"id"`
	Market        string           `json:"market"`
	Price         fixedpoint.Value `json:"price"`
	AvgFillPrice  fixedpoint.Value `json:"avgFillPrice"`
	Size          fixedpoint.Value `json:"size"`
	RemainingSize fixedpoint.Value `json:"remainingSize"`
	FilledSize    fixedpoint.Value `json:"filledSize"`
	Side          Side             `json:"side"`
	Status        OrderStatus      `json:"status"`
	Type          OrderType        `json:"type"`
	ReduceOnly    bool             `json:"reduceOnly"`
	Ioc           bool             `json:"ioc"`
	PostOnly      bool             `json:"postOnly"`
	ClientId      string           `json:"clientId"`
}

type OrderStatus

type OrderStatus string
const (
	OrderStatusNew    OrderStatus = "new"
	OrderStatusOpen   OrderStatus = "open"
	OrderStatusClosed OrderStatus = "closed"
)

type OrderType

type OrderType string
const (
	OrderTypeLimit  OrderType = "limit"
	OrderTypeMarket OrderType = "market"

	// trigger order types
	OrderTypeStopLimit    OrderType = "stop"
	OrderTypeTrailingStop OrderType = "trailingStop"
	OrderTypeTakeProfit   OrderType = "takeProfit"
)

type PlaceOrderRequest

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

func (*PlaceOrderRequest) ClientID

func (p *PlaceOrderRequest) ClientID(clientID string) *PlaceOrderRequest

func (*PlaceOrderRequest) Do

func (p *PlaceOrderRequest) Do(ctx context.Context) (*Order, error)

func (*PlaceOrderRequest) GetParameters

func (p *PlaceOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*PlaceOrderRequest) GetParametersJSON

func (p *PlaceOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*PlaceOrderRequest) GetParametersQuery

func (p *PlaceOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*PlaceOrderRequest) GetQueryParameters

func (p *PlaceOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*PlaceOrderRequest) GetSlugParameters

func (p *PlaceOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*PlaceOrderRequest) GetSlugsMap

func (p *PlaceOrderRequest) GetSlugsMap() (map[string]string, error)

func (*PlaceOrderRequest) Ioc

func (*PlaceOrderRequest) Market

func (p *PlaceOrderRequest) Market(market string) *PlaceOrderRequest

func (*PlaceOrderRequest) OrderType

func (p *PlaceOrderRequest) OrderType(orderType OrderType) *PlaceOrderRequest

func (*PlaceOrderRequest) PostOnly

func (p *PlaceOrderRequest) PostOnly(postOnly bool) *PlaceOrderRequest

func (*PlaceOrderRequest) Price

func (*PlaceOrderRequest) Side

func (p *PlaceOrderRequest) Side(side Side) *PlaceOrderRequest

func (*PlaceOrderRequest) Size

type Position

type Position struct {
	Cost                         fixedpoint.Value `json:"cost"`
	EntryPrice                   fixedpoint.Value `json:"entryPrice"`
	Future                       string           `json:"future"`
	InitialMarginRequirement     fixedpoint.Value `json:"initialMarginRequirement"`
	LongOrderSize                fixedpoint.Value `json:"longOrderSize"`
	MaintenanceMarginRequirement fixedpoint.Value `json:"maintenanceMarginRequirement"`
	NetSize                      fixedpoint.Value `json:"netSize"`
	OpenSize                     fixedpoint.Value `json:"openSize"`
	ShortOrderSize               fixedpoint.Value `json:"shortOrderSize"`
	Side                         string           `json:"side"`
	Size                         fixedpoint.Value `json:"size"`
	RealizedPnl                  fixedpoint.Value `json:"realizedPnl"`
	UnrealizedPnl                fixedpoint.Value `json:"unrealizedPnl"`
}

type RestClient

type RestClient struct {
	BaseURL *url.URL

	Key, Secret string
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *RestClient

func (*RestClient) Auth

func (c *RestClient) Auth(key, secret, subAccount string)

func (*RestClient) NewAuthenticatedRequest

func (c *RestClient) NewAuthenticatedRequest(ctx context.Context, method, refURL string, params url.Values, payload interface{}) (*http.Request, error)

newAuthenticatedRequest creates new http request for authenticated routes.

func (*RestClient) NewCancelAllOrderRequest

func (c *RestClient) NewCancelAllOrderRequest() *CancelAllOrderRequest

func (*RestClient) NewCancelOrderByClientOrderIdRequest

func (c *RestClient) NewCancelOrderByClientOrderIdRequest(clientOrderId string) *CancelOrderByClientOrderIdRequest

func (*RestClient) NewCancelOrderRequest

func (c *RestClient) NewCancelOrderRequest(orderID string) *CancelOrderRequest

func (*RestClient) NewGetAccountRequest

func (c *RestClient) NewGetAccountRequest() *GetAccountRequest

func (*RestClient) NewGetBalancesRequest

func (c *RestClient) NewGetBalancesRequest() *GetBalancesRequest

func (*RestClient) NewGetCoinsRequest

func (c *RestClient) NewGetCoinsRequest() *GetCoinsRequest

func (*RestClient) NewGetFillsRequest

func (c *RestClient) NewGetFillsRequest() *GetFillsRequest

func (*RestClient) NewGetMarketRequest

func (c *RestClient) NewGetMarketRequest(market string) *GetMarketRequest

func (*RestClient) NewGetMarketsRequest

func (c *RestClient) NewGetMarketsRequest() *GetMarketsRequest

func (*RestClient) NewGetOpenOrdersRequest

func (c *RestClient) NewGetOpenOrdersRequest(market string) *GetOpenOrdersRequest

func (*RestClient) NewGetOrderHistoryRequest

func (c *RestClient) NewGetOrderHistoryRequest(market string) *GetOrderHistoryRequest

func (*RestClient) NewGetOrderStatusRequest

func (c *RestClient) NewGetOrderStatusRequest(orderID uint64) *GetOrderStatusRequest

func (*RestClient) NewGetPositionsRequest

func (c *RestClient) NewGetPositionsRequest() *GetPositionsRequest

func (*RestClient) NewPlaceOrderRequest

func (c *RestClient) NewPlaceOrderRequest() *PlaceOrderRequest

func (*RestClient) NewRequest

func (c *RestClient) NewRequest(ctx context.Context, method, refURL string, params url.Values, payload interface{}) (*http.Request, error)

NewRequest create new API request. Relative url can be provided in refURL.

func (*RestClient) SendRequest

func (c *RestClient) SendRequest(req *http.Request) (*requestgen.Response, error)

sendRequest sends the request to the API server and handle the response

type Side

type Side string
const (
	SideBuy  Side = "buy"
	SideSell Side = "sell"
)

Jump to

Keyboard shortcuts

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