swagger

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2018 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const ContextAPIKey int = 4
View Source
const ContextAccessToken int = 3
View Source
const ContextBasicAuth int = 2
View Source
const ContextOAuth2 int = 1

Variables

This section is empty.

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

func CalSignature

func CalSignature(apiSecret, payload string) string

func DebugHttpRequest

func DebugHttpRequest(r *http.Request)

Save a copy of this request for debugging.

func SetAuthHeader

func SetAuthHeader(request *http.Request, apiKey APIKey, c *Configuration, httpMethod, path, postBody string,
	queryParams url.Values)

func Signature

func Signature(apiSecret, method, path, query, nonce, bodyStr string) string

*

  • nonce: nonce or expires

Types

type APIClient

type APIClient struct {

	// API Services
	APIKeyApi       *APIKeyApiService
	AnnouncementApi *AnnouncementApiService
	ChatApi         *ChatApiService
	ExecutionApi    *ExecutionApiService
	FundingApi      *FundingApiService
	InstrumentApi   *InstrumentApiService
	InsuranceApi    *InsuranceApiService
	LeaderboardApi  *LeaderboardApiService
	LiquidationApi  *LiquidationApiService
	NotificationApi *NotificationApiService
	OrderApi        *OrderApiService
	OrderBookApi    *OrderBookApiService
	PositionApi     *PositionApiService
	QuoteApi        *QuoteApiService
	SchemaApi       *SchemaApiService
	SettlementApi   *SettlementApiService
	StatsApi        *StatsApiService
	TradeApi        *TradeApiService
	UserApi         *UserApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the BitMEX API API v1.2.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
	Secret string
	Host   string
}

type APIKeyApiService

type APIKeyApiService service

func (*APIKeyApiService) APIKeyDisable

func (a *APIKeyApiService) APIKeyDisable(ctx context.Context, apiKeyID string) (ApiKey, *http.Response, error)

APIKeyApiService Disable an API Key. * @param ctx context.Context Authentication Context @param apiKeyID API Key ID (public component). @return ApiKey

func (*APIKeyApiService) APIKeyEnable

func (a *APIKeyApiService) APIKeyEnable(ctx context.Context, apiKeyID string) (ApiKey, *http.Response, error)

APIKeyApiService Enable an API Key. * @param ctx context.Context Authentication Context @param apiKeyID API Key ID (public component). @return ApiKey

func (*APIKeyApiService) APIKeyGet

func (a *APIKeyApiService) APIKeyGet(ctx context.Context, localVarOptionals map[string]interface{}) ([]ApiKey, *http.Response, error)

APIKeyApiService Get your API Keys. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "reverse" (bool) If true, will sort results newest first.

@return []ApiKey

func (*APIKeyApiService) APIKeyNew

func (a *APIKeyApiService) APIKeyNew(ctx context.Context, localVarOptionals map[string]interface{}) (ApiKey, *http.Response, error)

