Categorygithub.com/Javad-Alipanah/deribit-go-client
repositorypackage
1.0.2
Repository: https://github.com/javad-alipanah/deribit-go-client.git
Documentation: pkg.go.dev

# README

Go API client for openapi

#Overview Deribit provides three different interfaces to access the API: * JSON-RPC over Websocket * JSON-RPC over HTTP * FIX (Financial Information eXchange) With the API Console you can use and test the JSON-RPC API, both via HTTP and via Websocket. To visit the API console, go to Account > API tab > API Console tab. ##Naming Deribit tradeable assets or instruments use the following system of naming: |Kind|Examples|Template|Comments| |----|--------|--------|--------| |Future|BTC-25MAR16, BTC-5AUG16|BTC-DMMMYY|BTC is currency, DMMMYY is expiration date, D stands for day of month (1 or 2 digits), MMM - month (3 first letters in English), YY stands for year.| |Perpetual|BTC-PERPETUAL ||Perpetual contract for currency BTC.| |Option|BTC-25MAR16-420-C, BTC-5AUG16-580-P|BTC-DMMMYY-STRIKE-K|STRIKE is option strike price in USD. Template K is option kind: C for call options or P for put options.| # JSON-RPC JSON-RPC is a light-weight remote procedure call (RPC) protocol. The JSON-RPC specification defines the data structures that are used for the messages that are exchanged between client and server, as well as the rules around their processing. JSON-RPC uses JSON (RFC 4627) as data format. JSON-RPC is transport agnostic: it does not specify which transport mechanism must be used. The Deribit API supports both Websocket (preferred) and HTTP (with limitations: subscriptions are not supported over HTTP). ## Request messages > An example of a request message: json { \"jsonrpc\": \"2.0\", \"id\": 8066, \"method\": \"public/ticker\", \"params\": { \"instrument\": \"BTC-24AUG18-6500-P\" } } According to the JSON-RPC sepcification the requests must be JSON objects with the following fields. |Name|Type|Description| |----|----|-----------| |jsonrpc|string|The version of the JSON-RPC spec: "2.0"| |id|integer or string|An identifier of the request. If it is included, then the response will contain the same identifier| |method|string|The method to be invoked| |params|object|The parameters values for the method. The field names must match with the expected parameter names. The parameters that are expected are described in the documentation for the methods, below.| <aside class="warning"> The JSON-RPC specification describes two features that are currently not supported by the API:

  • Specification of parameter values by position
  • Batch requests
## Response messages > An example of a response message: json { \"jsonrpc\": \"2.0\", \"id\": 5239, \"testnet\": false, \"result\": [ { \"currency\": \"BTC\", \"currencyLong\": \"Bitcoin\", \"minConfirmation\": 2, \"txFee\": 0.0006, \"isActive\": true, \"coinType\": \"BITCOIN\", \"baseAddress\": null } ], \"usIn\": 1535043730126248, \"usOut\": 1535043730126250, \"usDiff\": 2 } The JSON-RPC API always responds with a JSON object with the following fields. |Name|Type|Description| |----|----|-----------| |id|integer|This is the same id that was sent in the request.| |result|any|If successful, the result of the API call. The format for the result is described with each method.| |error|error object|Only present if there was an error invoking the method. The error object is described below.| |testnet|boolean|Indicates whether the API in use is actually the test API. false for production server, true for test server.| |usIn|integer|The timestamp when the requests was received (microseconds since the Unix epoch)| |usOut|integer|The timestamp when the response was sent (microseconds since the Unix epoch)| |usDiff|integer|The number of microseconds that was spent handling the request| <aside class="notice"> The fields testnet, usIn, usOut and usDiff are not part of the JSON-RPC standard.

In order not to clutter the examples they will generally be omitted from the example code.

