deribit

package
v0.0.0-...-219ed90 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 38 Imported by: 2

README

GoCryptoTrader package Deribit

Build Status Software License GoDoc Coverage Status Go Report Card

This deribit 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 our GoCryptoTrader Kanban board.

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

Deribit Exchange

Current Features
  • REST Support
  • Websocket 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 d exchange.IBotExchange

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

// Public calls - wrapper functions

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

// Fetches current orderbook information
ob, err := d.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 := d.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

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

// Fetches current orderbook information
ob, err := d.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 := d.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := d.Trade(...)
if err != nil {
	// Handle error
}
How to do Websocket public/private calls
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
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

This section is empty.

Variables

This section is empty.

Functions

func GetRateLimits

func GetRateLimits() request.RateLimitDefinitions

GetRateLimits returns the rate limit for the exchange

Types

type APIKeyData

type APIKeyData struct {
	Timestamp    types.Time `json:"timestamp"`
	MaxScope     string     `json:"max_scope"`
	ID           int64      `json:"id"`
	Enabled      bool       `json:"enabled"`
	Default      bool       `json:"default"`
	ClientSecret string     `json:"client_secret"`
	ClientID     string     `json:"client_id"`
	Name         string     `json:"name"`
}

APIKeyData stores data regarding the api key

type AccessLog

type AccessLog struct {
	RecordsTotal int64             `json:"records_total"`
	Data         []AccessLogDetail `json:"data"`
}

AccessLog represents access log information.

type AccessLogDetail

type AccessLogDetail struct {
	Timestamp types.Time `json:"timestamp"`
	Result    string     `json:"result"`
	IP        string     `json:"ip"`
	ID        int64      `json:"id"`
	Country   string     `json:"country"`
	City      string     `json:"city"`
}

AccessLogDetail represents detailed access log information.

type AccountSummaryData

type AccountSummaryData struct {
	Balance                  float64 `json:"balance"`
	OptionsSessionUPL        float64 `json:"options_session_upl"`
	DepositAddress           string  `json:"deposit_address"`
	OptionsGamma             float64 `json:"options_gamma"`
	OptionsTheta             float64 `json:"options_theta"`
	Username                 string  `json:"username"`
	Equity                   float64 `json:"equity"`
	Type                     string  `json:"type"`
	Currency                 string  `json:"currency"`
	DeltaTotal               float64 `json:"delta_total"`
	FuturesSessionRPL        float64 `json:"futures_session_rpl"`
	PortfolioManagingEnabled bool    `json:"portfolio_managing_enabled"`
	TotalPL                  float64 `json:"total_pl"`
	MarginBalance            float64 `json:"margin_balance"`
	TFAEnabled               bool    `json:"tfa_enabled"`
	OptionsSessionRPL        float64 `json:"options_session_rpl"`
	OptionsDelta             float64 `json:"options_delta"`
	FuturesPL                float64 `json:"futures_pl"`
	ReferrerID               string  `json:"referrer_id"`
	ID                       int64   `json:"id"`
	SessionUPL               float64 `json:"session_upl"`
	AvailableWithdrawalFunds float64 `json:"available_withdrawal_funds"`
	OptionsPL                float64 `json:"options_pl"`
	SystemName               string  `json:"system_name"`
	Limits                   struct {
		NonMatchingEngine struct {
			Rate  int64 `json:"rate"`
			Burst int64 `json:"burst"`
		} `json:"non_matching_engine"`
		MatchingEngine struct {
			Rate  int64 `json:"rate"`
			Burst int64 `json:"burst"`
		} `json:"matching_engine"`
	} `json:"limits"`
	InitialMargin                float64            `json:"initial_margin"`
	ProjectedInitialMargin       float64            `json:"projected_initial_margin"`
	MaintenanceMargin            float64            `json:"maintenance_margin"`
	SessionRPL                   float64            `json:"session_rpl"`
	InteruserTransfersEnabled    bool               `json:"interuser_transfers_enabled"`
	OptionsVega                  float64            `json:"options_vega"`
	ProjectedDeltaTotal          float64            `json:"projected_delta_total"`
	Email                        string             `json:"email"`
	FuturesSessionUPL            float64            `json:"futures_session_upl"`
	AvailableFunds               float64            `json:"available_funds"`
	OptionsValue                 float64            `json:"options_value"`
	DeltaTotalMap                map[string]float64 `json:"delta_total_map"`
	ProjectedMaintenanceMargin   float64            `json:"projected_maintenance_margin"`
	EstimatedLiquidationRatio    float64            `json:"estimated_liquidation_ratio"`
	PortfolioMarginingEnabled    bool               `json:"portfolio_margining_enabled"`
	EstimatedLiquidationRatioMap map[string]float64 `json:"estimated_liquidation_ratio_map"`
	FeeBalance                   float64            `json:"fee_balance"`
	SpotReserve                  float64            `json:"spot_reserve"`
}

AccountSummaryData stores data of account summary for a given currency

type AffiliateProgramInfo

type AffiliateProgramInfo struct {
	Received           map[string]float64 `json:"received"`
	NumberOfAffiliates int64              `json:"number_of_affiliates"`
	Link               string             `json:"link"`
	IsEnabled          bool               `json:"is_enabled"`
}

AffiliateProgramInfo stores info of affiliate program

type Announcement

type Announcement struct {
	Title                string     `json:"title"`
	PublicationTimestamp types.Time `json:"publication_timestamp"`
	Important            bool       `json:"important"`
	ID                   int64      `json:"id"`
	Body                 string     `json:"body"`

	// Action taken by the platform administrators.
	Action string `json:"action"`
}

Announcement represents public announcements.

type BlockTradeData

type BlockTradeData struct {
	TradeSeq               int64       `json:"trade_seq"`
	TradeID                string      `json:"trade_id"`
	Timestamp              types.Time  `json:"timestamp"`
	TickDirection          int64       `json:"tick_direction"`
	State                  string      `json:"state"`
	SelfTrade              bool        `json:"self_trade"`
	Price                  float64     `json:"price"`
	OrderType              string      `json:"order_type"`
	OrderID                string      `json:"order_id"`
	MatchingID             interface{} `json:"matching_id"`
	Liquidity              string      `json:"liquidity"`
	OptionmpliedVolatility float64     `json:"iv,omitempty"`
	InstrumentName         string      `json:"instrument_name"`
	IndexPrice             float64     `json:"index_price"`
	FeeCurrency            string      `json:"fee_currency"`
	Fee                    float64     `json:"fee"`
	Direction              string      `json:"direction"`
	BlockTradeID           string      `json:"block_trade_id"`
	Amount                 float64     `json:"amount"`
}

BlockTradeData represents a user's block trade data.

type BlockTradeMoveResponse

type BlockTradeMoveResponse struct {
	TargetSubAccountUID int64   `json:"target_uid"`
	SourceSubAccountUID int64   `json:"source_uid"`
	Price               float64 `json:"price"`
	InstrumentName      string  `json:"instrument_name"`
	Direction           string  `json:"direction"`
	Amount              float64 `json:"amount"`
}

BlockTradeMoveResponse represents block trade move response.

type BlockTradeParam

type BlockTradeParam struct {
	Price          float64 `json:"price"`
	InstrumentName string  `json:"instrument_name"`
	Direction      string  `json:"direction,omitempty"`
	Amount         float64 `json:"amount"`
}

BlockTradeParam represents a block trade parameter.

type BlockTradeResponse

type BlockTradeResponse struct {
	TradeSeq       int64      `json:"trade_seq"`
	TradeID        string     `json:"trade_id"`
	Timestamp      types.Time `json:"timestamp"`
	TickDirection  int64      `json:"tick_direction"`
	State          string     `json:"state"`
	SelfTrade      bool       `json:"self_trade"`
	ReduceOnly     bool       `json:"reduce_only"`
	Price          float64    `json:"price"`
	PostOnly       bool       `json:"post_only"`
	OrderType      string     `json:"order_type"`
	OrderID        string     `json:"order_id"`
	MatchingID     string     `json:"matching_id"`
	MarkPrice      float64    `json:"mark_price"`
	Liquidity      string     `json:"liquidity"`
	InstrumentName string     `json:"instrument_name"`
	IndexPrice     float64    `json:"index_price"`
	FeeCurrency    string     `json:"fee_currency"`
	Fee            float64    `json:"fee"`
	Direction      string     `json:"direction"`
	BlockTradeID   string     `json:"block_trade_id"`
	Amount         float64    `json:"amount"`
}

BlockTradeResponse represents a block trade response.

type BookSummaryData

type BookSummaryData struct {
	InterestRate           float64    `json:"interest_rate"`
	AskPrice               float64    `json:"ask_price"`
	VolumeUSD              float64    `json:"volume_usd"`
	Volume                 float64    `json:"volume"`
	QuoteCurrency          string     `json:"quote_currency"`
	PriceChange            float64    `json:"price_change"`
	OpenInterest           float64    `json:"open_interest"`
	MidPrice               float64    `json:"mid_price"`
	MarkPrice              float64    `json:"mark_price"`
	Low                    float64    `json:"low"`
	Last                   float64    `json:"last"`
	InstrumentName         string     `json:"instrument_name"`
	High                   float64    `json:"high"`
	EstimatedDeliveryPrice float64    `json:"estimated_delivery_price"`
	CreationTimestamp      types.Time `json:"creation_timestamp"`
	BidPrice               float64    `json:"bid_price"`
	BaseCurrency           string     `json:"base_currency"`
	Funding8H              float64    `json:"funding_8h,omitempty"`
	CurrentFunding         float64    `json:"current_funding,omitempty"`
	UnderlyingIndex        string     `json:"underlying_index"`
	UnderlyingPrice        float64    `json:"underlying_price"`
	VolumeNotional         float64    `json:"volume_notional"`
}

BookSummaryData stores summary data

type CancelOnDisconnect

type CancelOnDisconnect struct {
	Scope  string `json:"scope"`
	Enable bool   `json:"enabled"`
}

CancelOnDisconnect holds scope and status information for cancel-on-disconnect

type CancelResp

type CancelResp struct {
	InstrumentName string              `json:"instrument_name"`
	Currency       string              `json:"currency"`
	Result         []PrivateCancelData `json:"result"`
	Type           string              `json:"type"`
}

CancelResp represents the detail of canceled order.

type CancelWithdrawalData

type CancelWithdrawalData struct {
	Address            string     `json:"address"`
	Amount             float64    `json:"amount"`
	ConfirmedTimestamp types.Time `json:"confirmed_timestamp"`
	CreatedTimestamp   types.Time `json:"created_timestamp"`
	Currency           string     `json:"currency"`
	Fee                float64    `json:"fee"`
	ID                 int64      `json:"id"`
	Priority           float64    `json:"priority"`
	Status             string     `json:"status"`
	TransactionID      int64      `json:"transaction_id"`
	UpdatedTimestamp   types.Time `json:"updated_timestamp"`
}

CancelWithdrawalData stores cancel request data for a withdrawal

type ComboDetail

type ComboDetail struct {
	ID                string     `json:"id"`
	InstrumentID      int64      `json:"instrument_id"`
	CreationTimestamp types.Time `json:"creation_timestamp"`
	StateTimestamp    types.Time `json:"state_timestamp"`
	State             string     `json:"state"`
	Legs              []struct {
		InstrumentName string  `json:"instrument_name"`
		Amount         float64 `json:"amount"`
	} `json:"legs"`
}

ComboDetail retrieves information about a combo

type ComboParam

type ComboParam struct {
	InstrumentName string  `json:"instrument_name"`
	Direction      string  `json:"direction"`
	Amount         float64 `json:"amount,string"`
}

ComboParam represents a parameter to sell and buy combo.

type ContractSizeData

type ContractSizeData struct {
	ContractSize float64 `json:"contract_size"`
}

ContractSizeData stores contract size for given instrument

type CurrencyData

type CurrencyData struct {
	CoinType             string  `json:"coin_type"`
	Currency             string  `json:"currency"`
	CurrencyLong         string  `json:"currency_long"`
	FeePrecision         int64   `json:"fee_precision"`
	MinConfirmations     int64   `json:"min_confirmations"`
	MinWithdrawalFee     float64 `json:"min_withdrawal_fee"`
	WithdrawalFee        float64 `json:"withdrawal_fee"`
	WithdrawalPriorities []struct {
		Value float64 `json:"value"`
		Name  string  `json:"name"`
	} `json:"withdrawal_priorities"`
}

CurrencyData stores data for currencies

type CustodyAccount

type CustodyAccount struct {
	Name                          string  `json:"name"`
	Currency                      string  `json:"currency"`
	ClientID                      string  `json:"client_id"`
	Balance                       float64 `json:"balance"`
	WithdrawalsRequireSecurityKey bool    `json:"withdrawals_require_security_key"`
	PendingWithdrawalBalance      float64 `json:"pending_withdrawal_balance"`
	AutoDeposit                   bool    `json:"auto_deposit"`
}

CustodyAccount retrieves user custody accounts list.

type DeliveryPriceData

type DeliveryPriceData struct {
	Date          string  `json:"date"`
	DeliveryPrice float64 `json:"delivery_price"`
}

DeliveryPriceData stores index delivery_price

type DepositAddressData

type DepositAddressData struct {
	Address           string     `json:"address"`
	CreationTimestamp types.Time `json:"creation_timestamp"`
	Currency          string     `json:"currency"`
	Type              string     `json:"type"`
}

DepositAddressData stores data of a deposit address

type DepositsData

type DepositsData struct {
	Count int64 `json:"count"`
	Data  []struct {
		Address           string     `json:"address"`
		Amount            float64    `json:"amount"`
		Currency          string     `json:"currency"`
		ReceivedTimestamp types.Time `json:"received_timestamp"`
		State             string     `json:"state"`
		TransactionID     string     `json:"transaction_id"`
		UpdatedTimestamp  types.Time `json:"updated_timestamp"`
	} `json:"data"`
}

DepositsData stores data of deposits

type Deribit

type Deribit struct {
	exchange.Base
}

Deribit is the overarching type across this package

func (*Deribit) AuthenticateWebsocket

func (d *Deribit) AuthenticateWebsocket(ctx context.Context) error

AuthenticateWebsocket sends an authentication message to the websocket

func (*Deribit) CancelAllOrders

func (d *Deribit) CancelAllOrders(ctx context.Context, orderCancellation *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*Deribit) CancelBatchOrders

func (d *Deribit) CancelBatchOrders(_ context.Context, _ []order.Cancel) (*order.CancelBatchResponse, error)

CancelBatchOrders cancels orders by their corresponding ID numbers

func (*Deribit) CancelOrder

func (d *Deribit) CancelOrder(ctx context.Context, ord *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*Deribit) CancelTransferByID

func (d *Deribit) CancelTransferByID(ctx context.Context, ccy currency.Code, tfa string, id int64) (*AccountSummaryData, error)

CancelTransferByID cancels transfer by ID through the websocket connection.

func (*Deribit) CancelWithdrawal

func (d *Deribit) CancelWithdrawal(ctx context.Context, ccy currency.Code, id int64) (*CancelWithdrawalData, error)

CancelWithdrawal cancels withdrawal request for a given currency by its id

func (*Deribit) ChangeAPIKeyName

func (d *Deribit) ChangeAPIKeyName(ctx context.Context, id int64, name string) (*APIKeyData, error)

ChangeAPIKeyName changes the name of the api key requested

func (*Deribit) ChangeMarginModel

func (d *Deribit) ChangeMarginModel(ctx context.Context, userID int64, marginModel string, dryRun bool) ([]TogglePortfolioMarginResponse, error)

ChangeMarginModel change margin model Margin model: 'cross_pm', 'cross_sm', 'segregated_pm', 'segregated_sm' 'dry_run': If true request returns the result without switching the margining model. Default: false

func (*Deribit) ChangeScopeInAPIKey

func (d *Deribit) ChangeScopeInAPIKey(ctx context.Context, id int64, maxScope string) (*APIKeyData, error)

