bitmex

package module
v0.0.0-...-4d04529 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: MIT Imports: 23 Imported by: 2

README

Bitmex REST/Realtime APIs for Go

Fork & Tribute

github@zmxv

Overview

This go-bitmex package enables golang clients to call REST APIs for the Bitmex crypto trading platform. It fixes critical bugs in the swagger-generated code and enhances its usability.

Notable changes:

  • Fixed the authentication logic and API endpoint
  • Fixed form data encoding
  • Renamed the package from swagger to bitmex
  • Removed all external dependencies (golang.org/x/oauth2 and github.com/antihax/optional)
  • Added a local optional package with mutable states to simplify parameter assignment
  • Fixed many type issues and removed the obsolete XAny type

This package also differs from an alternative library at https://github.com/qct/bitmex-go in the following ways:

  • bitmex employs strongly-typed structs for API parameters instead of map[string]interface{}.
  • bitmex is forked from a more recent version of the swagger-generated code.
  • bitmex depends on no external packages and is compatible with Google App Engine.

Installation

$ go get github.com/go-numb/go-bitmex

Usage

import "github.com/go-numb/go-bitmex"

const (
    // Get your API key/secret pair at https://www.bitmex.com/app/apiKeys
    key := "<API_KEY>"
    secret := "<API_SECRET>"
    isTestNet = false
)

func main() {

    // Create an authentication context
    auth := bitmex.NewAPIKeyContext(key, secret)

    // Create a shareable API client instance
    client := bitmex.NewAPIClient(bitmex.NewConfiguration())
    if isTestNet {
        // Create a testnet API client instance
        client := bitmex.NewAPIClient(bitmex.NewTestnetConfiguration())
    }

    // Manager API Limit
    isPrivate := true
    publicAPI := bitmex.NewLimit(!isPrivate)
    privateAPI := bitmex.NewLimit(isPrivate)


    // Call APIs without parameters by passing the auth context.
    // e.g. getting exchange-wide turnover and volume statistics:
    stats, res, err := client.StatsApi.StatsGet(auth)

    // gets API Remain from header x-ratelimit-remain & more
    publicAPI.FromHeader(res.Header)

    // Call APIs with default parameters by passing the auth context and a nil.
    // e.g. getting all open positions:
    pos, res, err := client.PositionApi.PositionGet(auth, nil)

    // gets API Remain from header x-ratelimit-remain & more
    publicAPI.FromHeader(res.Header)

    // Call APIs with additional parameters by constructing a corresponding XXXOpts struct.
    // e.g. submitting a limit order to buy 20000 contracts of XBTUSD at $6000.5:
    var params bitmex.OrderNewOpts
    params.OrdType.Set("Limit")
    params.Side.Set("Buy")
    params.OrderQty.Set(20000)
    params.Price.Set(6000.5)

    // checks API Limit
    if err := privateAPI.Check();err != nil {
        return
    }

    // order with params
    order, res, err := client.OrderApi.OrderNew(auth, "XBTUSD", &params)
    
    // gets API Remain from header x-ratelimit-remain & more
    privateAPI.FromHeader(res.Header)
}

Documentation for API Endpoints

All URIs are relative to https://www.bitmex.com/api/v1