> An example of a response with an error: json { \"jsonrpc\": \"2.0\", \"id\": 8163, \"error\": { \"code\": 11050, \"message\": \"bad_request\" }, \"testnet\": false, \"usIn\": 1535037392434763, \"usOut\": 1535037392448119, \"usDiff\": 13356 } In case of an error the response message will contain the error field, with as value an object with the following with the following fields: |Name|Type|Description |----|----|-----------| |code|integer|A number that indicates the kind of error.| |message|string|A short description that indicates the kind of error.| |data|any|Additional data about the error. This field may be omitted.| ## Notifications > An example of a notification: json { \"jsonrpc\": \"2.0\", \"method\": \"subscription\", \"params\": { \"channel\": \"deribit_price_index.btc_usd\", \"data\": { \"timestamp\": 1535098298227, \"price\": 6521.17, \"index_name\": \"btc_usd\" } } } API users can subscribe to certain types of notifications. This means that they will receive JSON-RPC notification-messages from the server when certain events occur, such as changes to the index price or changes to the order book for a certain instrument. The API methods public/subscribe and private/subscribe are used to set up a subscription. Since HTTP does not support the sending of messages from server to client, these methods are only availble when using the Websocket transport mechanism. At the moment of subscription a "channel" must be specified. The channel determines the type of events that will be received. See Subscriptions for more details about the channels. In accordance with the JSON-RPC specification, the format of a notification is that of a request message without an id field. The value of the method field will always be "subscription". The params field will always be an object with 2 members: channel and data. The value of the channel member is the name of the channel (a string). The value of the data member is an object that contains data that is specific for the channel. ## Authentication > An example of a JSON request with token: json { \"id\": 5647, \"method\": \"private/get_subaccounts\", \"params\": { \"access_token\": \"67SVutDoVZSzkUStHSuk51WntMNBJ5mh5DYZhwzpiqDF\" } } The API consists of public and private methods. The public methods do not require authentication. The private methods use OAuth 2.0 authentication. This means that a valid OAuth access token must be included in the request, which can get achived by calling method public/auth. When the token was assigned to the user, it should be passed along, with other request parameters, back to the server: |Connection type|Access token placement |----|-----------| |Websocket|Inside request JSON parameters, as an access_token field| |HTTP (REST)|Header Authorization: bearer ```Token``` value| ### Additional authorization method - basic user credentials <span style="color:red"> ! Not recommended - however, it could be useful for quick testing API
Every private method could be accessed by providing, inside HTTP Authorization: Basic XXX header, values with user ClientId and assigned ClientSecret (both values can be found on the API page on the Deribit website) encoded with Base64: Authorization: Basic BASE64(ClientId + : + ClientSecret) ### Additional authorization method - Deribit signature credentials The Derbit service provides dedicated authorization method, which harness user generated signature to increase security level for passing request data. Generated value is passed inside Authorization header, coded as: Authorization: deri-hmac-sha256 id=ClientId,ts=Timestamp,sig=Signature,nonce=Nonce where: |Deribit credential|Description |----|-----------| |ClientId|Can be found on the API page on the Deribit website| |Timestamp|Time when the request was generated - given as miliseconds. It's valid for 60 seconds since generation, after that time any request with an old timestamp will be rejected.| |Signature|Value for signature calculated as described below | |Nonce|Single usage, user generated initialization vector for the server token| The signature is generated by the following formula: Signature = HEX_STRING( HMAC-SHA256( ClientSecret, StringToSign ) );
StringToSign = Timestamp + "\n" + Nonce + "\n" + RequestData;
RequestData = UPPERCASE(HTTP_METHOD()) + "\n" + URI() + "\n" + RequestBody + "\n";
e.g. (using shell with openssl tool):     ClientId=AAAAAAAAAAA
    ClientSecret=ABCD
    Timestamp=$( date +%s000 )
    Nonce=$( cat /dev/urandom | tr -dc 'a-z0-9' | head -c8 )
    URI="/api/v2/private/get_account_summary?currency=BTC"
    HttpMethod=GET
    Body=""

    Signature=$( echo -ne "${Timestamp}\n${Nonce}\n${HttpMethod}\n${URI}\n${Body}\n" | openssl sha256 -r -hmac "$ClientSecret" | cut -f1 -d' ' )

    echo $Signature

    shell output> ea40d5e5e4fae235ab22b61da98121fbf4acdc06db03d632e23c66bcccb90d2c (WARNING: Exact value depends on current timestamp and client credentials

    curl -s -X ${HttpMethod} -H "Authorization: deri-hmac-sha256 id=${ClientId},ts=${Timestamp},nonce=${Nonce},sig=${Signature}" "https://www.deribit.com${URI}\"

### Additional authorization method - signature credentials (WebSocket API) When connecting through Websocket, user can request for authorization using client_credential method, which requires providing following parameters (as a part of JSON request): |JSON parameter|Description |----|-----------| |grant_type|Must be client_signature| |client_id|Can be found on the API page on the Deribit website| |timestamp|Time when the request was generated - given as miliseconds. It's valid for 60 seconds since generation, after that time any request with an old timestamp will be rejected.| |signature|Value for signature calculated as described below | |nonce|Single usage, user generated initialization vector for the server token| |data|Optional field, which contains any user specific value| The signature is generated by the following formula: StringToSign = Timestamp + "\n" + Nonce + "\n" + Data;
Signature = HEX_STRING( HMAC-SHA256( ClientSecret, StringToSign ) );
e.g. (using shell with openssl tool):     ClientId=AAAAAAAAAAA
    ClientSecret=ABCD
    Timestamp=$( date +%s000 ) # e.g. 1554883365000
    Nonce=$( cat /dev/urandom | tr -dc 'a-z0-9' | head -c8 ) # e.g. fdbmmz79
    Data=""

    Signature=$( echo -ne "${Timestamp}\n${Nonce}\n${Data}\n" | openssl sha256 -r -hmac "$ClientSecret" | cut -f1 -d' ' )

    echo $Signature

    shell output> e20c9cd5639d41f8bbc88f4d699c4baf94a4f0ee320e9a116b72743c449eb994 (WARNING: Exact value depends on current timestamp and client credentials

You can also check the signature value using some online tools like, e.g: https://codebeautify.org/hmac-generator (but don't forget about adding newline after each part of the hashed text and remember that you should use it only with your test credentials). Here's a sample JSON request created using the values from the example above: {
  "jsonrpc" : "2.0",
  "id" : 9929,
  "method" : "public/auth",
  "params" :
  {
    "grant_type" : "client_signature",
    "client_id" : "AAAAAAAAAAA",
    "timestamp": "1554883365000",
    "nonce": "fdbmmz79",
    "data": "",
    "signature" : "e20c9cd5639d41f8bbc88f4d699c4baf94a4f0ee320e9a116b72743c449eb994"
  }
}
### Access scope When asking for access token user can provide the required access level (called scope) which defines what type of functionality he/she wants to use, and whether requests are only going to check for some data or also to update them. Scopes are required and checked for private methods, so if you plan to use only public information you can stay with values assigned by default. |Scope|Description |----|-----------| |account:read|Access to account methods - read only data| |account:read_write|Access to account methods - allows to manage account settings, add subaccounts, etc.| |trade:read|Access to trade methods - read only data| |trade:read_write|Access to trade methods - required to create and modify orders| |wallet:read|Access to wallet methods - read only data| |wallet:read_write|Access to wallet methods - allows to withdraw, generate new deposit address, etc.| |wallet:none, account:none, trade:none|Blocked access to specified functionality| <span style="color:red">NOTICE: Depending on choosing an authentication method (grant type) some scopes could be narrowed by the server. e.g. when grant_type = client_credentials and scope = wallet:read_write it's modified by the server as scope = wallet:read" ## JSON-RPC over websocket Websocket is the prefered transport mechanism for the JSON-RPC API, because it is faster and because it can support subscriptions and cancel on disconnect. The code examples that can be found next to each of the methods show how websockets can be used from Python or Javascript/node.js. ## JSON-RPC over HTTP Besides websockets it is also possible to use the API via HTTP. The code examples for 'shell' show how this can be done using curl. Note that subscriptions and cancel on disconnect are not supported via HTTP. #Methods

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./openapi"

Documentation for API Endpoints

All URIs are relative to https://www.deribit.com/api/v2

ClassMethodHTTP requestDescription
AccountManagementApiPrivateChangeSubaccountNameGetGet /private/change_subaccount_nameChange the user name for a subaccount
AccountManagementApiPrivateCreateSubaccountGetGet /private/create_subaccountCreate a new subaccount
AccountManagementApiPrivateDisableTfaForSubaccountGetGet /private/disable_tfa_for_subaccountDisable two factor authentication for a subaccount.
AccountManagementApiPrivateGetAccountSummaryGetGet /private/get_account_summaryRetrieves user account summary.
AccountManagementApiPrivateGetEmailLanguageGetGet /private/get_email_languageRetrieves the language to be used for emails.
AccountManagementApiPrivateGetNewAnnouncementsGetGet /private/get_new_announcementsRetrieves announcements that have not been marked read by the user.
AccountManagementApiPrivateGetPositionGetGet /private/get_positionRetrieve user position.
AccountManagementApiPrivateGetPositionsGetGet /private/get_positionsRetrieve user positions.
AccountManagementApiPrivateGetSubaccountsGetGet /private/get_subaccountsGet information about subaccounts
AccountManagementApiPrivateSetAnnouncementAsReadGetGet /private/set_announcement_as_readMarks an announcement as read, so it will not be shown in `get_new_announcements`.
AccountManagementApiPrivateSetEmailForSubaccountGetGet /private/set_email_for_subaccountAssign an email address to a subaccount. User will receive an email with confirmation link.
AccountManagementApiPrivateSetEmailLanguageGetGet /private/set_email_languageChanges the language to be used for emails.
AccountManagementApiPrivateSetPasswordForSubaccountGetGet /private/set_password_for_subaccountSet the password for the subaccount
AccountManagementApiPrivateToggleNotificationsFromSubaccountGetGet /private/toggle_notifications_from_subaccountEnable or disable sending of notifications for the subaccount.
AccountManagementApiPrivateToggleSubaccountLoginGetGet /private/toggle_subaccount_loginEnable or disable login for a subaccount. If login is disabled and a session for the subaccount exists, this session will be terminated.
AccountManagementApiPublicGetAnnouncementsGetGet /public/get_announcementsRetrieves announcements from the last 30 days.
AuthenticationApiPublicAuthGetGet /public/authAuthenticate
InternalApiPrivateAddToAddressBookGetGet /private/add_to_address_bookAdds new entry to address book of given type
InternalApiPrivateDisableTfaWithRecoveryCodeGetGet /private/disable_tfa_with_recovery_codeDisables TFA with one time recovery code
InternalApiPrivateGetAddressBookGetGet /private/get_address_bookRetrieves address book of given type
InternalApiPrivateRemoveFromAddressBookGetGet /private/remove_from_address_bookAdds new entry to address book of given type
InternalApiPrivateSubmitTransferToSubaccountGetGet /private/submit_transfer_to_subaccountTransfer funds to a subaccount.
InternalApiPrivateSubmitTransferToUserGetGet /private/submit_transfer_to_userTransfer funds to a another user.
InternalApiPrivateToggleDepositAddressCreationGetGet /private/toggle_deposit_address_creationEnable or disable deposit address creation
InternalApiPublicGetFooterGetGet /public/get_footerGet information to be displayed in the footer of the website.
InternalApiPublicGetOptionMarkPricesGetGet /public/get_option_mark_pricesRetrives market prices and its implied volatility of options instruments
InternalApiPublicValidateFieldGetGet /public/validate_fieldMethod used to introduce the client software connected to Deribit platform over websocket. Provided data may have an impact on the maintained connection and will be collected for internal statistical purposes. In response, Deribit will also introduce itself.
MarketDataApiPublicGetBookSummaryByCurrencyGetGet /public/get_book_summary_by_currencyRetrieves the summary information such as open interest, 24h volume, etc. for all instruments for the currency (optionally filtered by kind).
MarketDataApiPublicGetBookSummaryByInstrumentGetGet /public/get_book_summary_by_instrumentRetrieves the summary information such as open interest, 24h volume, etc. for a specific instrument.
MarketDataApiPublicGetContractSizeGetGet /public/get_contract_sizeRetrieves contract size of provided instrument.
MarketDataApiPublicGetCurrenciesGetGet /public/get_currenciesRetrieves all cryptocurrencies supported by the API.
MarketDataApiPublicGetFundingChartDataGetGet /public/get_funding_chart_dataRetrieve the latest user trades that have occurred for PERPETUAL instruments in a specific currency symbol and within given time range.
MarketDataApiPublicGetHistoricalVolatilityGetGet /public/get_historical_volatilityProvides information about historical volatility for given cryptocurrency.
MarketDataApiPublicGetIndexGetGet /public/get_indexRetrieves the current index price for the instruments, for the selected currency.
MarketDataApiPublicGetInstrumentsGetGet /public/get_instrumentsRetrieves available trading instruments. This method can be used to see which instruments are available for trading, or which instruments have existed historically.
MarketDataApiPublicGetLastSettlementsByCurrencyGetGet /public/get_last_settlements_by_currencyRetrieves historical settlement, delivery and bankruptcy events coming from all instruments within given currency.
MarketDataApiPublicGetLastSettlementsByInstrumentGetGet /public/get_last_settlements_by_instrumentRetrieves historical public settlement, delivery and bankruptcy events filtered by instrument name.
MarketDataApiPublicGetLastTradesByCurrencyAndTimeGetGet /public/get_last_trades_by_currency_and_timeRetrieve the latest trades that have occurred for instruments in a specific currency symbol and within given time range.
MarketDataApiPublicGetLastTradesByCurrencyGetGet /public/get_last_trades_by_currencyRetrieve the latest trades that have occurred for instruments in a specific currency symbol.
MarketDataApiPublicGetLastTradesByInstrumentAndTimeGetGet /public/get_last_trades_by_instrument_and_timeRetrieve the latest trades that have occurred for a specific instrument and within given time range.
MarketDataApiPublicGetLastTradesByInstrumentGetGet /public/get_last_trades_by_instrumentRetrieve the latest trades that have occurred for a specific instrument.
MarketDataApiPublicGetOrderBookGetGet /public/get_order_bookRetrieves the order book, along with other market values for a given instrument.
MarketDataApiPublicGetTradeVolumesGetGet /public/get_trade_volumesRetrieves aggregated 24h trade volumes for different instrument types and currencies.
MarketDataApiPublicGetTradingviewChartDataGetGet /public/get_tradingview_chart_dataPublicly available market data used to generate a TradingView candle chart.
MarketDataApiPublicTickerGetGet /public/tickerGet ticker for an instrument.
PrivateApiPrivateAddToAddressBookGetGet /private/add_to_address_bookAdds new entry to address book of given type
PrivateApiPrivateBuyGetGet /private/buyPlaces a buy order for an instrument.
PrivateApiPrivateCancelAllByCurrencyGetGet /private/cancel_all_by_currencyCancels all orders by currency, optionally filtered by instrument kind and/or order type.
PrivateApiPrivateCancelAllByInstrumentGetGet /private/cancel_all_by_instrumentCancels all orders by instrument, optionally filtered by order type.
PrivateApiPrivateCancelAllGetGet /private/cancel_allThis method cancels all users orders and stop orders within all currencies and instrument kinds.
PrivateApiPrivateCancelGetGet /private/cancelCancel an order, specified by order id
PrivateApiPrivateCancelTransferByIdGetGet /private/cancel_transfer_by_idCancel transfer
PrivateApiPrivateCancelWithdrawalGetGet /private/cancel_withdrawalCancels withdrawal request
PrivateApiPrivateChangeSubaccountNameGetGet /private/change_subaccount_nameChange the user name for a subaccount
PrivateApiPrivateClosePositionGetGet /private/close_positionMakes closing position reduce only order .
PrivateApiPrivateCreateDepositAddressGetGet /private/create_deposit_addressCreates deposit address in currency
PrivateApiPrivateCreateSubaccountGetGet /private/create_subaccountCreate a new subaccount
PrivateApiPrivateDisableTfaForSubaccountGetGet /private/disable_tfa_for_subaccountDisable two factor authentication for a subaccount.
PrivateApiPrivateDisableTfaWithRecoveryCodeGetGet /private/disable_tfa_with_recovery_codeDisables TFA with one time recovery code
PrivateApiPrivateEditGetGet /private/editChange price, amount and/or other properties of an order.
PrivateApiPrivateGetAccountSummaryGetGet /private/get_account_summaryRetrieves user account summary.
PrivateApiPrivateGetAddressBookGetGet /private/get_address_bookRetrieves address book of given type
PrivateApiPrivateGetCurrentDepositAddressGetGet /private/get_current_deposit_addressRetrieve deposit address for currency
PrivateApiPrivateGetDepositsGetGet /private/get_depositsRetrieve the latest users deposits
PrivateApiPrivateGetEmailLanguageGetGet /private/get_email_languageRetrieves the language to be used for emails.
PrivateApiPrivateGetMarginsGetGet /private/get_marginsGet margins for given instrument, amount and price.
PrivateApiPrivateGetNewAnnouncementsGetGet /private/get_new_announcementsRetrieves announcements that have not been marked read by the user.
PrivateApiPrivateGetOpenOrdersByCurrencyGetGet /private/get_open_orders_by_currencyRetrieves list of user's open orders.
PrivateApiPrivateGetOpenOrdersByInstrumentGetGet /private/get_open_orders_by_instrumentRetrieves list of user's open orders within given Instrument.
PrivateApiPrivateGetOrderHistoryByCurrencyGetGet /private/get_order_history_by_currencyRetrieves history of orders that have been partially or fully filled.
PrivateApiPrivateGetOrderHistoryByInstrumentGetGet /private/get_order_history_by_instrumentRetrieves history of orders that have been partially or fully filled.
PrivateApiPrivateGetOrderMarginByIdsGetGet /private/get_order_margin_by_idsRetrieves initial margins of given orders
PrivateApiPrivateGetOrderStateGetGet /private/get_order_stateRetrieve the current state of an order.
PrivateApiPrivateGetPositionGetGet /private/get_positionRetrieve user position.
PrivateApiPrivateGetPositionsGetGet /private/get_positionsRetrieve user positions.
PrivateApiPrivateGetSettlementHistoryByCurrencyGetGet /private/get_settlement_history_by_currencyRetrieves settlement, delivery and bankruptcy events that have affected your account.
PrivateApiPrivateGetSettlementHistoryByInstrumentGetGet /private/get_settlement_history_by_instrumentRetrieves public settlement, delivery and bankruptcy events filtered by instrument name
PrivateApiPrivateGetSubaccountsGetGet /private/get_subaccountsGet information about subaccounts
PrivateApiPrivateGetTransfersGetGet /private/get_transfersAdds new entry to address book of given type
PrivateApiPrivateGetUserTradesByCurrencyAndTimeGetGet /private/get_user_trades_by_currency_and_timeRetrieve the latest user trades that have occurred for instruments in a specific currency symbol and within given time range.
PrivateApiPrivateGetUserTradesByCurrencyGetGet /private/get_user_trades_by_currencyRetrieve the latest user trades that have occurred for instruments in a specific currency symbol.
PrivateApiPrivateGetUserTradesByInstrumentAndTimeGetGet /private/get_user_trades_by_instrument_and_timeRetrieve the latest user trades that have occurred for a specific instrument and within given time range.
PrivateApiPrivateGetUserTradesByInstrumentGetGet /private/get_user_trades_by_instrumentRetrieve the latest user trades that have occurred for a specific instrument.
PrivateApiPrivateGetUserTradesByOrderGetGet /private/get_user_trades_by_orderRetrieve the list of user trades that was created for given order
PrivateApiPrivateGetWithdrawalsGetGet /private/get_withdrawalsRetrieve the latest users withdrawals
PrivateApiPrivateRemoveFromAddressBookGetGet /private/remove_from_address_bookAdds new entry to address book of given type
PrivateApiPrivateSellGetGet /private/sellPlaces a sell order for an instrument.
PrivateApiPrivateSetAnnouncementAsReadGetGet /private/set_announcement_as_readMarks an announcement as read, so it will not be shown in `get_new_announcements`.
PrivateApiPrivateSetEmailForSubaccountGetGet /private/set_email_for_subaccountAssign an email address to a subaccount. User will receive an email with confirmation link.
PrivateApiPrivateSetEmailLanguageGetGet /private/set_email_languageChanges the language to be used for emails.
PrivateApiPrivateSetPasswordForSubaccountGetGet /private/set_password_for_subaccountSet the password for the subaccount
PrivateApiPrivateSubmitTransferToSubaccountGetGet /private/submit_transfer_to_subaccountTransfer funds to a subaccount.
PrivateApiPrivateSubmitTransferToUserGetGet /private/submit_transfer_to_userTransfer funds to a another user.
PrivateApiPrivateToggleDepositAddressCreationGetGet /private/toggle_deposit_address_creationEnable or disable deposit address creation
PrivateApiPrivateToggleNotificationsFromSubaccountGetGet /private/toggle_notifications_from_subaccountEnable or disable sending of notifications for the subaccount.
PrivateApiPrivateToggleSubaccountLoginGetGet /private/toggle_subaccount_loginEnable or disable login for a subaccount. If login is disabled and a session for the subaccount exists, this session will be terminated.
PrivateApiPrivateWithdrawGetGet /private/withdrawCreates a new withdrawal request
PublicApiPublicAuthGetGet /public/authAuthenticate
PublicApiPublicGetAnnouncementsGetGet /public/get_announcementsRetrieves announcements from the last 30 days.
PublicApiPublicGetBookSummaryByCurrencyGetGet /public/get_book_summary_by_currencyRetrieves the summary information such as open interest, 24h volume, etc. for all instruments for the currency (optionally filtered by kind).
PublicApiPublicGetBookSummaryByInstrumentGetGet /public/get_book_summary_by_instrumentRetrieves the summary information such as open interest, 24h volume, etc. for a specific instrument.
PublicApiPublicGetContractSizeGetGet /public/get_contract_sizeRetrieves contract size of provided instrument.
PublicApiPublicGetCurrenciesGetGet /public/get_currenciesRetrieves all cryptocurrencies supported by the API.
PublicApiPublicGetFundingChartDataGetGet /public/get_funding_chart_dataRetrieve the latest user trades that have occurred for PERPETUAL instruments in a specific currency symbol and within given time range.
PublicApiPublicGetHistoricalVolatilityGetGet /public/get_historical_volatilityProvides information about historical volatility for given cryptocurrency.
PublicApiPublicGetIndexGetGet /public/get_indexRetrieves the current index price for the instruments, for the selected currency.
PublicApiPublicGetInstrumentsGetGet /public/get_instrumentsRetrieves available trading instruments. This method can be used to see which instruments are available for trading, or which instruments have existed historically.
PublicApiPublicGetLastSettlementsByCurrencyGetGet /public/get_last_settlements_by_currencyRetrieves historical settlement, delivery and bankruptcy events coming from all instruments within given currency.
PublicApiPublicGetLastSettlementsByInstrumentGetGet /public/get_last_settlements_by_instrumentRetrieves historical public settlement, delivery and bankruptcy events filtered by instrument name.
PublicApiPublicGetLastTradesByCurrencyAndTimeGetGet /public/get_last_trades_by_currency_and_timeRetrieve the latest trades that have occurred for instruments in a specific currency symbol and within given time range.
PublicApiPublicGetLastTradesByCurrencyGetGet /public/get_last_trades_by_currencyRetrieve the latest trades that have occurred for instruments in a specific currency symbol.
PublicApiPublicGetLastTradesByInstrumentAndTimeGetGet /public/get_last_trades_by_instrument_and_timeRetrieve the latest trades that have occurred for a specific instrument and within given time range.
PublicApiPublicGetLastTradesByInstrumentGetGet /public/get_last_trades_by_instrumentRetrieve the latest trades that have occurred for a specific instrument.
PublicApiPublicGetOrderBookGetGet /public/get_order_bookRetrieves the order book, along with other market values for a given instrument.
PublicApiPublicGetTimeGetGet /public/get_timeRetrieves the current time (in milliseconds). This API endpoint can be used to check the clock skew between your software and Deribit's systems.
PublicApiPublicGetTradeVolumesGetGet /public/get_trade_volumesRetrieves aggregated 24h trade volumes for different instrument types and currencies.
PublicApiPublicGetTradingviewChartDataGetGet /public/get_tradingview_chart_dataPublicly available market data used to generate a TradingView candle chart.
PublicApiPublicTestGetGet /public/testTests the connection to the API server, and returns its version. You can use this to make sure the API is reachable, and matches the expected version.
PublicApiPublicTickerGetGet /public/tickerGet ticker for an instrument.
PublicApiPublicValidateFieldGetGet /public/validate_fieldMethod used to introduce the client software connected to Deribit platform over websocket. Provided data may have an impact on the maintained connection and will be collected for internal statistical purposes. In response, Deribit will also introduce itself.
SupportingApiPublicGetTimeGetGet /public/get_timeRetrieves the current time (in milliseconds). This API endpoint can be used to check the clock skew between your software and Deribit's systems.
SupportingApiPublicTestGetGet /public/testTests the connection to the API server, and returns its version. You can use this to make sure the API is reachable, and matches the expected version.
TradingApiPrivateBuyGetGet /private/buyPlaces a buy order for an instrument.
TradingApiPrivateCancelAllByCurrencyGetGet /private/cancel_all_by_currencyCancels all orders by currency, optionally filtered by instrument kind and/or order type.
TradingApiPrivateCancelAllByInstrumentGetGet /private/cancel_all_by_instrumentCancels all orders by instrument, optionally filtered by order type.
TradingApiPrivateCancelAllGetGet /private/cancel_allThis method cancels all users orders and stop orders within all currencies and instrument kinds.
TradingApiPrivateCancelGetGet /private/cancelCancel an order, specified by order id
TradingApiPrivateClosePositionGetGet /private/close_positionMakes closing position reduce only order .
TradingApiPrivateEditGetGet /private/editChange price, amount and/or other properties of an order.
TradingApiPrivateGetMarginsGetGet /private/get_marginsGet margins for given instrument, amount and price.
TradingApiPrivateGetOpenOrdersByCurrencyGetGet /private/get_open_orders_by_currencyRetrieves list of user's open orders.
TradingApiPrivateGetOpenOrdersByInstrumentGetGet /private/get_open_orders_by_instrumentRetrieves list of user's open orders within given Instrument.
TradingApiPrivateGetOrderHistoryByCurrencyGetGet /private/get_order_history_by_currencyRetrieves history of orders that have been partially or fully filled.
TradingApiPrivateGetOrderHistoryByInstrumentGetGet /private/get_order_history_by_instrumentRetrieves history of orders that have been partially or fully filled.
TradingApiPrivateGetOrderMarginByIdsGetGet /private/get_order_margin_by_idsRetrieves initial margins of given orders
TradingApiPrivateGetOrderStateGetGet /private/get_order_stateRetrieve the current state of an order.
TradingApiPrivateGetSettlementHistoryByCurrencyGetGet /private/get_settlement_history_by_currencyRetrieves settlement, delivery and bankruptcy events that have affected your account.
TradingApiPrivateGetSettlementHistoryByInstrumentGetGet /private/get_settlement_history_by_instrumentRetrieves public settlement, delivery and bankruptcy events filtered by instrument name
TradingApiPrivateGetUserTradesByCurrencyAndTimeGetGet /private/get_user_trades_by_currency_and_timeRetrieve the latest user trades that have occurred for instruments in a specific currency symbol and within given time range.
TradingApiPrivateGetUserTradesByCurrencyGetGet /private/get_user_trades_by_currencyRetrieve the latest user trades that have occurred for instruments in a specific currency symbol.
TradingApiPrivateGetUserTradesByInstrumentAndTimeGetGet /private/get_user_trades_by_instrument_and_timeRetrieve the latest user trades that have occurred for a specific instrument and within given time range.
TradingApiPrivateGetUserTradesByInstrumentGetGet /private/get_user_trades_by_instrumentRetrieve the latest user trades that have occurred for a specific instrument.
TradingApiPrivateGetUserTradesByOrderGetGet /private/get_user_trades_by_orderRetrieve the list of user trades that was created for given order
TradingApiPrivateSellGetGet /private/sellPlaces a sell order for an instrument.
WalletApiPrivateAddToAddressBookGetGet /private/add_to_address_bookAdds new entry to address book of given type
WalletApiPrivateCancelTransferByIdGetGet /private/cancel_transfer_by_idCancel transfer
WalletApiPrivateCancelWithdrawalGetGet /private/cancel_withdrawalCancels withdrawal request
WalletApiPrivateCreateDepositAddressGetGet /private/create_deposit_addressCreates deposit address in currency
WalletApiPrivateGetAddressBookGetGet /private/get_address_bookRetrieves address book of given type
WalletApiPrivateGetCurrentDepositAddressGetGet /private/get_current_deposit_addressRetrieve deposit address for currency
WalletApiPrivateGetDepositsGetGet /private/get_depositsRetrieve the latest users deposits
WalletApiPrivateGetTransfersGetGet /private/get_transfersAdds new entry to address book of given type
WalletApiPrivateGetWithdrawalsGetGet /private/get_withdrawalsRetrieve the latest users withdrawals
WalletApiPrivateRemoveFromAddressBookGetGet /private/remove_from_address_bookAdds new entry to address book of given type
WalletApiPrivateSubmitTransferToSubaccountGetGet /private/submit_transfer_to_subaccountTransfer funds to a subaccount.
WalletApiPrivateSubmitTransferToUserGetGet /private/submit_transfer_to_userTransfer funds to a another user.
WalletApiPrivateToggleDepositAddressCreationGetGet /private/toggle_deposit_address_creationEnable or disable deposit address creation
WalletApiPrivateWithdrawGetGet /private/withdrawCreates a new withdrawal request

Documentation For Models

Documentation For Authorization

bearerAuth

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

Author