ChangeScopeInAPIKey changes the scope of the api key requested

func (*Deribit) ChangeSubAccountName

func (d *Deribit) ChangeSubAccountName(ctx context.Context, sid int64, name string) error

ChangeSubAccountName changes the name of the requested subaccount id

func (*Deribit) CreateAPIKey

func (d *Deribit) CreateAPIKey(ctx context.Context, maxScope, name string, defaultKey bool) (*APIKeyData, error)

CreateAPIKey creates an api key based on the provided settings

func (*Deribit) CreateCombo

func (d *Deribit) CreateCombo(ctx context.Context, args []ComboParam) (*ComboDetail, error)

CreateCombo verifies and creates a combo book or returns an existing combo matching given trades

func (*Deribit) CreateDepositAddress

func (d *Deribit) CreateDepositAddress(ctx context.Context, ccy currency.Code) (*DepositAddressData, error)

CreateDepositAddress creates a deposit address for the currency requested

func (*Deribit) CreateSubAccount

func (d *Deribit) CreateSubAccount(ctx context.Context) (*SubAccountData, error)

CreateSubAccount creates a new subaccount

func (*Deribit) DisableAPIKey

func (d *Deribit) DisableAPIKey(ctx context.Context, id int64) (*APIKeyData, error)

DisableAPIKey disables the api key linked to the provided id

func (*Deribit) EditAPIKey

func (d *Deribit) EditAPIKey(ctx context.Context, id int64, maxScope, name string, enabled bool, enabledFeatures, ipWhitelist []string) (*APIKeyData, error)

EditAPIKey edits existing API key. At least one parameter is required. Describes maximal access for tokens generated with given key, possible values: trade:[read, read_write, none], wallet:[read, read_write, none], account:[read, read_write, none], block_trade:[read, read_write, none].

func (*Deribit) EditOrderByLabel

func (d *Deribit) EditOrderByLabel(ctx context.Context, arg *OrderBuyAndSellParams) (*PrivateTradeData, error)

EditOrderByLabel submits an edit order request sorted via label

func (*Deribit) EnableAPIKey

func (d *Deribit) EnableAPIKey(ctx context.Context, id int64) (*APIKeyData, error)

EnableAPIKey enables the api key linked to the provided id

func (*Deribit) EnableAffiliateProgram

func (d *Deribit) EnableAffiliateProgram(ctx context.Context) error

EnableAffiliateProgram enables the affiliate program

func (*Deribit) EnableCancelOnDisconnect

func (d *Deribit) EnableCancelOnDisconnect(ctx context.Context, scope string) (string, error)

EnableCancelOnDisconnect enable Cancel On Disconnect for the connection. After enabling Cancel On Disconnect all orders created by the connection will be removed when the connection is closed.

func (*Deribit) ExchangeToken

func (d *Deribit) ExchangeToken(ctx context.Context, refreshToken string, subjectID int64) (*RefreshTokenInfo, error)

ExchangeToken generates a token for a new subject id. This method can be used to switch between subaccounts.

func (*Deribit) ExecuteBlockTrade

func (d *Deribit) ExecuteBlockTrade(ctx context.Context, timestampMS time.Time, nonce, role string, ccy currency.Code, trades []BlockTradeParam) ([]BlockTradeResponse, error)

ExecuteBlockTrade executes a block trade request The whole request have to be exact the same as in private/verify_block_trade, only role field should be set appropriately - it basically means that both sides have to agree on the same timestamp, nonce, trades fields and server will assure that role field is different between sides (each party accepted own role). Using the same timestamp and nonce by both sides in private/verify_block_trade assures that even if unintentionally both sides execute given block trade with valid counterparty_signature, the given block trade will be executed only once

func (*Deribit) FetchAccountInfo

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

FetchAccountInfo retrieves balances for all enabled currencies

func (*Deribit) FetchOrderbook

func (d *Deribit) FetchOrderbook(ctx context.Context, currencyPair currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*Deribit) FetchTicker

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

FetchTicker returns the ticker for a currency pair

func (*Deribit) FetchTradablePairs

func (d *Deribit) FetchTradablePairs(ctx context.Context, assetType asset.Item) (currency.Pairs, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Deribit) ForkToken

func (d *Deribit) ForkToken(ctx context.Context, refreshToken, sessionName string) (*RefreshTokenInfo, error)

ForkToken generates a token for a new named session. This method can be used only with session scoped tokens.

func (*Deribit) GenerateDefaultSubscriptions

func (d *Deribit) GenerateDefaultSubscriptions() (subscription.List, error)

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

func (*Deribit) GetAccessLog

func (d *Deribit) GetAccessLog(ctx context.Context, offset, count int64) (*AccessLog, error)

GetAccessLog lists access logs for the user

func (*Deribit) GetAccountFundingHistory

func (d *Deribit) GetAccountFundingHistory(ctx context.Context) ([]exchange.FundingHistory, error)

GetAccountFundingHistory returns funding history, deposits and withdrawals

func (*Deribit) GetAccountSummary

func (d *Deribit) GetAccountSummary(ctx context.Context, ccy currency.Code, extended bool) (*AccountSummaryData, error)

GetAccountSummary gets account summary data for the requested instrument

func (*Deribit) GetActiveOrders

func (d *Deribit) GetActiveOrders(ctx context.Context, getOrdersRequest *order.MultiOrderRequest) (order.FilteredOrders, error)

GetActiveOrders retrieves any orders that are active/open

func (*Deribit) GetAffiliateProgramInfo

func (d *Deribit) GetAffiliateProgramInfo(ctx context.Context) (*AffiliateProgramInfo, error)

GetAffiliateProgramInfo gets the affiliate program info

func (*Deribit) GetAnnouncements

func (d *Deribit) GetAnnouncements(ctx context.Context, startTime time.Time, count int64) ([]Announcement, error)

GetAnnouncements retrieves announcements. Default "start_timestamp" parameter value is current timestamp, "count" parameter value must be between 1 and 50, default is 5.

func (*Deribit) GetAssetKind

func (d *Deribit) GetAssetKind(assetType asset.Item) string

GetAssetKind returns the asset type (kind) string representation.

func (*Deribit) GetBookSummaryByCurrency

func (d *Deribit) GetBookSummaryByCurrency(ctx context.Context, ccy currency.Code, kind string) ([]BookSummaryData, error)

GetBookSummaryByCurrency gets book summary data for currency requested

func (*Deribit) GetBookSummaryByInstrument

func (d *Deribit) GetBookSummaryByInstrument(ctx context.Context, instrument string) ([]BookSummaryData, error)

GetBookSummaryByInstrument gets book summary data for instrument requested

func (*Deribit) GetComboDetails

func (d *Deribit) GetComboDetails(ctx context.Context, comboID string) (*ComboDetail, error)

GetComboDetails retrieves information about a combo

func (*Deribit) GetComboIDs

func (d *Deribit) GetComboIDs(ctx context.Context, ccy currency.Code, state string) ([]string, error)

GetComboIDs Retrieves available combos. This method can be used to get the list of all combos, or only the list of combos in the given state.

func (*Deribit) GetCombos

func (d *Deribit) GetCombos(ctx context.Context, ccy currency.Code) ([]ComboDetail, error)

GetCombos retrieves information about active combos

func (*Deribit) GetContractSize

func (d *Deribit) GetContractSize(ctx context.Context, instrument string) (*ContractSizeData, error)

GetContractSize gets contract size for instrument requested

func (*Deribit) GetCurrencies

func (d *Deribit) GetCurrencies(ctx context.Context) ([]CurrencyData, error)

GetCurrencies gets all cryptocurrencies supported by the API

func (*Deribit) GetCurrencyIndexPrice

func (d *Deribit) GetCurrencyIndexPrice(ctx context.Context, ccy currency.Code) (*IndexPrice, error)

GetCurrencyIndexPrice retrieves the current index price for the instruments, for the selected currency.

func (*Deribit) GetCurrencyTradeURL

func (d *Deribit) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currency.Pair) (string, error)

GetCurrencyTradeURL returns the URL to the exchange's trade page for the given asset and currency pair

func (*Deribit) GetCurrentDepositAddress

func (d *Deribit) GetCurrentDepositAddress(ctx context.Context, ccy currency.Code) (*DepositAddressData, error)

GetCurrentDepositAddress gets the current deposit address for the requested currency

func (*Deribit) GetCustodyAccounts

func (d *Deribit) GetCustodyAccounts(ctx context.Context, ccy currency.Code) ([]CustodyAccount, error)

GetCustodyAccounts retrieves user custody accounts list.

func (*Deribit) GetDefaultConfig

func (d *Deribit) GetDefaultConfig(ctx context.Context) (*config.Exchange, error)

GetDefaultConfig returns a default exchange config

func (*Deribit) GetDeliveryPrices

func (d *Deribit) GetDeliveryPrices(ctx context.Context, indexName string, offset, count int64) (*IndexDeliveryPrice, error)

GetDeliveryPrices gets all delivery prices for the given inde name

func (*Deribit) GetDepositAddress

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

GetDepositAddress returns a deposit address for a specified currency

func (*Deribit) GetDeposits

func (d *Deribit) GetDeposits(ctx context.Context, ccy currency.Code, count, offset int64) (*DepositsData, error)

GetDeposits gets the deposits of a given currency

func (*Deribit) GetEmailLanguage

func (d *Deribit) GetEmailLanguage(ctx context.Context) (string, error)

GetEmailLanguage gets the current language set for the email

func (*Deribit) GetFeeByType

func (d *Deribit) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on the type of transaction

func (*Deribit) GetFundingChartData

func (d *Deribit) GetFundingChartData(ctx context.Context, instrument, length string) (*FundingChartData, error)

GetFundingChartData gets funding chart data for the requested instrument and time length supported lengths: 8h, 24h, 1m <-(1month)

func (*Deribit) GetFundingRateHistory

func (d *Deribit) GetFundingRateHistory(ctx context.Context, instrumentName string, startTime, endTime time.Time) ([]FundingRateHistory, error)

GetFundingRateHistory retrieves hourly historical interest rate for requested PERPETUAL instrument.

func (*Deribit) GetFundingRateValue

func (d *Deribit) GetFundingRateValue(ctx context.Context, instrument string, startTime, endTime time.Time) (float64, error)

GetFundingRateValue gets funding rate value data.

func (*Deribit) GetFuturesContractDetails

func (d *Deribit) GetFuturesContractDetails(ctx context.Context, item asset.Item) ([]futures.Contract, error)

GetFuturesContractDetails returns all contracts from the exchange by asset type

func (*Deribit) GetFuturesPositionSummary

func (d *Deribit) GetFuturesPositionSummary(ctx context.Context, r *futures.PositionSummaryRequest) (*futures.PositionSummary, error)

GetFuturesPositionSummary returns position summary details for an active position

func (*Deribit) GetHistoricCandles

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

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

func (*Deribit) GetHistoricCandlesExtended

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

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

func (*Deribit) GetHistoricTrades

func (d *Deribit) 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 (*Deribit) GetHistoricalFundingRates

func (d *Deribit) GetHistoricalFundingRates(ctx context.Context, r *fundingrate.HistoricalRatesRequest) (*fundingrate.HistoricalRates, error)

GetHistoricalFundingRates returns historical funding rates for a future

func (*Deribit) GetHistoricalVolatility

func (d *Deribit) GetHistoricalVolatility(ctx context.Context, ccy currency.Code) ([]HistoricalVolatilityData, error)

GetHistoricalVolatility gets historical volatility data

func (*Deribit) GetIndexPrice

func (d *Deribit) GetIndexPrice(ctx context.Context, index string) (*IndexPriceData, error)

GetIndexPrice gets price data for the requested index

func (*Deribit) GetIndexPriceNames

func (d *Deribit) GetIndexPriceNames(ctx context.Context) ([]string, error)

GetIndexPriceNames gets names of indexes

func (*Deribit) GetInstrument

func (d *Deribit) GetInstrument(ctx context.Context, instrument string) (*InstrumentData, error)

GetInstrument retrieves instrument detail

func (*Deribit) GetInstruments

func (d *Deribit) GetInstruments(ctx context.Context, ccy currency.Code, kind string, expired bool) ([]InstrumentData, error)

GetInstruments gets data for all available instruments

func (*Deribit) GetLastBlockTradesByCurrency

func (d *Deribit) GetLastBlockTradesByCurrency(ctx context.Context, ccy currency.Code, startID, endID string, count int64) ([]BlockTradeData, error)

GetLastBlockTradesByCurrency returns list of last users block trades

func (*Deribit) GetLastSettlementsByCurrency

func (d *Deribit) GetLastSettlementsByCurrency(ctx context.Context, ccy currency.Code, settlementType, continuation string, count int64, searchStartTime time.Time) (*SettlementsData, error)

GetLastSettlementsByCurrency gets last settlement data by currency

func (*Deribit) GetLastSettlementsByInstrument

func (d *Deribit) GetLastSettlementsByInstrument(ctx context.Context, instrument, settlementType, continuation string, count int64, startTime time.Time) (*SettlementsData, error)

GetLastSettlementsByInstrument gets last settlement data for requested instrument

func (*Deribit) GetLastTradesByCurrency

func (d *Deribit) GetLastTradesByCurrency(ctx context.Context, ccy currency.Code, kind, startID, endID, sorting string, count int64, includeOld bool) (*PublicTradesData, error)

GetLastTradesByCurrency gets last trades for requested currency

func (*Deribit) GetLastTradesByCurrencyAndTime

func (d *Deribit) GetLastTradesByCurrencyAndTime(ctx context.Context, ccy currency.Code, kind, sorting string, count int64, startTime, endTime time.Time) (*PublicTradesData, error)

GetLastTradesByCurrencyAndTime gets last trades for requested currency and time intervals

func (*Deribit) GetLastTradesByInstrument

func (d *Deribit) GetLastTradesByInstrument(ctx context.Context, instrument, startSeq, endSeq, sorting string, count int64, includeOld bool) (*PublicTradesData, error)

GetLastTradesByInstrument gets last trades for requested instrument requested

func (*Deribit) GetLastTradesByInstrumentAndTime

func (d *Deribit) GetLastTradesByInstrumentAndTime(ctx context.Context, instrument, sorting string, count int64, startTime, endTime time.Time) (*PublicTradesData, error)

GetLastTradesByInstrumentAndTime gets last trades for requested instrument requested and time intervals

func (*Deribit) GetLatestFundingRates

GetLatestFundingRates returns the latest funding rates data

func (*Deribit) GetLockedStatus

func (d *Deribit) GetLockedStatus(ctx context.Context) (*LockedCurrenciesStatus, error)

GetLockedStatus retrieves information about locked currencies

func (*Deribit) GetMMPConfig

func (d *Deribit) GetMMPConfig(ctx context.Context, ccy currency.Code) (*MMPConfigData, error)

GetMMPConfig sends a request to fetch the config for MMP of the requested currency

func (*Deribit) GetMargins

func (d *Deribit) GetMargins(ctx context.Context, instrument string, amount, price float64) (*MarginsData, error)

GetMargins sends a request to fetch account margins data

func (*Deribit) GetMarkPriceHistory

func (d *Deribit) GetMarkPriceHistory(ctx context.Context, instrument string, startTime, endTime time.Time) ([]MarkPriceHistory, error)

GetMarkPriceHistory gets data for mark price history

func (*Deribit) GetNewAnnouncements

func (d *Deribit) GetNewAnnouncements(ctx context.Context) ([]Announcement, error)

GetNewAnnouncements gets new announcements

func (*Deribit) GetOpenInterest

func (d *Deribit) GetOpenInterest(ctx context.Context, k ...key.PairAsset) ([]futures.OpenInterest, error)

GetOpenInterest returns the open interest rate for a given asset pair

func (*Deribit) GetOpenOrdersByCurrency

func (d *Deribit) GetOpenOrdersByCurrency(ctx context.Context, ccy currency.Code, kind, orderType string) ([]OrderData, error)