Class Method HTTP request Description
APIKeyApi APIKeyDisable Post /apiKey/disable Disable an API Key.
APIKeyApi APIKeyEnable Post /apiKey/enable Enable an API Key.
APIKeyApi APIKeyGet Get /apiKey Get your API Keys.
APIKeyApi APIKeyNew Post /apiKey Create a new API Key.
APIKeyApi APIKeyRemove Delete /apiKey Remove an API Key.
AnnouncementApi AnnouncementGet Get /announcement Get site announcements.
AnnouncementApi AnnouncementGetUrgent Get /announcement/urgent Get urgent (banner) announcements.
ChatApi ChatGet Get /chat Get chat messages.
ChatApi ChatGetChannels Get /chat/channels Get available channels.
ChatApi ChatGetConnected Get /chat/connected Get connected users.
ChatApi ChatNew Post /chat Send a chat message.
ExecutionApi ExecutionGet Get /execution Get all raw executions for your account.
ExecutionApi ExecutionGetTradeHistory Get /execution/tradeHistory Get all balance-affecting executions. This includes each trade, insurance charge, and settlement.
FundingApi FundingGet Get /funding Get funding history.
InstrumentApi InstrumentGet Get /instrument Get instruments.
InstrumentApi InstrumentGetActive Get /instrument/active Get all active instruments and instruments that have expired in <24hrs.
InstrumentApi InstrumentGetActiveAndIndices Get /instrument/activeAndIndices Helper method. Gets all active instruments and all indices. This is a join of the result of /indices and /active.
InstrumentApi InstrumentGetActiveIntervals Get /instrument/activeIntervals Return all active contract series and interval pairs.
InstrumentApi InstrumentGetCompositeIndex Get /instrument/compositeIndex Show constituent parts of an index.
InstrumentApi InstrumentGetIndices Get /instrument/indices Get all price indices.
InsuranceApi InsuranceGet Get /insurance Get insurance fund history.
LeaderboardApi LeaderboardGet Get /leaderboard Get current leaderboard.
LeaderboardApi LeaderboardGetName Get /leaderboard/name Get your alias on the leaderboard.
LiquidationApi LiquidationGet Get /liquidation Get liquidation orders.
NotificationApi NotificationGet Get /notification Get your current notifications.
OrderApi OrderAmend Put /order Amend the quantity or price of an open order.
OrderApi OrderAmendBulk Put /order/bulk Amend multiple orders for the same symbol.
OrderApi OrderCancel Delete /order Cancel order(s). Send multiple order IDs to cancel in bulk.
OrderApi OrderCancelAll Delete /order/all Cancels all of your orders.
OrderApi OrderCancelAllAfter Post /order/cancelAllAfter Automatically cancel all your orders after a specified timeout.
OrderApi OrderClosePosition Post /order/closePosition Close a position. [Deprecated, use POST /order with execInst: 'Close']
OrderApi OrderGetOrders Get /order Get your orders.
OrderApi OrderNew Post /order Create a new order.
OrderApi OrderNewBulk Post /order/bulk Create multiple new orders for the same symbol.
OrderBookApi OrderBookGetL2 Get /orderBook/L2 Get current orderbook in vertical format.
PositionApi PositionGet Get /position Get your positions.
PositionApi PositionIsolateMargin Post /position/isolate Enable isolated margin or cross margin per-position.
PositionApi PositionTransferIsolatedMargin Post /position/transferMargin Transfer equity in or out of a position.
PositionApi PositionUpdateLeverage Post /position/leverage Choose leverage for a position.
PositionApi PositionUpdateRiskLimit Post /position/riskLimit Update your risk limit.
QuoteApi QuoteGet Get /quote Get Quotes.
QuoteApi QuoteGetBucketed Get /quote/bucketed Get previous quotes in time buckets.
SchemaApi SchemaGet Get /schema Get model schemata for data objects returned by this API.
SchemaApi SchemaWebsocketHelp Get /schema/websocketHelp Returns help text & subject list for websocket usage.
SettlementApi SettlementGet Get /settlement Get settlement history.
StatsApi StatsGet Get /stats Get exchange-wide and per-series turnover and volume statistics.
StatsApi StatsHistory Get /stats/history Get historical exchange-wide and per-series turnover and volume statistics.
StatsApi StatsHistoryUSD Get /stats/historyUSD Get a summary of exchange statistics in USD.
TradeApi TradeGet Get /trade Get Trades.
TradeApi TradeGetBucketed Get /trade/bucketed Get previous trades in time buckets.
UserApi UserCancelWithdrawal Post /user/cancelWithdrawal Cancel a withdrawal.
UserApi UserCheckReferralCode Get /user/checkReferralCode Check if a referral code is valid.
UserApi UserConfirm Post /user/confirmEmail Confirm your email address with a token.
UserApi UserConfirmEnableTFA Post /user/confirmEnableTFA Confirm two-factor auth for this account. If using a Yubikey, simply send a token to this endpoint.
UserApi UserConfirmWithdrawal Post /user/confirmWithdrawal Confirm a withdrawal.
UserApi UserDisableTFA Post /user/disableTFA Disable two-factor auth for this account.
UserApi UserGet Get /user Get your user model.
UserApi UserGetAffiliateStatus Get /user/affiliateStatus Get your current affiliate/referral status.
UserApi UserGetCommission Get /user/commission Get your account's commission status.
UserApi UserGetDepositAddress Get /user/depositAddress Get a deposit address.
UserApi UserGetMargin Get /user/margin Get your account's margin status. Send a currency of &quot;all&quot; to receive an array of all supported currencies.
UserApi UserGetWallet Get /user/wallet Get your current wallet information.
UserApi UserGetWalletHistory Get /user/walletHistory Get a history of all of your wallet transactions (deposits, withdrawals, PNL).
UserApi UserGetWalletSummary Get /user/walletSummary Get a summary of all of your wallet transactions (deposits, withdrawals, PNL).
UserApi UserLogout Post /user/logout Log out of BitMEX.
UserApi UserLogoutAll Post /user/logoutAll Log all systems out of BitMEX. This will revoke all of your account's access tokens, logging you out on all devices.
UserApi UserMinWithdrawalFee Get /user/minWithdrawalFee Get the minimum withdrawal fee for a currency.
UserApi UserRequestEnableTFA Post /user/requestEnableTFA Get secret key for setting up two-factor auth.
UserApi UserRequestWithdrawal Post /user/requestWithdrawal Request a withdrawal to an external wallet.
UserApi UserSavePreferences Post /user/preferences Save user preferences.
UserApi UserUpdate Put /user Update your password, name, and other attributes.

Documentation For Models

Author

@_numbP

Bitmex customer support

support@bitmex.com

Documentation

Index

Constants

View Source
const (
	// ProductCode
	XBTUSD = "XBTUSD"
	XBTU19 = "XBTU19"
	XBTZ19 = "XBTZ19"
	ETHUSD = "ETHUSD"

	// BUY is side string
	BUY = "Buy"
	// SELL is side string
	SELL = "Sell"

	// OrderType
	LIMIT           = "Limit"
	MARKET          = "Market"
	STOP            = "Stop"
	STOPLIMIT       = "StopLimit"
	MARKETIFTOUCHED = "MarketIfTouched"
	LIMITIFTOUCHED  = "LimitIfTouched"

	// PostOnly
	POSTONLY = "ParticipateDoNotInitiate"

	// TimeInForce
	IOC = "ImmediateOrCancel"
)
View Source
const (
	// APIREMAIN is API Limit initial number
	APIREMAIN = 60 // par 60sec
)

Variables

View Source
var ContextAPIKey = contextKey("apikey")

Functions

func CacheExpires

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

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

func NewAPIKeyContext

func NewAPIKeyContext(key, secret string) context.Context

Types

type APIClient

type APIClient struct {
	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
	Secret string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

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 - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @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 - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param apiKeyID API Key ID (public component).

@return ApiKey

func (*APIKeyApiService) APIKeyGet

func (a *APIKeyApiService) APIKeyGet(ctx context.Context, localVarOptionals *APIKeyGetOpts) ([]ApiKey, *http.Response, error)

func (*APIKeyApiService) APIKeyNew

func (a *APIKeyApiService) APIKeyNew(ctx context.Context, localVarOptionals *APIKeyNewOpts) (ApiKey, *http.Response, error)

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 - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param apiKeyID API Key ID (public component).

@return InlineResponse200

type APIKeyGetOpts

type APIKeyGetOpts struct {
	Reverse optional.Bool
}

type APIKeyNewOpts

type APIKeyNewOpts struct {
	Name        optional.String
	Cidr        optional.String
	Permissions optional.String
	Enabled     optional.Bool
	Token       optional.String
}

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         int       `json:"account"`
	Currency        string    `json:"currency"`
	PrevPayout      int       `json:"prevPayout,omitempty"`
	PrevTurnover    int       `json:"prevTurnover,omitempty"`
	PrevComm        int       `json:"prevComm,omitempty"`
	PrevTimestamp   time.Time `json:"prevTimestamp,omitempty"`
	ExecTurnover    int       `json:"execTurnover,omitempty"`
	ExecComm        int       `json:"execComm,omitempty"`
	TotalReferrals  int       `json:"totalReferrals,omitempty"`
	TotalTurnover   int       `json:"totalTurnover,omitempty"`
	TotalComm       int       `json:"totalComm,omitempty"`
	PayoutPcnt      float64   `json:"payoutPcnt,omitempty"`
	PendingPayout   int       `json:"pendingPayout,omitempty"`
	Timestamp       time.Time `json:"timestamp,omitempty"`
	ReferrerAccount int       `json:"referrerAccount,omitempty"`
}