APIKeyApiService Create a new API Key. API Keys can also be created via [this Python script](https://github.com/BitMEX/market-maker/blob/master/generate-api-key.py) See the [API Key Documentation](/app/apiKeys) for more information on capabilities. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "name" (string) Key name. This name is for reference only.
@param "cidr" (string) CIDR block to restrict this key to. To restrict to a single address, append \"/32\", e.g. 207.39.29.22/32. Leave blank or set to 0.0.0.0/0 to allow all IPs. Only one block may be set. <a href=\"http://software77.net/cidr-101.html\">More on CIDR blocks</a>
@param "permissions" (string) Key Permissions. All keys can read margin and position data. Additional permissions must be added. Available: [\"order\", \"orderCancel\", \"withdraw\"].
@param "enabled" (bool) Set to true to enable this key on creation. Otherwise, it must be explicitly enabled via /apiKey/enable.
@param "token" (string) OTP Token (YubiKey, Google Authenticator)

@return ApiKey

func (*APIKeyApiService) APIKeyRemove

func (a *APIKeyApiService) APIKeyRemove(ctx context.Context, apiKeyID string) (InlineResponse200, *http.Response, error)

APIKeyApiService Remove an API Key. * @param ctx context.Context Authentication Context @param apiKeyID API Key ID (public component). @return InlineResponse200

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type AccessToken

type AccessToken struct {
	Id string `json:"id"`

	// time to live in seconds (2 weeks by default)
	Ttl float64 `json:"ttl,omitempty"`

	Created time.Time `json:"created,omitempty"`

	UserId float64 `json:"userId,omitempty"`
}

type Affiliate

type Affiliate struct {
	Account float32 `json:"account"`

	Currency string `json:"currency"`

	PrevPayout float32 `json:"prevPayout,omitempty"`

	PrevTurnover float32 `json:"prevTurnover,omitempty"`

	PrevComm float32 `json:"prevComm,omitempty"`

	PrevTimestamp time.Time `json:"prevTimestamp,omitempty"`

	ExecTurnover float32 `json:"execTurnover,omitempty"`

	ExecComm float32 `json:"execComm,omitempty"`

	TotalReferrals float32 `json:"totalReferrals,omitempty"`

	TotalTurnover float32 `json:"totalTurnover,omitempty"`

	TotalComm float32 `json:"totalComm,omitempty"`

	PayoutPcnt float64 `json:"payoutPcnt,omitempty"`

	PendingPayout float32 `json:"pendingPayout,omitempty"`

	Timestamp time.Time `json:"timestamp,omitempty"`

	ReferrerAccount float64 `json:"referrerAccount,omitempty"`
}

type Announcement

type Announcement struct {
	Id float32 `json:"id"`

	Link string `json:"link,omitempty"`

	Title string `json:"title,omitempty"`

	Content string `json:"content,omitempty"`

	Date time.Time `json:"date,omitempty"`
}

Public Announcements

type AnnouncementApiService

type AnnouncementApiService service

func (*AnnouncementApiService) AnnouncementGet

func (a *AnnouncementApiService) AnnouncementGet(localVarOptionals map[string]interface{}) ([]Announcement, *http.Response, error)

AnnouncementApiService Get site announcements.

@param optional (nil or map[string]interface{}) with one or more of:

@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.

@return []Announcement

func (*AnnouncementApiService) AnnouncementGetUrgent

func (a *AnnouncementApiService) AnnouncementGetUrgent(ctx context.Context) ([]Announcement, *http.Response, error)

AnnouncementApiService Get urgent (banner) announcements. * @param ctx context.Context Authentication Context @return []Announcement

type ApiKey

type ApiKey struct {
	Id string `json:"id"`

	Secret string `json:"secret"`

	Name string `json:"name"`

	Nonce float32 `json:"nonce"`

	Cidr string `json:"cidr,omitempty"`

	Permissions []XAny `json:"permissions,omitempty"`

	Enabled bool `json:"enabled,omitempty"`

	UserId float32 `json:"userId"`

	Created time.Time `json:"created,omitempty"`
}

Persistent API Keys for Developers

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

type Chat

type Chat struct {
	Id float32 `json:"id,omitempty"`

	Date time.Time `json:"date"`

	User string `json:"user"`

	Message string `json:"message"`

	Html string `json:"html"`

	FromBot bool `json:"fromBot,omitempty"`

	ChannelID float64 `json:"channelID,omitempty"`
}

Trollbox Data

type ChatApiService

type ChatApiService service

func (*ChatApiService) ChatGet

func (a *ChatApiService) ChatGet(localVarOptionals map[string]interface{}) ([]Chat, *http.Response, error)

ChatApiService Get chat messages.

@param optional (nil or map[string]interface{}) with one or more of:

@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting ID for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "channelID" (float64) Channel id. GET /chat/channels for ids. Leave blank for all.

@return []Chat

func (*ChatApiService) ChatGetChannels

func (a *ChatApiService) ChatGetChannels() ([]ChatChannel, *http.Response, error)

ChatApiService Get available channels.

@return []ChatChannel

func (*ChatApiService) ChatGetConnected

func (a *ChatApiService) ChatGetConnected() (ConnectedUsers, *http.Response, error)

ChatApiService Get connected users. Returns an array with browser users in the first position and API users (bots) in the second position.

@return ConnectedUsers

func (*ChatApiService) ChatNew

func (a *ChatApiService) ChatNew(ctx context.Context, message string, localVarOptionals map[string]interface{}) (Chat, *http.Response, error)

ChatApiService Send a chat message. * @param ctx context.Context Authentication Context @param message @param optional (nil or map[string]interface{}) with one or more of:

@param "channelID" (float64) Channel to post to. Default 1 (English).

@return Chat

type ChatChannel

type ChatChannel struct {
	Id float32 `json:"id,omitempty"`

	Name string `json:"name"`
}

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client

	ExpireTime int64
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type ConnectedUsers

type ConnectedUsers struct {
	Users float32 `json:"users,omitempty"`

	Bots float32 `json:"bots,omitempty"`
}

type ErrorError

type ErrorError struct {
	Message string `json:"message,omitempty"`

	Name string `json:"name,omitempty"`
}

type Execution

type Execution struct {
	ExecID string `json:"execID"`

	OrderID string `json:"orderID,omitempty"`

	ClOrdID string `json:"clOrdID,omitempty"`

	ClOrdLinkID string `json:"clOrdLinkID,omitempty"`

	Account float32 `json:"account,omitempty"`

	Symbol string `json:"symbol,omitempty"`

	Side string `json:"side,omitempty"`

	LastQty float32 `json:"lastQty,omitempty"`

	LastPx float64 `json:"lastPx,omitempty"`

	UnderlyingLastPx float64 `json:"underlyingLastPx,omitempty"`

	LastMkt string `json:"lastMkt,omitempty"`

	LastLiquidityInd string `json:"lastLiquidityInd,omitempty"`

	SimpleOrderQty float64 `json:"simpleOrderQty,omitempty"`

	OrderQty float32 `json:"orderQty,omitempty"`

	Price float64 `json:"price,omitempty"`

	DisplayQty float32 `json:"displayQty,omitempty"`

	StopPx float64 `json:"stopPx,omitempty"`

	PegOffsetValue float64 `json:"pegOffsetValue,omitempty"`

	PegPriceType string `json:"pegPriceType,omitempty"`

	Currency string `json:"currency,omitempty"`

	SettlCurrency string `json:"settlCurrency,omitempty"`

	ExecType string `json:"execType,omitempty"`

	OrdType string `json:"ordType,omitempty"`

	TimeInForce string `json:"timeInForce,omitempty"`

	ExecInst string `json:"execInst,omitempty"`

	ContingencyType string `json:"contingencyType,omitempty"`

	ExDestination string `json:"exDestination,omitempty"`

	OrdStatus string `json:"ordStatus,omitempty"`

	Triggered string `json:"triggered,omitempty"`

	WorkingIndicator bool `json:"workingIndicator,omitempty"`

	OrdRejReason string `json:"ordRejReason,omitempty"`

	SimpleLeavesQty float64 `json:"simpleLeavesQty,omitempty"`

	LeavesQty float32 `json:"leavesQty,omitempty"`

	SimpleCumQty float64 `json:"simpleCumQty,omitempty"`

	CumQty float32 `json:"cumQty,omitempty"`

	AvgPx float64 `json:"avgPx,omitempty"`

	Commission float64 `json:"commission,omitempty"`

	TradePublishIndicator string `json:"tradePublishIndicator,omitempty"`

	MultiLegReportingType string `json:"multiLegReportingType,omitempty"`

	Text string `json:"text,omitempty"`

	TrdMatchID string `json:"trdMatchID,omitempty"`

	ExecCost float32 `json:"execCost,omitempty"`

	ExecComm float32 `json:"execComm,omitempty"`

	HomeNotional float64 `json:"homeNotional,omitempty"`

	ForeignNotional float64 `json:"foreignNotional,omitempty"`

	TransactTime time.Time `json:"transactTime,omitempty"`

	Timestamp time.Time `json:"timestamp,omitempty"`
}

Raw Order and Balance Data

type ExecutionApiService

type ExecutionApiService service

func (*ExecutionApiService) ExecutionGet

func (a *ExecutionApiService) ExecutionGet(ctx context.Context, localVarOptionals map[string]interface{}) ([]Execution, *http.Response, error)

ExecutionApiService Get all raw executions for your account. This returns all raw transactions, which includes order opening and cancelation, and order status changes. It can be quite noisy. More focused information is available at `/execution/tradeHistory`. You may also use the `filter` param to target your query. Specify an array as a filter value, such as `{\"execType\": [\"Settlement\", \"Trade\"]}` to filter on multiple values. See [the FIX Spec](http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_8_8.html) for explanations of these fields. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []Execution

func (*ExecutionApiService) ExecutionGetTradeHistory

func (a *ExecutionApiService) ExecutionGetTradeHistory(ctx context.Context, localVarOptionals map[string]interface{}) ([]Execution, *http.Response, error)

ExecutionApiService Get all balance-affecting executions. This includes each trade, insurance charge, and settlement. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []Execution

type Funding

type Funding struct {
	Timestamp time.Time `json:"timestamp"`

	Symbol string `json:"symbol"`

	FundingInterval time.Time `json:"fundingInterval,omitempty"`

	FundingRate float64 `json:"fundingRate,omitempty"`

	FundingRateDaily float64 `json:"fundingRateDaily,omitempty"`
}

Swap Funding History

type FundingApiService

type FundingApiService service

func (*FundingApiService) FundingGet

func (a *FundingApiService) FundingGet(localVarOptionals map[string]interface{}) ([]Funding, *http.Response, error)

FundingApiService Get funding history.

@param optional (nil or map[string]interface{}) with one or more of:

@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []Funding

type IndexComposite

type IndexComposite struct {
	Timestamp time.Time `json:"timestamp"`

	Symbol string `json:"symbol,omitempty"`

	IndexSymbol string `json:"indexSymbol,omitempty"`

	Reference string `json:"reference,omitempty"`

	LastPrice float64 `json:"lastPrice,omitempty"`

	Weight float64 `json:"weight,omitempty"`

	Logged time.Time `json:"logged,omitempty"`
}

type InlineResponse200

type InlineResponse200 struct {
	Success bool `json:"success,omitempty"`
}

type Instrument

type Instrument struct {
	Symbol string `json:"symbol"`

	RootSymbol string `json:"rootSymbol,omitempty"`

	State string `json:"state,omitempty"`

	Typ string `json:"typ,omitempty"`

	Listing time.Time `json:"listing,omitempty"`

	Front time.Time `json:"front,omitempty"`

	Expiry time.Time `json:"expiry,omitempty"`

	Settle time.Time `json:"settle,omitempty"`

	RelistInterval time.Time `json:"relistInterval,omitempty"`

	InverseLeg string `json:"inverseLeg,omitempty"`

	SellLeg string `json:"sellLeg,omitempty"`

	BuyLeg string `json:"buyLeg,omitempty"`

	PositionCurrency string `json:"positionCurrency,omitempty"`

	Underlying string `json:"underlying,omitempty"`

	QuoteCurrency string `json:"quoteCurrency,omitempty"`

	UnderlyingSymbol string `json:"underlyingSymbol,omitempty"`

	Reference string `json:"reference,omitempty"`

	ReferenceSymbol string `json:"referenceSymbol,omitempty"`

	CalcInterval time.Time `json:"calcInterval,omitempty"`

	PublishInterval time.Time `json:"publishInterval,omitempty"`

	PublishTime time.Time `json:"publishTime,omitempty"`

	MaxOrderQty float32 `json:"maxOrderQty,omitempty"`

	MaxPrice float64 `json:"maxPrice,omitempty"`

	LotSize float32 `json:"lotSize,omitempty"`

	TickSize float64 `json:"tickSize,omitempty"`

	Multiplier float32 `json:"multiplier,omitempty"`

	SettlCurrency string `json:"settlCurrency,omitempty"`

	UnderlyingToPositionMultiplier float32 `json:"underlyingToPositionMultiplier,omitempty"`

	UnderlyingToSettleMultiplier float32 `json:"underlyingToSettleMultiplier,omitempty"`

	QuoteToSettleMultiplier float32 `json:"quoteToSettleMultiplier,omitempty"`

	IsQuanto bool `json:"isQuanto,omitempty"`

	IsInverse bool `json:"isInverse,omitempty"`

	InitMargin float64 `json:"initMargin,omitempty"`

	MaintMargin float64 `json:"maintMargin,omitempty"`

	RiskLimit float32 `json:"riskLimit,omitempty"`

	RiskStep float32 `json:"riskStep,omitempty"`

	Limit float64 `json:"limit,omitempty"`

	Capped bool `json:"capped,omitempty"`

	Taxed bool `json:"taxed,omitempty"`

	Deleverage bool `json:"deleverage,omitempty"`

	MakerFee float64 `json:"makerFee,omitempty"`

	TakerFee float64 `json:"takerFee,omitempty"`

	SettlementFee float64 `json:"settlementFee,omitempty"`

	InsuranceFee float64 `json:"insuranceFee,omitempty"`

	FundingBaseSymbol string `json:"fundingBaseSymbol,omitempty"`

	FundingQuoteSymbol string `json:"fundingQuoteSymbol,omitempty"`

	FundingPremiumSymbol string `json:"fundingPremiumSymbol,omitempty"`

	FundingTimestamp time.Time `json:"fundingTimestamp,omitempty"`

	FundingInterval time.Time `json:"fundingInterval,omitempty"`

	FundingRate float64 `json:"fundingRate,omitempty"`

	IndicativeFundingRate float64 `json:"indicativeFundingRate,omitempty"`

	RebalanceTimestamp time.Time `json:"rebalanceTimestamp,omitempty"`

	RebalanceInterval time.Time `json:"rebalanceInterval,omitempty"`

	OpeningTimestamp time.Time `json:"openingTimestamp,omitempty"`

	ClosingTimestamp time.Time `json:"closingTimestamp,omitempty"`

	SessionInterval time.Time `json:"sessionInterval,omitempty"`

	PrevClosePrice float64 `json:"prevClosePrice,omitempty"`

	LimitDownPrice float64 `json:"limitDownPrice,omitempty"`

	LimitUpPrice float64 `json:"limitUpPrice,omitempty"`

	BankruptLimitDownPrice float64 `json:"bankruptLimitDownPrice,omitempty"`

	BankruptLimitUpPrice float64 `json:"bankruptLimitUpPrice,omitempty"`

	PrevTotalVolume float32 `json:"prevTotalVolume,omitempty"`

	TotalVolume float32 `json:"totalVolume,omitempty"`

	Volume float32 `json:"volume,omitempty"`

	Volume24h float32 `json:"volume24h,omitempty"`

	PrevTotalTurnover float32 `json:"prevTotalTurnover,omitempty"`

	TotalTurnover float32 `json:"totalTurnover,omitempty"`

	Turnover float32 `json:"turnover,omitempty"`

	Turnover24h float32 `json:"turnover24h,omitempty"`

	PrevPrice24h float64 `json:"prevPrice24h,omitempty"`

	Vwap float64 `json:"vwap,omitempty"`

	HighPrice float64 `json:"highPrice,omitempty"`

	LowPrice float64 `json:"lowPrice,omitempty"`

	LastPrice float64 `json:"lastPrice,omitempty"`

	LastPriceProtected float64 `json:"lastPriceProtected,omitempty"`

	LastTickDirection string `json:"lastTickDirection,omitempty"`

	LastChangePcnt float64 `json:"lastChangePcnt,omitempty"`

	BidPrice float64 `json:"bidPrice,omitempty"`

	MidPrice float64 `json:"midPrice,omitempty"`

	AskPrice float64 `json:"askPrice,omitempty"`

	ImpactBidPrice float64 `json:"impactBidPrice,omitempty"`

	ImpactMidPrice float64 `json:"impactMidPrice,omitempty"`

	ImpactAskPrice float64 `json:"impactAskPrice,omitempty"`

	HasLiquidity bool `json:"hasLiquidity,omitempty"`

	OpenInterest float32 `json:"openInterest,omitempty"`

	OpenValue float32 `json:"openValue,omitempty"`

	FairMethod string `json:"fairMethod,omitempty"`

	FairBasisRate float64 `json:"fairBasisRate,omitempty"`

	FairBasis float64 `json:"fairBasis,omitempty"`

	FairPrice float64 `json:"fairPrice,omitempty"`

	MarkMethod string `json:"markMethod,omitempty"`

	MarkPrice float64 `json:"markPrice,omitempty"`

	IndicativeTaxRate float64 `json:"indicativeTaxRate,omitempty"`

	IndicativeSettlePrice float64 `json:"indicativeSettlePrice,omitempty"`

	SettledPrice float64 `json:"settledPrice,omitempty"`

	Timestamp time.Time `json:"timestamp,omitempty"`
}

Tradeable Contracts, Indices, and History

type InstrumentApiService

type InstrumentApiService service

func (*InstrumentApiService) InstrumentGet

func (a *InstrumentApiService) InstrumentGet(localVarOptionals map[string]interface{}) ([]Instrument, *http.Response, error)

InstrumentApiService Get instruments. This returns all instruments and indices, including those that have settled or are unlisted. Use this endpoint if you want to query for individual instruments or use a complex filter. Use `/instrument/active` to return active instruments, or use a filter like `{\"state\": \"Open\"}`.

@param optional (nil or map[string]interface{}) with one or more of:

@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []Instrument

func (*InstrumentApiService) InstrumentGetActive

func (a *InstrumentApiService) InstrumentGetActive() ([]Instrument, *http.Response, error)

InstrumentApiService Get all active instruments and instruments that have expired in <24hrs.

@return []Instrument

func (*InstrumentApiService) InstrumentGetActiveAndIndices

func (a *InstrumentApiService) InstrumentGetActiveAndIndices() ([]Instrument, *http.Response, error)

InstrumentApiService Helper method. Gets all active instruments and all indices. This is a join of the result of /indices and /active.

@return []Instrument

func (*InstrumentApiService) InstrumentGetActiveIntervals

func (a *InstrumentApiService) InstrumentGetActiveIntervals() (InstrumentInterval, *http.Response, error)

InstrumentApiService Return all active contract series and interval pairs. This endpoint is useful for determining which pairs are live. It returns two arrays of strings. The first is intervals, such as `[\"BVOL:daily\", \"BVOL:weekly\", \"XBU:daily\", \"XBU:monthly\", ...]`. These identifiers are usable in any query's `symbol` param. The second array is the current resolution of these intervals. Results are mapped at the same index.

@return InstrumentInterval

func (*InstrumentApiService) InstrumentGetCompositeIndex

func (a *InstrumentApiService) InstrumentGetCompositeIndex(localVarOptionals map[string]interface{}) ([]IndexComposite, *http.Response, error)

InstrumentApiService Show constituent parts of an index. Composite indices are built from multiple external price sources. Use this endpoint to get the underlying prices of an index. For example, send a `symbol` of `.XBT` to get the ticks and weights of the constituent exchanges that build the \".XBT\" index. A tick with reference `\"BMI\"` and weight `null` is the composite index tick.

@param optional (nil or map[string]interface{}) with one or more of:

@param "account" (float64)
@param "symbol" (string) The composite index symbol.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []IndexComposite

func (*InstrumentApiService) InstrumentGetIndices

func (a *InstrumentApiService) InstrumentGetIndices() ([]Instrument, *http.Response, error)

InstrumentApiService Get all price indices.

@return []Instrument

type InstrumentInterval

type InstrumentInterval struct {
	Intervals []string `json:"intervals"`

	Symbols []string `json:"symbols"`
}

type Insurance

type Insurance struct {
	Currency string `json:"currency"`

	Timestamp time.Time `json:"timestamp"`

	WalletBalance float32 `json:"walletBalance,omitempty"`
}

Insurance Fund Data

type InsuranceApiService

type InsuranceApiService service

func (*InsuranceApiService) InsuranceGet

func (a *InsuranceApiService) InsuranceGet(localVarOptionals map[string]interface{}) ([]Insurance, *http.Response, error)

InsuranceApiService Get insurance fund history.

@param optional (nil or map[string]interface{}) with one or more of:

@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []Insurance

type Leaderboard

type Leaderboard struct {
	Name string `json:"name"`

	IsRealName bool `json:"isRealName,omitempty"`

	IsMe bool `json:"isMe,omitempty"`

	Profit float64 `json:"profit,omitempty"`
}

Information on Top Users

type LeaderboardApiService

type LeaderboardApiService service

func (*LeaderboardApiService) LeaderboardGet

func (a *LeaderboardApiService) LeaderboardGet(localVarOptionals map[string]interface{}) ([]Leaderboard, *http.Response, error)

LeaderboardApiService Get current leaderboard.

@param optional (nil or map[string]interface{}) with one or more of:

@param "method" (string) Ranking type. Options: \"notional\", \"ROE\"

@return []Leaderboard

type Liquidation

type Liquidation struct {
	OrderID string `json:"orderID"`

	Symbol string `json:"symbol,omitempty"`

	Side string `json:"side,omitempty"`

	Price float64 `json:"price,omitempty"`

	LeavesQty float32 `json:"leavesQty,omitempty"`
}

Active Liquidations

type LiquidationApiService

type LiquidationApiService service

func (*LiquidationApiService) LiquidationGet

func (a *LiquidationApiService) LiquidationGet(localVarOptionals map[string]interface{}) ([]Liquidation, *http.Response, error)

LiquidationApiService Get liquidation orders.

@param optional (nil or map[string]interface{}) with one or more of:

@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []Liquidation

type Margin

type Margin struct {
	Account float32 `json:"account"`

	Currency string `json:"currency"`

	RiskLimit float32 `json:"riskLimit,omitempty"`

	PrevState string `json:"prevState,omitempty"`

	State string `json:"state,omitempty"`

	Action string `json:"action,omitempty"`

	Amount float32 `json:"amount,omitempty"`

	PendingCredit float32 `json:"pendingCredit,omitempty"`

	PendingDebit float32 `json:"pendingDebit,omitempty"`

	ConfirmedDebit float32 `json:"confirmedDebit,omitempty"`

	PrevRealisedPnl float32 `json:"prevRealisedPnl,omitempty"`

	PrevUnrealisedPnl float32 `json:"prevUnrealisedPnl,omitempty"`

	GrossComm float32 `json:"grossComm,omitempty"`

	GrossOpenCost float32 `json:"grossOpenCost,omitempty"`

	GrossOpenPremium float32 `json:"grossOpenPremium,omitempty"`

	GrossExecCost float32 `json:"grossExecCost,omitempty"`

	GrossMarkValue float32 `json:"grossMarkValue,omitempty"`

	RiskValue float32 `json:"riskValue,omitempty"`

	TaxableMargin float32 `json:"taxableMargin,omitempty"`

	InitMargin float32 `json:"initMargin,omitempty"`

	MaintMargin float32 `json:"maintMargin,omitempty"`

	SessionMargin float32 `json:"sessionMargin,omitempty"`

	TargetExcessMargin float32 `json:"targetExcessMargin,omitempty"`

	VarMargin float32 `json:"varMargin,omitempty"`

	RealisedPnl float32 `json:"realisedPnl,omitempty"`

	UnrealisedPnl float32 `json:"unrealisedPnl,omitempty"`

	IndicativeTax float32 `json:"indicativeTax,omitempty"`

	UnrealisedProfit float32 `json:"unrealisedProfit,omitempty"`

	SyntheticMargin float32 `json:"syntheticMargin,omitempty"`

	WalletBalance float32 `json:"walletBalance,omitempty"`

	MarginBalance float32 `json:"marginBalance,omitempty"`

	MarginBalancePcnt float64 `json:"marginBalancePcnt,omitempty"`

	MarginLeverage float64 `json:"marginLeverage,omitempty"`

	MarginUsedPcnt float64 `json:"marginUsedPcnt,omitempty"`

	ExcessMargin float32 `json:"excessMargin,omitempty"`

	ExcessMarginPcnt float64 `json:"excessMarginPcnt,omitempty"`

	AvailableMargin float32 `json:"availableMargin,omitempty"`

	WithdrawableMargin float32 `json:"withdrawableMargin,omitempty"`

	Timestamp time.Time `json:"timestamp,omitempty"`

	GrossLastValue float32 `json:"grossLastValue,omitempty"`

	Commission float64 `json:"commission,omitempty"`
}

type ModelError

type ModelError struct {
	Error_ *ErrorError `json:"error,omitempty"`
}

type Notification

type Notification struct {
	Id float32 `json:"id,omitempty"`

	Date time.Time `json:"date"`

	Title string `json:"title"`

	Body string `json:"body"`

	Ttl float32 `json:"ttl"`

	Type_ string `json:"type,omitempty"`

	Closable bool `json:"closable,omitempty"`

	Persist bool `json:"persist,omitempty"`

	WaitForVisibility bool `json:"waitForVisibility,omitempty"`

	Sound string `json:"sound,omitempty"`
}

Account Notifications

type NotificationApiService

type NotificationApiService service

func (*NotificationApiService) NotificationGet

func (a *NotificationApiService) NotificationGet(ctx context.Context) ([]Notification, *http.Response, error)

NotificationApiService Get your current notifications. This is an upcoming feature and currently does not return data. * @param ctx context.Context Authentication Context @return []Notification

type Order

type Order struct {
	OrderID string `json:"orderID"`

	ClOrdID string `json:"clOrdID,omitempty"`

	ClOrdLinkID string `json:"clOrdLinkID,omitempty"`

	Account float32 `json:"account,omitempty"`

	Symbol string `json:"symbol,omitempty"`

	Side string `json:"side,omitempty"`

	SimpleOrderQty float64 `json:"simpleOrderQty,omitempty"`

	OrderQty float32 `json:"orderQty,omitempty"`

	Price float64 `json:"price,omitempty"`

	DisplayQty float32 `json:"displayQty,omitempty"`

	StopPx float64 `json:"stopPx,omitempty"`

	PegOffsetValue float64 `json:"pegOffsetValue,omitempty"`

	PegPriceType string `json:"pegPriceType,omitempty"`

	Currency string `json:"currency,omitempty"`

	SettlCurrency string `json:"settlCurrency,omitempty"`

	OrdType string `json:"ordType,omitempty"`

	TimeInForce string `json:"timeInForce,omitempty"`

	ExecInst string `json:"execInst,omitempty"`

	ContingencyType string `json:"contingencyType,omitempty"`

	ExDestination string `json:"exDestination,omitempty"`

	OrdStatus string `json:"ordStatus,omitempty"`

	Triggered string `json:"triggered,omitempty"`

	WorkingIndicator bool `json:"workingIndicator,omitempty"`

	OrdRejReason string `json:"ordRejReason,omitempty"`

	SimpleLeavesQty float64 `json:"simpleLeavesQty,omitempty"`

	LeavesQty float32 `json:"leavesQty,omitempty"`

	SimpleCumQty float64 `json:"simpleCumQty,omitempty"`

	CumQty float32 `json:"cumQty,omitempty"`

	AvgPx float64 `json:"avgPx,omitempty"`

	MultiLegReportingType string `json:"multiLegReportingType,omitempty"`

	Text string `json:"text,omitempty"`

	TransactTime time.Time `json:"transactTime,omitempty"`

	Timestamp time.Time `json:"timestamp,omitempty"`
}

Placement, Cancellation, Amending, and History

type OrderApiService

type OrderApiService service

func (*OrderApiService) OrderAmend

func (a *OrderApiService) OrderAmend(ctx context.Context, localVarOptionals map[string]interface{}) (Order, *http.Response, error)

OrderApiService Amend the quantity or price of an open order. Send an `orderID` or `origClOrdID` to identify the order you wish to amend. Both order quantity and price can be amended. Only one `qty` field can be used to amend. Use the `leavesQty` field to specify how much of the order you wish to remain open. This can be useful if you want to adjust your position's delta by a certain amount, regardless of how much of the order has already filled. Use the `simpleOrderQty` and `simpleLeavesQty` fields to specify order size in Bitcoin, rather than contracts. These fields will round up to the nearest contract. Like order placement, amending can be done in bulk. Simply send a request to `PUT /api/v1/order/bulk` with a JSON body of the shape: `{\"orders\": [{...}, {...}]}`, each object containing the fields used in this endpoint. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "orderID" (string) Order ID
@param "origClOrdID" (string) Client Order ID. See POST /order.
@param "clOrdID" (string) Optional new Client Order ID, requires `origClOrdID`.
@param "simpleOrderQty" (float64) Optional order quantity in units of the underlying instrument (i.e. Bitcoin).
@param "orderQty" (float32) Optional order quantity in units of the instrument (i.e. contracts).
@param "simpleLeavesQty" (float64) Optional leaves quantity in units of the underlying instrument (i.e. Bitcoin). Useful for amending partially filled orders.
@param "leavesQty" (float32) Optional leaves quantity in units of the instrument (i.e. contracts). Useful for amending partially filled orders.
@param "price" (float64) Optional limit price for 'Limit', 'StopLimit', and 'LimitIfTouched' orders.
@param "stopPx" (float64) Optional trigger price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders. Use a price below the current price for stop-sell orders and buy-if-touched orders.
@param "pegOffsetValue" (float64) Optional trailing offset from the current price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders; use a negative offset for stop-sell orders and buy-if-touched orders. Optional offset from the peg price for 'Pegged' orders.
@param "text" (string) Optional amend annotation. e.g. 'Adjust skew'.

@return Order

func (*OrderApiService) OrderAmendBulk

func (a *OrderApiService) OrderAmendBulk(ctx context.Context, localVarOptionals map[string]interface{}) ([]Order, *http.Response, error)

OrderApiService Amend multiple orders for the same symbol. Similar to POST /amend, but with multiple orders. `application/json` only. Ratelimited at 50%. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "orders" (string) An array of orders.

@return []Order

func (*OrderApiService) OrderCancel

func (a *OrderApiService) OrderCancel(ctx context.Context, localVarOptionals map[string]interface{}) ([]Order, *http.Response, error)

OrderApiService Cancel order(s). Send multiple order IDs to cancel in bulk. Either an orderID or a clOrdID must be provided. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "orderID" (string) Order ID(s).
@param "clOrdID" (string) Client Order ID(s). See POST /order.
@param "text" (string) Optional cancellation annotation. e.g. 'Spread Exceeded'.

@return []Order

func (*OrderApiService) OrderCancelAll

func (a *OrderApiService) OrderCancelAll(ctx context.Context, localVarOptionals map[string]interface{}) (interface{}, *http.Response, error)

OrderApiService Cancels all of your orders. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "symbol" (string) Optional symbol. If provided, only cancels orders for that symbol.
@param "filter" (string) Optional filter for cancellation. Use to only cancel some orders, e.g. `{\"side\": \"Buy\"}`.
@param "text" (string) Optional cancellation annotation. e.g. 'Spread Exceeded'

@return interface{}

func (*OrderApiService) OrderCancelAllAfter

func (a *OrderApiService) OrderCancelAllAfter(ctx context.Context, timeout float64) (interface{}, *http.Response, error)

OrderApiService Automatically cancel all your orders after a specified timeout. Useful as a dead-man's switch to ensure your orders are canceled in case of an outage. If called repeatedly, the existing offset will be canceled and a new one will be inserted in its place. Example usage: call this route at 15s intervals with an offset of 60000 (60s). If this route is not called within 60 seconds, all your orders will be automatically canceled. This is also available via [WebSocket](https://www.bitmex.com/app/wsAPI#dead-man-s-switch-auto-cancel-). * @param ctx context.Context Authentication Context @param timeout Timeout in ms. Set to 0 to cancel this timer. @return interface{}

func (*OrderApiService) OrderClosePosition

func (a *OrderApiService) OrderClosePosition(ctx context.Context, symbol string, localVarOptionals map[string]interface{}) (Order, *http.Response, error)

OrderApiService Close a position. [Deprecated, use POST /order with execInst: 'Close'] If no `price` is specified, a market order will be submitted to close the whole of your position. This will also close all other open orders in this symbol. * @param ctx context.Context Authentication Context @param symbol Symbol of position to close. @param optional (nil or map[string]interface{}) with one or more of:

@param "price" (float64) Optional limit price.

@return Order

func (*OrderApiService) OrderGetOrders

func (a *OrderApiService) OrderGetOrders(ctx context.Context, localVarOptionals map[string]interface{}) ([]Order, *http.Response, error)

OrderApiService Get your orders. To get open orders only, send {\"open\": true} in the filter param. See <a href=\"http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_D_68.html\">the FIX Spec</a> for explanations of these fields. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []Order

func (*OrderApiService) OrderNew

func (a *OrderApiService) OrderNew(ctx context.Context, symbol string, localVarOptionals map[string]interface{}) (Order, *http.Response, error)

OrderApiService Create a new order. ## Placing Orders This endpoint is used for placing orders. See individual fields below for more details on their use. #### Order Types All orders require a `symbol`. All other fields are optional except when otherwise specified. These are the valid `ordType`s: * **Limit**: The default order type. Specify an `orderQty` and `price`. * **Market**: A traditional Market order. A Market order will execute until filled or your bankruptcy price is reached, at which point it will cancel. * **MarketWithLeftOverAsLimit**: A market order that, after eating through the order book as far as permitted by available margin, will become a limit order. The difference between this type and `Market` only affects the behavior in thin books. Upon reaching the deepest possible price, if there is quantity left over, a `Market` order will cancel the remaining quantity. `MarketWithLeftOverAsLimit` will keep the remaining quantity in the books as a `Limit`. * **Stop**: A Stop Market order. Specify an `orderQty` and `stopPx`. When the `stopPx` is reached, the order will be entered into the book. * On sell orders, the order will trigger if the triggering price is lower than the `stopPx`. On buys, higher. * Note: Stop orders do not consume margin until triggered. Be sure that the required margin is available in your account so that it may trigger fully. * `Close` Stops don't require an `orderQty`. See Execution Instructions below. * **StopLimit**: Like a Stop Market, but enters a Limit order instead of a Market order. Specify an `orderQty`, `stopPx`, and `price`. * **MarketIfTouched**: Similar to a Stop, but triggers are done in the opposite direction. Useful for Take Profit orders. * **LimitIfTouched**: As above; use for Take Profit Limit orders. #### Execution Instructions The following `execInst`s are supported. If using multiple, separate with a comma (e.g. `LastPrice,Close`). * **ParticipateDoNotInitiate**: Also known as a Post-Only order. If this order would have executed on placement, it will cancel instead. * **AllOrNone**: Valid only for hidden orders (`displayQty: 0`). Use to only execute if the entire order would fill. * **MarkPrice, LastPrice, IndexPrice**: Used by stop and if-touched orders to determine the triggering price. Use only one. By default, `'MarkPrice'` is used. Also used for Pegged orders to define the value of `'LastPeg'`. * **ReduceOnly**: A `'ReduceOnly'` order can only reduce your position, not increase it. If you have a `'ReduceOnly'` limit order that rests in the order book while the position is reduced by other orders, then its order quantity will be amended down or canceled. If there are multiple `'ReduceOnly'` orders the least agresssive will be amended first. * **Close**: `'Close'` implies `'ReduceOnly'`. A `'Close'` order will cancel other active limit orders with the same side and symbol if the open quantity exceeds the current position. This is useful for stops: by canceling these orders, a `'Close'` Stop is ensured to have the margin required to execute, and can only execute up to the full size of your position. If not specified, a `'Close'` order has an `orderQty` equal to your current position's size. #### Linked Orders Linked Orders are an advanced capability. It is very powerful, but its use requires careful coding and testing. Please follow this document carefully and use the [Testnet Exchange](https://testnet.bitmex.com) while developing. BitMEX offers four advanced Linked Order types: * **OCO**: *One Cancels the Other*. A very flexible version of the standard Stop / Take Profit technique. Multiple orders may be linked together using a single `clOrdLinkID`. Send a `contingencyType` of `OneCancelsTheOther` on the orders. The first order that fully or partially executes (or activates for `Stop` orders) will cancel all other orders with the same `clOrdLinkID`. * **OTO**: *One Triggers the Other*. Send a `contingencyType` of `'OneTriggersTheOther'` on the primary order and then subsequent orders with the same `clOrdLinkID` will be not be triggered until the primary order fully executes. * **OUOA**: *One Updates the Other Absolute*. Send a `contingencyType` of `'OneUpdatesTheOtherAbsolute'` on the orders. Then as one order has a execution, other orders with the same `clOrdLinkID` will have their order quantity amended down by the execution quantity. * **OUOP**: *One Updates the Other Proportional*. Send a `contingencyType` of `'OneUpdatesTheOtherProportional'` on the orders. Then as one order has a execution, other orders with the same `clOrdLinkID` will have their order quantity reduced proportionally by the fill percentage. #### Trailing Stops You may use `pegPriceType` of `'TrailingStopPeg'` to create Trailing Stops. The pegged `stopPx` will move as the market moves away from the peg, and freeze as the market moves toward it. To use, combine with `pegOffsetValue` to set the `stopPx` of your order. The peg is set to the triggering price specified in the `execInst` (default `'MarkPrice'`). Use a negative offset for stop-sell and buy-if-touched orders. Requires `ordType`: `'Stop', 'StopLimit', 'MarketIfTouched', 'LimitIfTouched'`. #### Simple Quantities Send a `simpleOrderQty` instead of an `orderQty` to create an order denominated in the underlying currency. This is useful for opening up a position with 1 XBT of exposure without having to calculate how many contracts it is. #### Rate Limits See the [Bulk Order Documentation](#!/Order/Order_newBulk) if you need to place multiple orders at the same time. Bulk orders require fewer risk checks in the trading engine and thus are ratelimited at **1/10** the normal rate. You can also improve your reactivity to market movements while staying under your ratelimit by using the [Amend](#!/Order/Order_amend) and [Amend Bulk](#!/Order/Order_amendBulk) endpoints. This allows you to stay in the market and avoids the cancel/replace cycle. #### Tracking Your Orders If you want to keep track of order IDs yourself, set a unique `clOrdID` per order. This `clOrdID` will come back as a property on the order and any related executions (including on the WebSocket), and can be used to get or cancel the order. Max length is 36 characters. * @param ctx context.Context Authentication Context @param symbol Instrument symbol. e.g. 'XBTUSD'. @param optional (nil or map[string]interface{}) with one or more of:

@param "side" (string) Order side. Valid options: Buy, Sell. Defaults to 'Buy' unless `orderQty` or `simpleOrderQty` is negative.
@param "simpleOrderQty" (float64) Order quantity in units of the underlying instrument (i.e. Bitcoin).
@param "quantity" (float32) Deprecated: use `orderQty`.
@param "orderQty" (float32) Order quantity in units of the instrument (i.e. contracts).
@param "price" (float64) Optional limit price for 'Limit', 'StopLimit', and 'LimitIfTouched' orders.
@param "displayQty" (float32) Optional quantity to display in the book. Use 0 for a fully hidden order.
@param "stopPrice" (float64) Deprecated: use `stopPx`.
@param "stopPx" (float64) Optional trigger price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders. Use a price below the current price for stop-sell orders and buy-if-touched orders. Use `execInst` of 'MarkPrice' or 'LastPrice' to define the current price used for triggering.
@param "clOrdID" (string) Optional Client Order ID. This clOrdID will come back on the order and any related executions.
@param "clOrdLinkID" (string) Optional Client Order Link ID for contingent orders.
@param "pegOffsetValue" (float64) Optional trailing offset from the current price for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders; use a negative offset for stop-sell orders and buy-if-touched orders. Optional offset from the peg price for 'Pegged' orders.
@param "pegPriceType" (string) Optional peg price type. Valid options: LastPeg, MidPricePeg, MarketPeg, PrimaryPeg, TrailingStopPeg.
@param "type_" (string) Deprecated: use `ordType`.
@param "ordType" (string) Order type. Valid options: Market, Limit, Stop, StopLimit, MarketIfTouched, LimitIfTouched, MarketWithLeftOverAsLimit, Pegged. Defaults to 'Limit' when `price` is specified. Defaults to 'Stop' when `stopPx` is specified. Defaults to 'StopLimit' when `price` and `stopPx` are specified.
@param "timeInForce" (string) Time in force. Valid options: Day, GoodTillCancel, ImmediateOrCancel, FillOrKill. Defaults to 'GoodTillCancel' for 'Limit', 'StopLimit', 'LimitIfTouched', and 'MarketWithLeftOverAsLimit' orders.
@param "execInst" (string) Optional execution instructions. Valid options: ParticipateDoNotInitiate, AllOrNone, MarkPrice, IndexPrice, LastPrice, Close, ReduceOnly, Fixed. 'AllOrNone' instruction requires `displayQty` to be 0. 'MarkPrice', 'IndexPrice' or 'LastPrice' instruction valid for 'Stop', 'StopLimit', 'MarketIfTouched', and 'LimitIfTouched' orders.
@param "contingencyType" (string) Optional contingency type for use with `clOrdLinkID`. Valid options: OneCancelsTheOther, OneTriggersTheOther, OneUpdatesTheOtherAbsolute, OneUpdatesTheOtherProportional.
@param "text" (string) Optional order annotation. e.g. 'Take profit'.

@return Order

func (*OrderApiService) OrderNewBulk

func (a *OrderApiService) OrderNewBulk(ctx context.Context, localVarOptionals map[string]interface{}) ([]Order, *http.Response, error)

OrderApiService Create multiple new orders for the same symbol. This endpoint is used for placing bulk orders. Valid order types are Market, Limit, Stop, StopLimit, MarketIfTouched, LimitIfTouched, MarketWithLeftOverAsLimit, and Pegged. Each individual order object in the array should have the same properties as an individual POST /order call. This endpoint is much faster for getting many orders into the book at once. Because it reduces load on BitMEX systems, this endpoint is ratelimited at `ceil(0.1 * orders)`. Submitting 10 orders via a bulk order call will only count as 1 request, 15 as 2, 32 as 4, and so on. For now, only `application/json` is supported on this endpoint. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "orders" (string) An array of orders.

@return []Order

type OrderBook

type OrderBook struct {
	Symbol string `json:"symbol"`

	Level float32 `json:"level"`

	BidSize float32 `json:"bidSize,omitempty"`

	BidPrice float64 `json:"bidPrice,omitempty"`

	AskPrice float64 `json:"askPrice,omitempty"`

	AskSize float32 `json:"askSize,omitempty"`

	Timestamp time.Time `json:"timestamp,omitempty"`
}

Level 2 Book Data

type OrderBookApiService

type OrderBookApiService service

func (*OrderBookApiService) OrderBookGet

func (a *OrderBookApiService) OrderBookGet(symbol string, localVarOptionals map[string]interface{}) ([]OrderBook, *http.Response, error)

OrderBookApiService Get current orderbook [deprecated, use /orderBook/L2].

@param symbol Instrument symbol. Send a series (e.g. XBT) to get data for the nearest contract in that series. @param optional (nil or map[string]interface{}) with one or more of:

@param "depth" (float32) Orderbook depth.

@return []OrderBook

func (*OrderBookApiService) OrderBookGetL2

func (a *OrderBookApiService) OrderBookGetL2(symbol string, localVarOptionals map[string]interface{}) ([]OrderBookL2, *http.Response, error)

OrderBookApiService Get current orderbook in vertical format.

@param symbol Instrument symbol. Send a series (e.g. XBT) to get data for the nearest contract in that series. @param optional (nil or map[string]interface{}) with one or more of:

@param "depth" (float32) Orderbook depth per side. Send 0 for full depth.

@return []OrderBookL2

type OrderBookL2

type OrderBookL2 struct {
	Symbol string `json:"symbol"`

	Id float32 `json:"id"`

	Side string `json:"side"`

	Size float32 `json:"size,omitempty"`

	Price float64 `json:"price,omitempty"`
}

type Position

type Position struct {
	Account float32 `json:"account"`

	Symbol string `json:"symbol"`

	Currency string `json:"currency"`

	Underlying string `json:"underlying,omitempty"`

	QuoteCurrency string `json:"quoteCurrency,omitempty"`

	Commission float64 `json:"commission,omitempty"`

	InitMarginReq float64 `json:"initMarginReq,omitempty"`

	MaintMarginReq float64 `json:"maintMarginReq,omitempty"`

	RiskLimit float32 `json:"riskLimit,omitempty"`

	Leverage float64 `json:"leverage,omitempty"`

	CrossMargin bool `json:"crossMargin,omitempty"`

	DeleveragePercentile float64 `json:"deleveragePercentile,omitempty"`

	RebalancedPnl float32 `json:"rebalancedPnl,omitempty"`

	PrevRealisedPnl float32 `json:"prevRealisedPnl,omitempty"`

	PrevUnrealisedPnl float32 `json:"prevUnrealisedPnl,omitempty"`

	PrevClosePrice float64 `json:"prevClosePrice,omitempty"`

	OpeningTimestamp time.Time `json:"openingTimestamp,omitempty"`

	OpeningQty float32 `json:"openingQty,omitempty"`

	OpeningCost float32 `json:"openingCost,omitempty"`

	OpeningComm float32 `json:"openingComm,omitempty"`

	OpenOrderBuyQty float32 `json:"openOrderBuyQty,omitempty"`

	OpenOrderBuyCost float32 `json:"openOrderBuyCost,omitempty"`

	OpenOrderBuyPremium float32 `json:"openOrderBuyPremium,omitempty"`

	OpenOrderSellQty float32 `json:"openOrderSellQty,omitempty"`

	OpenOrderSellCost float32 `json:"openOrderSellCost,omitempty"`

	OpenOrderSellPremium float32 `json:"openOrderSellPremium,omitempty"`

	ExecBuyQty float32 `json:"execBuyQty,omitempty"`

	ExecBuyCost float32 `json:"execBuyCost,omitempty"`

	ExecSellQty float32 `json:"execSellQty,omitempty"`

	ExecSellCost float32 `json:"execSellCost,omitempty"`

	ExecQty float32 `json:"execQty,omitempty"`

	ExecCost float32 `json:"execCost,omitempty"`

	ExecComm float32 `json:"execComm,omitempty"`

	CurrentTimestamp time.Time `json:"currentTimestamp,omitempty"`

	CurrentQty float32 `json:"currentQty,omitempty"`

	CurrentCost float32 `json:"currentCost,omitempty"`

	CurrentComm float32 `json:"currentComm,omitempty"`

	RealisedCost float32 `json:"realisedCost,omitempty"`

	UnrealisedCost float32 `json:"unrealisedCost,omitempty"`

	GrossOpenCost float32 `json:"grossOpenCost,omitempty"`

	GrossOpenPremium float32 `json:"grossOpenPremium,omitempty"`

	GrossExecCost float32 `json:"grossExecCost,omitempty"`

	IsOpen bool `json:"isOpen,omitempty"`

	MarkPrice float64 `json:"markPrice,omitempty"`

	MarkValue float32 `json:"markValue,omitempty"`

	RiskValue float32 `json:"riskValue,omitempty"`

	HomeNotional float64 `json:"homeNotional,omitempty"`

	ForeignNotional float64 `json:"foreignNotional,omitempty"`

	PosState string `json:"posState,omitempty"`

	PosCost float32 `json:"posCost,omitempty"`

	PosCost2 float32 `json:"posCost2,omitempty"`

	PosCross float32 `json:"posCross,omitempty"`

	PosInit float32 `json:"posInit,omitempty"`

	PosComm float32 `json:"posComm,omitempty"`

	PosLoss float32 `json:"posLoss,omitempty"`

	PosMargin float32 `json:"posMargin,omitempty"`

	PosMaint float32 `json:"posMaint,omitempty"`

	PosAllowance float32 `json:"posAllowance,omitempty"`

	TaxableMargin float32 `json:"taxableMargin,omitempty"`

	InitMargin float32 `json:"initMargin,omitempty"`

	MaintMargin float32 `json:"maintMargin,omitempty"`

	SessionMargin float32 `json:"sessionMargin,omitempty"`

	TargetExcessMargin float32 `json:"targetExcessMargin,omitempty"`

	VarMargin float32 `json:"varMargin,omitempty"`

	RealisedGrossPnl float32 `json:"realisedGrossPnl,omitempty"`

	RealisedTax float32 `json:"realisedTax,omitempty"`

	RealisedPnl float32 `json:"realisedPnl,omitempty"`

	UnrealisedGrossPnl float32 `json:"unrealisedGrossPnl,omitempty"`

	LongBankrupt float32 `json:"longBankrupt,omitempty"`

	ShortBankrupt float32 `json:"shortBankrupt,omitempty"`

	TaxBase float32 `json:"taxBase,omitempty"`

	IndicativeTaxRate float64 `json:"indicativeTaxRate,omitempty"`

	IndicativeTax float32 `json:"indicativeTax,omitempty"`

	UnrealisedTax float32 `json:"unrealisedTax,omitempty"`

	UnrealisedPnl float32 `json:"unrealisedPnl,omitempty"`

	UnrealisedPnlPcnt float64 `json:"unrealisedPnlPcnt,omitempty"`

	UnrealisedRoePcnt float64 `json:"unrealisedRoePcnt,omitempty"`

	SimpleQty float64 `json:"simpleQty,omitempty"`

	SimpleCost float64 `json:"simpleCost,omitempty"`

	SimpleValue float64 `json:"simpleValue,omitempty"`

	SimplePnl float64 `json:"simplePnl,omitempty"`

	SimplePnlPcnt float64 `json:"simplePnlPcnt,omitempty"`

	AvgCostPrice float64 `json:"avgCostPrice,omitempty"`

	AvgEntryPrice float64 `json:"avgEntryPrice,omitempty"`

	BreakEvenPrice float64 `json:"breakEvenPrice,omitempty"`

	MarginCallPrice float64 `json:"marginCallPrice,omitempty"`

	LiquidationPrice float64 `json:"liquidationPrice,omitempty"`

	BankruptPrice float64 `json:"bankruptPrice,omitempty"`

	Timestamp time.Time `json:"timestamp,omitempty"`

	LastPrice float64 `json:"lastPrice,omitempty"`

	LastValue float32 `json:"lastValue,omitempty"`
}

Summary of Open and Closed Positions

type PositionApiService

type PositionApiService service

func (*PositionApiService) PositionGet

func (a *PositionApiService) PositionGet(ctx context.Context, localVarOptionals map[string]interface{}) ([]Position, *http.Response, error)

PositionApiService Get your positions. See <a href=\"http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_AP_6580.html\">the FIX Spec</a> for explanations of these fields. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "filter" (string) Table filter. For example, send {\"symbol\": \"XBTUSD\"}.
@param "columns" (string) Which columns to fetch. For example, send [\"columnName\"].
@param "count" (float32) Number of rows to fetch.

@return []Position

func (*PositionApiService) PositionIsolateMargin

func (a *PositionApiService) PositionIsolateMargin(ctx context.Context, symbol string, localVarOptionals map[string]interface{}) (Position, *http.Response, error)

PositionApiService Enable isolated margin or cross margin per-position. Users can switch isolate margin per-position. This function allows switching margin isolation (aka fixed margin) on and off. * @param ctx context.Context Authentication Context @param symbol Position symbol to isolate. @param optional (nil or map[string]interface{}) with one or more of:

@param "enabled" (bool) True for isolated margin, false for cross margin.

@return Position

func (*PositionApiService) PositionTransferIsolatedMargin

func (a *PositionApiService) PositionTransferIsolatedMargin(ctx context.Context, symbol string, amount float32) (Position, *http.Response, error)

PositionApiService Transfer equity in or out of a position. When margin is isolated on a position, use this function to add or remove margin from the position. Note that you cannot remove margin below the initial margin threshold. * @param ctx context.Context Authentication Context @param symbol Symbol of position to isolate. @param amount Amount to transfer, in Satoshis. May be negative. @return Position

func (*PositionApiService) PositionUpdateLeverage

func (a *PositionApiService) PositionUpdateLeverage(ctx context.Context, symbol string, leverage float64) (Position, *http.Response, error)

PositionApiService Choose leverage for a position. Users can choose an isolated leverage. This will automatically enable isolated margin. * @param ctx context.Context Authentication Context @param symbol Symbol of position to adjust. @param leverage Leverage value. Send a number between 0.01 and 100 to enable isolated margin with a fixed leverage. Send 0 to enable cross margin. @return Position

func (*PositionApiService) PositionUpdateRiskLimit

func (a *PositionApiService) PositionUpdateRiskLimit(ctx context.Context, symbol string, riskLimit float32) (Position, *http.Response, error)

PositionApiService Update your risk limit. Risk Limits limit the size of positions you can trade at various margin levels. Larger positions require more margin. Please see the Risk Limit documentation for more details. * @param ctx context.Context Authentication Context @param symbol Symbol of position to isolate. @param riskLimit New Risk Limit, in Satoshis. @return Position

type Quote

type Quote struct {
	Timestamp time.Time `json:"timestamp"`

	Symbol string `json:"symbol"`

	BidSize float32 `json:"bidSize,omitempty"`

	BidPrice float64 `json:"bidPrice,omitempty"`

	AskPrice float64 `json:"askPrice,omitempty"`

	AskSize float32 `json:"askSize,omitempty"`
}

Best Bid/Offer Snapshots & Historical Bins

type QuoteApiService

type QuoteApiService service

func (*QuoteApiService) QuoteGet

func (a *QuoteApiService) QuoteGet(localVarOptionals map[string]interface{}) ([]Quote, *http.Response, error)

QuoteApiService Get Quotes.

@param optional (nil or map[string]interface{}) with one or more of:

@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []Quote

func (*QuoteApiService) QuoteGetBucketed

func (a *QuoteApiService) QuoteGetBucketed(localVarOptionals map[string]interface{}) ([]Quote, *http.Response, error)

QuoteApiService Get previous quotes in time buckets.

@param optional (nil or map[string]interface{}) with one or more of:

@param "binSize" (string) Time interval to bucket by. Available options: [1m,5m,1h,1d].
@param "partial" (bool) If true, will send in-progress (incomplete) bins for the current time period.
@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []Quote

type SchemaApiService

type SchemaApiService service

func (*SchemaApiService) SchemaGet

func (a *SchemaApiService) SchemaGet(localVarOptionals map[string]interface{}) (interface{}, *http.Response, error)

SchemaApiService Get model schemata for data objects returned by this API.

@param optional (nil or map[string]interface{}) with one or more of:

@param "model" (string) Optional model filter. If omitted, will return all models.

@return interface{}

func (*SchemaApiService) SchemaWebsocketHelp

func (a *SchemaApiService) SchemaWebsocketHelp() (interface{}, *http.Response, error)

SchemaApiService Returns help text & subject list for websocket usage.

@return interface{}

type Settlement

type Settlement struct {
	Timestamp time.Time `json:"timestamp"`

	Symbol string `json:"symbol"`

	SettlementType string `json:"settlementType,omitempty"`

	SettledPrice float64 `json:"settledPrice,omitempty"`

	Bankrupt float32 `json:"bankrupt,omitempty"`

	TaxBase float32 `json:"taxBase,omitempty"`

	TaxRate float64 `json:"taxRate,omitempty"`
}

Historical Settlement Data

type SettlementApiService

type SettlementApiService service

func (*SettlementApiService) SettlementGet

func (a *SettlementApiService) SettlementGet(localVarOptionals map[string]interface{}) ([]Settlement, *http.Response, error)

SettlementApiService Get settlement history.

@param optional (nil or map[string]interface{}) with one or more of:

@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []Settlement

type Stats

type Stats struct {
	RootSymbol string `json:"rootSymbol"`

	Currency string `json:"currency,omitempty"`

	Volume24h float32 `json:"volume24h,omitempty"`

	Turnover24h float32 `json:"turnover24h,omitempty"`

	OpenInterest float32 `json:"openInterest,omitempty"`

	OpenValue float32 `json:"openValue,omitempty"`
}

Exchange Statistics

type StatsApiService

type StatsApiService service

func (*StatsApiService) StatsGet

func (a *StatsApiService) StatsGet() ([]Stats, *http.Response, error)

StatsApiService Get exchange-wide and per-series turnover and volume statistics.

@return []Stats

func (*StatsApiService) StatsHistory

func (a *StatsApiService) StatsHistory() ([]StatsHistory, *http.Response, error)

StatsApiService Get historical exchange-wide and per-series turnover and volume statistics.

@return []StatsHistory

func (*StatsApiService) StatsHistoryUSD

func (a *StatsApiService) StatsHistoryUSD() ([]StatsUsd, *http.Response, error)

StatsApiService Get a summary of exchange statistics in USD.

@return []StatsUsd

type StatsHistory

type StatsHistory struct {
	Date time.Time `json:"date"`

	RootSymbol string `json:"rootSymbol"`

	Currency string `json:"currency,omitempty"`

	Volume float32 `json:"volume,omitempty"`

	Turnover float32 `json:"turnover,omitempty"`
}

type StatsUsd

type StatsUsd struct {
	RootSymbol string `json:"rootSymbol"`

	Currency string `json:"currency,omitempty"`

	Turnover24h float32 `json:"turnover24h,omitempty"`

	Turnover30d float32 `json:"turnover30d,omitempty"`

	Turnover365d float32 `json:"turnover365d,omitempty"`

	Turnover float32 `json:"turnover,omitempty"`
}

type Trade

type Trade struct {
	Timestamp time.Time `json:"timestamp"`

	Symbol string `json:"symbol"`

	Side string `json:"side,omitempty"`

	Size float32 `json:"size,omitempty"`

	Price float64 `json:"price,omitempty"`

	TickDirection string `json:"tickDirection,omitempty"`

	TrdMatchID string `json:"trdMatchID,omitempty"`

	GrossValue float32 `json:"grossValue,omitempty"`

	HomeNotional float64 `json:"homeNotional,omitempty"`

	ForeignNotional float64 `json:"foreignNotional,omitempty"`
}

Individual & Bucketed Trades

type TradeApiService

type TradeApiService service

func (*TradeApiService) TradeGet

func (a *TradeApiService) TradeGet(localVarOptionals map[string]interface{}) ([]Trade, *http.Response, error)

TradeApiService Get Trades. Please note that indices (symbols starting with `.`) post trades at intervals to the trade feed. These have a `size` of 0 and are used only to indicate a changing price. See [the FIX Spec](http://www.onixs.biz/fix-dictionary/5.0.SP2/msgType_AE_6569.html) for explanations of these fields.

@param optional (nil or map[string]interface{}) with one or more of:

@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []Trade

func (*TradeApiService) TradeGetBucketed

func (a *TradeApiService) TradeGetBucketed(localVarOptionals map[string]interface{}) ([]TradeBin, *http.Response, error)

TradeApiService Get previous trades in time buckets.

@param optional (nil or map[string]interface{}) with one or more of:

@param "binSize" (string) Time interval to bucket by. Available options: [1m,5m,1h,1d].
@param "partial" (bool) If true, will send in-progress (incomplete) bins for the current time period.
@param "symbol" (string) Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series.  You can also send a timeframe, e.g. `XBU:monthly`. Timeframes are `daily`, `weekly`, `monthly`, `quarterly`, and `biquarterly`.
@param "filter" (string) Generic table filter. Send JSON key/value pairs, such as `{\"key\": \"value\"}`. You can key on individual fields, and do more advanced querying on timestamps. See the [Timestamp Docs](https://www.bitmex.com/app/restAPI#timestamp-filters) for more details.
@param "columns" (string) Array of column names to fetch. If omitted, will return all columns.  Note that this method will always return item keys, even when not specified, so you may receive more columns that you expect.
@param "count" (float32) Number of results to fetch.
@param "start" (float32) Starting point for results.
@param "reverse" (bool) If true, will sort results newest first.
@param "startTime" (time.Time) Starting date filter for results.
@param "endTime" (time.Time) Ending date filter for results.

@return []TradeBin

type TradeBin

type TradeBin struct {
	Timestamp time.Time `json:"timestamp"`

	Symbol string `json:"symbol"`

	Open float64 `json:"open,omitempty"`

	High float64 `json:"high,omitempty"`

	Low float64 `json:"low,omitempty"`

	Close float64 `json:"close,omitempty"`

	Trades float32 `json:"trades,omitempty"`

	Volume float32 `json:"volume,omitempty"`

	Vwap float64 `json:"vwap,omitempty"`

	LastSize float32 `json:"lastSize,omitempty"`

	Turnover float32 `json:"turnover,omitempty"`

	HomeNotional float64 `json:"homeNotional,omitempty"`

	ForeignNotional float64 `json:"foreignNotional,omitempty"`
}

type Transaction

type Transaction struct {
	TransactID string `json:"transactID"`

	Account float32 `json:"account,omitempty"`

	Currency string `json:"currency,omitempty"`

	TransactType string `json:"transactType,omitempty"`

	Amount float32 `json:"amount,omitempty"`

	Fee float32 `json:"fee,omitempty"`

	TransactStatus string `json:"transactStatus,omitempty"`

	Address string `json:"address,omitempty"`

	Tx string `json:"tx,omitempty"`

	Text string `json:"text,omitempty"`

	TransactTime time.Time `json:"transactTime,omitempty"`

	Timestamp time.Time `json:"timestamp,omitempty"`
}

type User

type User struct {
	Id float32 `json:"id,omitempty"`

	OwnerId float32 `json:"ownerId,omitempty"`

	Firstname string `json:"firstname,omitempty"`

	Lastname string `json:"lastname,omitempty"`

	Username string `json:"username"`

	Email string `json:"email"`

	Phone string `json:"phone,omitempty"`

	Created time.Time `json:"created,omitempty"`

	LastUpdated time.Time `json:"lastUpdated,omitempty"`

	Preferences *UserPreferences `json:"preferences,omitempty"`

	TFAEnabled string `json:"TFAEnabled,omitempty"`

	AffiliateID string `json:"affiliateID,omitempty"`

	PgpPubKey string `json:"pgpPubKey,omitempty"`

	Country string `json:"country,omitempty"`
}

Account Operations

type UserApiService

type UserApiService service

func (*UserApiService) UserCancelWithdrawal

func (a *UserApiService) UserCancelWithdrawal(token string) (Transaction, *http.Response, error)

UserApiService Cancel a withdrawal.

@param token @return Transaction

func (*UserApiService) UserCheckReferralCode

func (a *UserApiService) UserCheckReferralCode(localVarOptionals map[string]interface{}) (float64, *http.Response, error)

UserApiService Check if a referral code is valid. If the code is valid, responds with the referral code's discount (e.g. `0.1` for 10%). Otherwise, will return a 404.

@param optional (nil or map[string]interface{}) with one or more of:

@param "referralCode" (string)

@return float64

func (*UserApiService) UserConfirm

func (a *UserApiService) UserConfirm(token string) (AccessToken, *http.Response, error)

UserApiService Confirm your email address with a token.

@param token @return AccessToken

func (*UserApiService) UserConfirmEnableTFA

func (a *UserApiService) UserConfirmEnableTFA(ctx context.Context, token string, localVarOptionals map[string]interface{}) (bool, *http.Response, error)

UserApiService Confirm two-factor auth for this account. If using a Yubikey, simply send a token to this endpoint. * @param ctx context.Context Authentication Context @param token Token from your selected TFA type. @param optional (nil or map[string]interface{}) with one or more of:

@param "type_" (string) Two-factor auth type. Supported types: 'GA' (Google Authenticator), 'Yubikey'

@return bool

func (*UserApiService) UserConfirmWithdrawal

func (a *UserApiService) UserConfirmWithdrawal(token string) (Transaction, *http.Response, error)

UserApiService Confirm a withdrawal.

@param token @return Transaction

func (*UserApiService) UserDisableTFA

func (a *UserApiService) UserDisableTFA(ctx context.Context, token string, localVarOptionals map[string]interface{}) (bool, *http.Response, error)

UserApiService Disable two-factor auth for this account. * @param ctx context.Context Authentication Context @param token Token from your selected TFA type. @param optional (nil or map[string]interface{}) with one or more of:

@param "type_" (string) Two-factor auth type. Supported types: 'GA' (Google Authenticator)

@return bool

func (*UserApiService) UserGet

func (a *UserApiService) UserGet(ctx context.Context) (User, *http.Response, error)

UserApiService Get your user model. * @param ctx context.Context Authentication Context @return User

func (*UserApiService) UserGetAffiliateStatus

func (a *UserApiService) UserGetAffiliateStatus(ctx context.Context) (Affiliate, *http.Response, error)

UserApiService Get your current affiliate/referral status. * @param ctx context.Context Authentication Context @return Affiliate

func (*UserApiService) UserGetCommission

func (a *UserApiService) UserGetCommission(ctx context.Context) ([]UserCommission, *http.Response, error)

UserApiService Get your account's commission status. * @param ctx context.Context Authentication Context @return []UserCommission

func (*UserApiService) UserGetDepositAddress

func (a *UserApiService) UserGetDepositAddress(ctx context.Context, localVarOptionals map[string]interface{}) (string, *http.Response, error)

UserApiService Get a deposit address. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "currency" (string)

@return string

func (*UserApiService) UserGetMargin

func (a *UserApiService) UserGetMargin(ctx context.Context, localVarOptionals map[string]interface{}) (Margin, *http.Response, error)

UserApiService Get your account's margin status. Send a currency of \"all\" to receive an array of all supported currencies. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "currency" (string)

@return Margin

func (*UserApiService) UserGetWallet

func (a *UserApiService) UserGetWallet(ctx context.Context, localVarOptionals map[string]interface{}) (Wallet, *http.Response, error)

UserApiService Get your current wallet information. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "currency" (string)

@return Wallet

func (*UserApiService) UserGetWalletHistory

func (a *UserApiService) UserGetWalletHistory(ctx context.Context, localVarOptionals map[string]interface{}) ([]Transaction, *http.Response, error)

UserApiService Get a history of all of your wallet transactions (deposits, withdrawals, PNL). * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "currency" (string)

@return []Transaction

func (*UserApiService) UserGetWalletSummary

func (a *UserApiService) UserGetWalletSummary(ctx context.Context, localVarOptionals map[string]interface{}) ([]Transaction, *http.Response, error)

UserApiService Get a summary of all of your wallet transactions (deposits, withdrawals, PNL). * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "currency" (string)

@return []Transaction

func (*UserApiService) UserLogout

func (a *UserApiService) UserLogout() (*http.Response, error)

UserApiService Log out of BitMEX.

@return

func (*UserApiService) UserLogoutAll

func (a *UserApiService) UserLogoutAll(ctx context.Context) (float64, *http.Response, error)

UserApiService Log all systems out of BitMEX. This will revoke all of your account's access tokens, logging you out on all devices. * @param ctx context.Context Authentication Context @return float64

func (*UserApiService) UserMinWithdrawalFee

func (a *UserApiService) UserMinWithdrawalFee(localVarOptionals map[string]interface{}) (interface{}, *http.Response, error)

UserApiService Get the minimum withdrawal fee for a currency. This is changed based on network conditions to ensure timely withdrawals. During network congestion, this may be high. The fee is returned in the same currency.

@param optional (nil or map[string]interface{}) with one or more of:

@param "currency" (string)

@return interface{}

func (*UserApiService) UserRequestEnableTFA

func (a *UserApiService) UserRequestEnableTFA(ctx context.Context, localVarOptionals map[string]interface{}) (bool, *http.Response, error)

UserApiService Get secret key for setting up two-factor auth. Use /confirmEnableTFA directly for Yubikeys. This fails if TFA is already enabled. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "type_" (string) Two-factor auth type. Supported types: 'GA' (Google Authenticator)

@return bool

func (*UserApiService) UserRequestWithdrawal

func (a *UserApiService) UserRequestWithdrawal(ctx context.Context, currency string, amount float32, address string, localVarOptionals map[string]interface{}) (Transaction, *http.Response, error)

UserApiService Request a withdrawal to an external wallet. This will send a confirmation email to the email address on record, unless requested via an API Key with the `withdraw` permission. * @param ctx context.Context Authentication Context @param currency Currency you're withdrawing. Options: `XBt` @param amount Amount of withdrawal currency. @param address Destination Address. @param optional (nil or map[string]interface{}) with one or more of:

@param "otpToken" (string) 2FA token. Required if 2FA is enabled on your account.
@param "fee" (float64) Network fee for Bitcoin withdrawals. If not specified, a default value will be calculated based on Bitcoin network conditions. You will have a chance to confirm this via email.

@return Transaction

func (*UserApiService) UserSavePreferences

func (a *UserApiService) UserSavePreferences(ctx context.Context, prefs string, localVarOptionals map[string]interface{}) (User, *http.Response, error)

UserApiService Save user preferences. * @param ctx context.Context Authentication Context @param prefs @param optional (nil or map[string]interface{}) with one or more of:

@param "overwrite" (bool) If true, will overwrite all existing preferences.

@return User

func (*UserApiService) UserUpdate

func (a *UserApiService) UserUpdate(ctx context.Context, localVarOptionals map[string]interface{}) (User, *http.Response, error)

UserApiService Update your password, name, and other attributes. * @param ctx context.Context Authentication Context @param optional (nil or map[string]interface{}) with one or more of:

@param "firstname" (string)
@param "lastname" (string)
@param "oldPassword" (string)
@param "newPassword" (string)
@param "newPasswordConfirm" (string)
@param "username" (string) Username can only be set once. To reset, email support.
@param "country" (string) Country of residence.
@param "pgpPubKey" (string) PGP Public Key. If specified, automated emails will be sentwith this key.

@return User

type UserCommission

type UserCommission struct {
	MakerFee float64 `json:"makerFee,omitempty"`

	TakerFee float64 `json:"takerFee,omitempty"`

	SettlementFee float64 `json:"settlementFee,omitempty"`

	MaxFee float64 `json:"maxFee,omitempty"`
}

type UserPreferences

type UserPreferences struct {
	AlertOnLiquidations bool `json:"alertOnLiquidations,omitempty"`

	AnimationsEnabled bool `json:"animationsEnabled,omitempty"`

	AnnouncementsLastSeen time.Time `json:"announcementsLastSeen,omitempty"`

	ChatChannelID float64 `json:"chatChannelID,omitempty"`

	ColorTheme string `json:"colorTheme,omitempty"`

	Currency string `json:"currency,omitempty"`

	Debug bool `json:"debug,omitempty"`

	DisableEmails []string `json:"disableEmails,omitempty"`

	HideConfirmDialogs []string `json:"hideConfirmDialogs,omitempty"`

	HideConnectionModal bool `json:"hideConnectionModal,omitempty"`

	HideFromLeaderboard bool `json:"hideFromLeaderboard,omitempty"`

	HideNameFromLeaderboard bool `json:"hideNameFromLeaderboard,omitempty"`

	HideNotifications []string `json:"hideNotifications,omitempty"`

	Locale string `json:"locale,omitempty"`

	MsgsSeen []string `json:"msgsSeen,omitempty"`

	OrderBookBinning *interface{} `json:"orderBookBinning,omitempty"`

	OrderBookType string `json:"orderBookType,omitempty"`

	OrderClearImmediate bool `json:"orderClearImmediate,omitempty"`

	OrderControlsPlusMinus bool `json:"orderControlsPlusMinus,omitempty"`

	Sounds []string `json:"sounds,omitempty"`

	StrictIPCheck bool `json:"strictIPCheck,omitempty"`

	StrictTimeout bool `json:"strictTimeout,omitempty"`

	TickerGroup string `json:"tickerGroup,omitempty"`

	TickerPinned bool `json:"tickerPinned,omitempty"`

	TradeLayout string `json:"tradeLayout,omitempty"`
}

type Wallet

type Wallet struct {
	Account float32 `json:"account"`

	Currency string `json:"currency"`

	PrevDeposited float32 `json:"prevDeposited,omitempty"`

	PrevWithdrawn float32 `json:"prevWithdrawn,omitempty"`

	PrevTransferIn float32 `json:"prevTransferIn,omitempty"`

	PrevTransferOut float32 `json:"prevTransferOut,omitempty"`

	PrevAmount float32 `json:"prevAmount,omitempty"`

	PrevTimestamp time.Time `json:"prevTimestamp,omitempty"`

	DeltaDeposited float32 `json:"deltaDeposited,omitempty"`

	DeltaWithdrawn float32 `json:"deltaWithdrawn,omitempty"`

	DeltaTransferIn float32 `json:"deltaTransferIn,omitempty"`

	DeltaTransferOut float32 `json:"deltaTransferOut,omitempty"`

	DeltaAmount float32 `json:"deltaAmount,omitempty"`

	Deposited float32 `json:"deposited,omitempty"`

	Withdrawn float32 `json:"withdrawn,omitempty"`

	TransferIn float32 `json:"transferIn,omitempty"`

	TransferOut float32 `json:"transferOut,omitempty"`

	Amount float32 `json:"amount,omitempty"`

	PendingCredit float32 `json:"pendingCredit,omitempty"`

	PendingDebit float32 `json:"pendingDebit,omitempty"`

	ConfirmedDebit float32 `json:"confirmedDebit,omitempty"`

	Timestamp time.Time `json:"timestamp,omitempty"`

	Addr string `json:"addr,omitempty"`

	Script string `json:"script,omitempty"`

	WithdrawalLock []string `json:"withdrawalLock,omitempty"`
}

type XAny

type XAny struct {
}

Jump to

Keyboard shortcuts

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