GetOpenOrdersByCurrency retrieves open orders data sorted by requested params

func (*Deribit) GetOpenOrdersByInstrument

func (d *Deribit) GetOpenOrdersByInstrument(ctx context.Context, instrument, orderType string) ([]OrderData, error)

GetOpenOrdersByInstrument sends a request to fetch open orders data sorted by requested params

func (*Deribit) GetOpenOrdersByLabel

func (d *Deribit) GetOpenOrdersByLabel(ctx context.Context, ccy currency.Code, label string) ([]OrderData, error)

GetOpenOrdersByLabel retrieves open orders using label and currency

func (*Deribit) GetOrderHistory

func (d *Deribit) GetOrderHistory(ctx context.Context, getOrdersRequest *order.MultiOrderRequest) (order.FilteredOrders, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*Deribit) GetOrderHistoryByCurrency

func (d *Deribit) GetOrderHistoryByCurrency(ctx context.Context, ccy currency.Code, kind string, count, offset int64, includeOld, includeUnfilled bool) ([]OrderData, error)

GetOrderHistoryByCurrency sends a request to fetch order history according to given params and currency

func (*Deribit) GetOrderHistoryByInstrument

func (d *Deribit) GetOrderHistoryByInstrument(ctx context.Context, instrument string, count, offset int64, includeOld, includeUnfilled bool) ([]OrderData, error)

GetOrderHistoryByInstrument sends a request to fetch order history according to given params and instrument

func (*Deribit) GetOrderInfo

func (d *Deribit) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, assetType asset.Item) (*order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*Deribit) GetOrderMarginsByID

func (d *Deribit) GetOrderMarginsByID(ctx context.Context, ids []string) ([]InitialMarginInfo, error)

GetOrderMarginsByID sends a request to fetch order margins data according to their ids

func (*Deribit) GetOrderState

func (d *Deribit) GetOrderState(ctx context.Context, orderID string) (*OrderData, error)

GetOrderState sends a request to fetch order state of the order id provided

func (*Deribit) GetOrderStateByLabel

func (d *Deribit) GetOrderStateByLabel(ctx context.Context, ccy currency.Code, label string) ([]OrderData, error)

GetOrderStateByLabel retrieves an order state by label and currency

func (*Deribit) GetOrderbook

func (d *Deribit) GetOrderbook(ctx context.Context, instrument string, depth int64) (*Orderbook, error)

GetOrderbook gets data orderbook of requested instrument

func (*Deribit) GetOrderbookByInstrumentID

func (d *Deribit) GetOrderbookByInstrumentID(ctx context.Context, instrumentID int64, depth float64) (*Orderbook, error)

GetOrderbookByInstrumentID retrieves orderbook by instrument ID

func (*Deribit) GetPosition

func (d *Deribit) GetPosition(ctx context.Context, instrument string) (*PositionData, error)

GetPosition gets the data of all positions in the requested instrument name

func (*Deribit) GetPositions

func (d *Deribit) GetPositions(ctx context.Context, ccy currency.Code, kind string) ([]PositionData, error)

GetPositions gets positions data of the user account

func (*Deribit) GetPrivatePortfolioMargins

func (d *Deribit) GetPrivatePortfolioMargins(ctx context.Context, ccy currency.Code, accPositions bool, simulatedPositions map[string]float64) (*PortfolioMargin, error)

GetPrivatePortfolioMargins calculates portfolio margin info for simulated position or current position of the user. This request has special restricted rate limit (not more than once per a second).

func (*Deribit) GetPublicPortfolioMargins

func (d *Deribit) GetPublicPortfolioMargins(ctx context.Context, ccy currency.Code, simulatedPositions map[string]float64) (*PortfolioMargin, error)

GetPublicPortfolioMargins public version of the method calculates portfolio margin info for simulated position. For concrete user position, the private version of the method must be used. The public version of the request has special restricted rate limit (not more than once per a second for the IP).

func (*Deribit) GetPublicTicker

func (d *Deribit) GetPublicTicker(ctx context.Context, instrument string) (*TickerData, error)

GetPublicTicker gets public ticker data of the instrument requested

func (*Deribit) GetRecentTrades

func (d *Deribit) 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 (*Deribit) GetRequestForQuote

func (d *Deribit) GetRequestForQuote(ctx context.Context, ccy currency.Code, kind string) ([]RequestForQuote, error)

GetRequestForQuote retrieves RFQ information.

func (*Deribit) GetResolutionFromInterval

func (d *Deribit) GetResolutionFromInterval(interval kline.Interval) (string, error)

GetResolutionFromInterval returns the string representation of intervals given kline.Interval instance.

func (*Deribit) GetServerTime

func (d *Deribit) GetServerTime(ctx context.Context, _ asset.Item) (time.Time, error)

GetServerTime returns the current exchange server time.

func (*Deribit) GetSettlementHistoryByCurency

func (d *Deribit) GetSettlementHistoryByCurency(ctx context.Context, ccy currency.Code, settlementType, continuation string, count int64, searchStartTimeStamp time.Time) (*PrivateSettlementsHistoryData, error)

GetSettlementHistoryByCurency sends a request to fetch settlement history data sorted by currency

func (*Deribit) GetSettlementHistoryByInstrument

func (d *Deribit) GetSettlementHistoryByInstrument(ctx context.Context, instrument, settlementType, continuation string, count int64, searchStartTimeStamp time.Time) (*PrivateSettlementsHistoryData, error)

GetSettlementHistoryByInstrument sends a request to fetch settlement history data sorted by instrument

func (*Deribit) GetSubAccountDetails

func (d *Deribit) GetSubAccountDetails(ctx context.Context, ccy currency.Code, withOpenOrders bool) ([]SubAccountDetail, error)

GetSubAccountDetails retrieves sub accounts detail information.

func (*Deribit) GetSubAccounts

func (d *Deribit) GetSubAccounts(ctx context.Context, withPortfolio bool) ([]SubAccountData, error)

GetSubAccounts gets all subaccounts' data

func (*Deribit) GetSupportedIndexNames

func (d *Deribit) GetSupportedIndexNames(ctx context.Context, priceIndexType string) ([]string, error)

GetSupportedIndexNames retrieves the identifiers of all supported Price Indexes 'type' represents Type of a cryptocurrency price index. possible 'all', 'spot', 'derivative'

func (*Deribit) GetTime

func (d *Deribit) GetTime(ctx context.Context) (time.Time, error)

GetTime retrieves the current time (in milliseconds). This API endpoint can be used to check the clock skew between your software and Deribit's systems.

func (*Deribit) GetTradeVolumes

func (d *Deribit) GetTradeVolumes(ctx context.Context, extended bool) ([]TradeVolumesData, error)

GetTradeVolumes gets trade volumes' data of all instruments

func (*Deribit) GetTradingViewChart

func (d *Deribit) GetTradingViewChart(ctx context.Context, instrument, resolution string, startTime, endTime time.Time) (*TVChartData, error)

GetTradingViewChart gets volatility index data for the requested instrument

func (*Deribit) GetTransactionLog

func (d *Deribit) GetTransactionLog(ctx context.Context, ccy currency.Code, query string, startTime, endTime time.Time, count, continuation int64) (*TransactionsData, error)

GetTransactionLog gets transaction logs' data

func (*Deribit) GetTransfers

func (d *Deribit) GetTransfers(ctx context.Context, ccy currency.Code, count, offset int64) (*TransfersData, error)

GetTransfers gets transfers data for the requested currency

func (*Deribit) GetTriggerOrderHistory

func (d *Deribit) GetTriggerOrderHistory(ctx context.Context, ccy currency.Code, instrumentName, continuation string, count int64) (*OrderData, error)

GetTriggerOrderHistory sends a request to fetch order state of the order id provided

func (*Deribit) GetUserBlockTrade

func (d *Deribit) GetUserBlockTrade(ctx context.Context, id string) ([]BlockTradeData, error)

GetUserBlockTrade returns information about users block trade

func (*Deribit) GetUserLocks

func (d *Deribit) GetUserLocks(ctx context.Context) ([]UserLock, error)

GetUserLocks retrieves information about locks on user account.

func (*Deribit) GetUserTradesByCurrency

func (d *Deribit) GetUserTradesByCurrency(ctx context.Context, ccy currency.Code, kind, startID, endID, sorting string, count int64, includeOld bool) (*UserTradesData, error)

GetUserTradesByCurrency sends a request to fetch user trades sorted by currency

func (*Deribit) GetUserTradesByCurrencyAndTime

func (d *Deribit) GetUserTradesByCurrencyAndTime(ctx context.Context, ccy currency.Code, kind, sorting string, count int64, startTime, endTime time.Time) (*UserTradesData, error)

GetUserTradesByCurrencyAndTime sends a request to fetch user trades sorted by currency and time

func (*Deribit) GetUserTradesByInstrument

func (d *Deribit) GetUserTradesByInstrument(ctx context.Context, instrument, sorting string, startSeq, endSeq, count int64, includeOld bool) (*UserTradesData, error)

GetUserTradesByInstrument sends a request to fetch user trades sorted by instrument

func (*Deribit) GetUserTradesByInstrumentAndTime

func (d *Deribit) GetUserTradesByInstrumentAndTime(ctx context.Context, instrument, sorting string, count int64, startTime, endTime time.Time) (*UserTradesData, error)

GetUserTradesByInstrumentAndTime sends a request to fetch user trades sorted by instrument and time

func (*Deribit) GetUserTradesByOrder

func (d *Deribit) GetUserTradesByOrder(ctx context.Context, orderID, sorting string) (*UserTradesData, error)

GetUserTradesByOrder sends a request to get user trades fetched by orderID

func (*Deribit) GetVolatilityIndex

func (d *Deribit) GetVolatilityIndex(ctx context.Context, ccy currency.Code, resolution string, startTime, endTime time.Time) ([]VolatilityIndexData, error)

GetVolatilityIndex gets volatility index for the requested currency

func (*Deribit) GetWithdrawals

func (d *Deribit) GetWithdrawals(ctx context.Context, ccy currency.Code, count, offset int64) (*WithdrawalsData, error)

GetWithdrawals gets withdrawals data for a requested currency

func (*Deribit) GetWithdrawalsHistory

func (d *Deribit) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error)

GetWithdrawalsHistory returns previous withdrawals data

func (*Deribit) InvalidateBlockTradeSignature

func (d *Deribit) InvalidateBlockTradeSignature(ctx context.Context, signature string) error

InvalidateBlockTradeSignature user at any time (before the private/execute_block_trade is called) can invalidate its own signature effectively cancelling block trade

func (*Deribit) IsPerpetualFutureCurrency

func (d *Deribit) IsPerpetualFutureCurrency(assetType asset.Item, pair currency.Pair) (bool, error)

IsPerpetualFutureCurrency ensures a given asset and currency is a perpetual future differs by exchange

func (*Deribit) ListAPIKeys

func (d *Deribit) ListAPIKeys(ctx context.Context, tfa string) ([]APIKeyData, error)

ListAPIKeys lists all the api keys associated with a user account

func (*Deribit) ModifyOrder

func (d *Deribit) ModifyOrder(ctx context.Context, action *order.Modify) (*order.ModifyResponse, error)

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

func (*Deribit) MovePositions

func (d *Deribit) MovePositions(ctx context.Context, ccy currency.Code, sourceSubAccountUID, targetSubAccountUID int64, trades []BlockTradeParam) ([]BlockTradeMoveResponse, error)

MovePositions moves positions from source subaccount to target subaccount

func (*Deribit) RemoveAPIKey

func (d *Deribit) RemoveAPIKey(ctx context.Context, id int64) error

RemoveAPIKey removes api key vid ID

func (*Deribit) RemoveSubAccount

func (d *Deribit) RemoveSubAccount(ctx context.Context, subAccountID int64) error

RemoveSubAccount removes a subaccount given its id

func (*Deribit) ResetAPIKey

func (d *Deribit) ResetAPIKey(ctx context.Context, id int64) (*APIKeyData, error)

ResetAPIKey resets the api key to its default settings

func (*Deribit) ResetMMP

func (d *Deribit) ResetMMP(ctx context.Context, ccy currency.Code) error

ResetMMP sends a request to reset MMP for a currency provided

func (*Deribit) SayHello

func (d *Deribit) SayHello(clientName, clientVersion string) (*Info, error)

SayHello method used to introduce the client software connected to Deribit platform over websocket. It returns version information

func (*Deribit) SendHTTPAuthRequest

func (d *Deribit) SendHTTPAuthRequest(ctx context.Context, ep exchange.URL, epl request.EndpointLimit, method, path string, params url.Values, result interface{}) error

SendHTTPAuthRequest sends an authenticated request to deribit api

func (*Deribit) SendHTTPRequest

func (d *Deribit) SendHTTPRequest(ctx context.Context, ep exchange.URL, epl request.EndpointLimit, path string, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP request

func (*Deribit) SendRequestForQuote

func (d *Deribit) SendRequestForQuote(ctx context.Context, instrumentName string, amount float64, side order.Side) error

SendRequestForQuote sends RFQ on a given instrument.

func (*Deribit) SendWSRequest

func (d *Deribit) SendWSRequest(epl request.EndpointLimit, method string, params, response interface{}, authenticated bool) error

SendWSRequest sends a request through the websocket connection. both authenticated and public endpoints are allowed.

func (*Deribit) SetAnnouncementAsRead

func (d *Deribit) SetAnnouncementAsRead(ctx context.Context, id int64) error

SetAnnouncementAsRead sets an announcement as read

func (*Deribit) SetDefaults

func (d *Deribit) SetDefaults()

SetDefaults sets the basic defaults for Deribit

func (*Deribit) SetEmailForSubAccount

func (d *Deribit) SetEmailForSubAccount(ctx context.Context, sid int64, email string) error

SetEmailForSubAccount links an email given to the designated subaccount

func (*Deribit) SetEmailLanguage

func (d *Deribit) SetEmailLanguage(ctx context.Context, language string) error

SetEmailLanguage sets a requested language for an email

func (*Deribit) SetMMPConfig

func (d *Deribit) SetMMPConfig(ctx context.Context, ccy currency.Code, interval kline.Interval, frozenTime int64, quantityLimit, deltaLimit float64) error

SetMMPConfig sends a request to set the given parameter values to the mmp config for the provided currency

func (*Deribit) SetSelfTradingConfig

func (d *Deribit) SetSelfTradingConfig(ctx context.Context, mode string, extendedToSubaccounts bool) (string, error)

SetSelfTradingConfig configure self trading behavior mode: Self trading prevention behavior. Possible values: 'reject_taker', 'cancel_maker' extended_to_subaccounts: If value is true trading is prevented between subaccounts of given account

func (*Deribit) Setup

func (d *Deribit) Setup(exch *config.Exchange) error

Setup takes in the supplied exchange configuration details and sets params

func (*Deribit) SimulateBlockTrade

func (d *Deribit) SimulateBlockTrade(ctx context.Context, role string, trades []BlockTradeParam) (bool, error)

SimulateBlockTrade checks if a block trade can be executed

func (*Deribit) StringToAssetKind

func (d *Deribit) StringToAssetKind(assetType string) (asset.Item, error)

StringToAssetKind returns the asset type (kind) from a string representation.

func (*Deribit) SubmitBuy

func (d *Deribit) SubmitBuy(ctx context.Context, arg *OrderBuyAndSellParams) (*PrivateTradeData, error)

SubmitBuy submits a private buy request through the websocket connection.

func (*Deribit) SubmitCancel

func (d *Deribit) SubmitCancel(ctx context.Context, orderID string) (*PrivateCancelData, error)

SubmitCancel sends a request to cancel the order via its orderID

func (*Deribit) SubmitCancelAll

func (d *Deribit) SubmitCancelAll(ctx context.Context, detailed bool) (*MultipleCancelResponse, error)

SubmitCancelAll sends a request to cancel all user orders in all currencies and instruments

func (*Deribit) SubmitCancelAllByCurrency

func (d *Deribit) SubmitCancelAllByCurrency(ctx context.Context, ccy currency.Code, kind, orderType string, detailed bool) (*MultipleCancelResponse, error)

SubmitCancelAllByCurrency sends a request to cancel all user orders for the specified currency returns the total number of successfully cancelled orders

func (*Deribit) SubmitCancelAllByInstrument

func (d *Deribit) SubmitCancelAllByInstrument(ctx context.Context, instrument, orderType string, detailed, includeCombos bool) (*MultipleCancelResponse, error)

SubmitCancelAllByInstrument sends a request to cancel all user orders for the specified instrument returns the total number of successfully cancelled orders

func (*Deribit) SubmitCancelAllByKind

func (d *Deribit) SubmitCancelAllByKind(ctx context.Context, ccy currency.Code, kind, orderType string, detailed bool) (*MultipleCancelResponse, error)

SubmitCancelAllByKind cancels all orders in currency(currencies), optionally filtered by instrument kind and/or order type. 'kind' instrument kind . Possible values: 'future', 'option', 'spot', 'future_combo', 'option_combo', 'combo', 'any' returns the total number of successfully cancelled orders

func (*Deribit) SubmitCancelByLabel

func (d *Deribit) SubmitCancelByLabel(ctx context.Context, label string, ccy currency.Code, detailed bool) (*MultipleCancelResponse, error)

SubmitCancelByLabel sends a request to cancel all user orders for the specified label returns the total number of successfully cancelled orders

func (*Deribit) SubmitCancelQuotes

func (d *Deribit) SubmitCancelQuotes(ctx context.Context, ccy currency.Code, minDelta, maxDelta float64, cancelType, quoteSetID, instrumentName, kind string, detailed bool) (*MultipleCancelResponse, error)

SubmitCancelQuotes cancels quotes based on the provided type. Delta cancels quotes within a Delta range defined by MinDelta and MaxDelta. quote_set_id cancels quotes by a specific Quote Set identifier. instrument cancels all quotes associated with a particular instrument. kind cancels all quotes for a certain kind. currency cancels all quotes in a specified currency. "all" cancels all quotes.

possible cancel_type values are delta, 'quote_set_id', 'instrument', 'instrument_kind', 'currency', and 'all' possible kind values are future 'option', 'spot', 'future_combo', 'option_combo', 'combo', and 'any'

func (*Deribit) SubmitClosePosition

func (d *Deribit) SubmitClosePosition(ctx context.Context, instrument, orderType string, price float64) (*PrivateTradeData, error)

SubmitClosePosition sends a request to cancel all user orders for the specified label

func (*Deribit) SubmitEdit

func (d *Deribit) SubmitEdit(ctx context.Context, arg *OrderBuyAndSellParams) (*PrivateTradeData, error)

SubmitEdit submits an edit order request

func (*Deribit) SubmitOrder

func (d *Deribit) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)