type Announcement

type Announcement struct {
	Id      int       `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(ctx context.Context, localVarOptionals *AnnouncementGetOpts) ([]Announcement, *http.Response, error)

func (*AnnouncementApiService) AnnouncementGetUrgent

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

AnnouncementApiService Get urgent (banner) announcements.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []Announcement

type AnnouncementGetOpts

type AnnouncementGetOpts struct {
	Columns optional.String
}

type ApiKey

type ApiKey struct {
	Id          string    `json:"id"`
	Secret      string    `json:"secret"`
	Name        string    `json:"name"`
	Nonce       int       `json:"nonce"`
	Cidr        string    `json:"cidr,omitempty"`
	Permissions []string  `json:"permissions,omitempty"`
	Enabled     bool      `json:"enabled,omitempty"`
	UserId      int       `json:"userId"`
	Created     time.Time `json:"created,omitempty"`
}

Persistent API Keys for Developers

type Chat

type Chat struct {
	Id        int       `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 int       `json:"channelID,omitempty"`
}

Trollbox Data

type ChatApiService

type ChatApiService service

func (*ChatApiService) ChatGet

func (a *ChatApiService) ChatGet(ctx context.Context, localVarOptionals *ChatGetOpts) ([]Chat, *http.Response, error)

func (*ChatApiService) ChatGetChannels

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

ChatApiService Get available channels.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []ChatChannel

func (*ChatApiService) ChatGetConnected

