bitmex

package
v0.0.0-...-83dca6d Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 34 Imported by: 0

README

GoCryptoTrader package Bitmex

Build Status Software License GoDoc Coverage Status Go Report Card

This bitmex package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Bithumb Exchange

Current Features
  • REST Support
How to enable
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var b exchange.IBotExchange

for i := range bot.Exchanges {
	if bot.Exchanges[i].GetName() == "Bitmex" {
		b = bot.Exchanges[i]
	}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
	// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
	// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
	// Handle error
}
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

View Source
const (

	// ContractPerpetual perpetual contract type
	ContractPerpetual = iota
	// ContractFutures futures contract type
	ContractFutures
	// ContractDownsideProfit downside profit contract type
	ContractDownsideProfit
	// ContractUpsideProfit upside profit contract type
	ContractUpsideProfit
)

Variables

This section is empty.

Functions

func StructValsToURLVals

func StructValsToURLVals(v interface{}) (url.Values, error)

StructValsToURLVals converts a struct into url.values for easy encoding can set json tags for outgoing naming conventions.

Types

type APIKey

type APIKey struct {
	Cidr        string        `json:"cidr"`
	Created     string        `json:"created"`
	Enabled     bool          `json:"enabled"`
	ID          string        `json:"id"`
	Name        string        `json:"name"`
	Nonce       int64         `json:"nonce"`
	Permissions []interface{} `json:"permissions"`
	Secret      string        `json:"secret"`
	UserID      int32         `json:"userId"`
}

APIKey Persistent API Keys for Developers

type APIKeyParams

type APIKeyParams struct {
	// API Key ID (public component).
	APIKeyID string `json:"apiKeyID,omitempty"`
}

APIKeyParams contains all the parameters to send to the API endpoint

func (*APIKeyParams) IsNil

func (p *APIKeyParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (*APIKeyParams) ToURLVals

func (p *APIKeyParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (*APIKeyParams) VerifyData

func (p *APIKeyParams) VerifyData() error

VerifyData verifies outgoing data sets

type AffiliateStatus

type AffiliateStatus struct {
	Account         int64     `json:"account"`
	Currency        string    `json:"currency"`
	ExecComm        int64     `json:"execComm"`
	ExecTurnover    int64     `json:"execTurnover"`
	PayoutPcnt      float64   `json:"payoutPcnt"`
	PendingPayout   int64     `json:"pendingPayout"`
	PrevComm        int64     `json:"prevComm"`
	PrevPayout      int64     `json:"prevPayout"`
	PrevTimestamp   time.Time `json:"prevTimestamp"`
	PrevTurnover    int64     `json:"prevTurnover"`
	ReferrerAccount float64   `json:"referrerAccount"`
	Timestamp       time.Time `json:"timestamp"`
	TotalComm       int64     `json:"totalComm"`
	TotalReferrals  int64     `json:"totalReferrals"`
	TotalTurnover   int64     `json:"totalTurnover"`
}

AffiliateStatus affiliate Status details

type Alias

type Alias struct {
	Name string `json:"name"`
}

Alias Name refers to Trollbox client name

type Announcement

type Announcement struct {
	Content string `json:"content"`
	Date    string `json:"date"`
	ID      int32  `json:"id"`
	Link    string `json:"link"`
	Title   string `json:"title"`
}

Announcement General Announcements

type AnnouncementData

type AnnouncementData struct {
	Data   []Announcement `json:"data"`
	Action string         `json:"action"`
}

AnnouncementData contains announcement resp data with action to be taken

type Bitmex

type Bitmex struct {
	exchange.Base
}

Bitmex is the overarching type across this package

func (*Bitmex) AmendBulkOrders

func (b *Bitmex) AmendBulkOrders(ctx context.Context, params OrderAmendBulkParams) ([]Order, error)

AmendBulkOrders amends multiple orders for the same symbol

func (*Bitmex) AmendOrder

func (b *Bitmex) AmendOrder(ctx context.Context, params *OrderAmendParams) (Order, error)

AmendOrder amends the quantity or price of an open order

func (*Bitmex) AuthenticateWebsocket

func (b *Bitmex) AuthenticateWebsocket(_ context.Context) error

AuthenticateWebsocket sends an authentication message to the websocket

func (*Bitmex) CancelAllExistingOrders

func (b *Bitmex) CancelAllExistingOrders(ctx context.Context, params OrderCancelAllParams) ([]Order, error)

CancelAllExistingOrders cancels all open orders on the exchange

func (*Bitmex) CancelAllOrders

func (b *Bitmex) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*Bitmex) CancelAllOrdersAfterTime

func (b *Bitmex) CancelAllOrdersAfterTime(ctx context.Context, params OrderCancelAllAfterParams) ([]Order, error)

CancelAllOrdersAfterTime closes all positions after a certain time period

func (*Bitmex) CancelBatchOrders

func (b *Bitmex) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error)

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*Bitmex) CancelOrder

func (b *Bitmex) CancelOrder(ctx context.Context, o *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*Bitmex) CancelOrders

func (b *Bitmex) CancelOrders(ctx context.Context, params *OrderCancelParams) ([]Order, error)

CancelOrders cancels one or a batch of orders on the exchange and returns a cancelled order list

func (*Bitmex) CancelWithdraw

func (b *Bitmex) CancelWithdraw(ctx context.Context, token string) (TransactionInfo, error)

CancelWithdraw cancels a current withdrawal

func (*Bitmex) CaptureError

func (b *Bitmex) CaptureError(resp, reType interface{}) error

CaptureError little hack that captures an error

func (*Bitmex) CheckReferalCode

func (b *Bitmex) CheckReferalCode(ctx context.Context, referralCode string) (float64, error)

CheckReferalCode checks a code, will return a percentage eg 0.1 for 10% or if err a 404

func (*Bitmex) ClosePosition

func (b *Bitmex) ClosePosition(ctx context.Context, params OrderClosePositionParams) ([]Order, error)

ClosePosition closes a position WARNING deprecated use /order endpoint

func (*Bitmex) ConfirmEmail

func (b *Bitmex) ConfirmEmail(ctx context.Context, token string) (ConfirmEmail, error)

ConfirmEmail confirms email address with a token

func (*Bitmex) ConfirmTwoFactorAuth

func (b *Bitmex) ConfirmTwoFactorAuth(ctx context.Context, token, typ string) (bool, error)

ConfirmTwoFactorAuth confirms 2FA for this account.

func (*Bitmex) ConfirmWithdrawal

func (b *Bitmex) ConfirmWithdrawal(ctx context.Context, token string) (TransactionInfo, error)

ConfirmWithdrawal confirms a withdrawal

func (*Bitmex) CreateBulkOrders

func (b *Bitmex) CreateBulkOrders(ctx context.Context, params OrderNewBulkParams) ([]Order, error)

CreateBulkOrders creates multiple orders for the same symbol

func (*Bitmex) CreateOrder

func (b *Bitmex) CreateOrder(ctx context.Context, params *OrderNewParams) (Order, error)

CreateOrder creates a new order

func (*Bitmex) DisableAPIKey

func (b *Bitmex) DisableAPIKey(ctx context.Context, params APIKeyParams) (APIKey, error)

DisableAPIKey disables an Apikey from the bitmex trading engine

func (*Bitmex) DisableTFA

func (b *Bitmex) DisableTFA(ctx context.Context, token, typ string) (bool, error)

DisableTFA dsiables 2 factor authentication for your account

func (*Bitmex) EnableAPIKey

func (b *Bitmex) EnableAPIKey(ctx context.Context, params APIKeyParams) (APIKey, error)

EnableAPIKey enables an Apikey from the bitmex trading engine

func (*Bitmex) EnableTFA

func (b *Bitmex) EnableTFA(ctx context.Context, typ string) (bool, error)

EnableTFA enables 2 factor authentication

func (*Bitmex) FetchAccountInfo

func (b *Bitmex) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*Bitmex) FetchOrderbook

func (b *Bitmex) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*Bitmex) FetchTicker

func (b *Bitmex) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*Bitmex) FetchTradablePairs

func (b *Bitmex) FetchTradablePairs(ctx context.Context, asset asset.Item) ([]string, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Bitmex) GenerateAuthenticatedSubscriptions

func (b *Bitmex) GenerateAuthenticatedSubscriptions() ([]stream.ChannelSubscription, error)

GenerateAuthenticatedSubscriptions Adds authenticated subscriptions to websocket to be handled by ManageSubscriptions()

func (*Bitmex) GenerateDefaultSubscriptions

func (b *Bitmex) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)

GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()

func (*Bitmex) GetAPIKeys

func (b *Bitmex) GetAPIKeys(ctx context.Context) ([]APIKey, error)

GetAPIKeys returns the APIkeys from bitmex

func (*Bitmex) GetAccountExecutionTradeHistory

func (b *Bitmex) GetAccountExecutionTradeHistory(ctx context.Context, params *GenericRequestParams) ([]Execution, error)

GetAccountExecutionTradeHistory returns all balance-affecting executions. This includes each trade, insurance charge, and settlement.

func (*Bitmex) GetAccountExecutions

func (b *Bitmex) GetAccountExecutions(ctx context.Context, params *GenericRequestParams) ([]Execution, error)

GetAccountExecutions 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.

func (*Bitmex) GetActiveAndIndexInstruments

func (b *Bitmex) GetActiveAndIndexInstruments(ctx context.Context) ([]Instrument, error)

GetActiveAndIndexInstruments returns all active instruments and all indices

func (*Bitmex) GetActiveInstruments

func (b *Bitmex) GetActiveInstruments(ctx context.Context, params *GenericRequestParams) ([]Instrument, error)

GetActiveInstruments returns active instruments

func (*Bitmex) GetActiveIntervals

func (b *Bitmex) GetActiveIntervals(ctx context.Context) (InstrumentInterval, error)

GetActiveIntervals returns funding history

func (*Bitmex) GetActiveOrders

func (b *Bitmex) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)

GetActiveOrders retrieves any orders that are active/open This function is not concurrency safe due to orderSide/orderType maps

func (*Bitmex) GetAffiliateStatus

func (b *Bitmex) GetAffiliateStatus(ctx context.Context) (AffiliateStatus, error)

GetAffiliateStatus returns your affiliate status

func (*Bitmex) GetAliasOnLeaderboard

func (b *Bitmex) GetAliasOnLeaderboard(ctx context.Context) (Alias, error)

GetAliasOnLeaderboard returns your alias on the leaderboard

func (*Bitmex) GetAllUserMargin

func (b *Bitmex) GetAllUserMargin(ctx context.Context) ([]UserMargin, error)

GetAllUserMargin returns user margin information

func (*Bitmex) GetAnnouncement

func (b *Bitmex) GetAnnouncement(ctx context.Context) ([]Announcement, error)