SubmitOrder submits a new order

func (*Deribit) SubmitSell

func (d *Deribit) SubmitSell(ctx context.Context, arg *OrderBuyAndSellParams) (*PrivateTradeData, error)

SubmitSell submits a sell request with the parameters provided

func (*Deribit) SubmitTransferBetweenSubAccounts

func (d *Deribit) SubmitTransferBetweenSubAccounts(ctx context.Context, ccy currency.Code, amount float64, destinationID int64, source string) (*TransferData, error)

SubmitTransferBetweenSubAccounts transfer funds between two (sub)accounts. Id of the source (sub)account. Can be found in My Account >> Subaccounts tab. By default, it is the Id of the account which made the request. However, if a different "source" is specified, the user must possess the mainaccount scope, and only other subaccounts can be designated as the source.

func (*Deribit) SubmitTransferToSubAccount

func (d *Deribit) SubmitTransferToSubAccount(ctx context.Context, ccy currency.Code, amount float64, destinationID int64) (*TransferData, error)

SubmitTransferToSubAccount submits a request to transfer a currency to a subaccount

func (*Deribit) SubmitTransferToUser

func (d *Deribit) SubmitTransferToUser(ctx context.Context, ccy currency.Code, tfa, destinationAddress string, amount float64) (*TransferData, error)

SubmitTransferToUser submits a request to transfer a currency to another user

func (*Deribit) SubmitWithdraw

func (d *Deribit) SubmitWithdraw(ctx context.Context, ccy currency.Code, address, priority string, amount float64) (*WithdrawData, error)

SubmitWithdraw submits a withdrawal request to the exchange for the requested currency

func (*Deribit) Subscribe

func (d *Deribit) Subscribe(channelsToSubscribe subscription.List) error

Subscribe sends a websocket message to receive data from the channel

func (*Deribit) ToggleNotificationsFromSubAccount

func (d *Deribit) ToggleNotificationsFromSubAccount(ctx context.Context, sid int64, state bool) error

ToggleNotificationsFromSubAccount toggles the notifications from a subaccount specified

func (*Deribit) TogglePortfolioMargining

func (d *Deribit) TogglePortfolioMargining(ctx context.Context, userID int64, enabled, dryRun bool) ([]TogglePortfolioMarginResponse, error)

TogglePortfolioMargining toggle between SM and PM models.

func (*Deribit) ToggleSubAccountLogin

func (d *Deribit) ToggleSubAccountLogin(ctx context.Context, subAccountUserID int64, state bool) error

ToggleSubAccountLogin toggles access for subaccount login

func (*Deribit) Unsubscribe

func (d *Deribit) Unsubscribe(channelsToUnsubscribe subscription.List) error

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

func (*Deribit) UnsubscribeAll

func (d *Deribit) UnsubscribeAll() (string, error)

UnsubscribeAll unsubscribe from all the public channels subscribed so far.

func (*Deribit) UnsubscribeAllPrivateChannels

func (d *Deribit) UnsubscribeAllPrivateChannels() (string, error)

UnsubscribeAllPrivateChannels sends an unsubscribe request to cancel all private channels subscriptions

func (*Deribit) UpdateAccountInfo

func (d *Deribit) UpdateAccountInfo(ctx context.Context, _ asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies

func (*Deribit) UpdateOrderExecutionLimits

func (d *Deribit) UpdateOrderExecutionLimits(ctx context.Context, a asset.Item) error

UpdateOrderExecutionLimits sets exchange execution order limits for an asset type

func (*Deribit) UpdateOrderbook

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

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Deribit) UpdateTicker

func (d *Deribit) UpdateTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*Deribit) UpdateTickers

func (d *Deribit) UpdateTickers(_ context.Context, _ asset.Item) error

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

func (*Deribit) UpdateTradablePairs

func (d *Deribit) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

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

func (*Deribit) ValidateAPICredentials

func (d *Deribit) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error

ValidateAPICredentials validates current credentials used for wrapper functionality

func (*Deribit) VerifyBlockTrade

func (d *Deribit) VerifyBlockTrade(ctx context.Context, timestampMS time.Time, nonce, role string, ccy currency.Code, trades []BlockTradeParam) (string, error)

VerifyBlockTrade verifies and creates block trade signature

func (*Deribit) WSCancelTransferByID

func (d *Deribit) WSCancelTransferByID(ccy currency.Code, tfa string, id int64) (*AccountSummaryData, error)

WSCancelTransferByID cancels transfer by ID through the websocket connection.

func (*Deribit) WSCancelWithdrawal

func (d *Deribit) WSCancelWithdrawal(ccy currency.Code, id int64) (*CancelWithdrawalData, error)

WSCancelWithdrawal cancels withdrawal request for a given currency by its id through the websocket connection.

func (*Deribit) WSChangeAPIKeyName

func (d *Deribit) WSChangeAPIKeyName(id int64, name string) (*APIKeyData, error)

WSChangeAPIKeyName changes the name of the api key requested through the websocket connection.

func (*Deribit) WSChangeScopeInAPIKey

func (d *Deribit) WSChangeScopeInAPIKey(id int64, maxScope string) (*APIKeyData, error)

WSChangeScopeInAPIKey changes the name of the requested subaccount id through the websocket connection.

func (*Deribit) WSChangeSubAccountName

func (d *Deribit) WSChangeSubAccountName(sid int64, name string) error

WSChangeSubAccountName retrieves changes the name of the requested subaccount id through the websocket connection.

func (*Deribit) WSCreateAPIKey

func (d *Deribit) WSCreateAPIKey(maxScope, name string, defaultKey bool) (*APIKeyData, error)

WSCreateAPIKey creates an api key based on the provided settings through the websocket connection.

func (*Deribit) WSCreateCombo

func (d *Deribit) WSCreateCombo(args []ComboParam) (*ComboDetail, error)

WSCreateCombo verifies and creates a combo book or returns an existing combo matching given trades through the websocket connection.

func (*Deribit) WSCreateDepositAddress

func (d *Deribit) WSCreateDepositAddress(ccy currency.Code) (*DepositAddressData, error)

WSCreateDepositAddress creates a deposit address for the currency requested through the websocket connection.

func (*Deribit) WSCreateSubAccount

func (d *Deribit) WSCreateSubAccount() (*SubAccountData, error)

WSCreateSubAccount creates a new subaccount through the websocket connection.

func (*Deribit) WSDisableAPIKey

func (d *Deribit) WSDisableAPIKey(id int64) (*APIKeyData, error)

WSDisableAPIKey disables the api key linked to the provided id through the websocket connection.

func (*Deribit) WSEditOrderByLabel

func (d *Deribit) WSEditOrderByLabel(arg *OrderBuyAndSellParams) (*PrivateTradeData, error)

WSEditOrderByLabel submits an edit order request sorted via label through the websocket connection.

func (*Deribit) WSEnableAPIKey

func (d *Deribit) WSEnableAPIKey(id int64) (*APIKeyData, error)

WSEnableAPIKey enables the api key linked to the provided id through the websocket connection.

func (*Deribit) WSEnableAffiliateProgram

func (d *Deribit) WSEnableAffiliateProgram() error

WSEnableAffiliateProgram enables the affiliate program through the websocket connection.

func (*Deribit) WSExecuteBlockTrade

func (d *Deribit) WSExecuteBlockTrade(timestampMS time.Time, nonce, role string, ccy currency.Code, trades []BlockTradeParam) ([]BlockTradeResponse, error)

WSExecuteBlockTrade executes a block trade request The whole request have to be exact the same as in private/verify_block_trade, only role field should be set appropriately - it basically means that both sides have to agree on the same timestamp, nonce, trades fields and server will assure that role field is different between sides (each party accepted own role). Using the same timestamp and nonce by both sides in private/verify_block_trade assures that even if unintentionally both sides execute given block trade with valid counterparty_signature, the given block trade will be executed only once

func (*Deribit) WSListAPIKeys

func (d *Deribit) WSListAPIKeys(tfa string) ([]APIKeyData, error)

WSListAPIKeys retrieves all the api keys associated with a user account through the websocket connection.

func (*Deribit) WSMovePositions

func (d *Deribit) WSMovePositions(ccy currency.Code, sourceSubAccountUID, targetSubAccountUID int64, trades []BlockTradeParam) ([]BlockTradeMoveResponse, error)

WSMovePositions moves positions from source subaccount to target subaccount through the websocket connection.

func (*Deribit) WSRemoveAPIKey

func (d *Deribit) WSRemoveAPIKey(id int64) error

WSRemoveAPIKey removes api key vid ID through the websocket connection.

func (*Deribit) WSRemoveSubAccount

func (d *Deribit) WSRemoveSubAccount(subAccountID int64) error

WSRemoveSubAccount removes a subaccount given its id through the websocket connection.

func (*Deribit) WSResetAPIKey

func (d *Deribit) WSResetAPIKey(id int64) error

WSResetAPIKey sets an announcement as read through the websocket connection.

func (*Deribit) WSResetMMP

func (d *Deribit) WSResetMMP(ccy currency.Code) error

WSResetMMP sends a request to reset MMP for a currency provided through the websocket connection.

func (*Deribit) WSRetrieveAccessLog

func (d *Deribit) WSRetrieveAccessLog(offset, count int64) (*AccessLog, error)

WSRetrieveAccessLog lists access logs for the user through the websocket connection.

func (*Deribit) WSRetrieveAccountSummary

func (d *Deribit) WSRetrieveAccountSummary(ccy currency.Code, extended bool) (*AccountSummaryData, error)

WSRetrieveAccountSummary retrieves account summary data for the requested instrument through the websocket connection.

func (*Deribit) WSRetrieveAffiliateProgramInfo

func (d *Deribit) WSRetrieveAffiliateProgramInfo() (*AffiliateProgramInfo, error)

WSRetrieveAffiliateProgramInfo retrieves the affiliate program info through the websocket connection.

func (*Deribit) WSRetrieveAnnouncements

func (d *Deribit) WSRetrieveAnnouncements(startTime time.Time, count int64) ([]Announcement, error)

WSRetrieveAnnouncements retrieves announcements through the websocket connection. Default "start_timestamp" parameter value is current timestamp, "count" parameter value must be between 1 and 50, default is 5.

func (*Deribit) WSRetrieveBookBySummary

func (d *Deribit) WSRetrieveBookBySummary(ccy currency.Code, kind string) ([]BookSummaryData, error)

WSRetrieveBookBySummary retrieves book summary data for currency requested through websocket connection.

func (*Deribit) WSRetrieveBookSummaryByInstrument

func (d *Deribit) WSRetrieveBookSummaryByInstrument(instrument string) ([]BookSummaryData, error)

WSRetrieveBookSummaryByInstrument retrieves book summary data for instrument requested through the websocket connection.

func (*Deribit) WSRetrieveComboDetails

func (d *Deribit) WSRetrieveComboDetails(comboID string) (*ComboDetail, error)

WSRetrieveComboDetails retrieves information about a combo through the websocket connection.

func (*Deribit) WSRetrieveComboIDs

func (d *Deribit) WSRetrieveComboIDs(ccy currency.Code, state string) ([]string, error)

WSRetrieveComboIDs Retrieves available combos. This method can be used to get the list of all combos, or only the list of combos in the given state.

func (*Deribit) WSRetrieveCombos

func (d *Deribit) WSRetrieveCombos(ccy currency.Code) ([]ComboDetail, error)

WSRetrieveCombos retrieves information about active combos through the websocket connection.

func (*Deribit) WSRetrieveContractSize

func (d *Deribit) WSRetrieveContractSize(instrument string) (*ContractSizeData, error)

WSRetrieveContractSize retrieves contract size for instrument requested through the websocket connection.

func (*Deribit) WSRetrieveCurrencies

func (d *Deribit) WSRetrieveCurrencies() ([]CurrencyData, error)

WSRetrieveCurrencies retrieves all cryptocurrencies supported by the API through the websocket connection.

func (*Deribit) WSRetrieveCurrencyIndexPrice

func (d *Deribit) WSRetrieveCurrencyIndexPrice(ccy currency.Code) (map[string]float64, error)

WSRetrieveCurrencyIndexPrice the current index price for the instruments, for the selected currency through the websocket connection.

func (*Deribit) WSRetrieveCurrentDepositAddress

func (d *Deribit) WSRetrieveCurrentDepositAddress(ccy currency.Code) (*DepositAddressData, error)

WSRetrieveCurrentDepositAddress retrieves the current deposit address for the requested currency through the websocket connection.

func (*Deribit) WSRetrieveDeliveryPrices

func (d *Deribit) WSRetrieveDeliveryPrices(indexName string, offset, count int64) (*IndexDeliveryPrice, error)

WSRetrieveDeliveryPrices retrieves delivery prices using index name through the websocket connection.

func (*Deribit) WSRetrieveDeposits

func (d *Deribit) WSRetrieveDeposits(ccy currency.Code, count, offset int64) (*DepositsData, error)

WSRetrieveDeposits retrieves the deposits of a given currency through the websocket connection.

func (*Deribit) WSRetrieveEmailLanguage

func (d *Deribit) WSRetrieveEmailLanguage() (string, error)

WSRetrieveEmailLanguage retrieves the current language set for the email through the websocket connection.