func (a *ChatApiService) ChatGetConnected(ctx context.Context) (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.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return ConnectedUsers

func (*ChatApiService) ChatNew

func (a *ChatApiService) ChatNew(ctx context.Context, message string, localVarOptionals *ChatNewOpts) (Chat, *http.Response, error)

type ChatChannel

type ChatChannel struct {
	Id   int    `json:"id,omitempty"`
	Name string `json:"name"`
}

type ChatGetOpts

type ChatGetOpts struct {
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	ChannelID optional.Float64
}

type ChatNewOpts

type ChatNewOpts struct {
	ChannelID optional.Float64
}

type Configuration

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

func NewConfiguration

func NewConfiguration() *Configuration

func NewTestnetConfiguration

func NewTestnetConfiguration() *Configuration

type ConnectedUsers

type ConnectedUsers struct {
	Users int `json:"users,omitempty"`
	Bots  int `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               int       `json:"account,omitempty"`
	Symbol                string    `json:"symbol,omitempty"`
	Side                  string    `json:"side,omitempty"`
	LastQty               int       `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              int       `json:"orderQty,omitempty"`
	Price                 float64   `json:"price,omitempty"`
	DisplayQty            int       `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             int       `json:"leavesQty,omitempty"`
	SimpleCumQty          float64   `json:"simpleCumQty,omitempty"`
	CumQty                int       `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              int       `json:"execCost,omitempty"`
	ExecComm              int       `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 *ExecutionGetOpts) ([]Execution, *http.Response, error)

func (*ExecutionApiService) ExecutionGetTradeHistory

func (a *ExecutionApiService) ExecutionGetTradeHistory(ctx context.Context, localVarOptionals *ExecutionGetTradeHistoryOpts) ([]Execution, *http.Response, error)

type ExecutionGetOpts

type ExecutionGetOpts struct {
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

type ExecutionGetTradeHistoryOpts

type ExecutionGetTradeHistoryOpts struct {
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

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(ctx context.Context, localVarOptionals *FundingGetOpts) ([]Funding, *http.Response, error)

type FundingGetOpts

type FundingGetOpts struct {
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

type GenericSwaggerError

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

GenericSwaggerError Provides access to the body, error and model on returned errors.

func (GenericSwaggerError) Body

func (e GenericSwaggerError) Body() []byte

Body returns the raw bytes of the response

func (GenericSwaggerError) Error

func (e GenericSwaggerError) Error() string

Error returns non-empty string if there was an error.

func (GenericSwaggerError) Model

func (e GenericSwaggerError) Model() interface{}

Model returns the unpacked model of the error

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 InlineResponse2001

type InlineResponse2001 struct {
	Name string `json:"name,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"`
	OptionStrikePcnt               float64   `json:"optionStrikePcnt,omitempty"`
	OptionStrikeRound              float64   `json:"optionStrikeRound,omitempty"`
	OptionStrikePrice              float64   `json:"optionStrikePrice,omitempty"`
	OptionMultiplier               float64   `json:"optionMultiplier,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                    int       `json:"maxOrderQty,omitempty"`
	MaxPrice                       float64   `json:"maxPrice,omitempty"`
	LotSize                        int       `json:"lotSize,omitempty"`
	TickSize                       float64   `json:"tickSize,omitempty"`
	Multiplier                     int       `json:"multiplier,omitempty"`
	SettlCurrency                  string    `json:"settlCurrency,omitempty"`
	UnderlyingToPositionMultiplier int       `json:"underlyingToPositionMultiplier,omitempty"`
	UnderlyingToSettleMultiplier   int       `json:"underlyingToSettleMultiplier,omitempty"`
	QuoteToSettleMultiplier        int       `json:"quoteToSettleMultiplier,omitempty"`
	IsQuanto                       bool      `json:"isQuanto,omitempty"`
	IsInverse                      bool      `json:"isInverse,omitempty"`
	InitMargin                     float64   `json:"initMargin,omitempty"`
	MaintMargin                    float64   `json:"maintMargin,omitempty"`
	RiskLimit                      int       `json:"riskLimit,omitempty"`
	RiskStep                       int       `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                int       `json:"prevTotalVolume,omitempty"`
	TotalVolume                    int       `json:"totalVolume,omitempty"`
	Volume                         int       `json:"volume,omitempty"`
	Volume24h                      int       `json:"volume24h,omitempty"`
	PrevTotalTurnover              int       `json:"prevTotalTurnover,omitempty"`
	TotalTurnover                  int       `json:"totalTurnover,omitempty"`
	Turnover                       int       `json:"turnover,omitempty"`
	Turnover24h                    int       `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                   int       `json:"openInterest,omitempty"`
	OpenValue                      int       `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"`
	OptionUnderlyingPrice          float64   `json:"optionUnderlyingPrice,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(ctx context.Context, localVarOptionals *InstrumentGetOpts) ([]Instrument, *http.Response, error)

func (*InstrumentApiService) InstrumentGetActive

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

InstrumentApiService Get all active instruments and instruments that have expired in &lt;24hrs.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []Instrument

func (*InstrumentApiService) InstrumentGetActiveAndIndices

func (a *InstrumentApiService) InstrumentGetActiveAndIndices(ctx context.Context) ([]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.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []Instrument

func (*InstrumentApiService) InstrumentGetActiveIntervals

func (a *InstrumentApiService) InstrumentGetActiveIntervals(ctx context.Context) (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 &#x60;[\&quot;XBT:perpetual\&quot;, \&quot;XBT:monthly\&quot;, \&quot;XBT:quarterly\&quot;, \&quot;ETH:monthly\&quot;, ...]&#x60;. These identifiers are usable in any query&#39;s &#x60;symbol&#x60; param. The second array is the current resolution of these intervals. Results are mapped at the same index.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return InstrumentInterval

func (*InstrumentApiService) InstrumentGetCompositeIndex

func (a *InstrumentApiService) InstrumentGetCompositeIndex(ctx context.Context, localVarOptionals *InstrumentGetCompositeIndexOpts) ([]IndexComposite, *http.Response, error)

func (*InstrumentApiService) InstrumentGetIndices

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

InstrumentApiService Get all price indices.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []Instrument

type InstrumentGetCompositeIndexOpts

type InstrumentGetCompositeIndexOpts struct {
	Account   optional.Float64
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

type InstrumentGetOpts

type InstrumentGetOpts struct {
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

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 int       `json:"walletBalance,omitempty"`
}

Insurance Fund Data

type InsuranceApiService

type InsuranceApiService service

func (*InsuranceApiService) InsuranceGet

func (a *InsuranceApiService) InsuranceGet(ctx context.Context, localVarOptionals *InsuranceGetOpts) ([]Insurance, *http.Response, error)

type InsuranceGetOpts

type InsuranceGetOpts struct {
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

type Leaderboard

type Leaderboard struct {
	Name       string  `json:"name"`
	IsRealName bool    `json:"isRealName,omitempty"`
	Profit     float64 `json:"profit,omitempty"`
}

Information on Top Users

type LeaderboardApiService

type LeaderboardApiService service

func (*LeaderboardApiService) LeaderboardGet

func (a *LeaderboardApiService) LeaderboardGet(ctx context.Context, localVarOptionals *LeaderboardGetOpts) ([]Leaderboard, *http.Response, error)

func (*LeaderboardApiService) LeaderboardGetName

func (a *LeaderboardApiService) LeaderboardGetName(ctx context.Context) (InlineResponse2001, *http.Response, error)

LeaderboardApiService Get your alias on the leaderboard.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return InlineResponse2001

type LeaderboardGetOpts

type LeaderboardGetOpts struct {
	Method optional.String
}

type Limit

type Limit struct {
	Wait   int       // 429 too much request時の待機時間
	Limit  int       // Limit is resets count
	Remain int       // Remain is 残Requests
	Reset  time.Time // Reset Remainの詳細時間(sec未満なし)
}

Limit is API Limit struct

func NewLimit

func NewLimit(isPrivate bool) *Limit

NewLimit is API Limit

func (*Limit) Check

func (p *Limit) Check() error

Check is checks remain number

func (*Limit) FromHeader

func (p *Limit) FromHeader(h http.Header)

FromHeader X-xxxからLimitを取得 If you are limited, you will receive a 429 response and an additional header, Retry-After, that indicates the number of seconds you should sleep before retrying.

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 int     `json:"leavesQty,omitempty"`
}

Active Liquidations

type LiquidationApiService

type LiquidationApiService service

func (*LiquidationApiService) LiquidationGet

func (a *LiquidationApiService) LiquidationGet(ctx context.Context, localVarOptionals *LiquidationGetOpts) ([]Liquidation, *http.Response, error)

type LiquidationGetOpts

type LiquidationGetOpts struct {
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

type Margin

type Margin struct {
	Account            int       `json:"account"`
	Currency           string    `json:"currency"`
	RiskLimit          int       `json:"riskLimit,omitempty"`
	PrevState          string    `json:"prevState,omitempty"`
	State              string    `json:"state,omitempty"`
	Action             string    `json:"action,omitempty"`
	Amount             int       `json:"amount,omitempty"`
	PendingCredit      int       `json:"pendingCredit,omitempty"`
	PendingDebit       int       `json:"pendingDebit,omitempty"`
	ConfirmedDebit     int       `json:"confirmedDebit,omitempty"`
	PrevRealisedPnl    int       `json:"prevRealisedPnl,omitempty"`
	PrevUnrealisedPnl  int       `json:"prevUnrealisedPnl,omitempty"`
	GrossComm          int       `json:"grossComm,omitempty"`
	GrossOpenCost      int       `json:"grossOpenCost,omitempty"`
	GrossOpenPremium   int       `json:"grossOpenPremium,omitempty"`
	GrossExecCost      int       `json:"grossExecCost,omitempty"`
	GrossMarkValue     int       `json:"grossMarkValue,omitempty"`
	RiskValue          int       `json:"riskValue,omitempty"`
	TaxableMargin      int       `json:"taxableMargin,omitempty"`
	InitMargin         int       `json:"initMargin,omitempty"`
	MaintMargin        int       `json:"maintMargin,omitempty"`
	SessionMargin      int       `json:"sessionMargin,omitempty"`
	TargetExcessMargin int       `json:"targetExcessMargin,omitempty"`
	VarMargin          int       `json:"varMargin,omitempty"`
	RealisedPnl        int       `json:"realisedPnl,omitempty"`
	UnrealisedPnl      int       `json:"unrealisedPnl,omitempty"`
	IndicativeTax      int       `json:"indicativeTax,omitempty"`
	UnrealisedProfit   int       `json:"unrealisedProfit,omitempty"`
	SyntheticMargin    int       `json:"syntheticMargin,omitempty"`
	WalletBalance      int       `json:"walletBalance,omitempty"`
	MarginBalance      int       `json:"marginBalance,omitempty"`
	MarginBalancePcnt  float64   `json:"marginBalancePcnt,omitempty"`
	MarginLeverage     float64   `json:"marginLeverage,omitempty"`
	MarginUsedPcnt     float64   `json:"marginUsedPcnt,omitempty"`
	ExcessMargin       int       `json:"excessMargin,omitempty"`
	ExcessMarginPcnt   float64   `json:"excessMarginPcnt,omitempty"`
	AvailableMargin    int       `json:"availableMargin,omitempty"`
	WithdrawableMargin int       `json:"withdrawableMargin,omitempty"`
	Timestamp          time.Time `json:"timestamp,omitempty"`
	GrossLastValue     int       `json:"grossLastValue,omitempty"`
	Commission         float64   `json:"commission,omitempty"`
}

type ModelError

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

type Notification

type Notification struct {
	Id                int       `json:"id,omitempty"`
	Date              time.Time `json:"date"`
	Title             string    `json:"title"`
	Body              string    `json:"body"`
	Ttl               int       `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 - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []Notification

type Order

type Order struct {
	OrderID               string    `json:"orderID"`
	ClOrdID               string    `json:"clOrdID,omitempty"`
	ClOrdLinkID           string    `json:"clOrdLinkID,omitempty"`
	Account               int       `json:"account,omitempty"`
	Symbol                string    `json:"symbol,omitempty"`
	Side                  string    `json:"side,omitempty"`
	SimpleOrderQty        float64   `json:"simpleOrderQty,omitempty"`
	OrderQty              int       `json:"orderQty,omitempty"`
	Price                 float64   `json:"price,omitempty"`
	DisplayQty            int       `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             int       `json:"leavesQty,omitempty"`
	SimpleCumQty          float64   `json:"simpleCumQty,omitempty"`
	CumQty                int       `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 OrderAmendBulkOpts

type OrderAmendBulkOpts struct {
	Orders optional.String
}

type OrderAmendOpts

type OrderAmendOpts struct {
	OrderID         optional.String
	OrigClOrdID     optional.String
	ClOrdID         optional.String
	SimpleOrderQty  optional.Float64
	OrderQty        optional.Int
	SimpleLeavesQty optional.Float64
	LeavesQty       optional.Int
	Price           optional.Float64
	StopPx          optional.Float64
	PegOffsetValue  optional.Float64
	Text            optional.String
}

type OrderApiService

type OrderApiService service

func (*OrderApiService) OrderAmend

func (a *OrderApiService) OrderAmend(ctx context.Context, localVarOptionals *OrderAmendOpts) (Order, *http.Response, error)

func (*OrderApiService) OrderAmendBulk

func (a *OrderApiService) OrderAmendBulk(ctx context.Context, localVarOptionals *OrderAmendBulkOpts) ([]Order, *http.Response, error)

func (*OrderApiService) OrderCancel

func (a *OrderApiService) OrderCancel(ctx context.Context, localVarOptionals *OrderCancelOpts) ([]Order, *http.Response, error)

func (*OrderApiService) OrderCancelAll

func (a *OrderApiService) OrderCancelAll(ctx context.Context, localVarOptionals *OrderCancelAllOpts) ([]Order, *http.Response, error)

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&#39;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-Mans-Switch-Auto-Cancel).

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @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 *OrderClosePositionOpts) (Order, *http.Response, error)

func (*OrderApiService) OrderGetOrders

func (a *OrderApiService) OrderGetOrders(ctx context.Context, localVarOptionals *OrderGetOrdersOpts) ([]Order, *http.Response, error)

func (*OrderApiService) OrderNew

func (a *OrderApiService) OrderNew(ctx context.Context, symbol string, localVarOptionals *OrderNewOpts) (Order, *http.Response, error)

func (*OrderApiService) OrderNewBulk

func (a *OrderApiService) OrderNewBulk(ctx context.Context, localVarOptionals *OrderNewBulkOpts) ([]Order, *http.Response, error)

type OrderBookApiService

type OrderBookApiService service

func (*OrderBookApiService) OrderBookGetL2

func (a *OrderBookApiService) OrderBookGetL2(ctx context.Context, symbol string, localVarOptionals *OrderBookGetL2Opts) ([]OrderBookL2, *http.Response, error)

type OrderBookGetL2Opts

type OrderBookGetL2Opts struct {
	Depth optional.Int
}

type OrderBookL2

type OrderBookL2 struct {
	Symbol string  `json:"symbol"`
	Id     int     `json:"id"`
	Side   string  `json:"side"`
	Size   int     `json:"size,omitempty"`
	Price  float64 `json:"price,omitempty"`
}

type OrderCancelAllOpts

type OrderCancelAllOpts struct {
	Symbol optional.String
	Filter optional.String
	Text   optional.String
}

type OrderCancelOpts

type OrderCancelOpts struct {
	OrderID optional.String
	ClOrdID optional.String
	Text    optional.String
}

type OrderClosePositionOpts

type OrderClosePositionOpts struct {
	Price optional.Float64
}

type OrderGetOrdersOpts

type OrderGetOrdersOpts struct {
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

type OrderNewBulkOpts

type OrderNewBulkOpts struct {
	Orders optional.String
}

type OrderNewOpts

type OrderNewOpts struct {
	Side            optional.String
	SimpleOrderQty  optional.Float64
	OrderQty        optional.Int
	Price           optional.Float64
	DisplayQty      optional.Int
	StopPx          optional.Float64
	ClOrdID         optional.String
	ClOrdLinkID     optional.String
	PegOffsetValue  optional.Float64
	PegPriceType    optional.String
	OrdType         optional.String
	TimeInForce     optional.String
	ExecInst        optional.String
	ContingencyType optional.String
	Text            optional.String
}

type Position

type Position struct {
	Account              int       `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            int       `json:"riskLimit,omitempty"`
	Leverage             float64   `json:"leverage,omitempty"`
	CrossMargin          bool      `json:"crossMargin,omitempty"`
	DeleveragePercentile float64   `json:"deleveragePercentile,omitempty"`
	RebalancedPnl        int       `json:"rebalancedPnl,omitempty"`
	PrevRealisedPnl      int       `json:"prevRealisedPnl,omitempty"`
	PrevUnrealisedPnl    int       `json:"prevUnrealisedPnl,omitempty"`
	PrevClosePrice       float64   `json:"prevClosePrice,omitempty"`
	OpeningTimestamp     time.Time `json:"openingTimestamp,omitempty"`
	OpeningQty           int       `json:"openingQty,omitempty"`
	OpeningCost          int       `json:"openingCost,omitempty"`
	OpeningComm          int       `json:"openingComm,omitempty"`
	OpenOrderBuyQty      int       `json:"openOrderBuyQty,omitempty"`
	OpenOrderBuyCost     int       `json:"openOrderBuyCost,omitempty"`
	OpenOrderBuyPremium  int       `json:"openOrderBuyPremium,omitempty"`
	OpenOrderSellQty     int       `json:"openOrderSellQty,omitempty"`
	OpenOrderSellCost    int       `json:"openOrderSellCost,omitempty"`
	OpenOrderSellPremium int       `json:"openOrderSellPremium,omitempty"`
	ExecBuyQty           int       `json:"execBuyQty,omitempty"`
	ExecBuyCost          int       `json:"execBuyCost,omitempty"`
	ExecSellQty          int       `json:"execSellQty,omitempty"`
	ExecSellCost         int       `json:"execSellCost,omitempty"`
	ExecQty              int       `json:"execQty,omitempty"`
	ExecCost             int       `json:"execCost,omitempty"`
	ExecComm             int       `json:"execComm,omitempty"`
	CurrentTimestamp     time.Time `json:"currentTimestamp,omitempty"`
	CurrentQty           int       `json:"currentQty,omitempty"`
	CurrentCost          int       `json:"currentCost,omitempty"`
	CurrentComm          int       `json:"currentComm,omitempty"`
	RealisedCost         int       `json:"realisedCost,omitempty"`
	UnrealisedCost       int       `json:"unrealisedCost,omitempty"`
	GrossOpenCost        int       `json:"grossOpenCost,omitempty"`
	GrossOpenPremium     int       `json:"grossOpenPremium,omitempty"`
	GrossExecCost        int       `json:"grossExecCost,omitempty"`
	IsOpen               bool      `json:"isOpen,omitempty"`
	MarkPrice            float64   `json:"markPrice,omitempty"`
	MarkValue            int       `json:"markValue,omitempty"`
	RiskValue            int       `json:"riskValue,omitempty"`
	HomeNotional         float64   `json:"homeNotional,omitempty"`
	ForeignNotional      float64   `json:"foreignNotional,omitempty"`
	PosState             string    `json:"posState,omitempty"`
	PosCost              int       `json:"posCost,omitempty"`
	PosCost2             int       `json:"posCost2,omitempty"`
	PosCross             int       `json:"posCross,omitempty"`
	PosInit              int       `json:"posInit,omitempty"`
	PosComm              int       `json:"posComm,omitempty"`
	PosLoss              int       `json:"posLoss,omitempty"`
	PosMargin            int       `json:"posMargin,omitempty"`
	PosMaint             int       `json:"posMaint,omitempty"`
	PosAllowance         int       `json:"posAllowance,omitempty"`
	TaxableMargin        int       `json:"taxableMargin,omitempty"`
	InitMargin           int       `json:"initMargin,omitempty"`
	MaintMargin          int       `json:"maintMargin,omitempty"`
	SessionMargin        int       `json:"sessionMargin,omitempty"`
	TargetExcessMargin   int       `json:"targetExcessMargin,omitempty"`
	VarMargin            int       `json:"varMargin,omitempty"`
	RealisedGrossPnl     int       `json:"realisedGrossPnl,omitempty"`
	RealisedTax          int       `json:"realisedTax,omitempty"`
	RealisedPnl          int       `json:"realisedPnl,omitempty"`
	UnrealisedGrossPnl   int       `json:"unrealisedGrossPnl,omitempty"`
	LongBankrupt         int       `json:"longBankrupt,omitempty"`
	ShortBankrupt        int       `json:"shortBankrupt,omitempty"`
	TaxBase              int       `json:"taxBase,omitempty"`
	IndicativeTaxRate    float64   `json:"indicativeTaxRate,omitempty"`
	IndicativeTax        int       `json:"indicativeTax,omitempty"`
	UnrealisedTax        int       `json:"unrealisedTax,omitempty"`
	UnrealisedPnl        int       `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            int       `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 *PositionGetOpts) ([]Position, *http.Response, error)

func (*PositionApiService) PositionIsolateMargin

func (a *PositionApiService) PositionIsolateMargin(ctx context.Context, symbol string, localVarOptionals *PositionIsolateMarginOpts) (Position, *http.Response, error)

func (*PositionApiService) PositionTransferIsolatedMargin

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

PositionApiService Transfer equity in or out of a position.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @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.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @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 int) (Position, *http.Response, error)

PositionApiService Update your risk limit.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param symbol Symbol of position to update risk limit on.
  • @param riskLimit New Risk Limit, in Satoshis.

@return Position

type PositionGetOpts

type PositionGetOpts struct {
	Filter  optional.String
	Columns optional.String
	Count   optional.Int
}

type PositionIsolateMarginOpts

type PositionIsolateMarginOpts struct {
	Enabled optional.Bool
}

type Quote

type Quote struct {
	Timestamp time.Time `json:"timestamp"`
	Symbol    string    `json:"symbol"`
	BidSize   int       `json:"bidSize,omitempty"`
	BidPrice  float64   `json:"bidPrice,omitempty"`
	AskPrice  float64   `json:"askPrice,omitempty"`
	AskSize   int       `json:"askSize,omitempty"`
}

Best Bid/Offer Snapshots & Historical Bins

type QuoteApiService

type QuoteApiService service

func (*QuoteApiService) QuoteGet

func (a *QuoteApiService) QuoteGet(ctx context.Context, localVarOptionals *QuoteGetOpts) ([]Quote, *http.Response, error)

func (*QuoteApiService) QuoteGetBucketed

func (a *QuoteApiService) QuoteGetBucketed(ctx context.Context, localVarOptionals *QuoteGetBucketedOpts) ([]Quote, *http.Response, error)

type QuoteGetBucketedOpts

type QuoteGetBucketedOpts struct {
	BinSize   optional.String
	Partial   optional.Bool
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

type QuoteGetOpts

type QuoteGetOpts struct {
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

type SchemaApiService

type SchemaApiService service

func (*SchemaApiService) SchemaGet

func (a *SchemaApiService) SchemaGet(ctx context.Context, localVarOptionals *SchemaGetOpts) (interface{}, *http.Response, error)

func (*SchemaApiService) SchemaWebsocketHelp

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

SchemaApiService Returns help text &amp; subject list for websocket usage.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return interface{}

type SchemaGetOpts

type SchemaGetOpts struct {
	Model optional.String
}

type Settlement

type Settlement struct {
	Timestamp             time.Time `json:"timestamp"`
	Symbol                string    `json:"symbol"`
	SettlementType        string    `json:"settlementType,omitempty"`
	SettledPrice          float64   `json:"settledPrice,omitempty"`
	OptionStrikePrice     float64   `json:"optionStrikePrice,omitempty"`
	OptionUnderlyingPrice float64   `json:"optionUnderlyingPrice,omitempty"`
	Bankrupt              int       `json:"bankrupt,omitempty"`
	TaxBase               int       `json:"taxBase,omitempty"`
	TaxRate               float64   `json:"taxRate,omitempty"`
}

Historical Settlement Data

type SettlementApiService

type SettlementApiService service

func (*SettlementApiService) SettlementGet

func (a *SettlementApiService) SettlementGet(ctx context.Context, localVarOptionals *SettlementGetOpts) ([]Settlement, *http.Response, error)

type SettlementGetOpts

type SettlementGetOpts struct {
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

type Stats

type Stats struct {
	RootSymbol   string `json:"rootSymbol"`
	Currency     string `json:"currency,omitempty"`
	Volume24h    int    `json:"volume24h,omitempty"`
	Turnover24h  int    `json:"turnover24h,omitempty"`
	OpenInterest int    `json:"openInterest,omitempty"`
	OpenValue    int    `json:"openValue,omitempty"`
}

Exchange Statistics

type StatsApiService

type StatsApiService service

func (*StatsApiService) StatsGet

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

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

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []Stats

func (*StatsApiService) StatsHistory

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

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

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []StatsHistory

func (*StatsApiService) StatsHistoryUSD

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

StatsApiService Get a summary of exchange statistics in USD.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []StatsUsd

type StatsHistory

type StatsHistory struct {
	Date       time.Time `json:"date"`
	RootSymbol string    `json:"rootSymbol"`
	Currency   string    `json:"currency,omitempty"`
	Volume     int       `json:"volume,omitempty"`
	Turnover   int       `json:"turnover,omitempty"`
}

type StatsUsd

type StatsUsd struct {
	RootSymbol   string `json:"rootSymbol"`
	Currency     string `json:"currency,omitempty"`
	Turnover24h  int    `json:"turnover24h,omitempty"`
	Turnover30d  int    `json:"turnover30d,omitempty"`
	Turnover365d int    `json:"turnover365d,omitempty"`
	Turnover     int    `json:"turnover,omitempty"`
}

type Trade

type Trade struct {
	Timestamp       time.Time `json:"timestamp"`
	Symbol          string    `json:"symbol"`
	Side            string    `json:"side,omitempty"`
	Size            int       `json:"size,omitempty"`
	Price           float64   `json:"price,omitempty"`
	TickDirection   string    `json:"tickDirection,omitempty"`
	TrdMatchID      string    `json:"trdMatchID,omitempty"`
	GrossValue      int       `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(ctx context.Context, localVarOptionals *TradeGetOpts) ([]Trade, *http.Response, error)

func (*TradeApiService) TradeGetBucketed

func (a *TradeApiService) TradeGetBucketed(ctx context.Context, localVarOptionals *TradeGetBucketedOpts) ([]TradeBin, *http.Response, error)

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          int       `json:"trades,omitempty"`
	Volume          int       `json:"volume,omitempty"`
	Vwap            float64   `json:"vwap,omitempty"`
	LastSize        int       `json:"lastSize,omitempty"`
	Turnover        int       `json:"turnover,omitempty"`
	HomeNotional    float64   `json:"homeNotional,omitempty"`
	ForeignNotional float64   `json:"foreignNotional,omitempty"`
}

type TradeGetBucketedOpts

type TradeGetBucketedOpts struct {
	BinSize   optional.String
	Partial   optional.Bool
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

type TradeGetOpts

type TradeGetOpts struct {
	Symbol    optional.String
	Filter    optional.String
	Columns   optional.String
	Count     optional.Int
	Start     optional.Int
	Reverse   optional.Bool
	StartTime optional.Time
	EndTime   optional.Time
}

type Transaction

type Transaction struct {
	TransactID     string    `json:"transactID"`
	Account        int       `json:"account,omitempty"`
	Currency       string    `json:"currency,omitempty"`
	TransactType   string    `json:"transactType,omitempty"`
	Amount         int       `json:"amount,omitempty"`
	Fee            int       `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           int              `json:"id,omitempty"`
	OwnerId      int              `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"`
	GeoipCountry string           `json:"geoipCountry,omitempty"`
	GeoipRegion  string           `json:"geoipRegion,omitempty"`
	Typ          string           `json:"typ,omitempty"`
}

Account Operations

type UserApiService

type UserApiService service

func (*UserApiService) UserCancelWithdrawal

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

UserApiService Cancel a withdrawal.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param token

@return Transaction

func (*UserApiService) UserCheckReferralCode

func (a *UserApiService) UserCheckReferralCode(ctx context.Context, localVarOptionals *UserCheckReferralCodeOpts) (float64, *http.Response, error)

func (*UserApiService) UserConfirm

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

UserApiService Confirm your email address with a token.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param token

@return AccessToken

func (*UserApiService) UserConfirmEnableTFA

func (a *UserApiService) UserConfirmEnableTFA(ctx context.Context, token string, localVarOptionals *UserConfirmEnableTFAOpts) (bool, *http.Response, error)

func (*UserApiService) UserConfirmWithdrawal

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

UserApiService Confirm a withdrawal.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param token

@return Transaction

func (*UserApiService) UserDisableTFA

func (a *UserApiService) UserDisableTFA(ctx context.Context, token string, localVarOptionals *UserDisableTFAOpts) (bool, *http.Response, error)

func (*UserApiService) UserGet

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

UserApiService Get your user model.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@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 - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return Affiliate

func (*UserApiService) UserGetCommission

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

UserApiService Get your account&#39;s commission status.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []UserCommission

func (*UserApiService) UserGetDepositAddress

func (a *UserApiService) UserGetDepositAddress(ctx context.Context, localVarOptionals *UserGetDepositAddressOpts) (string, *http.Response, error)

func (*UserApiService) UserGetMargin

func (a *UserApiService) UserGetMargin(ctx context.Context, localVarOptionals *UserGetMarginOpts) (Margin, *http.Response, error)

func (*UserApiService) UserGetWallet

func (a *UserApiService) UserGetWallet(ctx context.Context, localVarOptionals *UserGetWalletOpts) (Wallet, *http.Response, error)

func (*UserApiService) UserGetWalletHistory

func (a *UserApiService) UserGetWalletHistory(ctx context.Context, localVarOptionals *UserGetWalletHistoryOpts) ([]Transaction, *http.Response, error)

func (*UserApiService) UserGetWalletSummary

func (a *UserApiService) UserGetWalletSummary(ctx context.Context, localVarOptionals *UserGetWalletSummaryOpts) ([]Transaction, *http.Response, error)

func (*UserApiService) UserLogout

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

UserApiService Log out of BitMEX.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

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&#39;s access tokens, logging you out on all devices.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return float64

func (*UserApiService) UserMinWithdrawalFee

func (a *UserApiService) UserMinWithdrawalFee(ctx context.Context, localVarOptionals *UserMinWithdrawalFeeOpts) (UserWithdrawalFees, *http.Response, error)

func (*UserApiService) UserRequestEnableTFA

func (a *UserApiService) UserRequestEnableTFA(ctx context.Context, localVarOptionals *UserRequestEnableTFAOpts) (bool, *http.Response, error)

func (*UserApiService) UserRequestWithdrawal

func (a *UserApiService) UserRequestWithdrawal(ctx context.Context, currency string, amount int, address string, localVarOptionals *UserRequestWithdrawalOpts) (Transaction, *http.Response, error)

func (*UserApiService) UserSavePreferences

func (a *UserApiService) UserSavePreferences(ctx context.Context, prefs string, localVarOptionals *UserSavePreferencesOpts) (User, *http.Response, error)

func (*UserApiService) UserUpdate

func (a *UserApiService) UserUpdate(ctx context.Context, localVarOptionals *UserUpdateOpts) (User, *http.Response, error)

type UserCheckReferralCodeOpts

type UserCheckReferralCodeOpts struct {
	ReferralCode optional.String
}

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 UserConfirmEnableTFAOpts

type UserConfirmEnableTFAOpts struct {
	Type_ optional.String
}

type UserDisableTFAOpts

type UserDisableTFAOpts struct {
	Type_ optional.String
}

type UserGetDepositAddressOpts

type UserGetDepositAddressOpts struct {
	Currency optional.String
}

type UserGetMarginOpts

type UserGetMarginOpts struct {
	Currency optional.String
}

type UserGetWalletHistoryOpts

type UserGetWalletHistoryOpts struct {
	Currency optional.String
}

type UserGetWalletOpts

type UserGetWalletOpts struct {
	Currency optional.String
}

type UserGetWalletSummaryOpts

type UserGetWalletSummaryOpts struct {
	Currency optional.String
}

type UserMinWithdrawalFeeOpts

type UserMinWithdrawalFeeOpts struct {
	Currency optional.String
}

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"`
	ShowLocaleNumbers       bool         `json:"showLocaleNumbers,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 UserRequestEnableTFAOpts

type UserRequestEnableTFAOpts struct {
	Type_ optional.String
}

type UserRequestWithdrawalOpts

type UserRequestWithdrawalOpts struct {
	OtpToken optional.String
	Fee      optional.Float64
}

type UserSavePreferencesOpts

type UserSavePreferencesOpts struct {
	Overwrite optional.Bool
}

type UserUpdateOpts

type UserUpdateOpts struct {
	Firstname          optional.String
	Lastname           optional.String
	OldPassword        optional.String
	NewPassword        optional.String
	NewPasswordConfirm optional.String
	Username           optional.String
	Country            optional.String
	PgpPubKey          optional.String
}

type UserWithdrawalFees

type UserWithdrawalFees struct {
	Currency string `json:"currency,omitempty"`
	Fee      int    `json:"fee,omitempty"`
	MinFee   int    `json:"minFee,omitempty"`
	MaxFee   int    `json:"maxFee,omitempty"`
}

type Wallet

type Wallet struct {
	Account          int       `json:"account"`
	Currency         string    `json:"currency"`
	PrevDeposited    int       `json:"prevDeposited,omitempty"`
	PrevWithdrawn    int       `json:"prevWithdrawn,omitempty"`
	PrevTransferIn   int       `json:"prevTransferIn,omitempty"`
	PrevTransferOut  int       `json:"prevTransferOut,omitempty"`
	PrevAmount       int       `json:"prevAmount,omitempty"`
	PrevTimestamp    time.Time `json:"prevTimestamp,omitempty"`
	DeltaDeposited   int       `json:"deltaDeposited,omitempty"`
	DeltaWithdrawn   int       `json:"deltaWithdrawn,omitempty"`
	DeltaTransferIn  int       `json:"deltaTransferIn,omitempty"`
	DeltaTransferOut int       `json:"deltaTransferOut,omitempty"`
	DeltaAmount      int       `json:"deltaAmount,omitempty"`
	Deposited        int       `json:"deposited,omitempty"`
	Withdrawn        int       `json:"withdrawn,omitempty"`
	TransferIn       int       `json:"transferIn,omitempty"`
	TransferOut      int       `json:"transferOut,omitempty"`
	Amount           int       `json:"amount,omitempty"`
	PendingCredit    int       `json:"pendingCredit,omitempty"`
	PendingDebit     int       `json:"pendingDebit,omitempty"`
	ConfirmedDebit   int       `json:"confirmedDebit,omitempty"`
	Timestamp        time.Time `json:"timestamp,omitempty"`
	Addr             string    `json:"addr,omitempty"`
	Script           string    `json:"script,omitempty"`
	WithdrawalLock   []string  `json:"withdrawalLock,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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