GetAnnouncement returns the general announcements from Bitmex

func (*Bitmex) GetCompositeIndex

func (b *Bitmex) GetCompositeIndex(ctx context.Context, symbol, count, filter, columns, start, reverse string, startTime, endTime time.Time) ([]IndexComposite, error)

GetCompositeIndex returns composite index

func (*Bitmex) GetCryptoDepositAddress

func (b *Bitmex) GetCryptoDepositAddress(ctx context.Context, cryptoCurrency string) (string, error)

GetCryptoDepositAddress returns a deposit address for a cryptocurency

func (*Bitmex) GetCurrentNotifications

func (b *Bitmex) GetCurrentNotifications(ctx context.Context) ([]Notification, error)

GetCurrentNotifications returns your current notifications

func (*Bitmex) GetDefaultConfig

func (b *Bitmex) GetDefaultConfig() (*config.Exchange, error)

GetDefaultConfig returns a default exchange config

func (*Bitmex) GetDepositAddress

func (b *Bitmex) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, _ string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*Bitmex) GetFee

func (b *Bitmex) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns an estimate of fee based on type of transaction

func (*Bitmex) GetFeeByType

func (b *Bitmex) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*Bitmex) GetFullFundingHistory

func (b *Bitmex) GetFullFundingHistory(ctx context.Context, symbol, count, filter, columns, start string, reverse bool, startTime, endTime time.Time) ([]Funding, error)

GetFullFundingHistory returns funding history

func (*Bitmex) GetFundingHistory

func (b *Bitmex) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error)

GetFundingHistory returns funding history, deposits and withdrawals

func (*Bitmex) GetHistoricCandles

func (b *Bitmex) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)

GetHistoricCandles returns candles between a time period for a set time interval

func (*Bitmex) GetHistoricCandlesExtended

func (b *Bitmex) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)

GetHistoricCandlesExtended returns candles between a time period for a set time interval

func (*Bitmex) GetHistoricTrades

func (b *Bitmex) GetHistoricTrades(ctx context.Context, p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*Bitmex) GetIndices

func (b *Bitmex) GetIndices(ctx context.Context) ([]Instrument, error)

GetIndices returns all price indices

func (*Bitmex) GetInstruments

func (b *Bitmex) GetInstruments(ctx context.Context, params *GenericRequestParams) ([]Instrument, error)

GetInstruments returns instrument data

func (*Bitmex) GetInsuranceFundHistory

func (b *Bitmex) GetInsuranceFundHistory(ctx context.Context, params *GenericRequestParams) ([]Insurance, error)

GetInsuranceFundHistory returns insurance fund history

func (*Bitmex) GetLeaderboard

func (b *Bitmex) GetLeaderboard(ctx context.Context, params LeaderboardGetParams) ([]Leaderboard, error)

GetLeaderboard returns leaderboard information

func (*Bitmex) GetLiquidationOrders

func (b *Bitmex) GetLiquidationOrders(ctx context.Context, params *GenericRequestParams) ([]Liquidation, error)

GetLiquidationOrders returns liquidation orders

func (*Bitmex) GetMinimumWithdrawalFee

func (b *Bitmex) GetMinimumWithdrawalFee(ctx context.Context, currency string) (MinWithdrawalFee, error)

GetMinimumWithdrawalFee returns minimum withdrawal fee information

func (*Bitmex) GetOrderHistory

func (b *Bitmex) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status This function is not concurrency safe due to orderSide/orderType maps

func (*Bitmex) GetOrderInfo

func (b *Bitmex) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*Bitmex) GetOrderbook

func (b *Bitmex) GetOrderbook(ctx context.Context, params OrderBookGetL2Params) ([]OrderBookL2, error)

GetOrderbook returns layer two orderbook data

func (*Bitmex) GetOrders

func (b *Bitmex) GetOrders(ctx context.Context, params *OrdersRequest) ([]Order, error)

GetOrders returns all the orders, open and closed

func (*Bitmex) GetPositions

func (b *Bitmex) GetPositions(ctx context.Context, params PositionGetParams) ([]Position, error)

GetPositions returns positions

func (*Bitmex) GetPreviousTrades

func (b *Bitmex) GetPreviousTrades(ctx context.Context, params *TradeGetBucketedParams) ([]Trade, error)

GetPreviousTrades previous trade history in time buckets

func (*Bitmex) GetQuotes

func (b *Bitmex) GetQuotes(ctx context.Context, params *GenericRequestParams) ([]Quote, error)

GetQuotes returns quotations

func (*Bitmex) GetQuotesByBuckets

func (b *Bitmex) GetQuotesByBuckets(ctx context.Context, params *QuoteGetBucketedParams) ([]Quote, error)

GetQuotesByBuckets returns previous quotes in time buckets

func (*Bitmex) GetRecentTrades

func (b *Bitmex) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)

GetRecentTrades returns the most recent trades for a currency and asset

func (*Bitmex) GetSettlementHistory

func (b *Bitmex) GetSettlementHistory(ctx context.Context, params *GenericRequestParams) ([]Settlement, error)

GetSettlementHistory returns settlement history

func (*Bitmex) GetStatSummary

func (b *Bitmex) GetStatSummary(ctx context.Context) ([]StatsUSD, error)

GetStatSummary returns the stats summary in USD terms

func (*Bitmex) GetStats

func (b *Bitmex) GetStats(ctx context.Context) ([]Stats, error)

GetStats returns exchange wide per series turnover and volume statistics

func (*Bitmex) GetStatsHistorical

func (b *Bitmex) GetStatsHistorical(ctx context.Context) ([]StatsHistory, error)

GetStatsHistorical historic stats

func (*Bitmex) GetTrade

func (b *Bitmex) GetTrade(ctx context.Context, params *GenericRequestParams) ([]Trade, error)

GetTrade returns executed trades on the desk

func (*Bitmex) GetTrollboxChannels

func (b *Bitmex) GetTrollboxChannels(ctx context.Context) ([]ChatChannel, error)

GetTrollboxChannels the channels from the the bitmex trollbox

func (*Bitmex) GetTrollboxConnectedUsers

func (b *Bitmex) GetTrollboxConnectedUsers(ctx context.Context) (ConnectedUsers, error)

GetTrollboxConnectedUsers the channels from the the bitmex trollbox

func (*Bitmex) GetTrollboxMessages

func (b *Bitmex) GetTrollboxMessages(ctx context.Context, params ChatGetParams) ([]Chat, error)

GetTrollboxMessages returns messages from the bitmex trollbox

func (*Bitmex) GetUrgentAnnouncement

func (b *Bitmex) GetUrgentAnnouncement(ctx context.Context) ([]Announcement, error)

GetUrgentAnnouncement returns an urgent announcement for your account

func (*Bitmex) GetUserCommision

func (b *Bitmex) GetUserCommision(ctx context.Context) (UserCommission, error)

GetUserCommision returns your account's commission status.

func (*Bitmex) GetUserInfo

func (b *Bitmex) GetUserInfo(ctx context.Context) (User, error)

GetUserInfo returns your user information

func (*Bitmex) GetUserMargin

func (b *Bitmex) GetUserMargin(ctx context.Context, currency string) (UserMargin, error)

GetUserMargin returns user margin information

func (*Bitmex) GetUserPreferences

func (b *Bitmex) GetUserPreferences(ctx context.Context, params UserPreferencesParams) (User, error)

GetUserPreferences returns user preferences

func (*Bitmex) GetWalletHistory

func (b *Bitmex) GetWalletHistory(ctx context.Context, currency string) ([]TransactionInfo, error)

GetWalletHistory returns user wallet history transaction data

func (*Bitmex) GetWalletInfo

func (b *Bitmex) GetWalletInfo(ctx context.Context, currency string) (WalletInfo, error)

GetWalletInfo returns user wallet information

func (*Bitmex) GetWalletSummary

func (b *Bitmex) GetWalletSummary(ctx context.Context, currency string) ([]TransactionInfo, error)

GetWalletSummary returns user wallet summary

func (*Bitmex) GetWithdrawalsHistory

func (b *Bitmex) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)

GetWithdrawalsHistory returns previous withdrawals data

func (*Bitmex) IsolatePosition

func (b *Bitmex) IsolatePosition(ctx context.Context, params PositionIsolateMarginParams) (Position, error)

IsolatePosition enables isolated margin or cross margin per-position

func (*Bitmex) LeveragePosition

func (b *Bitmex) LeveragePosition(ctx context.Context, params PositionUpdateLeverageParams) (Position, error)

LeveragePosition chooses leverage for a position

func (*Bitmex) ModifyOrder

func (b *Bitmex) ModifyOrder(ctx context.Context, action *order.Modify) (order.Modify, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*Bitmex) RemoveAPIKey

func (b *Bitmex) RemoveAPIKey(ctx context.Context, params APIKeyParams) (bool, error)

RemoveAPIKey removes an Apikey from the bitmex trading engine

func (*Bitmex) Run

func (b *Bitmex) Run()

Run implements the Bitmex wrapper

func (*Bitmex) SendAuthenticatedHTTPRequest

func (b *Bitmex) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, verb, path string, params Parameter, result interface{}) error

SendAuthenticatedHTTPRequest sends an authenticated HTTP request to bitmex

func (*Bitmex) SendHTTPRequest

func (b *Bitmex) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, params Parameter, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP request

func (*Bitmex) SendTrollboxMessage

func (b *Bitmex) SendTrollboxMessage(ctx context.Context, params ChatSendParams) ([]Chat, error)

SendTrollboxMessage sends a message to the bitmex trollbox

func (*Bitmex) SetDefaults

func (b *Bitmex) SetDefaults()

SetDefaults sets the basic defaults for Bitmex

func (*Bitmex) Setup

func (b *Bitmex) Setup(exch *config.Exchange) error

Setup takes in the supplied exchange configuration details and sets params

func (*Bitmex) Start

func (b *Bitmex) Start(wg *sync.WaitGroup) error

Start starts the Bitmex go routine

func (*Bitmex) SubmitOrder

func (b *Bitmex) SubmitOrder(ctx context.Context, s *order.Submit) (order.SubmitResponse, error)

SubmitOrder submits a new order

func (*Bitmex) Subscribe

func (b *Bitmex) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error

Subscribe subscribes to a websocket channel

func (*Bitmex) TransferMargin

func (b *Bitmex) TransferMargin(ctx context.Context, params PositionTransferIsolatedMarginParams) (Position, error)

TransferMargin transfers equity in or out of a position

func (*Bitmex) Unsubscribe

func (b *Bitmex) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) error

Unsubscribe sends a websocket message to stop receiving data from the channel

func (*Bitmex) UpdateAccountInfo

func (b *Bitmex) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies for the Bitmex exchange