func (*Deribit) WSRetrieveFundingChartData

func (d *Deribit) WSRetrieveFundingChartData(instrument, length string) (*FundingChartData, error)

WSRetrieveFundingChartData retrieves funding chart data for the requested instrument and time length through the websocket connection. supported lengths: 8h, 24h, 1m <-(1month)

func (*Deribit) WSRetrieveFundingRateHistory

func (d *Deribit) WSRetrieveFundingRateHistory(instrumentName string, startTime, endTime time.Time) ([]FundingRateHistory, error)

WSRetrieveFundingRateHistory retrieves hourly historical interest rate for requested PERPETUAL instrument through the websocket connection.

func (*Deribit) WSRetrieveFundingRateValue

func (d *Deribit) WSRetrieveFundingRateValue(instrument string, startTime, endTime time.Time) (float64, error)

WSRetrieveFundingRateValue retrieves funding rate value data through the websocket connection.

func (*Deribit) WSRetrieveHistoricalVolatility

func (d *Deribit) WSRetrieveHistoricalVolatility(ccy currency.Code) ([]HistoricalVolatilityData, error)

WSRetrieveHistoricalVolatility retrieves historical volatility data

func (*Deribit) WSRetrieveIndexPrice

func (d *Deribit) WSRetrieveIndexPrice(index string) (*IndexPriceData, error)

WSRetrieveIndexPrice retrieves price data for the requested index through the websocket connection.

func (*Deribit) WSRetrieveIndexPriceNames

func (d *Deribit) WSRetrieveIndexPriceNames() ([]string, error)

WSRetrieveIndexPriceNames names of indexes through the websocket connection.

func (*Deribit) WSRetrieveInstrumentData

func (d *Deribit) WSRetrieveInstrumentData(instrument string) (*InstrumentData, error)

WSRetrieveInstrumentData retrieves data for a requested instrument through the websocket connection.

func (*Deribit) WSRetrieveInstrumentsData

func (d *Deribit) WSRetrieveInstrumentsData(ccy currency.Code, kind string, expired bool) ([]InstrumentData, error)

WSRetrieveInstrumentsData gets data for all available instruments

func (*Deribit) WSRetrieveLastBlockTradesByCurrency

func (d *Deribit) WSRetrieveLastBlockTradesByCurrency(ccy currency.Code, startID, endID string, count int64) ([]BlockTradeData, error)

WSRetrieveLastBlockTradesByCurrency returns list of last users block trades through the websocket connection.

func (*Deribit) WSRetrieveLastSettlementsByCurrency

func (d *Deribit) WSRetrieveLastSettlementsByCurrency(ccy currency.Code, settlementType, continuation string, count int64, startTime time.Time) (*SettlementsData, error)

WSRetrieveLastSettlementsByCurrency retrieves last settlement data by currency through the websocket connection.

func (*Deribit) WSRetrieveLastSettlementsByInstrument

func (d *Deribit) WSRetrieveLastSettlementsByInstrument(instrument, settlementType, continuation string, count int64, startTime time.Time) (*SettlementsData, error)

WSRetrieveLastSettlementsByInstrument retrieves last settlement data for requested instrument through the websocket connection.

func (*Deribit) WSRetrieveLastTradesByCurrency

func (d *Deribit) WSRetrieveLastTradesByCurrency(ccy currency.Code, kind, startID, endID, sorting string, count int64, includeOld bool) (*PublicTradesData, error)

WSRetrieveLastTradesByCurrency retrieves last trades for requested currency through the websocket connection.

func (*Deribit) WSRetrieveLastTradesByCurrencyAndTime

func (d *Deribit) WSRetrieveLastTradesByCurrencyAndTime(ccy currency.Code, kind, sorting string, count int64, includeOld bool, startTime, endTime time.Time) (*PublicTradesData, error)

WSRetrieveLastTradesByCurrencyAndTime retrieves last trades for requested currency and time intervals through the websocket connection.

func (*Deribit) WSRetrieveLastTradesByInstrument

func (d *Deribit) WSRetrieveLastTradesByInstrument(instrument, startSeq, endSeq, sorting string, count int64, includeOld bool) (*PublicTradesData, error)

WSRetrieveLastTradesByInstrument retrieves last trades for requested instrument requested through the websocket connection.

func (*Deribit) WSRetrieveLastTradesByInstrumentAndTime

func (d *Deribit) WSRetrieveLastTradesByInstrumentAndTime(instrument, sorting string, count int64, includeOld bool, startTime, endTime time.Time) (*PublicTradesData, error)

WSRetrieveLastTradesByInstrumentAndTime retrieves last trades for requested instrument requested and time intervals through the websocket connection.

func (*Deribit) WSRetrieveMMPConfig

func (d *Deribit) WSRetrieveMMPConfig(ccy currency.Code) (*MMPConfigData, error)

WSRetrieveMMPConfig sends a request to fetch the config for MMP of the requested currency through the websocket connection.

func (*Deribit) WSRetrieveMargins

func (d *Deribit) WSRetrieveMargins(instrument string, amount, price float64) (*MarginsData, error)

WSRetrieveMargins sends a request to fetch account margins data through the websocket connection.

func (*Deribit) WSRetrieveMarkPriceHistory

func (d *Deribit) WSRetrieveMarkPriceHistory(instrument string, startTime, endTime time.Time) ([]MarkPriceHistory, error)

WSRetrieveMarkPriceHistory retrieves data for mark price history through the websocket connection.

func (*Deribit) WSRetrieveNewAnnouncements

func (d *Deribit) WSRetrieveNewAnnouncements() ([]Announcement, error)

WSRetrieveNewAnnouncements retrieves new announcements through the websocket connection.

func (*Deribit) WSRetrieveOpenOrdersByCurrency

func (d *Deribit) WSRetrieveOpenOrdersByCurrency(ccy currency.Code, kind, orderType string) ([]OrderData, error)

WSRetrieveOpenOrdersByCurrency retrieves open order by symbol and kind

func (*Deribit) WSRetrieveOpenOrdersByInstrument

func (d *Deribit) WSRetrieveOpenOrdersByInstrument(instrument, orderType string) ([]OrderData, error)

WSRetrieveOpenOrdersByInstrument sends a request to fetch open orders data sorted by requested params through the websocket connection.

func (*Deribit) WSRetrieveOpenOrdersByLabel

func (d *Deribit) WSRetrieveOpenOrdersByLabel(ccy currency.Code, label string) ([]OrderData, error)

WSRetrieveOpenOrdersByLabel retrieves open order by label and currency

func (*Deribit) WSRetrieveOrderHistoryByCurrency

func (d *Deribit) WSRetrieveOrderHistoryByCurrency(ccy currency.Code, kind string, count, offset int64, includeOld, includeUnfilled bool) ([]OrderData, error)

WSRetrieveOrderHistoryByCurrency sends a request to fetch order history according to given params and currency through the websocket connection.

func (*Deribit) WSRetrieveOrderHistoryByInstrument

func (d *Deribit) WSRetrieveOrderHistoryByInstrument(instrument string, count, offset int64, includeOld, includeUnfilled bool) ([]OrderData, error)

WSRetrieveOrderHistoryByInstrument sends a request to fetch order history according to given params and instrument through the websocket connection.

func (*Deribit) WSRetrieveOrderMarginsByID

func (d *Deribit) WSRetrieveOrderMarginsByID(ids []string) ([]OrderData, error)

WSRetrieveOrderMarginsByID sends a request to fetch order margins data according to their ids through the websocket connection.

func (*Deribit) WSRetrieveOrderbookByInstrumentID

func (d *Deribit) WSRetrieveOrderbookByInstrumentID(instrumentID int64, depth float64) (*Orderbook, error)

WSRetrieveOrderbookByInstrumentID retrieves orderbook by instrument ID through websocket connection.

func (*Deribit) WSRetrieveOrderbookData

func (d *Deribit) WSRetrieveOrderbookData(instrument string, depth int64) (*Orderbook, error)

WSRetrieveOrderbookData retrieves data orderbook of requested instrument through the web-socket connection.

func (*Deribit) WSRetrievePosition

func (d *Deribit) WSRetrievePosition(instrument string) (*PositionData, error)

WSRetrievePosition retrieves the data of all positions in the requested instrument name through the websocket connection.

func (*Deribit) WSRetrievePositions

func (d *Deribit) WSRetrievePositions(ccy currency.Code, kind string) ([]PositionData, error)

WSRetrievePositions retrieves positions data of the user account through the websocket connection.

func (*Deribit) WSRetrievePrivatePortfolioMargins

func (d *Deribit) WSRetrievePrivatePortfolioMargins(ccy currency.Code, accPositions bool, simulatedPositions map[string]float64) (*PortfolioMargin, error)

WSRetrievePrivatePortfolioMargins alculates portfolio margin info for simulated position or current position of the user through the websocket connection. This request has special restricted rate limit (not more than once per a second).

func (*Deribit) WSRetrievePublicPortfolioMargins

func (d *Deribit) WSRetrievePublicPortfolioMargins(ccy currency.Code, simulatedPositions map[string]float64) (*PortfolioMargin, error)

WSRetrievePublicPortfolioMargins public version of the method calculates portfolio margin info for simulated position. For concrete user position, the private version of the method must be used. The public version of the request has special restricted rate limit (not more than once per a second for the IP).

func (*Deribit) WSRetrievePublicTicker

func (d *Deribit) WSRetrievePublicTicker(instrument string) (*TickerData, error)

WSRetrievePublicTicker retrieves public ticker data of the instrument requested through the websocket connection.

func (*Deribit) WSRetrieveRequestForQuote

func (d *Deribit) WSRetrieveRequestForQuote(ccy currency.Code, kind string) ([]RequestForQuote, error)

WSRetrieveRequestForQuote retrieves RFQ information.

func (*Deribit) WSRetrieveSettlementHistoryByCurency

func (d *Deribit) WSRetrieveSettlementHistoryByCurency(ccy currency.Code, settlementType, continuation string, count int64, searchStartTimeStamp time.Time) (*PrivateSettlementsHistoryData, error)

WSRetrieveSettlementHistoryByCurency sends a request to fetch settlement history data sorted by currency through the websocket connection.

func (*Deribit) WSRetrieveSettlementHistoryByInstrument

func (d *Deribit) WSRetrieveSettlementHistoryByInstrument(instrument, settlementType, continuation string, count int64, searchStartTimeStamp time.Time) (*PrivateSettlementsHistoryData, error)

WSRetrieveSettlementHistoryByInstrument sends a request to fetch settlement history data sorted by instrument through the websocket connection.

func (*Deribit) WSRetrieveSubAccountDetails

func (d *Deribit) WSRetrieveSubAccountDetails(ccy currency.Code, withOpenOrders bool) ([]SubAccountDetail, error)

WSRetrieveSubAccountDetails retrieves sub-account detail information through the websocket connection.

func (*Deribit) WSRetrieveSubAccounts

func (d *Deribit) WSRetrieveSubAccounts(withPortfolio bool) ([]SubAccountData, error)

WSRetrieveSubAccounts retrieves all subaccounts' data through the websocket connection.

func (*Deribit) WSRetrieveTradeVolumes

func (d *Deribit) WSRetrieveTradeVolumes(extended bool) ([]TradeVolumesData, error)

WSRetrieveTradeVolumes retrieves trade volumes' data of all instruments through the websocket connection.

func (*Deribit) WSRetrieveTransactionLog

func (d *Deribit) WSRetrieveTransactionLog(ccy currency.Code, query string, startTime, endTime time.Time, count, continuation int64) (*TransactionsData, error)

WSRetrieveTransactionLog retrieves transaction logs data through the websocket connection.

func (*Deribit) WSRetrieveTransfers

func (d *Deribit) WSRetrieveTransfers(ccy currency.Code, count, offset int64) (*TransfersData, error)

WSRetrieveTransfers retrieves data for the requested currency through the websocket connection.

func (*Deribit) WSRetrieveTriggerOrderHistory

func (d *Deribit) WSRetrieveTriggerOrderHistory(ccy currency.Code, instrumentName, continuation string, count int64) (*OrderData, error)

WSRetrieveTriggerOrderHistory sends a request to fetch order state of the order id provided through the websocket connection.

func (*Deribit) WSRetrieveUserBlockTrade

func (d *Deribit) WSRetrieveUserBlockTrade(id string) ([]BlockTradeData, error)

WSRetrieveUserBlockTrade returns information about users block trade through the websocket connection.

func (*Deribit) WSRetrieveUserLocks

func (d *Deribit) WSRetrieveUserLocks() ([]UserLock, error)

WSRetrieveUserLocks retrieves information about locks on user account through the websocket connection.

func (*Deribit) WSRetrieveUserTradesByCurrency

func (d *Deribit) WSRetrieveUserTradesByCurrency(ccy currency.Code, kind, startID, endID, sorting string, count int64, includeOld bool) (*UserTradesData, error)

WSRetrieveUserTradesByCurrency sends a request to fetch user trades sorted by currency through the websocket connection.

func (*Deribit) WSRetrieveUserTradesByCurrencyAndTime

func (d *Deribit) WSRetrieveUserTradesByCurrencyAndTime(ccy currency.Code, kind, sorting string, count int64, startTime, endTime time.Time) (*UserTradesData, error)

WSRetrieveUserTradesByCurrencyAndTime retrieves user trades sorted by currency and time through the websocket connection.

func (*Deribit) WSRetrieveUserTradesByInstrumentAndTime

func (d *Deribit) WSRetrieveUserTradesByInstrumentAndTime(instrument, sorting string, count int64, includeOld bool, startTime, endTime time.Time) (*UserTradesData, error)

WSRetrieveUserTradesByInstrumentAndTime retrieves user trades sorted by instrument and time through the websocket connection.

func (*Deribit) WSRetrieveUserTradesByOrder

func (d *Deribit) WSRetrieveUserTradesByOrder(orderID, sorting string) (*UserTradesData, error)

WSRetrieveUserTradesByOrder retrieves user trades fetched by orderID through the web socket connection.

func (*Deribit) WSRetrieveVolatilityIndexData

func (d *Deribit) WSRetrieveVolatilityIndexData(ccy currency.Code, resolution string, startTime, endTime time.Time) ([]VolatilityIndexData, error)

WSRetrieveVolatilityIndexData retrieves volatility index data for the requested currency through the websocket connection.

func (*Deribit) WSRetrieveWithdrawals

func (d *Deribit) WSRetrieveWithdrawals(ccy currency.Code, count, offset int64) (*WithdrawalsData, error)

WSRetrieveWithdrawals retrieves withdrawals data for a requested currency through the websocket connection.

func (*Deribit) WSRetrievesOrderState

func (d *Deribit) WSRetrievesOrderState(orderID string) (*OrderData, error)

WSRetrievesOrderState sends a request to fetch order state of the order id provided

func (*Deribit) WSRetrievesTradingViewChartData

func (d *Deribit) WSRetrievesTradingViewChartData(instrument, resolution string, startTime, endTime time.Time) (*TVChartData, error)

WSRetrievesTradingViewChartData retrieves volatility index data for the requested instrument through the websocket connection.

func (*Deribit) WSSendRequestForQuote

func (d *Deribit) WSSendRequestForQuote(instrumentName string, amount float64, side order.Side) error

WSSendRequestForQuote sends RFQ on a given instrument through the websocket connection.

func (*Deribit) WSSetEmailForSubAccount

func (d *Deribit) WSSetEmailForSubAccount(sid int64, email string) error

WSSetEmailForSubAccount links an email given to the designated subaccount through the websocket connection.

func (*Deribit) WSSetEmailLanguage

func (d *Deribit) WSSetEmailLanguage(language string) error

WSSetEmailLanguage sets a requested language for an email through the websocket connection.

func (*Deribit) WSSetMMPConfig

func (d *Deribit) WSSetMMPConfig(ccy currency.Code, interval kline.Interval, frozenTime int64, quantityLimit, deltaLimit float64) error

WSSetMMPConfig sends a request to set the given parameter values to the mmp config for the provided currency through the websocket connection.

func (*Deribit) WSSubmitBuy

func (d *Deribit) WSSubmitBuy(arg *OrderBuyAndSellParams) (*PrivateTradeData, error)

WSSubmitBuy submits a private buy request through the websocket connection.

func (*Deribit) WSSubmitCancel

func (d *Deribit) WSSubmitCancel(orderID string) (*PrivateCancelData, error)

WSSubmitCancel sends a request to cancel the order via its orderID through the websocket connection.

func (*Deribit) WSSubmitCancelAll

func (d *Deribit) WSSubmitCancelAll(detailed bool) (*MultipleCancelResponse, error)

WSSubmitCancelAll sends a request to cancel all user orders in all currencies and instruments

func (*Deribit) WSSubmitCancelAllByCurrency

func (d *Deribit) WSSubmitCancelAllByCurrency(ccy currency.Code, kind, orderType string, detailed bool) (*MultipleCancelResponse, error)

WSSubmitCancelAllByCurrency sends a request to cancel all user orders for the specified currency through the websocket connection.

func (*Deribit) WSSubmitCancelAllByInstrument

func (d *Deribit) WSSubmitCancelAllByInstrument(instrument, orderType string, detailed, includeCombos bool) (*MultipleCancelResponse, error)

WSSubmitCancelAllByInstrument sends a request to cancel all user orders for the specified instrument through the websocket connection.

func (*Deribit) WSSubmitCancelByLabel

func (d *Deribit) WSSubmitCancelByLabel(label string, ccy currency.Code, detailed bool) (*MultipleCancelResponse, error)

WSSubmitCancelByLabel sends a request to cancel all user orders for the specified label through the websocket connection.

func (*Deribit) WSSubmitCancelQuotes

func (d *Deribit) WSSubmitCancelQuotes(ccy currency.Code, minDelta, maxDelta float64, cancelType, quoteSetID, instrumentName, kind string, detailed bool) (*MultipleCancelResponse, error)

WSSubmitCancelQuotes cancels quotes based on the provided type.

possible cancel_type values are delta, 'quote_set_id', 'instrument', 'instrument_kind', 'currency', and 'all' possible kind values are future 'option', 'spot', 'future_combo', 'option_combo', 'combo', and 'any'

func (*Deribit) WSSubmitClosePosition

func (d *Deribit) WSSubmitClosePosition(instrument, orderType string, price float64) (*PrivateTradeData, error)

WSSubmitClosePosition sends a request to cancel all user orders for the specified label through the websocket connection.

func (*Deribit) WSSubmitEdit

func (d *Deribit) WSSubmitEdit(arg *OrderBuyAndSellParams) (*PrivateTradeData, error)

WSSubmitEdit submits an edit order request through the websocket connection.

func (*Deribit) WSSubmitSell

func (d *Deribit) WSSubmitSell(arg *OrderBuyAndSellParams) (*PrivateTradeData, error)

WSSubmitSell submits a sell request with the parameters provided through the websocket connection.

func (*Deribit) WSSubmitTransferToSubAccount

func (d *Deribit) WSSubmitTransferToSubAccount(ccy currency.Code, amount float64, destinationID int64) (*TransferData, error)

WSSubmitTransferToSubAccount submits a request to transfer a currency to a subaccount

func (*Deribit) WSSubmitTransferToUser

func (d *Deribit) WSSubmitTransferToUser(ccy currency.Code, tfa, destinationAddress string, amount float64) (*TransferData, error)

WSSubmitTransferToUser submits a request to transfer a currency to another user through the websocket connection.

func (*Deribit) WSSubmitWithdraw

func (d *Deribit) WSSubmitWithdraw(ccy currency.Code, address, priority string, amount float64) (*WithdrawData, error)

WSSubmitWithdraw submits a withdrawal request to the exchange for the requested currency through the websocket connection.

func (*Deribit) WSToggleNotificationsFromSubAccount

func (d *Deribit) WSToggleNotificationsFromSubAccount(sid int64, state bool) error

WSToggleNotificationsFromSubAccount toggles the notifications from a subaccount specified through the websocket connection.

func (*Deribit) WSTogglePortfolioMargining

func (d *Deribit) WSTogglePortfolioMargining(userID int64, enabled, dryRun bool) ([]TogglePortfolioMarginResponse, error)

WSTogglePortfolioMargining toggle between SM and PM models through the websocket connection.

func (*Deribit) WSToggleSubAccountLogin

func (d *Deribit) WSToggleSubAccountLogin(sid int64, state bool) error

WSToggleSubAccountLogin toggles access for subaccount login through the websocket connection.

func (*Deribit) WSVerifyBlockTrade

func (d *Deribit) WSVerifyBlockTrade(timestampMS time.Time, nonce, role string, ccy currency.Code, trades []BlockTradeParam) (string, error)

WSVerifyBlockTrade verifies and creates block trade signature through the websocket connection.

func (*Deribit) WithdrawCryptocurrencyFunds

func (d *Deribit) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*Deribit) WithdrawFiatFunds

func (d *Deribit) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*Deribit) WithdrawFiatFundsToInternationalBank

func (d *Deribit) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*Deribit) WsChangeMarginModel

func (d *Deribit) WsChangeMarginModel(userID int64, marginModel string, dryRun bool) ([]TogglePortfolioMarginResponse, error)

WsChangeMarginModel change margin model Margin model: 'cross_pm', 'cross_sm', 'segregated_pm', 'segregated_sm' 'dry_run': If true request returns the result without switching the margining model. Default: false

func (*Deribit) WsConnect

func (d *Deribit) WsConnect() error

WsConnect starts a new connection with the websocket API

func (*Deribit) WsDisableCancelOnDisconnect

func (d *Deribit) WsDisableCancelOnDisconnect(scope string) (string, error)

WsDisableCancelOnDisconnect isable Cancel On Disconnect for the connection. When change is applied for the account, then every newly opened connection will start with inactive Cancel on Disconnect. scope: possible values are 'connection', 'account'

func (*Deribit) WsEditAPIKey

func (d *Deribit) WsEditAPIKey(id int64, maxScope, name string, enabled bool, enabledFeatures, ipWhitelist []string) (*APIKeyData, error)

WsEditAPIKey edits existing API key. At least one parameter is required. Describes maximal access for tokens generated with given key, possible values: trade:[read, read_write, none], wallet:[read, read_write, none], account:[read, read_write, none], block_trade:[read, read_write, none].

func (*Deribit) WsEnableCancelOnDisconnect

func (d *Deribit) WsEnableCancelOnDisconnect(scope string) (string, error)

WsEnableCancelOnDisconnect enable Cancel On Disconnect for the connection. After enabling Cancel On Disconnect all orders created by the connection will be removed when the connection is closed.

func (*Deribit) WsExchangeToken

func (d *Deribit) WsExchangeToken(refreshToken string, subjectID int64) (*RefreshTokenInfo, error)

WsExchangeToken generates a token for a new subject id. This method can be used to switch between subaccounts.

func (*Deribit) WsForkToken

func (d *Deribit) WsForkToken(refreshToken, sessionName string) (*RefreshTokenInfo, error)

WsForkToken generates a token for a new named session. This method can be used only with session scoped tokens.

func (*Deribit) WsInvalidateBlockTradeSignature

func (d *Deribit) WsInvalidateBlockTradeSignature(signature string) error

WsInvalidateBlockTradeSignature user at any time (before the private/execute_block_trade is called) can invalidate its own signature effectively cancelling block trade through the websocket connection.

func (*Deribit) WsLogout

func (d *Deribit) WsLogout(invalidateToken bool) error

WsLogout gracefully close websocket connection, when COD (Cancel On Disconnect) is enabled orders are not cancelled

func (*Deribit) WsRetrieveCancelOnDisconnect

func (d *Deribit) WsRetrieveCancelOnDisconnect(scope string) (*CancelOnDisconnect, error)

WsRetrieveCancelOnDisconnect read current Cancel On Disconnect configuration for the account. 'scope': Specifies if Cancel On Disconnect change should be applied/checked for the current connection or the account (default - connection) Scope connection can be used only when working via Websocket.

func (*Deribit) WsRetrieveCustodyAccounts

func (d *Deribit) WsRetrieveCustodyAccounts(ccy currency.Code) ([]CustodyAccount, error)

WsRetrieveCustodyAccounts retrieves user custody accounts

func (*Deribit) WsRetrieveOrderStateByLabel

func (d *Deribit) WsRetrieveOrderStateByLabel(ccy currency.Code, label string) ([]OrderData, error)

WsRetrieveOrderStateByLabel retrieves an order state by label and currency

func (*Deribit) WsRetrieveSupportedIndexNames

func (d *Deribit) WsRetrieveSupportedIndexNames(priceIndexType string) ([]string, error)

WsRetrieveSupportedIndexNames retrieves the identifiers of all supported Price Indexes 'type' represents Type of a cryptocurrency price index. possible 'all', 'spot', 'derivative'

func (*Deribit) WsRetrieveUserTradesByInstrument

func (d *Deribit) WsRetrieveUserTradesByInstrument(instrument, sorting string, startSeq, endSeq, count int64, includeOld bool) (*UserTradesData, error)

WsRetrieveUserTradesByInstrument retrieves user trades sorted by instrument through the websocket connection.

func (*Deribit) WsSetSelfTradingConfig

func (d *Deribit) WsSetSelfTradingConfig(mode string, extendedToSubaccounts bool) (string, error)

WsSetSelfTradingConfig configure self trading behavior through the websocket connection. mode: Self trading prevention behavior. Possible values: 'reject_taker', 'cancel_maker' extended_to_subaccounts: If value is true trading is prevented between subaccounts of given account

func (*Deribit) WsSimulateBlockTrade

func (d *Deribit) WsSimulateBlockTrade(role string, trades []BlockTradeParam) (bool, error)

WsSimulateBlockTrade checks if a block trade can be executed through the websocket stream.

func (*Deribit) WsSubmitCancelAllByKind

func (d *Deribit) WsSubmitCancelAllByKind(ccy currency.Code, kind, orderType string, detailed bool) (*MultipleCancelResponse, error)

WsSubmitCancelAllByKind cancels all orders in currency(currencies), optionally filtered by instrument kind and/or order type. 'kind' Instrument kind. Possible values: 'future', 'option', 'spot', 'future_combo', 'option_combo', 'combo', 'any'

func (*Deribit) WsSubmitTransferBetweenSubAccounts

func (d *Deribit) WsSubmitTransferBetweenSubAccounts(ccy currency.Code, amount float64, destinationID int64, source string) (*TransferData, error)

WsSubmitTransferBetweenSubAccounts transfer funds between two (sub)accounts.

type ErrInfo

type ErrInfo struct {
	Message string `json:"message"`
	Data    struct {
		Param  string `json:"param"`
		Reason string `json:"reason"`
	} `json:"data"`
	Code int64 `json:"code"`
}

ErrInfo represents an error response messages

type FundingChartData

type FundingChartData struct {
	CurrentInterest float64 `json:"current_interest"`
	Interest8H      float64 `json:"interest_8h"`
	Data            []struct {
		IndexPrice float64    `json:"index_price"`
		Interest8H float64    `json:"interest_8h"`
		Timestamp  types.Time `json:"timestamp"`
	} `json:"data"`
}

FundingChartData stores futures funding chart data

type FundingRateHistory

type FundingRateHistory struct {
	Timestamp      types.Time `json:"timestamp"`
	IndexPrice     float64    `json:"index_price"`      // Index price in base currency
	PrevIndexPrice float64    `json:"prev_index_price"` // Previous index price in base currency
	Interest8H     float64    `json:"interest_8h"`      // 8hour interest rate
	Interest1H     float64    `json:"interest_1h"`      // 1hour interest rate
}

FundingRateHistory represents a funding rate history item

type HistoricalVolatilityData

type HistoricalVolatilityData struct {
	Timestamp float64
	Value     float64
}

HistoricalVolatilityData stores volatility data for requested symbols

type IndexDeliveryPrice

type IndexDeliveryPrice struct {
	Data         []DeliveryPriceData `json:"data"`
	TotalRecords int64               `json:"records_total"`
}

IndexDeliveryPrice store index delivery prices list.

type IndexPrice

type IndexPrice struct {
	BTC float64 `json:"BTC"`
	ETH float64 `json:"ETH"`
	Edp float64 `json:"edp"`
}

IndexPrice holds index price for the instruments

type IndexPriceData

type IndexPriceData struct {
	EstimatedDeliveryPrice float64 `json:"estimated_delivery_price"`
	IndexPrice             float64 `json:"index_price"`
}

IndexPriceData gets index price data

type Info

type Info struct {
	Version string `json:"version"`
}

Info holds version information

type InitialMarginInfo

type InitialMarginInfo struct {
	InitialMarginCurrency string  `json:"initial_margin_currency"`
	InitialMargin         float64 `json:"initial_margin"`
	OrderID               string  `json:"order_id"`
}

InitialMarginInfo represents an initial margin of an order.

type InstrumentData

type InstrumentData struct {
	InstrumentName               string     `json:"instrument_name"`
	BaseCurrency                 string     `json:"base_currency"`
	Kind                         string     `json:"kind"`
	OptionType                   string     `json:"option_type"`
	QuoteCurrency                string     `json:"quote_currency"`
	BlockTradeCommission         float64    `json:"block_trade_commission"`
	ContractSize                 float64    `json:"contract_size"`
	CreationTimestamp            types.Time `json:"creation_timestamp"`
	ExpirationTimestamp          types.Time `json:"expiration_timestamp"`
	IsActive                     bool       `json:"is_active"`
	Leverage                     float64    `json:"leverage"`
	MaxLeverage                  float64    `json:"max_leverage"`
	MakerCommission              float64    `json:"maker_commission"`
	MinimumTradeAmount           float64    `json:"min_trade_amount"`
	TickSize                     float64    `json:"tick_size"`
	TakerCommission              float64    `json:"taker_commission"`
	Strike                       float64    `json:"strike"`
	SettlementPeriod             string     `json:"settlement_period"`
	SettlementCurrency           string     `json:"settlement_currency"`
	RequestForQuote              bool       `json:"rfq"`
	PriceIndex                   string     `json:"price_index"`
	InstrumentID                 int64      `json:"instrument_id"`
	CounterCurrency              string     `json:"counter_currency"`
	MaximumLiquidationCommission float64    `json:"max_liquidation_commission"`
	FutureType                   string     `json:"future_type"`
	TickSizeSteps                []struct {
		AbovePrice float64 `json:"above_price"`
		TickSize   float64 `json:"tick_size"`
	} `json:"tick_size_steps"`
	BlockTradeTickSize       float64 `json:"block_trade_tick_size"`
	BlockTradeMinTradeAmount float64 `json:"block_trade_min_trade_amount"`
	InstrumentType           string  `json:"instrument_type"`
}

InstrumentData gets data for instruments

type LockedCurrenciesStatus

type LockedCurrenciesStatus struct {
	LockedCurrencies []string `json:"locked_currencies"`
	Locked           string   `json:"locked"`
}

LockedCurrenciesStatus represents locked currencies status information.

type MMPConfigData

type MMPConfigData struct {
	Currency      string  `json:"currency"`
	Interval      int64   `json:"interval"`
	FrozenTime    int64   `json:"frozen_time"`
	QuantityLimit float64 `json:"quantity_limit"`
}

MMPConfigData gets the current configuration data for MMP

type MarginsData

type MarginsData struct {
	Buy      float64 `json:"buy"`
	MaxPrice float64 `json:"max_price"`
	MinPrice float64 `json:"min_price"`
	Sell     float64 `json:"sell"`
}

MarginsData stores data for margin

type MarkPriceHistory

type MarkPriceHistory struct {
	Timestamp      types.Time
	MarkPriceValue float64
}

MarkPriceHistory stores data for mark price history

func (*MarkPriceHistory) UnmarshalJSON

func (a *MarkPriceHistory) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp.