func (*Bitmex) UpdateOrderbook

func (b *Bitmex) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Bitmex) UpdateRiskLimit

func (b *Bitmex) UpdateRiskLimit(ctx context.Context, params PositionUpdateRiskLimitParams) (Position, error)

UpdateRiskLimit updates risk limit on a position

func (*Bitmex) UpdateTicker

func (b *Bitmex) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*Bitmex) UpdateTickers

func (b *Bitmex) UpdateTickers(ctx context.Context, a asset.Item) error

UpdateTickers updates the ticker for all currency pairs of a given asset type

func (*Bitmex) UpdateTradablePairs

func (b *Bitmex) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config

func (*Bitmex) UpdateUserInfo

func (b *Bitmex) UpdateUserInfo(ctx context.Context, params *UserUpdateParams) (User, error)

UpdateUserInfo updates user information

func (*Bitmex) UserLogOut

func (b *Bitmex) UserLogOut(ctx context.Context) error

UserLogOut logs you out of BitMEX

func (*Bitmex) UserLogOutAll

func (b *Bitmex) UserLogOutAll(ctx context.Context) (int64, error)

UserLogOutAll logs you out of all systems for BitMEX

func (*Bitmex) UserRequestWithdrawal

func (b *Bitmex) UserRequestWithdrawal(ctx context.Context, params UserRequestWithdrawalParams) (TransactionInfo, error)

UserRequestWithdrawal This will send a confirmation email to the email address on record, unless requested via an API Key with the withdraw permission.

func (*Bitmex) ValidateCredentials

func (b *Bitmex) ValidateCredentials(ctx context.Context, assetType asset.Item) error

ValidateCredentials validates current credentials used for wrapper functionality

func (*Bitmex) WithdrawCryptocurrencyFunds

func (b *Bitmex) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*Bitmex) WithdrawFiatFunds

func (b *Bitmex) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*Bitmex) WithdrawFiatFundsToInternationalBank

func (b *Bitmex) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*Bitmex) WsConnect

func (b *Bitmex) WsConnect() error

WsConnect initiates a new websocket connection

type Chat

type Chat struct {
	ChannelID float64 `json:"channelID"`
	Date      string  `json:"date"`
	FromBot   bool    `json:"fromBot"`
	HTML      string  `json:"html"`
	ID        int32   `json:"id"`
	Message   string  `json:"message"`
	User      string  `json:"user"`
}

Chat Trollbox Data

type ChatChannel

type ChatChannel struct {
	ID   int32  `json:"id"`
	Name string `json:"name"`
}

ChatChannel chat channel

type ChatGetParams

type ChatGetParams struct {
	// ChannelID - [Optional] Leave blank for all.
	ChannelID float64 `json:"channelID,omitempty"`

	// Count - [Optional] Number of results to fetch.
	Count int32 `json:"count,omitempty"`

	// Reverse - [Optional] If true, will sort results newest first.
	Reverse bool `json:"reverse,omitempty"`

	// Start - [Optional] Starting ID for results.
	Start int32 `json:"start,omitempty"`
}

ChatGetParams contains all the parameters to send to the API endpoint

func (*ChatGetParams) IsNil