type MultipleCancelResponse

type MultipleCancelResponse struct {
	CancelCount   int64
	CancelDetails []CancelResp
}

MultipleCancelResponse represents a response after cancelling multiple orders.

func (*MultipleCancelResponse) UnmarshalJSON

func (a *MultipleCancelResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes order cancellation response into a MultipleCancelResponse instance.

type OrderBuyAndSellParams

type OrderBuyAndSellParams struct {
	OrderID        string  `json:"order_id,omitempty"`
	Instrument     string  `json:"instrument_name,omitempty"`
	Amount         float64 `json:"amount,omitempty"`
	OrderType      string  `json:"order_type,omitempty"`
	Price          float64 `json:"price,omitempty"`
	Label          string  `json:"label,omitempty"`
	TimeInForce    string  `json:"time_in_force,omitempty"`
	MaxShow        float64 `json:"max_show,omitempty"`
	PostOnly       bool    `json:"post_only,omitempty"`
	RejectPostOnly bool    `json:"reject_post_only,omitempty"`
	ReduceOnly     bool    `json:"reduce_only,omitempty"`
	MMP            bool    `json:"mmp,omitempty"`
	TriggerPrice   float64 `json:"trigger_price,omitempty"`
	Trigger        string  `json:"trigger,omitempty"`
	Advanced       string  `json:"advanced,omitempty"`
}

OrderBuyAndSellParams represents request parameters for submit order.

type OrderData

type OrderData struct {
	Web                 bool       `json:"web"`
	TimeInForce         string     `json:"time_in_force"`
	Replaced            bool       `json:"replaced"`
	ReduceOnly          bool       `json:"reduce_only"`
	ProfitLoss          float64    `json:"profit_loss"`
	Price               float64    `json:"price"`
	PostOnly            bool       `json:"post_only"`
	OrderType           string     `json:"order_type"`
	OrderState          string     `json:"order_state"`
	OrderID             string     `json:"order_id"`
	MaxShow             float64    `json:"max_show"`
	LastUpdateTimestamp types.Time `json:"last_update_timestamp"`
	Label               string     `json:"label"`
	IsLiquidation       bool       `json:"is_liquidation"`
	InstrumentName      string     `json:"instrument_name"`
	FilledAmount        float64    `json:"filled_amount"`
	Direction           string     `json:"direction"`
	CreationTimestamp   types.Time `json:"creation_timestamp"`
	Commission          float64    `json:"commission"`
	AveragePrice        float64    `json:"average_price"`
	API                 bool       `json:"api"`
	Amount              float64    `json:"amount"`
	IsRebalance         bool       `json:"is_rebalance"`
}

OrderData stores order data

type Orderbook

type Orderbook struct {
	EstimatedDeliveryPrice float64    `json:"estimated_delivery_price"`
	UnderlyingPrice        float64    `json:"underlying_price"`
	UnderlyingIndex        string     `json:"underlying_index"`
	Timestamp              types.Time `json:"timestamp"`
	Stats                  struct {
		Volume      float64 `json:"volume"`
		PriceChange float64 `json:"price_change"`
		Low         float64 `json:"low"`
		High        float64 `json:"high"`
	} `json:"stats"`
	State           string  `json:"state"`
	SettlementPrice float64 `json:"settlement_price"`
	OpenInterest    float64 `json:"open_interest"`
	MinPrice        float64 `json:"min_price"`
	MaxPrice        float64 `json:"max_price"`
	MarkIV          float64 `json:"mark_iv"`
	MarkPrice       float64 `json:"mark_price"`
	LastPrice       float64 `json:"last_price"`
	InterestRate    float64 `json:"interest_rate"`
	InstrumentName  string  `json:"instrument_name"`
	IndexPrice      float64 `json:"index_price"`
	GreeksData      struct {
		Delta float64 `json:"delta"`
		Gamma float64 `json:"gamma"`
		Rho   float64 `json:"rho"`
		Theta float64 `json:"theta"`
		Vega  float64 `json:"vega"`
	} `json:"greeks"`
	Funding8H      float64     `json:"funding_8h"`
	CurrentFunding float64     `json:"current_funding"`
	ChangeID       int64       `json:"change_id"`
	Bids           [][]float64 `json:"bids"`
	Asks           [][]float64 `json:"asks"`
	BidIV          float64     `json:"bid_iv"`
	BestBidPrice   float64     `json:"best_bid_price"`
	BestBidAmount  float64     `json:"best_bid_amount"`
	BestAskAmount  float64     `json:"best_ask_amount"`
	AskIV          float64     `json:"ask_iv"`
}

Orderbook stores orderbook data

type PortfolioMargin

type PortfolioMargin struct {
	VolumeRange         []float64          `json:"vol_range"`
	VegaPow2            float64            `json:"vega_pow2"`
	VegaPow1            float64            `json:"vega_pow1"`
	Skew                float64            `json:"skew"`
	PriceRange          float64            `json:"price_range"`
	OptSumContinguency  float64            `json:"opt_sum_continguency"`
	OptContinguency     float64            `json:"opt_continguency"`
	Kurtosis            float64            `json:"kurtosis"`
	IntRate             float64            `json:"int_rate"`
	InitialMarginFactor float64            `json:"initial_margin_factor"`
	FtuContinguency     float64            `json:"ftu_continguency"`
	AtmRange            float64            `json:"atm_range"`
	ProjectedMarginPos  float64            `json:"projected_margin_pos"`
	ProjectedMargin     float64            `json:"projected_margin"`
	PositionSizes       map[string]float64 `json:"position_sizes"`
	Pls                 []float64          `json:"pls"`
	PcoOpt              float64            `json:"pco_opt"`
	PcoFtu              float64            `json:"pco_ftu"`
	OptSummary          []interface{}      `json:"opt_summary"`
	OptPls              []float64          `json:"opt_pls"`
	OptEntries          []interface{}      `json:"opt_entries"`
	MarginPos           float64            `json:"margin_pos"`
	Margin              float64            `json:"margin"`
	FtuSummary          []struct {
		ShortTotalCost  float64    `json:"short_total_cost"`
		PlVec           []float64  `json:"pl_vec"`
		LongTotalCost   float64    `json:"long_total_cost"`
		ExpiryTimestamp types.Time `json:"exp_tstamp"`
	} `json:"ftu_summary"`
	FtuPls     []float64 `json:"ftu_pls"`
	FtuEntries []struct {
		TotalCost       float64    `json:"total_cost"`
		Size            float64    `json:"size"`
		PlVec           []float64  `json:"pl_vec"`
		MarkPrice       float64    `json:"mark_price"`
		InstrumentName  string     `json:"instrument_name"`
		ExpiryTimestamp types.Time `json:"exp_tstamp"`
	} `json:"ftu_entries"`
	CoOpt                float64    `json:"co_opt"`
	CoFtu                float64    `json:"co_ftu"`
	CalculationTimestamp types.Time `json:"calculation_timestamp"`
}

PortfolioMargin represents public portfolio margins.

type PortfolioMarginState

type PortfolioMarginState struct {
	MaintenanceMarginRate float64 `json:"maintenance_margin_rate"`
	InitialMarginRate     float64 `json:"initial_margin_rate"`
	AvailableBalance      float64 `json:"available_balance"`
}

PortfolioMarginState represents a portfolio margin state information.

type PositionData

type PositionData struct {
	AveragePrice              float64 `json:"average_price"`
	Delta                     float64 `json:"delta"`
	Direction                 string  `json:"direction"`
	EstimatedLiquidationPrice float64 `json:"estimated_liquidation_price"`
	FloatingProfitLoss        float64 `json:"floating_profit_loss"`
	IndexPrice                float64 `json:"index_price"`
	InitialMargin             float64 `json:"initial_margin"`
	InstrumentName            string  `json:"instrument_name"`
	Leverage                  float64 `json:"leverage"`
	Kind                      string  `json:"kind"`
	MaintenanceMargin         float64 `json:"maintenance_margin"`
	MarkPrice                 float64 `json:"mark_price"`
	OpenOrdersMargin          float64 `json:"open_orders_margin"`
	RealizedProfitLoss        float64 `json:"realized_profit_loss"`
	SettlementPrice           float64 `json:"settlement_price"`
	Size                      float64 `json:"size"`
	SizeCurrency              float64 `json:"size_currency"`
	TotalProfitLoss           float64 `json:"total_profit_loss"`
	Theta                     float64 `json:"theta"`
	Vega                      float64 `json:"vega"`
	RealizedFunding           float64 `json:"realized_funding"`
	InterestValue             float64 `json:"interest_value"`
	Gamma                     float64 `json:"gamma"`
	FloatingProfitAndLossUSD  float64 `json:"floating_profit_loss_usd"`
}

PositionData stores data for account's position

type PrivateCancelData

type PrivateCancelData struct {
	Triggered           bool         `json:"triggered"`
	Trigger             string       `json:"trigger"`
	TimeInForce         string       `json:"time_in_force"`
	TriggerPrice        float64      `json:"trigger_price"`
	ReduceOnly          bool         `json:"reduce_only"`
	ProfitLoss          float64      `json:"profit_loss"`
	Price               types.Number `json:"price"`
	PostOnly            bool         `json:"post_only"`
	OrderType           string       `json:"order_type"`
	OrderState          string       `json:"order_state"`
	OrderID             string       `json:"order_id"`
	MaxShow             float64      `json:"max_show"`
	LastUpdateTimestamp types.Time   `json:"last_update_timestamp"`
	Label               string       `json:"label"`
	IsLiquidation       bool         `json:"is_liquidation"`
	InstrumentName      string       `json:"instrument_name"`
	Direction           string       `json:"direction"`
	CreationTimestamp   types.Time   `json:"creation_timestamp"`
	API                 bool         `json:"api"`
	Amount              float64      `json:"amount"`
	Web                 bool         `json:"web"`
	StopPrice           float64      `json:"stop_price"`
	Replaced            bool         `json:"replaced"`
	IsRebalance         bool         `json:"is_rebalance"`
	RiskReducing        bool         `json:"risk_reducing"`
	Contracts           float64      `json:"contracts"`
	AveragePrice        float64      `json:"average_price"`
	FilledAmount        float64      `json:"filled_amount"`
	Mmp                 bool         `json:"mmp"`
	CancelReason        string       `json:"cancel_reason"`
}

PrivateCancelData stores data of a private cancel

type PrivateSettlementData

type PrivateSettlementData struct {
	Type              string     `json:"type"`
	Timestamp         types.Time `json:"timestamp"`
	SessionProfitLoss float64    `json:"session_profit_loss"`
	ProfitLoss        float64    `json:"profit_loss"`
	Position          float64    `json:"position"`
	MarkPrice         float64    `json:"mark_price"`
	InstrumentName    string     `json:"instrument_name"`
	IndexPrice        float64    `json:"index_price"`
}

PrivateSettlementData stores private settlement data

type PrivateSettlementsHistoryData

type PrivateSettlementsHistoryData struct {
	Settlements  []PrivateSettlementData `json:"settlements"`
	Continuation string                  `json:"continuation"`
}

PrivateSettlementsHistoryData stores data for private settlement history

type PrivateTradeData

type PrivateTradeData struct {
	Trades []TradeData `json:"trades"`
	Order  OrderData   `json:"order"`
}

PrivateTradeData stores data of a private buy, sell or edit

type PublicTradesData

type PublicTradesData struct {
	Trades []struct {
		TradeSeq          float64    `json:"trade_seq"`
		TradeID           string     `json:"trade_id"`
		Timestamp         types.Time `json:"timestamp"`
		TickDirection     int64      `json:"tick_direction"`
		Price             float64    `json:"price"`
		MarkPrice         float64    `json:"mark_price"`
		Liquidation       string     `json:"liquidation"`
		ImpliedVolatility float64    `json:"iv"`
		InstrumentName    string     `json:"instrument_name"`
		IndexPrice        float64    `json:"index_price"`
		Direction         string     `json:"direction"`
		BlockTradeID      string     `json:"block_trade_id"`
		Amount            float64    `json:"amount"`
	} `json:"trades"`
	HasMore bool `json:"has_more"`
}

PublicTradesData stores data for public trades

type RefreshTokenInfo

type RefreshTokenInfo struct {
	AccessToken      string `json:"access_token"`
	ExpiresInSeconds int64  `json:"expires_in"`
	RefreshToken     string `json:"refresh_token"`
	Scope            string `json:"scope"`
	TokenType        string `json:"token_type"`
}

RefreshTokenInfo holds access token information.

type RequestForQuote

type RequestForQuote struct {
	TradedVolume     float64    `json:"traded_volume"`
	Amount           float64    `json:"amount"`
	Side             string     `json:"side"`
	LastRFQTimestamp types.Time `json:"last_rfq_tstamp"`
	InstrumentName   string     `json:"instrument_name"`
}

RequestForQuote RFQs for instruments in given currency.

type SettlementsData

type SettlementsData struct {
	Settlements []struct {
		Funded            float64    `json:"funded"`
		Funding           float64    `json:"funding"`
		IndexPrice        float64    `json:"index_price"`
		SessionTax        float64    `json:"session_tax"`
		SessionTaxRate    float64    `json:"session_tax_rate"`
		Socialized        float64    `json:"socialized"`
		SettlementType    string     `json:"type"`
		Timestamp         types.Time `json:"timestamp"`
		SessionProfitLoss float64    `json:"session_profit_loss"`
		ProfitLoss        float64    `json:"profit_loss"`
		Position          float64    `json:"position"`
		MarkPrice         float64    `json:"mark_price"`
		InstrumentName    string     `json:"instrument_name"`
	} `json:"settlements"`
	Continuation string `json:"continuation"`
}

SettlementsData stores data for settlement futures

type SubAccountBalanceData

type SubAccountBalanceData struct {
	AvailableFunds           float64 `json:"available_funds"`
	AvailableWithdrawalFunds float64 `json:"available_withdrawal_funds"`
	Balance                  float64 `json:"balance"`
	Currency                 string  `json:"currency"`
	Equity                   float64 `json:"equity"`
	InitialMargin            float64 `json:"initial_margin"`
	MaintenanceMargin        float64 `json:"maintenance_margin"`
	MarginBalance            float64 `json:"margin_balance"`
}

SubAccountBalanceData represents the subaccount balance information for each currency.

type SubAccountData

type SubAccountData struct {
	Email                string                           `json:"email"`
	ID                   int64                            `json:"id"`
	IsPassword           bool                             `json:"is_password"`
	LoginEnabled         bool                             `json:"login_enabled"`
	Portfolio            map[string]SubAccountBalanceData `json:"portfolio"`
	ReceiveNotifications bool                             `json:"receive_notifications"`
	SystemName           string                           `json:"system_name"`
	TFAEnabled           bool                             `json:"tfa_enabled"`
	Type                 string                           `json:"type"`
	Username             string                           `json:"username"`
}

SubAccountData stores subaccount data

type SubAccountDetail

type SubAccountDetail struct {
	UID       int64 `json:"uid"`
	Positions []struct {
		TotalProfitLoss           float64 `json:"total_profit_loss"`
		SizeCurrency              float64 `json:"size_currency"`
		Size                      float64 `json:"size"`
		SettlementPrice           float64 `json:"settlement_price"`
		RealizedProfitLoss        float64 `json:"realized_profit_loss"`
		RealizedFunding           float64 `json:"realized_funding"`
		OpenOrdersMargin          float64 `json:"open_orders_margin"`
		MarkPrice                 float64 `json:"mark_price"`
		MaintenanceMargin         float64 `json:"maintenance_margin"`
		Leverage                  float64 `json:"leverage"`
		Kind                      string  `json:"kind"`
		InstrumentName            string  `json:"instrument_name"`
		InitialMargin             float64 `json:"initial_margin"`
		IndexPrice                float64 `json:"index_price"`
		FloatingProfitLoss        float64 `json:"floating_profit_loss"`
		EstimatedLiquidationPrice float64 `json:"estimated_liquidation_price"`
		Direction                 string  `json:"direction"`
		Delta                     float64 `json:"delta"`
		AveragePrice              float64 `json:"average_price"`
	} `json:"positions"`
}

SubAccountDetail represents subaccount positions detail.

type TVChartData

type TVChartData struct {
	Volume []float64 `json:"volume"`
	Cost   []float64 `json:"cost"`
	Ticks  []int64   `json:"ticks"` // Values of the time axis given in milliseconds since UNIX epoch
	Status string    `json:"status"`
	Open   []float64 `json:"open"`
	Low    []float64 `json:"low"`
	High   []float64 `json:"high"`
	Close  []float64 `json:"close"`
}

TVChartData stores trading view chart data

type TickerData

type TickerData struct {
	AskIV          float64 `json:"ask_iv"`
	BestAskAmount  float64 `json:"best_ask_amount"`
	BestAskPrice   float64 `json:"best_ask_price"`
	BestBidAmount  float64 `json:"best_bid_amount"`
	BestBidPrice   float64 `json:"best_bid_price"`
	BidIV          float64 `json:"bid_iv"`
	CurrentFunding float64 `json:"current_funding"`
	DeliveryPrice  float64 `json:"delivery_price"`
	Funding8H      float64 `json:"funding_8h"`
	GreeksData     struct {
		Delta float64 `json:"delta"`
		Gamma float64 `json:"gamma"`
		Rho   float64 `json:"rho"`
		Theta float64 `json:"theta"`
		Vega  float64 `json:"vega"`
	} `json:"greeks"`
	IndexPrice      float64 `json:"index_price"`
	InstrumentName  string  `json:"instrument_name"`
	LastPrice       float64 `json:"last_price"`
	MarkIV          float64 `json:"mark_iv"`
	MarkPrice       float64 `json:"mark_price"`
	MaxPrice        float64 `json:"max_price"`
	MinPrice        float64 `json:"min_price"`
	OpenInterest    float64 `json:"open_interest"`
	SettlementPrice float64 `json:"settlement_price"`
	State           string  `json:"state"`
	Stats           struct {
		VolumeNotional float64 `json:"volume_notional"`
		VolumeUSD      float64 `json:"volume_usd"`
		Volume         float64 `json:"volume"`
		PriceChange    float64 `json:"price_change"`
		Low            float64 `json:"low"`
		High           float64 `json:"high"`
	} `json:"stats"`
	Timestamp              types.Time `json:"timestamp"`
	UnderlyingIndex        string     `json:"underlying_index"`
	UnderlyingPrice        float64    `json:"underlying_price"`
	EstimatedDeliveryPrice float64    `json:"estimated_delivery_price"`
	InterestValue          float64    `json:"interest_value"`
}

TickerData stores data for ticker

type TogglePortfolioMarginResponse

type TogglePortfolioMarginResponse struct {
	OldState PortfolioMarginState `json:"old_state"`
	NewState PortfolioMarginState `json:"new_state"`
	Currency string               `json:"currency"`
}

TogglePortfolioMarginResponse represents a response from toggling portfolio margin for currency.

type TradeData

type TradeData struct {
	TradeSequence  int64      `json:"trade_seq"`
	TradeID        string     `json:"trade_id"`
	Timestamp      types.Time `json:"timestamp"`
	TickDirection  int64      `json:"tick_direction"`
	State          string     `json:"state"`
	SelfTrade      bool       `json:"self_trade"`
	ReduceOnly     bool       `json:"reduce_only"`
	Price          float64    `json:"price"`
	PostOnly       bool       `json:"post_only"`
	OrderType      string     `json:"order_type"`
	OrderID        string     `json:"order_id"`
	MatchingID     int64      `json:"matching_id"`
	MarkPrice      float64    `json:"mark_price"`
	Liquidity      string     `json:"liquidity"`
	Label          string     `json:"label"`
	InstrumentName string     `json:"instrument_name"`
	IndexPrice     float64    `json:"index_price"`
	FeeCurrency    string     `json:"fee_currency"`
	Fee            float64    `json:"fee"`
	Direction      string     `json:"direction"`
	Amount         float64    `json:"amount"`
}

TradeData stores a data for a private trade

type TradeVolumesData

type TradeVolumesData struct {
	PutsVolume       float64 `json:"puts_volume"`
	PutsVolume7D     float64 `json:"puts_volume_7d"`
	PutsVolume30D    float64 `json:"puts_volume_30d"`
	FuturesVolume7D  float64 `json:"futures_volume_7d"`
	FuturesVolume30D float64 `json:"futures_volume_30d"`
	FuturesVolume    float64 `json:"futures_volume"`
	CurrencyPair     string  `json:"currency_pair"`
	CallsVolume7D    float64 `json:"calls_volume_7d"`
	CallsVolume30D   float64 `json:"calls_volume_30d"`
	CallsVolume      float64 `json:"calls_volume"`
}

TradeVolumesData stores data for trade volumes

type TransactionLogData

type TransactionLogData struct {
	Username        string     `json:"username"`
	UserSeq         int64      `json:"user_seq"`
	UserID          int64      `json:"user_id"`
	TransactionType string     `json:"transaction_type"`
	TradeID         string     `json:"trade_id"`
	Timestamp       types.Time `json:"timestamp"`
	Side            string     `json:"side"`
	Price           float64    `json:"price"`
	Position        float64    `json:"position"`
	OrderID         string     `json:"order_id"`
	InterestPL      float64    `json:"interest_pl"`
	InstrumentName  string     `json:"instrument_name"`
	Info            struct {
		TransferType string `json:"transfer_type"`
		OtherUserID  int64  `json:"other_user_id"`
		OtherUser    string `json:"other_user"`
	} `json:"info"`
	ID         int64   `json:"id"`
	Equity     float64 `json:"equity"`
	Currency   string  `json:"currency"`
	Commission float64 `json:"commission"`
	Change     float64 `json:"change"`
	Cashflow   float64 `json:"cashflow"`
	Balance    float64 `json:"balance"`
}

TransactionLogData stores information regarding an account transaction

type TransactionsData

type TransactionsData struct {
	Logs         []TransactionLogData `json:"logs"`
	Continuation int64                `json:"continuation"`
}

TransactionsData stores multiple transaction logs

type TransferData

type TransferData struct {
	Amount           float64    `json:"amount"`
	CreatedTimestamp types.Time `json:"created_timestamp"`
	Currency         string     `json:"currency"`
	Direction        string     `json:"direction"`
	ID               int64      `json:"id"`
	OtherSide        string     `json:"other_side"`
	State            string     `json:"state"`
	Type             string     `json:"type"`
	UpdatedTimestamp types.Time `json:"updated_timestamp"`
}

TransferData stores data for a transfer

type TransfersData

type TransfersData struct {
	Count int64          `json:"count"`
	Data  []TransferData `json:"data"`
}

TransfersData stores list of transfer data

type UnmarshalError

type UnmarshalError struct {
	Message string `json:"message"`
	Data    struct {
		Reason string `json:"reason"`
	}
	Code int64 `json:"code"`
}

UnmarshalError is the struct which is used for unmarshalling errors

type UserLock

type UserLock struct {
	Message  string `json:"message"`
	Locked   bool   `json:"locked"`
	Currency string `json:"currency"`
}

UserLock represents a user lock information for currency.

type UserTradeData

type UserTradeData struct {
	UnderlyingPrice float64    `json:"underlying_price"`
	TradeSequence   int64      `json:"trade_sequence"`
	TradeInstrument string     `json:"trade_id"`
	Timestamp       types.Time `json:"timestamp"`
	TickDirection   int64      `json:"tick_direction"`
	State           string     `json:"state"`
	SelfTrade       bool       `json:"self_trade"`
	ReduceOnly      bool       `json:"reduce_only"`
	Price           float64    `json:"price"`
	PostOnly        bool       `json:"post_only"`
	OrderType       string     `json:"order_type"`
	OrderID         string     `json:"order_id"`
	MatchingID      int64      `json:"matching_id"`
	MarkPrice       float64    `json:"mark_price"`
	Liquidity       string     `json:"liquidity"`
	IV              float64    `json:"iv"`
	InstrumentName  string     `json:"instrument_name"`
	IndexPrice      float64    `json:"index_price"`
	FeeCurrency     string     `json:"fee_currency"`
	Fee             float64    `json:"fee"`
	Direction       string     `json:"direction"`
	Amount          float64    `json:"amount"`
}

UserTradeData stores data of user trades

type UserTradesData

type UserTradesData struct {
	Trades  []UserTradeData `json:"trades"`
	HasMore bool            `json:"has_more"`
}

UserTradesData stores data of user trades

type VersionInformation

type VersionInformation struct {
	Version string `json:"version"`
}

VersionInformation represents websocket version information

type VolatilityIndexData

type VolatilityIndexData struct {
	TimestampMS time.Time `json:"timestamp"`
	Open        float64   `json:"open"`
	High        float64   `json:"high"`
	Low         float64   `json:"low"`
	Close       float64   `json:"close"`
}

VolatilityIndexData stores index data for volatility

type VolatilityIndexRawData

type VolatilityIndexRawData struct {
	Data [][5]float64 `json:"data"`
}

VolatilityIndexRawData stores raw index data for volatility

type WebsocketPosition

type WebsocketPosition struct {
	TotalProfitLoss    float64 `json:"total_profit_loss"`
	SizeCurrency       float64 `json:"size_currency"`
	Size               float64 `json:"size"`
	SettlementPrice    float64 `json:"settlement_price"`
	RealizedProfitLoss float64 `json:"realized_profit_loss"`
	RealizedFunding    float64 `json:"realized_funding"`
	OpenOrdersMargin   float64 `json:"open_orders_margin"`
	MarkPrice          float64 `json:"mark_price"`
	MaintenanceMargin  float64 `json:"maintenance_margin"`
	Leverage           float64 `json:"leverage"`
	Kind               string  `json:"kind"`
	InterestValue      float64 `json:"interest_value"`
	InstrumentName     string  `json:"instrument_name"`
	InitialMargin      float64 `json:"initial_margin"`
	IndexPrice         float64 `json:"index_price"`
	FloatingProfitLoss float64 `json:"floating_profit_loss"`
	Direction          string  `json:"direction"`
	Delta              float64 `json:"delta"`
	AveragePrice       float64 `json:"average_price"`
}

WebsocketPosition holds position information

type WithdrawData

type WithdrawData struct {
	Address            string     `json:"address"`
	Amount             float64    `json:"amount"`
	ConfirmedTimestamp types.Time `json:"confirmed_timestamp"`
	CreatedTimestamp   types.Time `json:"created_timestamp"`
	Currency           string     `json:"currency"`
	Fee                float64    `json:"fee"`
	ID                 int64      `json:"id"`
	Priority           float64    `json:"priority"`
	State              string     `json:"state"`
	TransactionID      string     `json:"transaction_id"`
	UpdatedTimestamp   types.Time `json:"updated_timestamp"`
}

WithdrawData stores data of withdrawal

type WithdrawalsData

type WithdrawalsData struct {
	Count int64          `json:"count"`
	Data  []WithdrawData `json:"data"`
}

WithdrawalsData stores data of withdrawals

type WsIncrementalTicker

type WsIncrementalTicker struct {
	Type      string     `json:"type"`
	Timestamp types.Time `json:"timestamp"`
	Stats     struct {
		VolumeUsd   float64 `json:"volume_usd"`
		Volume      float64 `json:"volume"`
		PriceChange float64 `json:"price_change"`
	} `json:"stats"`
	MinPrice               float64 `json:"min_price"`
	MaxPrice               float64 `json:"max_price"`
	MarkPrice              float64 `json:"mark_price"`
	InstrumentName         string  `json:"instrument_name"`
	IndexPrice             float64 `json:"index_price"`
	EstimatedDeliveryPrice float64 `json:"estimated_delivery_price"`
	BestBidAmount          float64 `json:"best_bid_amount"`
	BestAskAmount          float64 `json:"best_ask_amount"`

	// For future_combo instruments
	ImpliedAsk float64 `json:"implied_ask"`
	ImpliedBid float64 `json:"implied_bid"`

	UnderlyingPrice float64 `json:"underlying_price"`
	UnderlyingIndex string  `json:"underlying_index"`
	State           string  `json:"state"`
	SettlementPrice float64 `json:"settlement_price"`
	OpenInterest    float64 `json:"open_interest"`

	MarkIv       float64 `json:"mark_iv"`
	LastPrice    float64 `json:"last_price"`
	InterestRate float64 `json:"interest_rate"`
	Greeks       struct {
		Vega  float64 `json:"vega"`
		Theta float64 `json:"theta"`
		Rho   float64 `json:"rho"`
		Gamma float64 `json:"gamma"`
		Delta float64 `json:"delta"`
	} `json:"greeks"`
	ComboState   string  `json:"combo_state"`
	BidIv        float64 `json:"bid_iv"`
	BestBidPrice float64 `json:"best_bid_price"`
	BestAskPrice float64 `json:"best_ask_price"`
	AskIv        float64 `json:"ask_iv"`
}

WsIncrementalTicker represents a ticker information for incremental ticker subscriptions.

type WsMMPTrigger

type WsMMPTrigger struct {
	FrozenUntil int64  `json:"frozen_until"`
	Currency    string `json:"currency"`
}

WsMMPTrigger represents mmp trigger data.

type WsOrder

type WsOrder struct {
	TimeInForce         string     `json:"time_in_force"`
	Replaced            bool       `json:"replaced"`
	ReduceOnly          bool       `json:"reduce_only"`
	ProfitLoss          float64    `json:"profit_loss"`
	Price               float64    `json:"price"`
	PostOnly            bool       `json:"post_only"`
	OriginalOrderType   string     `json:"original_order_type"`
	OrderType           string     `json:"order_type"`
	OrderState          string     `json:"order_state"`
	OrderID             string     `json:"order_id"`
	MaxShow             float64    `json:"max_show"`
	LastUpdateTimestamp types.Time `json:"last_update_timestamp"`
	Label               string     `json:"label"`
	IsLiquidation       bool       `json:"is_liquidation"`
	InstrumentName      string     `json:"instrument_name"`
	FilledAmount        float64    `json:"filled_amount"`
	Direction           string     `json:"direction"`
	CreationTimestamp   types.Time `json:"creation_timestamp"`
	Commission          float64    `json:"commission"`
	AveragePrice        float64    `json:"average_price"`
	API                 bool       `json:"api"`
	Amount              float64    `json:"amount"`
}

WsOrder represents changes in user's orders for given instrument.

type WsRequest

type WsRequest struct {
	JSONRPCVersion string      `json:"jsonrpc,omitempty"`
	ID             int64       `json:"id,omitempty"`
	Method         string      `json:"method"`
	Params         interface{} `json:"params,omitempty"`
}

WsRequest defines a request obj for the JSON-RPC endpoints and gets a websocket response

type WsResponse

type WsResponse struct {
	ID     int64 `json:"id,omitempty"`
	Params struct {
		Data    interface{} `json:"data"`
		Channel string      `json:"channel"`

		// Used in heartbead and test_request messages.
		Type string `json:"type"`
	} `json:"params"`
	Method         string `json:"method"`
	JSONRPCVersion string `json:"jsonrpc"`

	// for status "ok" and "version" push data messages
	Result interface{} `json:"result"`
}

WsResponse represents generalized websocket subscription push data and immediate websocket call responses.

type WsSubscriptionInput

type WsSubscriptionInput struct {
	JSONRPCVersion string              `json:"jsonrpc,omitempty"`
	ID             int64               `json:"id,omitempty"`
	Method         string              `json:"method"`
	Params         map[string][]string `json:"params,omitempty"`
}

WsSubscriptionInput defines a request obj for the JSON-RPC and gets a websocket response

type WsUserLock

type WsUserLock struct {
	Locked   bool   `json:"locked"`
	Currency string `json:"currency"`
}

WsUserLock represents a notification data when account is locked/unlocked

Jump to

Keyboard shortcuts

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