func (p *ChatGetParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (*ChatGetParams) ToURLVals

func (p *ChatGetParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (*ChatGetParams) VerifyData

func (p *ChatGetParams) VerifyData() error

VerifyData verifies outgoing data sets

type ChatSendParams

type ChatSendParams struct {
	// ChannelID - Channel to post to. Default 1 (English).
	ChannelID float64 `json:"channelID,omitempty"`

	// Message to send
	Message string `json:"message,omitempty"`
}

ChatSendParams contains all the parameters to send to the API endpoint

func (*ChatSendParams) IsNil

func (p *ChatSendParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (ChatSendParams) ToURLVals

func (p ChatSendParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (ChatSendParams) VerifyData

func (p ChatSendParams) VerifyData() error

VerifyData verifies outgoing data sets

type ConfirmEmail

type ConfirmEmail struct {
	ID      string `json:"id"`
	TTL     int64  `json:"ttl"`
	Created string `json:"created"`
	UserID  int64  `json:"userId"`
}

ConfirmEmail confirmatin email endpoint data

type ConnectedUsers

type ConnectedUsers struct {
	Bots  int32 `json:"bots"`
	Users int32 `json:"users"`
}

ConnectedUsers connected users

type Execution

type Execution struct {
	Account               int64     `json:"account"`
	AvgPx                 float64   `json:"avgPx"`
	ClOrdID               string    `json:"clOrdID"`
	ClOrdLinkID           string    `json:"clOrdLinkID"`
	Commission            float64   `json:"commission"`
	ContingencyType       string    `json:"contingencyType"`
	CumQty                int64     `json:"cumQty"`
	Currency              string    `json:"currency"`
	DisplayQuantity       int64     `json:"displayQty"`
	ExDestination         string    `json:"exDestination"`
	ExecComm              int64     `json:"execComm"`
	ExecCost              int64     `json:"execCost"`
	ExecID                string    `json:"execID"`
	ExecInst              string    `json:"execInst"`
	ExecType              string    `json:"execType"`
	ForeignNotional       float64   `json:"foreignNotional"`
	HomeNotional          float64   `json:"homeNotional"`
	LastLiquidityInd      string    `json:"lastLiquidityInd"`
	LastMkt               string    `json:"lastMkt"`
	LastPx                float64   `json:"lastPx"`
	LastQty               int64     `json:"lastQty"`
	LeavesQty             int64     `json:"leavesQty"`
	MultiLegReportingType string    `json:"multiLegReportingType"`
	OrdRejReason          string    `json:"ordRejReason"`
	OrdStatus             string    `json:"ordStatus"`
	OrdType               string    `json:"ordType"`
	OrderID               string    `json:"orderID"`
	OrderQty              int64     `json:"orderQty"`
	PegOffsetValue        float64   `json:"pegOffsetValue"`
	PegPriceType          string    `json:"pegPriceType"`
	Price                 float64   `json:"price"`
	SettlCurrency         string    `json:"settlCurrency"`
	Side                  string    `json:"side"`
	SimpleCumQty          float64   `json:"simpleCumQty"`
	SimpleLeavesQty       float64   `json:"simpleLeavesQty"`
	SimpleOrderQty        float64   `json:"simpleOrderQty"`
	StopPx                float64   `json:"stopPx"`
	Symbol                string    `json:"symbol"`
	Text                  string    `json:"text"`
	TimeInForce           string    `json:"timeInForce"`
	Timestamp             time.Time `json:"timestamp"`
	TradePublishIndicator string    `json:"tradePublishIndicator"`
	TransactTime          string    `json:"transactTime"`
	TrdMatchID            string    `json:"trdMatchID"`
	Triggered             string    `json:"triggered"`
	UnderlyingLastPx      float64   `json:"underlyingLastPx"`
	WorkingIndicator      bool      `json:"workingIndicator"`
}

Execution Raw Order and Balance Data

type Funding

type Funding struct {
	FundingInterval  string    `json:"fundingInterval"`
	FundingRate      float64   `json:"fundingRate"`
	FundingRateDaily float64   `json:"fundingRateDaily"`
	Symbol           string    `json:"symbol"`
	Timestamp        time.Time `json:"timestamp"`
}

Funding Swap Funding History

type GenericRequestParams

type GenericRequestParams struct {
	// Columns - [Optional] 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.
	Columns string `json:"columns,omitempty"`

	// Count - Number of results to fetch.
	Count int32 `json:"count,omitempty"`

	// EndTime - Ending date filter for results.
	EndTime string `json:"endTime,omitempty"`

	// Filter - 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://testnet.bitmex.com/app/restAPI#Timestamp-Filters)
	// for more details.
	Filter string `json:"filter,omitempty"`

	// Reverse - If true, will sort results newest first.
	Reverse bool `json:"reverse,omitempty"`

	// Start - Starting point for results.
	Start int32 `json:"start,omitempty"`

	// StartTime - Starting date filter for results.
	StartTime string `json:"startTime,omitempty"`

	// Symbol - 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`.
	Symbol string `json:"symbol,omitempty"`
}

GenericRequestParams contains all the parameters for some general functions

func (*GenericRequestParams) IsNil

func (p *GenericRequestParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (*GenericRequestParams) ToURLVals

func (p *GenericRequestParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (*GenericRequestParams) VerifyData

func (p *GenericRequestParams) VerifyData() error

VerifyData verifies outgoing data sets

type IndexComposite

type IndexComposite struct {
	IndexSymbol string    `json:"indexSymbol"`
	LastPrice   float64   `json:"lastPrice"`
	Logged      string    `json:"logged"`
	Reference   string    `json:"reference"`
	Symbol      string    `json:"symbol"`
	Timestamp   time.Time `json:"timestamp"`
	Weight      float64   `json:"weight"`
}

IndexComposite index composite

type Instrument

type Instrument struct {
	AskPrice                       float64       `json:"askPrice"`
	BankruptLimitDownPrice         float64       `json:"bankruptLimitDownPrice"`
	BankruptLimitUpPrice           float64       `json:"bankruptLimitUpPrice"`
	BidPrice                       float64       `json:"bidPrice"`
	BuyLeg                         string        `json:"buyLeg"`
	CalcInterval                   string        `json:"calcInterval"`
	Capped                         bool          `json:"capped"`
	ClosingTimestamp               time.Time     `json:"closingTimestamp"`
	Deleverage                     bool          `json:"deleverage"`
	Expiry                         string        `json:"expiry"`
	FairBasis                      float64       `json:"fairBasis"`
	FairBasisRate                  float64       `json:"fairBasisRate"`
	FairMethod                     string        `json:"fairMethod"`
	FairPrice                      float64       `json:"fairPrice"`
	Front                          string        `json:"front"`
	FundingBaseSymbol              string        `json:"fundingBaseSymbol"`
	FundingInterval                string        `json:"fundingInterval"`
	FundingPremiumSymbol           string        `json:"fundingPremiumSymbol"`
	FundingQuoteSymbol             string        `json:"fundingQuoteSymbol"`
	FundingRate                    float64       `json:"fundingRate"`
	FundingTimestamp               time.Time     `json:"fundingTimestamp"`
	HasLiquidity                   bool          `json:"hasLiquidity"`
	HighPrice                      float64       `json:"highPrice"`
	ImpactAskPrice                 float64       `json:"impactAskPrice"`
	ImpactBidPrice                 float64       `json:"impactBidPrice"`
	ImpactMidPrice                 float64       `json:"impactMidPrice"`
	IndicativeFundingRate          float64       `json:"indicativeFundingRate"`
	IndicativeSettlePrice          float64       `json:"indicativeSettlePrice"`
	IndicativeTaxRate              float64       `json:"indicativeTaxRate"`
	InitMargin                     float64       `json:"initMargin"`
	InsuranceFee                   float64       `json:"insuranceFee"`
	InverseLeg                     string        `json:"inverseLeg"`
	IsInverse                      bool          `json:"isInverse"`
	IsQuanto                       bool          `json:"isQuanto"`
	LastChangePcnt                 float64       `json:"lastChangePcnt"`
	LastPrice                      float64       `json:"lastPrice"`
	LastPriceProtected             float64       `json:"lastPriceProtected"`
	LastTickDirection              string        `json:"lastTickDirection"`
	Limit                          float64       `json:"limit"`
	LimitDownPrice                 float64       `json:"limitDownPrice"`
	LimitUpPrice                   float64       `json:"limitUpPrice"`
	Listing                        string        `json:"listing"`
	LotSize                        int64         `json:"lotSize"`
	LowPrice                       float64       `json:"lowPrice"`
	MaintMargin                    float64       `json:"maintMargin"`
	MakerFee                       float64       `json:"makerFee"`
	MarkMethod                     string        `json:"markMethod"`
	MarkPrice                      float64       `json:"markPrice"`
	MaxOrderQty                    int64         `json:"maxOrderQty"`
	MaxPrice                       float64       `json:"maxPrice"`
	MidPrice                       float64       `json:"midPrice"`
	Multiplier                     int64         `json:"multiplier"`
	OpenInterest                   int64         `json:"openInterest"`
	OpenValue                      int64         `json:"openValue"`
	OpeningTimestamp               time.Time     `json:"openingTimestamp"`
	OptionMultiplier               float64       `json:"optionMultiplier"`
	OptionStrikePcnt               float64       `json:"optionStrikePcnt"`
	OptionStrikePrice              float64       `json:"optionStrikePrice"`
	OptionStrikeRound              float64       `json:"optionStrikeRound"`
	OptionUnderlyingPrice          float64       `json:"optionUnderlyingPrice"`
	PositionCurrency               string        `json:"positionCurrency"`
	PrevClosePrice                 float64       `json:"prevClosePrice"`
	PrevPrice24h                   float64       `json:"prevPrice24h"`
	PrevTotalTurnover              int64         `json:"prevTotalTurnover"`
	PrevTotalVolume                int64         `json:"prevTotalVolume"`
	PublishInterval                string        `json:"publishInterval"`
	PublishTime                    string        `json:"publishTime"`
	QuoteCurrency                  string        `json:"quoteCurrency"`
	QuoteToSettleMultiplier        int64         `json:"quoteToSettleMultiplier"`
	RebalanceInterval              string        `json:"rebalanceInterval"`
	RebalanceTimestamp             time.Time     `json:"rebalanceTimestamp"`
	Reference                      string        `json:"reference"`
	ReferenceSymbol                string        `json:"referenceSymbol"`
	RelistInterval                 string        `json:"relistInterval"`
	RiskLimit                      int64         `json:"riskLimit"`
	RiskStep                       int64         `json:"riskStep"`
	RootSymbol                     string        `json:"rootSymbol"`
	SellLeg                        string        `json:"sellLeg"`
	SessionInterval                string        `json:"sessionInterval"`
	SettlCurrency                  string        `json:"settlCurrency"`
	Settle                         string        `json:"settle"`
	SettledPrice                   float64       `json:"settledPrice"`
	SettlementFee                  float64       `json:"settlementFee"`
	State                          string        `json:"state"`
	Symbol                         currency.Pair `json:"symbol"`
	TakerFee                       float64       `json:"takerFee"`
	Taxed                          bool          `json:"taxed"`
	TickSize                       float64       `json:"tickSize"`
	Timestamp                      time.Time     `json:"timestamp"`
	TotalTurnover                  int64         `json:"totalTurnover"`
	TotalVolume                    int64         `json:"totalVolume"`
	Turnover                       int64         `json:"turnover"`
	Turnover24h                    int64         `json:"turnover24h"`
	Typ                            string        `json:"typ"`
	Underlying                     string        `json:"underlying"`
	UnderlyingSymbol               string        `json:"underlyingSymbol"`
	UnderlyingToPositionMultiplier int64         `json:"underlyingToPositionMultiplier"`
	UnderlyingToSettleMultiplier   int64         `json:"underlyingToSettleMultiplier"`
	Volume                         float64       `json:"volume"`
	Volume24h                      float64       `json:"volume24h"`
	Vwap                           float64       `json:"vwap"`
}

Instrument Tradeable Contracts, Indices, and History

type InstrumentInterval

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

InstrumentInterval instrument interval

type Insurance

type Insurance struct {
	Currency      string    `json:"currency"`
	Timestamp     time.Time `json:"timestamp"`
	WalletBalance int64     `json:"walletBalance"`
}

Insurance Insurance Fund Data

type Leaderboard

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

Leaderboard Information on Top Users

type LeaderboardGetParams

type LeaderboardGetParams struct {
	// MethodRanking - [Optional] type. Options: "notional", "ROE"
	Method string `json:"method,omitempty"`
}

LeaderboardGetParams contains all the parameters to send to the API endpoint

func (LeaderboardGetParams) IsNil

func (p LeaderboardGetParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (LeaderboardGetParams) ToURLVals

func (p LeaderboardGetParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (LeaderboardGetParams) VerifyData

func (p LeaderboardGetParams) VerifyData() error

VerifyData verifies outgoing data sets

type Liquidation

type Liquidation struct {
	LeavesQty int64   `json:"leavesQty"`
	OrderID   string  `json:"orderID"`
	Price     float64 `json:"price"`
	Side      string  `json:"side"`
	Symbol    string  `json:"symbol"`
}

Liquidation Active Liquidations

type MinWithdrawalFee

type MinWithdrawalFee struct {
	Currency string `json:"currency"`
	Fee      int64  `json:"fee"`
	MinFee   int64  `json:"minFee"`
}

MinWithdrawalFee minimum withdrawal fee information

type Notification

type Notification struct {
	Body              string `json:"body"`
	Closable          bool   `json:"closable"`
	Date              string `json:"date"`
	ID                int32  `json:"id"`
	Persist           bool   `json:"persist"`
	Sound             string `json:"sound"`
	Title             string `json:"title"`
	TTL               int32  `json:"ttl"`
	Type              string `json:"type"`
	WaitForVisibility bool   `json:"waitForVisibility"`
}

Notification Account Notifications

type Order

type Order struct {
	Account               int64     `json:"account"`
	AvgPx                 float64   `json:"avgPx"`
	ClOrdID               string    `json:"clOrdID"`
	ClOrdLinkID           string    `json:"clOrdLinkID"`
	ContingencyType       string    `json:"contingencyType"`
	CumQty                float64   `json:"cumQty"`
	Currency              string    `json:"currency"`
	DisplayQuantity       int64     `json:"displayQty"`
	ExDestination         string    `json:"exDestination"`
	ExecInst              string    `json:"execInst"`
	LeavesQty             float64   `json:"leavesQty"`
	MultiLegReportingType string    `json:"multiLegReportingType"`
	OrdRejReason          string    `json:"ordRejReason"`
	OrdStatus             string    `json:"ordStatus"`
	OrdType               int64     `json:"ordType,string"`
	OrderID               string    `json:"orderID"`
	OrderQty              float64   `json:"orderQty"`
	PegOffsetValue        float64   `json:"pegOffsetValue"`
	PegPriceType          string    `json:"pegPriceType"`
	Price                 float64   `json:"price"`
	SettlCurrency         string    `json:"settlCurrency"`
	Side                  int64     `json:"side,string"`
	SimpleCumQty          float64   `json:"simpleCumQty"`
	SimpleLeavesQty       float64   `json:"simpleLeavesQty"`
	SimpleOrderQty        float64   `json:"simpleOrderQty"`
	StopPx                float64   `json:"stopPx"`
	Symbol                string    `json:"symbol"`
	Text                  string    `json:"text"`
	TimeInForce           string    `json:"timeInForce"`
	Timestamp             time.Time `json:"timestamp"`
	TransactTime          time.Time `json:"transactTime"`
	Triggered             string    `json:"triggered"`
	WorkingIndicator      bool      `json:"workingIndicator"`
}

Order Placement, Cancellation, Amending, and History

type OrderAmendBulkParams

type OrderAmendBulkParams struct {
	// Orders - An array of orders.
	Orders []OrderAmendParams `json:"orders,omitempty"`
}

OrderAmendBulkParams contains all the parameters to send to the API endpoint

func (OrderAmendBulkParams) IsNil

func (p OrderAmendBulkParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (OrderAmendBulkParams) ToURLVals

func (p OrderAmendBulkParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (OrderAmendBulkParams) VerifyData

func (p OrderAmendBulkParams) VerifyData() error

VerifyData verifies outgoing data sets

type OrderAmendParams

type OrderAmendParams struct {
	// ClientOrderID - [Optional] new Client Order ID, requires `origClOrdID`.
	ClientOrderID string `json:"clOrdID,omitempty"`

	// LeavesQuantity - [Optional] leaves quantity in units of the instrument
	// (i.e. contracts). Useful for amending partially filled orders.
	LeavesQuantity int32 `json:"leavesQty,omitempty"`

	OrderID string `json:"orderID,omitempty"`

	// OrderQuantity - [Optional] order quantity in units of the instrument
	// (i.e. contracts).
	OrderQty int32 `json:"orderQty,omitempty"`

	// OrigClOrdID - Client Order ID. See POST /order.
	OrigClOrdID string `json:"origClOrdID,omitempty"`

	// PegOffsetValue - [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.
	PegOffsetValue float64 `json:"pegOffsetValue,omitempty"`

	// Price - [Optional] limit price for 'Limit', 'StopLimit', and
	// 'LimitIfTouched' orders.
	Price float64 `json:"price,omitempty"`

	// SimpleLeavesQuantity - [Optional] leaves quantity in units of the underlying
	// instrument (i.e. Bitcoin). Useful for amending partially filled orders.
	SimpleLeavesQuantity float64 `json:"simpleLeavesQty,omitempty"`

	// SimpleOrderQuantity - [Optional] order quantity in units of the underlying
	// instrument (i.e. Bitcoin).
	SimpleOrderQuantity float64 `json:"simpleOrderQty,omitempty"`

	// StopPrice - [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.
	StopPx float64 `json:"stopPx,omitempty"`

	// Text - [Optional] amend annotation. e.g. 'Adjust skew'.
	Text string `json:"text,omitempty"`
}

OrderAmendParams contains all the parameters to send to the API endpoint for the order amend operation

func (*OrderAmendParams) IsNil

func (p *OrderAmendParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (*OrderAmendParams) ToURLVals

func (p *OrderAmendParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (*OrderAmendParams) VerifyData

func (p *OrderAmendParams) VerifyData() error

VerifyData verifies outgoing data sets

type OrderBookData

type OrderBookData struct {
	Data   []OrderBookL2 `json:"data"`
	Action string        `json:"action"`
}

OrderBookData contains orderbook resp data with action to be taken

type OrderBookGetL2Params

type OrderBookGetL2Params struct {
	// Depth - Orderbook depth per side. Send 0 for full depth.
	Depth int32 `json:"depth,omitempty"`

	// Symbol -Instrument symbol. Send a series (e.g. XBT) to get data for the
	// nearest contract in that series.
	Symbol string `json:"symbol,omitempty"`
}

OrderBookGetL2Params contains all the parameters to send to the API endpoint

func (OrderBookGetL2Params) IsNil

func (p OrderBookGetL2Params) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (OrderBookGetL2Params) ToURLVals

func (p OrderBookGetL2Params) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (OrderBookGetL2Params) VerifyData

func (p OrderBookGetL2Params) VerifyData() error

VerifyData verifies outgoing data sets

type OrderBookL2

type OrderBookL2 struct {
	ID     int64   `json:"id"`
	Price  float64 `json:"price"`
	Side   string  `json:"side"`
	Size   int64   `json:"size"`
	Symbol string  `json:"symbol"`
}

OrderBookL2 contains order book l2

type OrderCancelAllAfterParams

type OrderCancelAllAfterParams struct {
	// Timeout in ms. Set to 0 to cancel this timer.
	Timeout float64 `json:"timeout,omitempty"`
}

OrderCancelAllAfterParams contains all the parameters to send to the API endpoint

func (OrderCancelAllAfterParams) IsNil

func (p OrderCancelAllAfterParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (OrderCancelAllAfterParams) ToURLVals

func (p OrderCancelAllAfterParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (OrderCancelAllAfterParams) VerifyData

func (p OrderCancelAllAfterParams) VerifyData() error

VerifyData verifies outgoing data sets

type OrderCancelAllParams

type OrderCancelAllParams struct {
	// Filter - [Optional] filter for cancellation. Use to only cancel some
	// orders, e.g. `{"side": "Buy"}`.
	Filter string `json:"filter,omitempty"`

	// Symbol - [Optional] symbol. If provided, only cancels orders for that
	// symbol.
	Symbol string `json:"symbol,omitempty"`

	// Text - [Optional] cancellation annotation. e.g. 'Spread Exceeded'
	Text string `json:"text,omitempty"`
}

OrderCancelAllParams contains all the parameters to send to the API endpoint for cancelling all your orders

func (OrderCancelAllParams) IsNil

func (p OrderCancelAllParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (OrderCancelAllParams) ToURLVals

func (p OrderCancelAllParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (OrderCancelAllParams) VerifyData

func (p OrderCancelAllParams) VerifyData() error

VerifyData verifies outgoing data sets

type OrderCancelParams

type OrderCancelParams struct {
	// ClientOrderID - Client Order ID(s). See POST /order.
	ClientOrderID string `json:"clOrdID,omitempty"`

	// OrderID - Order ID(s).
	OrderID string `json:"orderID,omitempty"`

	// Text - [Optional] cancellation annotation. e.g. 'Spread Exceeded'.
	Text string `json:"text,omitempty"`
}

OrderCancelParams contains all the parameters to send to the API endpoint

func (OrderCancelParams) IsNil

func (p OrderCancelParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (OrderCancelParams) ToURLVals

func (p OrderCancelParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (OrderCancelParams) VerifyData

func (p OrderCancelParams) VerifyData() error

VerifyData verifies outgoing data sets

type OrderClosePositionParams

type OrderClosePositionParams struct {
	// Price - [Optional] limit price.
	Price float64 `json:"price,omitempty"`

	// Symbol of position to close.
	Symbol string `json:"symbol,omitempty"`
}

OrderClosePositionParams contains all the parameters to send to the API endpoint

func (OrderClosePositionParams) IsNil

func (p OrderClosePositionParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (OrderClosePositionParams) ToURLVals

func (p OrderClosePositionParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (OrderClosePositionParams) VerifyData

func (p OrderClosePositionParams) VerifyData() error

VerifyData verifies outgoing data sets

type OrderInsertData

type OrderInsertData struct {
	WorkingIndicator      bool      `json:"workingIndicator"`
	Account               int64     `json:"account"`
	AveragePrice          float64   `json:"avgPx"`
	Commission            float64   `json:"commission"`
	FilledQuantity        float64   `json:"cumQty"`
	DisplayQuantity       float64   `json:"displayQty"`
	ExecComm              float64   `json:"execComm"`
	ExecCost              float64   `json:"execCost"`
	ForeignNotional       float64   `json:"foreignNotional"`
	HomeNotional          float64   `json:"homeNotional"`
	LastPrice             float64   `json:"lastPx"`
	LastQuantity          float64   `json:"lastQty"`
	LeavesQuantity        float64   `json:"leavesQty"`
	OrderQuantity         float64   `json:"orderQty"`
	PegOffsetValue        float64   `json:"pegOffsetValue"`
	Price                 float64   `json:"price"`
	SimpleFilledQuantity  float64   `json:"simpleCumQty"`
	SimpleLeavesQuantity  float64   `json:"simpleLeavesQty"`
	SimpleOrderQuantity   float64   `json:"simpleOrderQty"`
	StopPrice             float64   `json:"stopPx"`
	ExDestination         string    `json:"exDestination"`
	ContingencyType       string    `json:"contingencyType"`
	Currency              string    `json:"currency"`
	ExecutionID           string    `json:"execID"`
	ExecutionInstance     string    `json:"execInst"`
	ExecutionType         string    `json:"execType"`
	LastLiquidityInd      string    `json:"lastLiquidityInd"`
	LastMkt               string    `json:"lastMkt"`
	UnderlyingLastPrice   float64   `json:"underlyingLastPx"`
	MultiLegReportingType string    `json:"multiLegReportingType"`
	OrderRejectedReason   string    `json:"ordRejReason"`
	OrderStatus           string    `json:"ordStatus"`
	OrderType             string    `json:"ordType"`
	OrderID               string    `json:"orderID"`
	PegPriceType          string    `json:"pegPriceType"`
	ClientOrderID         string    `json:"clOrdID"`
	ClientOrderLinkID     string    `json:"clOrdLinkID"`
	Symbol                string    `json:"symbol"`
	Text                  string    `json:"text"`
	TimeInForce           string    `json:"timeInForce"`
	Timestamp             time.Time `json:"timestamp"`
	TradePublishIndicator string    `json:"tradePublishIndicator"`
	TransactTime          time.Time `json:"transactTime"`
	TradingMatchID        string    `json:"trdMatchID"`
	Triggered             string    `json:"triggered"`
	SettleCurrency        string    `json:"settlCurrency"`
	Side                  string    `json:"side"`
}

OrderInsertData holds order data from an order response

type OrderNewBulkParams

type OrderNewBulkParams struct {
	// Orders - An array of orders.
	Orders []OrderNewParams `json:"orders,omitempty"`
}

OrderNewBulkParams contains all the parameters to send to the API endpoint

func (OrderNewBulkParams) IsNil

func (p OrderNewBulkParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (OrderNewBulkParams) ToURLVals

func (p OrderNewBulkParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (OrderNewBulkParams) VerifyData

func (p OrderNewBulkParams) VerifyData() error

VerifyData verifies outgoing data sets

type OrderNewParams

type OrderNewParams struct {
	// ClientOrderID - [Optional] Client Order ID. This clOrdID will come back on the
	// order and any related executions.
	ClientOrderID string `json:"clOrdID,omitempty"`

	// ClientOrderLinkID - [Optional] Client Order Link ID for contingent orders.
	ClientOrderLinkID string `json:"clOrdLinkID,omitempty"`

	// ContingencyType - [Optional] contingency type for use with `clOrdLinkID`.
	// Valid options: OneCancelsTheOther, OneTriggersTheOther,
	// OneUpdatesTheOtherAbsolute, OneUpdatesTheOtherProportional.
	ContingencyType string `json:"contingencyType,omitempty"`

	// DisplayQuantity- [Optional] quantity to display in the book. Use 0 for a fully
	// hidden order.
	DisplayQuantity float64 `json:"displayQty,omitempty"`

	// ExecutionInstance - [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.
	ExecInst string `json:"execInst,omitempty"`

	// OrderType - 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.
	OrderType string `json:"ordType,omitempty"`

	// OrderQuantity Order quantity in units of the instrument (i.e. contracts).
	OrderQuantity float64 `json:"orderQty,omitempty"`

	// PegOffsetValue - [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.
	PegOffsetValue float64 `json:"pegOffsetValue,omitempty"`

	// PegPriceType - [Optional] peg price type. Valid options: LastPeg,
	// MidPricePeg, MarketPeg, PrimaryPeg, TrailingStopPeg.
	PegPriceType string `json:"pegPriceType,omitempty"`

	// Price - [Optional] limit price for 'Limit', 'StopLimit', and
	// 'LimitIfTouched' orders.
	Price float64 `json:"price,omitempty"`

	// Side - Order side. Valid options: Buy, Sell. Defaults to 'Buy' unless
	// `orderQty` or `simpleOrderQty` is negative.
	Side string `json:"side,omitempty"`

	// SimpleOrderQuantity - Order quantity in units of the underlying instrument
	// (i.e. Bitcoin).
	SimpleOrderQuantity float64 `json:"simpleOrderQty,omitempty"`

	// StopPrice - [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.
	StopPx float64 `json:"stopPx,omitempty"`

	// Symbol - Instrument symbol. e.g. 'XBTUSD'.
	Symbol string `json:"symbol,omitempty"`

	// Text - [Optional] order annotation. e.g. 'Take profit'.
	Text string `json:"text,omitempty"`

	// TimeInForce - Valid options: Day, GoodTillCancel, ImmediateOrCancel,
	// FillOrKill. Defaults to 'GoodTillCancel' for 'Limit', 'StopLimit',
	// 'LimitIfTouched', and 'MarketWithLeftOverAsLimit' orders.
	TimeInForce string `json:"timeInForce,omitempty"`
}

OrderNewParams contains all the parameters to send to the API endpoint

func (*OrderNewParams) IsNil

func (p *OrderNewParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (*OrderNewParams) ToURLVals

func (p *OrderNewParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (*OrderNewParams) VerifyData

func (p *OrderNewParams) VerifyData() error

VerifyData verifies outgoing data sets

type OrdersRequest

type OrdersRequest struct {
	Symbol    string  `json:"symbol,omitempty"`
	Filter    string  `json:"filter,omitempty"`
	Columns   string  `json:"columns,omitempty"`
	Count     float64 `json:"count,omitempty"`
	Start     float64 `json:"start,omitempty"`
	Reverse   bool    `json:"reverse,omitempty"`
	StartTime string  `json:"startTime,omitempty"`
	EndTime   string  `json:"endTime,omitempty"`
}

OrdersRequest used for GetOrderHistory

func (*OrdersRequest) IsNil

func (p *OrdersRequest) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (*OrdersRequest) ToURLVals

func (p *OrdersRequest) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (*OrdersRequest) VerifyData

func (p *OrdersRequest) VerifyData() error

VerifyData verifies parameter data during SendAuthenticatedHTTPRequest

type Parameter

type Parameter interface {
	VerifyData() error
	ToURLVals(path string) (string, error)
	IsNil() bool
}

Parameter just enforces a check on all outgoing data

type Position

type Position struct {
	Account              int64     `json:"account"`
	AvgCostPrice         float64   `json:"avgCostPrice"`
	AvgEntryPrice        float64   `json:"avgEntryPrice"`
	BankruptPrice        float64   `json:"bankruptPrice"`
	BreakEvenPrice       float64   `json:"breakEvenPrice"`
	Commission           float64   `json:"commission"`
	CrossMargin          bool      `json:"crossMargin"`
	Currency             string    `json:"currency"`
	CurrentComm          int64     `json:"currentComm"`
	CurrentCost          int64     `json:"currentCost"`
	CurrentQty           int64     `json:"currentQty"`
	CurrentTimestamp     time.Time `json:"currentTimestamp"`
	DeleveragePercentile float64   `json:"deleveragePercentile"`
	ExecBuyCost          int64     `json:"execBuyCost"`
	ExecBuyQty           int64     `json:"execBuyQty"`
	ExecComm             int64     `json:"execComm"`
	ExecCost             int64     `json:"execCost"`
	ExecQty              int64     `json:"execQty"`
	ExecSellCost         int64     `json:"execSellCost"`
	ExecSellQty          int64     `json:"execSellQty"`
	ForeignNotional      float64   `json:"foreignNotional"`
	GrossExecCost        int64     `json:"grossExecCost"`
	GrossOpenCost        int64     `json:"grossOpenCost"`
	GrossOpenPremium     int64     `json:"grossOpenPremium"`
	HomeNotional         float64   `json:"homeNotional"`
	IndicativeTax        int64     `json:"indicativeTax"`
	IndicativeTaxRate    float64   `json:"indicativeTaxRate"`
	InitMargin           int64     `json:"initMargin"`
	InitMarginReq        float64   `json:"initMarginReq"`
	IsOpen               bool      `json:"isOpen"`
	LastPrice            float64   `json:"lastPrice"`
	LastValue            int64     `json:"lastValue"`
	Leverage             float64   `json:"leverage"`
	LiquidationPrice     float64   `json:"liquidationPrice"`
	LongBankrupt         int64     `json:"longBankrupt"`
	MaintMargin          int64     `json:"maintMargin"`
	MaintMarginReq       float64   `json:"maintMarginReq"`
	MarginCallPrice      float64   `json:"marginCallPrice"`
	MarkPrice            float64   `json:"markPrice"`
	MarkValue            int64     `json:"markValue"`
	OpenOrderBuyCost     int64     `json:"openOrderBuyCost"`
	OpenOrderBuyPremium  int64     `json:"openOrderBuyPremium"`
	OpenOrderBuyQty      int64     `json:"openOrderBuyQty"`
	OpenOrderSellCost    int64     `json:"openOrderSellCost"`
	OpenOrderSellPremium int64     `json:"openOrderSellPremium"`
	OpenOrderSellQty     int64     `json:"openOrderSellQty"`
	OpeningComm          int64     `json:"openingComm"`
	OpeningCost          int64     `json:"openingCost"`
	OpeningQty           int64     `json:"openingQty"`
	OpeningTimestamp     time.Time `json:"openingTimestamp"`
	PosAllowance         int64     `json:"posAllowance"`
	PosComm              int64     `json:"posComm"`
	PosCost              int64     `json:"posCost"`
	PosCost2             int64     `json:"posCost2"`
	PosCross             int64     `json:"posCross"`
	PosInit              int64     `json:"posInit"`
	PosLoss              int64     `json:"posLoss"`
	PosMaint             int64     `json:"posMaint"`
	PosMargin            int64     `json:"posMargin"`
	PosState             string    `json:"posState"`
	PrevClosePrice       float64   `json:"prevClosePrice"`
	PrevRealisedPnl      int64     `json:"prevRealisedPnl"`
	PrevUnrealisedPnl    int64     `json:"prevUnrealisedPnl"`
	QuoteCurrency        string    `json:"quoteCurrency"`
	RealisedCost         int64     `json:"realisedCost"`
	RealisedGrossPnl     int64     `json:"realisedGrossPnl"`
	RealisedPnl          int64     `json:"realisedPnl"`
	RealisedTax          int64     `json:"realisedTax"`
	RebalancedPnl        int64     `json:"rebalancedPnl"`
	RiskLimit            int64     `json:"riskLimit"`
	RiskValue            int64     `json:"riskValue"`
	SessionMargin        int64     `json:"sessionMargin"`
	ShortBankrupt        int64     `json:"shortBankrupt"`
	SimpleCost           float64   `json:"simpleCost"`
	SimplePnl            float64   `json:"simplePnl"`
	SimplePnlPcnt        float64   `json:"simplePnlPcnt"`
	SimpleQty            float64   `json:"simpleQty"`
	SimpleValue          float64   `json:"simpleValue"`
	Symbol               string    `json:"symbol"`
	TargetExcessMargin   int64     `json:"targetExcessMargin"`
	TaxBase              int64     `json:"taxBase"`
	TaxableMargin        int64     `json:"taxableMargin"`
	Timestamp            time.Time `json:"timestamp"`
	Underlying           string    `json:"underlying"`
	UnrealisedCost       int64     `json:"unrealisedCost"`
	UnrealisedGrossPnl   int64     `json:"unrealisedGrossPnl"`
	UnrealisedPnl        int64     `json:"unrealisedPnl"`
	UnrealisedPnlPcnt    float64   `json:"unrealisedPnlPcnt"`
	UnrealisedRoePcnt    float64   `json:"unrealisedRoePcnt"`
	UnrealisedTax        int64     `json:"unrealisedTax"`
	VarMargin            int64     `json:"varMargin"`
}

Position Summary of Open and Closed Positions

type PositionGetParams

type PositionGetParams struct {

	// Columns - Which columns to fetch. For example, send ["columnName"].
	Columns string `json:"columns,omitempty"`

	// Count - Number of rows to fetch.
	Count int32 `json:"count,omitempty"`

	// Filter - Table filter. For example, send {"symbol": "XBTUSD"}.
	Filter string `json:"filter,omitempty"`
}

PositionGetParams contains all the parameters to send to the API endpoint

func (PositionGetParams) IsNil

func (p PositionGetParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (PositionGetParams) ToURLVals

func (p PositionGetParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (PositionGetParams) VerifyData

func (p PositionGetParams) VerifyData() error

VerifyData verifies outgoing data sets

type PositionIsolateMarginParams

type PositionIsolateMarginParams struct {
	// Enabled - True for isolated margin, false for cross margin.
	Enabled bool `json:"enabled,omitempty"`

	// Symbol - Position symbol to isolate.
	Symbol string `json:"symbol,omitempty"`
}

PositionIsolateMarginParams contains all the parameters to send to the API endpoint

func (PositionIsolateMarginParams) IsNil

IsNil checks to see if any values has been set for the paramater

func (PositionIsolateMarginParams) ToURLVals

func (p PositionIsolateMarginParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (PositionIsolateMarginParams) VerifyData

func (p PositionIsolateMarginParams) VerifyData() error

VerifyData verifies outgoing data sets

type PositionTransferIsolatedMarginParams

type PositionTransferIsolatedMarginParams struct {
	// Amount - Amount to transfer, in Satoshis. May be negative.
	Amount int64 `json:"amount,omitempty"`

	// Symbol - Symbol of position to isolate.
	Symbol string `json:"symbol,omitempty"`
}

PositionTransferIsolatedMarginParams contains all the parameters to send to the API endpoint

func (PositionTransferIsolatedMarginParams) IsNil

IsNil checks to see if any values has been set for the paramater

func (PositionTransferIsolatedMarginParams) ToURLVals

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (PositionTransferIsolatedMarginParams) VerifyData

VerifyData verifies outgoing data sets

type PositionUpdateLeverageParams

type PositionUpdateLeverageParams struct {
	// 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.
	Leverage float64 `json:"leverage,omitempty"`

	// Symbol - Symbol of position to adjust.
	Symbol string `json:"symbol,omitempty"`
}

PositionUpdateLeverageParams contains all the parameters to send to the API endpoint

func (PositionUpdateLeverageParams) IsNil

IsNil checks to see if any values has been set for the paramater

func (PositionUpdateLeverageParams) ToURLVals

func (p PositionUpdateLeverageParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (PositionUpdateLeverageParams) VerifyData

func (p PositionUpdateLeverageParams) VerifyData() error

VerifyData verifies outgoing data sets

type PositionUpdateRiskLimitParams

type PositionUpdateRiskLimitParams struct {
	// RiskLimit - New Risk Limit, in Satoshis.
	RiskLimit int64 `json:"riskLimit,omitempty"`

	// Symbol - Symbol of position to update risk limit on.
	Symbol string `json:"symbol,omitempty"`
}

PositionUpdateRiskLimitParams contains all the parameters to send to the API endpoint

func (PositionUpdateRiskLimitParams) IsNil

IsNil checks to see if any values has been set for the paramater

func (PositionUpdateRiskLimitParams) ToURLVals

func (p PositionUpdateRiskLimitParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (PositionUpdateRiskLimitParams) VerifyData

func (p PositionUpdateRiskLimitParams) VerifyData() error

VerifyData verifies outgoing data sets

type Quote

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

Quote Best Bid/Offer Snapshots & Historical Bins

type QuoteGetBucketedParams

type QuoteGetBucketedParams struct {
	// BinSize - Time interval to bucket by. Available options: [1m,5m,1h,1d].
	BinSize string `json:"binSize,omitempty"`

	// Columns - 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.
	Columns string `json:"columns,omitempty"`

	// Count - Number of results to fetch.
	Count int32 `json:"count,omitempty"`

	// EndTime - Ending date filter for results.
	EndTime string `json:"endTime,omitempty"`

	// Filter - 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://testnet.bitmex.com/app/restAPI#Timestamp-Filters)
	// for more details.
	Filter string `json:"filter,omitempty"`

	// Partial - If true, will send in-progress (incomplete) bins for the current
	// time period.
	Partial bool `json:"partial,omitempty"`

	// Reverse - If true, will sort results newest first.
	Reverse bool `json:"reverse,omitempty"`

	// Start - Starting point for results.
	Start int32 `json:"start,omitempty"`

	// StartTime - Starting date filter for results.
	StartTime string `json:"startTime,omitempty"`

	// Symbol - 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`.
	Symbol string `json:"symbol,omitempty"`
}

QuoteGetBucketedParams contains all the parameters to send to the API endpoint

func (*QuoteGetBucketedParams) IsNil

func (p *QuoteGetBucketedParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (*QuoteGetBucketedParams) ToURLVals

func (p *QuoteGetBucketedParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (*QuoteGetBucketedParams) VerifyData

func (p *QuoteGetBucketedParams) VerifyData() error

VerifyData verifies outgoing data sets

type RateLimit

type RateLimit struct {
	Auth   *rate.Limiter
	UnAuth *rate.Limiter
}

RateLimit implements the request.Limiter interface

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns the rate limit for the exchange

func (*RateLimit) Limit

Limit limits outbound calls

type RequestError

type RequestError struct {
	Error struct {
		Message string `json:"message"`
		Name    string `json:"name"`
	} `json:"error"`
}

RequestError allows for a general error capture from requests

type Settlement

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

Settlement Historical Settlement Data

type Stats

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

Stats Exchange Statistics

type StatsHistory

type StatsHistory struct {
	Currency   string `json:"currency"`
	Date       string `json:"date"`
	RootSymbol string `json:"rootSymbol"`
	Turnover   int64  `json:"turnover"`
	Volume     int64  `json:"volume"`
}

StatsHistory stats history

type StatsUSD

type StatsUSD struct {
	Currency     string `json:"currency"`
	RootSymbol   string `json:"rootSymbol"`
	Turnover     int64  `json:"turnover"`
	Turnover24h  int64  `json:"turnover24h"`
	Turnover30d  int64  `json:"turnover30d"`
	Turnover365d int64  `json:"turnover365d"`
}

StatsUSD contains summary of exchange stats

type Trade

type Trade struct {
	ForeignNotional float64   `json:"foreignNotional"`
	GrossValue      int64     `json:"grossValue"`
	HomeNotional    float64   `json:"homeNotional"`
	Price           float64   `json:"price"`
	Side            string    `json:"side"`
	Size            int64     `json:"size"`
	Symbol          string    `json:"symbol"`
	TickDirection   string    `json:"tickDirection"`
	Timestamp       time.Time `json:"timestamp"`
	TrdMatchID      string    `json:"trdMatchID"`
}

Trade Individual & Bucketed Trades

type TradeData

type TradeData struct {
	Data   []Trade `json:"data"`
	Action string  `json:"action"`
}

TradeData contains trade resp data with action to be taken

type TradeGetBucketedParams

type TradeGetBucketedParams struct {
	// BinSize - Time interval to bucket by. Available options: [1m,5m,1h,1d].
	BinSize string `json:"binSize,omitempty"`

	// Columns - 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.
	Columns string `json:"columns,omitempty"`

	// Count - Number of results to fetch.
	Count int32 `json:"count,omitempty"`

	// EndTime - Ending date filter for results.
	EndTime string `json:"endTime,omitempty"`

	// Filter - 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://testnet.bitmex.com/app/restAPI#Timestamp-Filters)
	// for more details.
	Filter string `json:"filter,omitempty"`

	// Partial - If true, will send in-progress (incomplete) bins for the current
	// time period.
	Partial bool `json:"partial,omitempty"`

	// Reverse - If true, will sort results newest first.
	Reverse bool `json:"reverse,omitempty"`

	// Start - Starting point for results.
	Start int32 `json:"start,omitempty"`

	// StartTime - Starting date filter for results.
	StartTime string `json:"startTime,omitempty"`

	// Symbol - 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`.
	Symbol string `json:"symbol,omitempty"`
}

TradeGetBucketedParams contains all the parameters to send to the API endpoint

func (*TradeGetBucketedParams) IsNil

func (p *TradeGetBucketedParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (*TradeGetBucketedParams) ToURLVals

func (p *TradeGetBucketedParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (*TradeGetBucketedParams) VerifyData

func (p *TradeGetBucketedParams) VerifyData() error

VerifyData verifies outgoing data sets

type TransactionInfo

type TransactionInfo struct {
	Account        int64     `json:"account"`
	Address        string    `json:"address"`
	Amount         int64     `json:"amount"`
	Currency       string    `json:"currency"`
	Fee            int64     `json:"fee"`
	Text           string    `json:"text"`
	Timestamp      time.Time `json:"timestamp"`
	TransactID     string    `json:"transactID"`
	TransactStatus string    `json:"transactStatus"`
	TransactTime   string    `json:"transactTime"`
	TransactType   string    `json:"transactType"`
	Tx             string    `json:"tx"`
}

TransactionInfo Information

type User

type User struct {
	TFAEnabled   string          `json:"TFAEnabled"`
	AffiliateID  string          `json:"affiliateID"`
	Country      string          `json:"country"`
	Created      string          `json:"created"`
	Email        string          `json:"email"`
	Firstname    string          `json:"firstname"`
	GeoipCountry string          `json:"geoipCountry"`
	GeoipRegion  string          `json:"geoipRegion"`
	ID           int32           `json:"id"`
	LastUpdated  string          `json:"lastUpdated"`
	Lastname     string          `json:"lastname"`
	OwnerID      int32           `json:"ownerId"`
	PgpPubKey    string          `json:"pgpPubKey"`
	Phone        string          `json:"phone"`
	Preferences  UserPreferences `json:"preferences"`
	Typ          string          `json:"typ"`
	Username     string          `json:"username"`
}

User Account Operations

type UserCheckReferralCodeParams

type UserCheckReferralCodeParams struct {
	ReferralCode string `json:"referralCode,omitempty"`
}

UserCheckReferralCodeParams contains all the parameters to send to the API endpoint

func (UserCheckReferralCodeParams) IsNil

IsNil checks to see if any values has been set for the paramater

func (UserCheckReferralCodeParams) ToURLVals

func (p UserCheckReferralCodeParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (UserCheckReferralCodeParams) VerifyData

func (p UserCheckReferralCodeParams) VerifyData() error

VerifyData verifies outgoing data sets

type UserCommission

type UserCommission struct {
	MakerFee      float64 `json:"makerFee"`
	MaxFee        float64 `json:"maxFee"`
	SettlementFee float64 `json:"settlementFee"`
	TakerFee      float64 `json:"takerFee"`
}

UserCommission user commission

type UserConfirmTFAParams

type UserConfirmTFAParams struct {
	// Token - Token from your selected TFA type.
	Token string `json:"token,omitempty"`

	// Type - Two-factor auth type. Supported types: 'GA' (Google Authenticator),
	// 'Yubikey'
	Type string `json:"type,omitempty"`
}

UserConfirmTFAParams contains all the parameters to send to the API endpoint

func (UserConfirmTFAParams) IsNil

func (p UserConfirmTFAParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (UserConfirmTFAParams) ToURLVals

func (p UserConfirmTFAParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (UserConfirmTFAParams) VerifyData

func (p UserConfirmTFAParams) VerifyData() error

VerifyData verifies outgoing data sets

type UserCurrencyParams

type UserCurrencyParams struct {
	Currency string `json:"currency,omitempty"`
}

UserCurrencyParams contains all the parameters to send to the API endpoint

func (UserCurrencyParams) IsNil

func (p UserCurrencyParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (UserCurrencyParams) ToURLVals

func (p UserCurrencyParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (UserCurrencyParams) VerifyData

func (p UserCurrencyParams) VerifyData() error

VerifyData verifies outgoing data sets

type UserMargin

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

UserMargin margin information

type UserPreferences

type UserPreferences struct {
	AlertOnLiquidations     bool        `json:"alertOnLiquidations"`
	AnimationsEnabled       bool        `json:"animationsEnabled"`
	AnnouncementsLastSeen   string      `json:"announcementsLastSeen"`
	ChatChannelID           float64     `json:"chatChannelID"`
	ColorTheme              string      `json:"colorTheme"`
	Currency                string      `json:"currency"`
	Debug                   bool        `json:"debug"`
	DisableEmails           []string    `json:"disableEmails"`
	HideConfirmDialogs      []string    `json:"hideConfirmDialogs"`
	HideConnectionModal     bool        `json:"hideConnectionModal"`
	HideFromLeaderboard     bool        `json:"hideFromLeaderboard"`
	HideNameFromLeaderboard bool        `json:"hideNameFromLeaderboard"`
	HideNotifications       []string    `json:"hideNotifications"`
	Locale                  string      `json:"locale"`
	MsgsSeen                []string    `json:"msgsSeen"`
	OrderBookBinning        interface{} `json:"orderBookBinning"`
	OrderBookType           string      `json:"orderBookType"`
	OrderClearImmediate     bool        `json:"orderClearImmediate"`
	OrderControlsPlusMinus  bool        `json:"orderControlsPlusMinus"`
	ShowLocaleNumbers       bool        `json:"showLocaleNumbers"`
	Sounds                  []string    `json:"sounds"`
	StrictIPCheck           bool        `json:"strictIPCheck"`
	StrictTimeout           bool        `json:"strictTimeout"`
	TickerGroup             string      `json:"tickerGroup"`
	TickerPinned            bool        `json:"tickerPinned"`
	TradeLayout             string      `json:"tradeLayout"`
}

UserPreferences user preferences

type UserPreferencesParams

type UserPreferencesParams struct {
	// Overwrite - If true, will overwrite all existing preferences.
	Overwrite bool `json:"overwrite,omitempty"`
	// Prefs - preferences
	Prefs string `json:"prefs,omitempty"`
}

UserPreferencesParams contains all the parameters to send to the API endpoint

func (UserPreferencesParams) IsNil

func (p UserPreferencesParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (UserPreferencesParams) ToURLVals

func (p UserPreferencesParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (UserPreferencesParams) VerifyData

func (p UserPreferencesParams) VerifyData() error

VerifyData verifies outgoing data sets

type UserRequestWithdrawalParams

type UserRequestWithdrawalParams struct {
	// Address - Destination Address.
	Address string `json:"address,omitempty"`

	// Amount - Amount of withdrawal currency.
	Amount float64 `json:"amount,omitempty"`

	// Currency - Currency you're withdrawing. Options: `XBt`
	Currency string `json:"currency,omitempty"`

	// Fee - 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.
	Fee float64 `json:"fee,omitempty"`

	// OtpToken - 2FA token. Required if 2FA is enabled on your account.
	OtpToken int64 `json:"otpToken,omitempty"`
}

UserRequestWithdrawalParams contains all the parameters to send to the API endpoint

func (UserRequestWithdrawalParams) IsNil

IsNil checks to see if any values has been set for the paramater

func (UserRequestWithdrawalParams) ToURLVals

func (p UserRequestWithdrawalParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (UserRequestWithdrawalParams) VerifyData

func (p UserRequestWithdrawalParams) VerifyData() error

VerifyData verifies outgoing data sets

type UserTokenParams

type UserTokenParams struct {
	Token string `json:"token,omitempty"`
}

UserTokenParams contains all the parameters to send to the API endpoint

func (UserTokenParams) IsNil

func (p UserTokenParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (UserTokenParams) ToURLVals

func (p UserTokenParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (UserTokenParams) VerifyData

func (p UserTokenParams) VerifyData() error

VerifyData verifies outgoing data sets

type UserUpdateParams

type UserUpdateParams struct {
	// Country - Country of residence.
	Country string `json:"country,omitempty"`

	// New Password string
	NewPassword string `json:"newPassword,omitempty"`

	// Confirmation string - must match
	NewPasswordConfirm string `json:"newPasswordConfirm,omitempty"`

	// old password string
	OldPassword string `json:"oldPassword,omitempty"`

	// PGP Public Key. If specified, automated emails will be sent with this key.
	PgpPubKey string `json:"pgpPubKey,omitempty"`

	// Username can only be set once. To reset, email support.
	Username string `json:"username,omitempty"`
}

UserUpdateParams contains all the parameters to send to the API endpoint

func (*UserUpdateParams) IsNil

func (p *UserUpdateParams) IsNil() bool

IsNil checks to see if any values has been set for the paramater

func (*UserUpdateParams) ToURLVals

func (p *UserUpdateParams) ToURLVals(path string) (string, error)

ToURLVals converts struct values to url.values and encodes it on the supplied path

func (*UserUpdateParams) VerifyData

func (p *UserUpdateParams) VerifyData() error

VerifyData verifies outgoing data sets

type WalletInfo

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

WalletInfo wallet information

type WebsocketErrorResponse

type WebsocketErrorResponse struct {
	Status  int64            `json:"status"`
	Error   string           `json:"error"`
	Meta    interface{}      `json:"meta"`
	Request WebsocketRequest `json:"request"`
}

WebsocketErrorResponse main error response

type WebsocketMainResponse

type WebsocketMainResponse struct {
	Table string   `json:"table"`
	Keys  []string `json:"keys"`
	Types struct {
		ID     string `json:"id"`
		Price  string `json:"price"`
		Side   string `json:"side"`
		Size   string `json:"size"`
		Symbol string `json:"symbol"`
	} `json:"types"`
	ForeignKeys struct {
		Side   string `json:"side"`
		Symbol string `json:"symbol"`
	} `json:"foreignKeys"`
	Attributes struct {
		ID     string `json:"id"`
		Symbol string `json:"symbol"`
	} `json:"Attributes"`
	Action string `json:"action,omitempty"`
}

WebsocketMainResponse main table defined response

type WebsocketRequest

type WebsocketRequest struct {
	Command   string        `json:"op"`
	Arguments []interface{} `json:"args"`
}

WebsocketRequest is the main request type

type WebsocketSubscribeResp

type WebsocketSubscribeResp struct {
	Success   bool             `json:"success"`
	Subscribe string           `json:"subscribe"`
	Request   WebsocketRequest `json:"request"`
}

WebsocketSubscribeResp is a response that occurs after a subscription

type WebsocketWelcome

type WebsocketWelcome struct {
	Info      string `json:"info"`
	Version   string `json:"version"`
	Timestamp string `json:"timestamp"`
	Docs      string `json:"docs"`
	Limit     struct {
		Remaining int64 `json:"remaining"`
	} `json:"limit"`
}

WebsocketWelcome initial welcome type

type WsAffiliateResponse

type WsAffiliateResponse struct {
	WsDataResponse
	ForeignKeys interface{}                   `json:"foreignKeys"`
	Attributes  WsAffiliateResponseAttributes `json:"attributes"`
	Filter      WsAffiliateResponseFilter     `json:"filter"`
	Data        []interface{}                 `json:"data"`
}

WsAffiliateResponse private api response

type WsAffiliateResponseAttributes

type WsAffiliateResponseAttributes struct {
	Account  string `json:"account"`
	Currency string `json:"currency"`
}

WsAffiliateResponseAttributes private api data

type WsAffiliateResponseFilter

type WsAffiliateResponseFilter struct {
	Account int64 `json:"account"`
}

WsAffiliateResponseFilter private api data

type WsDataResponse

type WsDataResponse struct {
	Table  string            `json:"table"`
	Action string            `json:"action"`
	Keys   []string          `json:"keys"`
	Types  map[string]string `json:"types"`
}

WsDataResponse contains common elements

type WsExecutionResponse

type WsExecutionResponse struct {
	WsDataResponse
	ForeignKeys WsExecutionResponseForeignKeys `json:"foreignKeys"`
	Attributes  WsExecutionResponseAttributes  `json:"attributes"`
	Filter      WsExecutionResponseFilter      `json:"filter"`
	Data        []wsExecutionData              `json:"data"`
}

WsExecutionResponse private api response

type WsExecutionResponseAttributes

type WsExecutionResponseAttributes struct {
	ExecID       string `json:"execID"`
	Account      string `json:"account"`
	ExecType     string `json:"execType"`
	TransactTime string `json:"transactTime"`
}

WsExecutionResponseAttributes private api data

type WsExecutionResponseFilter

type WsExecutionResponseFilter struct {
	Account int64  `json:"account"`
	Symbol  string `json:"symbol"`
}

WsExecutionResponseFilter private api data

type WsExecutionResponseForeignKeys

type WsExecutionResponseForeignKeys struct {
	Symbol    string `json:"symbol"`
	Side      string `json:"side"`
	OrdStatus string `json:"ordStatus"`
}

WsExecutionResponseForeignKeys private api data

type WsMarginResponse

type WsMarginResponse struct {
	WsDataResponse
	ForeignKeys interface{}                `json:"foreignKeys"`
	Attributes  WsMarginResponseAttributes `json:"attributes"`
	Filter      WsMarginResponseFilter     `json:"filter"`
	Data        []WsMarginResponseData     `json:"data"`
}

WsMarginResponse private api response

type WsMarginResponseAttributes

type WsMarginResponseAttributes struct {
	Account  string `json:"account"`
	Currency string `json:"currency"`
}

WsMarginResponseAttributes private api data

type WsMarginResponseData

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

WsMarginResponseData private api data

type WsMarginResponseFilter

type WsMarginResponseFilter struct {
	Account int64 `json:"account"`
}

WsMarginResponseFilter private api data

type WsOrderResponse

type WsOrderResponse struct {
	WsDataResponse
	ForeignKeys WsOrderResponseForeignKeys `json:"foreignKeys"`
	Attributes  WsOrderResponseAttributes  `json:"attributes"`
	Filter      WsOrderResponseFilter      `json:"filter"`
	Data        []OrderInsertData          `json:"data"`
}

WsOrderResponse private api response

type WsOrderResponseAttributes

type WsOrderResponseAttributes struct {
	OrderID          string `json:"orderID"`
	Account          string `json:"account"`
	OrdStatus        string `json:"ordStatus"`
	WorkingIndicator string `json:"workingIndicator"`
}

WsOrderResponseAttributes private api data

type WsOrderResponseFilter

type WsOrderResponseFilter struct {
	Account int64 `json:"account"`
}

WsOrderResponseFilter private api data

type WsOrderResponseForeignKeys

type WsOrderResponseForeignKeys struct {
	Symbol    string `json:"symbol"`
	Side      string `json:"side"`
	OrdStatus string `json:"ordStatus"`
}

WsOrderResponseForeignKeys private api data

type WsPositionResponse

type WsPositionResponse struct {
	WsDataResponse
	ForeignKeys WsPositionResponseForeignKeys `json:"foreignKeys"`
	Attributes  WsPositionResponseAttributes  `json:"attributes"`
	Filter      WsPositionResponseFilter      `json:"filter"`
	Data        []wsPositionData              `json:"data"`
}

WsPositionResponse private api response

type WsPositionResponseAttributes

type WsPositionResponseAttributes struct {
	Account       string `json:"account"`
	Symbol        string `json:"symbol"`
	Currency      string `json:"currency"`
	Underlying    string `json:"underlying"`
	QuoteCurrency string `json:"quoteCurrency"`
}

WsPositionResponseAttributes private api data

type WsPositionResponseFilter

type WsPositionResponseFilter struct {
	Account int64  `json:"account"`
	Symbol  string `json:"symbol"`
}

WsPositionResponseFilter private api data

type WsPositionResponseForeignKeys

type WsPositionResponseForeignKeys struct {
	Symbol string `json:"symbol"`
}

WsPositionResponseForeignKeys private api data

type WsPrivateNotificationsResponse

type WsPrivateNotificationsResponse struct {
	Table  string        `json:"table"`
	Action string        `json:"action"`
	Data   []interface{} `json:"data"`
}

WsPrivateNotificationsResponse private api response

type WsTransactResponse

type WsTransactResponse struct {
	WsDataResponse
	ForeignKeys interface{}                  `json:"foreignKeys"`
	Attributes  WsTransactResponseAttributes `json:"attributes"`
	Filter      WsTransactResponseFilter     `json:"filter"`
	Data        []interface{}                `json:"data"`
}

WsTransactResponse private api response

type WsTransactResponseAttributes

type WsTransactResponseAttributes struct {
	TransactID   string `json:"transactID"`
	TransactTime string `json:"transactTime"`
}

WsTransactResponseAttributes private api data

type WsTransactResponseFilter

type WsTransactResponseFilter struct {
	Account int64 `json:"account"`
}

WsTransactResponseFilter private api data

type WsWalletResponse

type WsWalletResponse struct {
	WsDataResponse
	ForeignKeys interface{}                `json:"foreignKeys"`
	Attributes  WsWalletResponseAttributes `json:"attributes"`
	Filter      WsWalletResponseFilter     `json:"filter"`
	Data        []WsWalletResponseData     `json:"data"`
}

WsWalletResponse private api response

type WsWalletResponseAttributes

type WsWalletResponseAttributes struct {
	Account  string `json:"account"`
	Currency string `json:"currency"`
}

WsWalletResponseAttributes private api data

type WsWalletResponseData

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

WsWalletResponseData private api data

type WsWalletResponseFilter

type WsWalletResponseFilter struct {
	Account int64 `json:"account"`
}

WsWalletResponseFilter private api data

Jump to

Keyboard shortcuts

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