Documentation
¶
Overview ¶
Package goderive is the root of the go-derive SDK for the Derive exchange (formerly Lyra). The user-facing API lives under pkg/. Most users want pkg/derive for the top-level facade, or pkg/rest and pkg/ws directly for fine-grained control.
Quick start:
import (
"context"
"github.com/amiwrpremium/go-derive/pkg/auth"
"github.com/amiwrpremium/go-derive/pkg/derive"
)
signer, _ := auth.NewLocalSigner("0xPRIVATEKEY")
c, _ := derive.NewClient(
derive.WithMainnet(),
derive.WithSigner(signer),
derive.WithSubaccount(123),
)
defer c.Close()
instruments, err := c.REST.GetInstruments(context.Background(), "BTC", "perp")
Index ¶
Constants ¶
View Source
const Version = "0.23.3" // x-release-please-version
Version is the SDK semantic version. It is reported in the User-Agent header of REST requests and in the WebSocket connect handshake. The literal is maintained by release-please via the x-release-please-version annotation.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
auth/action_data
command
Computes the EIP-712 hashStruct of an ActionData.
|
Computes the EIP-712 hashStruct of an ActionData. |
|
auth/http_headers
command
Builds the X-LyraWallet/Timestamp/Signature header bundle.
|
Builds the X-LyraWallet/Timestamp/Signature header bundle. |
|
auth/local_signer
command
Builds an auth.LocalSigner from the configured private key.
|
Builds an auth.LocalSigner from the configured private key. |
|
auth/nonce
command
Generates strictly-increasing nonces.
|
Generates strictly-increasing nonces. |
|
auth/session_key_signer
command
Builds an auth.SessionKeySigner — owner address differs from the session key address.
|
Builds an auth.SessionKeySigner — owner address differs from the session key address. |
|
auth/sign_action
command
Signs an EIP-712 ActionData and prints the resulting signature.
|
Signs an EIP-712 ActionData and prints the resulting signature. |
|
auth/sign_auth_header
command
Signs an EIP-191 timestamp for use as the X-LyraSignature header.
|
Signs an EIP-191 timestamp for use as the X-LyraSignature header. |
|
auth/signature
command
Demonstrates Signature.Hex serialisation.
|
Demonstrates Signature.Hex serialisation. |
|
auth/trade_module_data
command
Hashes the per-trade module payload that goes into ActionData.Data.
|
Hashes the per-trade module payload that goes into ActionData.Data. |
|
auth/transfer_module_data
command
Hashes the per-transfer module payload.
|
Hashes the per-transfer module payload. |
|
derive/full
command
Builds the facade with private credentials and uses both REST and WS.
|
Builds the facade with private credentials and uses both REST and WS. |
|
derive/new_client
command
Constructs the top-level facade with the configured network.
|
Constructs the top-level facade with the configured network. |
|
derive/rest_only
command
Uses only the c.REST client from the facade.
|
Uses only the c.REST client from the facade. |
|
derive/ws_only
command
Uses only the c.WS client from the facade — connects and fetches a ticker.
|
Uses only the c.WS client from the facade — connects and fetches a ticker. |
|
rest/private/change_subaccount_label
command
Sets a human-readable label on the configured subaccount.
|
Sets a human-readable label on the configured subaccount. |
|
rest/private/contact_info/create
command
Registers a new contact-info record on the configured signer's wallet.
|
Registers a new contact-info record on the configured signer's wallet. |
|
rest/private/contact_info/delete
command
Deletes one contact-info record by id.
|
Deletes one contact-info record by id. |
|
rest/private/contact_info/get
command
Lists every contact-info record on the configured signer's wallet.
|
Lists every contact-info record on the configured signer's wallet. |
|
rest/private/contact_info/update
command
Updates the value of an existing contact-info record.
|
Updates the value of an existing contact-info record. |
|
rest/private/expired_and_cancelled_history
command
Exports the configured subaccount's expired and cancelled orders.
|
Exports the configured subaccount's expired and cancelled orders. |
|
rest/private/get_account
command
Fetches wallet-level account information for the configured signer.
|
Fetches wallet-level account information for the configured signer. |
|
rest/private/get_algo_orders
command
Lists every active algo order on the configured subaccount.
|
Lists every active algo order on the configured subaccount. |
|
rest/private/get_all_portfolios
command
Lists per-subaccount portfolio snapshots for every subaccount the configured signer's wallet owns.
|
Lists per-subaccount portfolio snapshots for every subaccount the configured signer's wallet owns. |
|
rest/private/get_collaterals
command
Lists the subaccount's collateral positions.
|
Lists the subaccount's collateral positions. |
|
rest/private/get_deposit_history
command
Paginates deposit events.
|
Paginates deposit events. |
|
rest/private/get_erc20_transfer_history
command
Lists ERC20 transfers for the configured subaccount.
|
Lists ERC20 transfers for the configured subaccount. |
|
rest/private/get_funding_history
command
Fetches funding payments received / paid by the configured subaccount.
|
Fetches funding payments received / paid by the configured subaccount. |
|
rest/private/get_interest_history
command
Lists interest payments received / paid by the configured subaccount.
|
Lists interest payments received / paid by the configured subaccount. |
|
rest/private/get_liquidation_history
command
Fetches the configured subaccount's past liquidation events.
|
Fetches the configured subaccount's past liquidation events. |
|
rest/private/get_liquidator_history
command
Lists auction bids placed by the configured subaccount as a liquidator (paginated).
|
Lists auction bids placed by the configured subaccount as a liquidator (paginated). |
|
rest/private/get_margin
command
Simulates a margin calculation against the configured subaccount and reports pre/post initial- and maintenance-margin values.
|
Simulates a margin calculation against the configured subaccount and reports pre/post initial- and maintenance-margin values. |
|
rest/private/get_open_orders
command
Lists currently-open orders.
|
Lists currently-open orders. |
|
rest/private/get_option_settlement_history
command
Lists option settlements for the configured subaccount.
|
Lists option settlements for the configured subaccount. |
|
rest/private/get_order
command
Fetches one order by id.
|
Fetches one order by id. |
|
rest/private/get_order_history
command
Paginates past orders by time window.
|
Paginates past orders by time window. |
|
rest/private/get_orders
command
Paginates orders on the configured subaccount, optionally filtered by instrument / label / status.
|
Paginates orders on the configured subaccount, optionally filtered by instrument / label / status. |
|
rest/private/get_positions
command
Lists the subaccount's open positions.
|
Lists the subaccount's open positions. |
|
rest/private/get_subaccount
command
Fetches a single subaccount snapshot.
|
Fetches a single subaccount snapshot. |
|
rest/private/get_subaccount_value_history
command
Lists historical subaccount-value snapshots.
|
Lists historical subaccount-value snapshots. |
|
rest/private/get_subaccounts
command
Lists every subaccount the wallet owns.
|
Lists every subaccount the wallet owns. |
|
rest/private/get_trade_history
command
Paginates the user's filled trades.
|
Paginates the user's filled trades. |
|
rest/private/get_transaction
command
Fetches one transaction record by id.
|
Fetches one transaction record by id. |
|
rest/private/get_trigger_orders
command
Lists every untriggered trigger order on the configured subaccount.
|
Lists every untriggered trigger order on the configured subaccount. |
|
rest/private/get_withdrawal_history
command
Paginates withdrawal events.
|
Paginates withdrawal events. |
|
rest/private/mmp/get
command
Reads market-maker-protection config for the configured subaccount, optionally filtered to one currency (empty string returns every configured currency).
|
Reads market-maker-protection config for the configured subaccount, optionally filtered to one currency (empty string returns every configured currency). |
|
rest/private/mmp/reset
command
Unfreezes market-maker protection for one currency.
|
Unfreezes market-maker protection for one currency. |
|
rest/private/mmp/set
command
Configures market-maker protection for one currency.
|
Configures market-maker protection for one currency. |
|
rest/private/notifications/get
command
Paginates notifications for the configured subaccount.
|
Paginates notifications for the configured subaccount. |
|
rest/private/notifications/update
command
Marks specific notifications as seen or hidden.
|
Marks specific notifications as seen or hidden. |
|
rest/private/order_debug
command
Previews an order without submitting it.
|
Previews an order without submitting it. |
|
rest/private/order_quote
command
Pre-flights a hypothetical order through the matching engine for the configured subaccount.
|
Pre-flights a hypothetical order through the matching engine for the configured subaccount. |
|
rest/private/orders/cancel
command
Cancels one order by id.
|
Cancels one order by id. |
|
rest/private/orders/cancel_algo_order
command
Cancels one in-flight algo order by id.
|
Cancels one in-flight algo order by id. |
|
rest/private/orders/cancel_all
command
Cancels every open order on the subaccount.
|
Cancels every open order on the subaccount. |
|
rest/private/orders/cancel_all_algo_orders
command
Cancels every in-flight algo order on the configured subaccount.
|
Cancels every in-flight algo order on the configured subaccount. |
|
rest/private/orders/cancel_all_trigger_orders
command
Cancels every untriggered trigger order on the configured subaccount.
|
Cancels every untriggered trigger order on the configured subaccount. |
|
rest/private/orders/cancel_by_instrument
command
Cancels every open order on one instrument.
|
Cancels every open order on one instrument. |
|
rest/private/orders/cancel_by_label
command
Cancels every order carrying a given label.
|
Cancels every order carrying a given label. |
|
rest/private/orders/cancel_by_nonce
command
Cancels every order on the configured subaccount that carries the given nonce.
|
Cancels every order on the configured subaccount that carries the given nonce. |
|
rest/private/orders/cancel_trigger_order
command
Cancels one untriggered trigger order by id.
|
Cancels one untriggered trigger order by id. |
|
rest/private/orders/place
command
Places one limit buy 5% below mark (won't fill on a normal book).
|
Places one limit buy 5% below mark (won't fill on a normal book). |
|
rest/private/orders/place_algo
command
Places one TWAP algo buy 5% below mark — saved server-side and sliced over a 10-minute window into 10 child orders.
|
Places one TWAP algo buy 5% below mark — saved server-side and sliced over a 10-minute window into 10 child orders. |
|
rest/private/orders/place_trigger
command
Places one stop-loss trigger sell 5% below mark.
|
Places one stop-loss trigger sell 5% below mark. |
|
rest/private/replace
command
Replaces (cancel + place) one outstanding order in a single round trip.
|
Replaces (cancel + place) one outstanding order in a single round trip. |
|
rest/private/rfq/cancel
command
Cancels one outstanding RFQ.
|
Cancels one outstanding RFQ. |
|
rest/private/rfq/cancel_batch_quotes
command
Bulk-cancels every quote on the configured subaccount, optionally filtered by label / nonce.
|
Bulk-cancels every quote on the configured subaccount, optionally filtered by label / nonce. |
|
rest/private/rfq/cancel_batch_rfqs
command
Bulk-cancels every outstanding RFQ on the configured subaccount.
|
Bulk-cancels every outstanding RFQ on the configured subaccount. |
|
rest/private/rfq/cancel_quote
command
Cancels one outstanding quote by id.
|
Cancels one outstanding quote by id. |
|
rest/private/rfq/execute_quote
command
Executes (accepts) a quote received against the configured subaccount's RFQ.
|
Executes (accepts) a quote received against the configured subaccount's RFQ. |
|
rest/private/rfq/get_best_quote
command
Returns the best quote currently available for a hypothetical RFQ shape — the SDK's pre-flight for "what could I get if I asked for this?" without actually submitting the RFQ.
|
Returns the best quote currently available for a hypothetical RFQ shape — the SDK's pre-flight for "what could I get if I asked for this?" without actually submitting the RFQ. |
|
rest/private/rfq/get_quotes
command
Paginates the configured subaccount's quotes — own quotes either active or in any historical state.
|
Paginates the configured subaccount's quotes — own quotes either active or in any historical state. |
|
rest/private/rfq/get_rfqs
command
Paginates the configured subaccount's outstanding and historical RFQs.
|
Paginates the configured subaccount's outstanding and historical RFQs. |
|
rest/private/rfq/poll
command
Polls outstanding RFQs for the subaccount.
|
Polls outstanding RFQs for the subaccount. |
|
rest/private/rfq/poll_quotes
command
Polls quotes received against the configured subaccount's RFQs — the maker-side view of what other makers are quoting on an active RFQ.
|
Polls quotes received against the configured subaccount's RFQs — the maker-side view of what other makers are quoting on an active RFQ. |
|
rest/private/rfq/replace_quote
command
Replaces (cancel + send) one outstanding maker quote in a single round trip — the quote-side counterpart to private/replace for orders.
|
Replaces (cancel + send) one outstanding maker quote in a single round trip — the quote-side counterpart to private/replace for orders. |
|
rest/private/rfq/send
command
Sends a one-leg RFQ.
|
Sends a one-leg RFQ. |
|
rest/private/rfq/send_quote
command
Submits a quote in response to an existing RFQ — the maker side of the RFQ flow.
|
Submits a quote in response to an existing RFQ — the maker side of the RFQ flow. |
|
rest/private/set_cancel_on_disconnect
command
Arms (or disarms) the cancel-on-disconnect kill-switch for the wallet.
|
Arms (or disarms) the cancel-on-disconnect kill-switch for the wallet. |
|
rest/public/all_statistics
command
Aggregate (currency, instrument_type) statistics across every instrument.
|
Aggregate (currency, instrument_type) statistics across every instrument. |
|
rest/public/all_user_statistics
command
Per-wallet trading statistics for every wallet matching the supplied filters.
|
Per-wallet trading statistics for every wallet matching the supplied filters. |
|
rest/public/get_all_instruments
command
Lists every active perpetual instrument across all currencies, paginated.
|
Lists every active perpetual instrument across all currencies, paginated. |
|
rest/public/get_all_points
command
Program-wide points snapshot.
|
Program-wide points snapshot. |
|
rest/public/get_all_referral_codes
command
Lists every valid referral code for the configured signer's wallet (or omits the wallet param when no signer is configured).
|
Lists every valid referral code for the configured signer's wallet (or omits the wallet param when no signer is configured). |
|
rest/public/get_asset
command
Fetches one Asset record by name.
|
Fetches one Asset record by name. |
|
rest/public/get_assets
command
Lists Asset records matching the supplied filter.
|
Lists Asset records matching the supplied filter. |
|
rest/public/get_bridge_balances
command
Lists every bridge / cross-chain balance the engine tracks.
|
Lists every bridge / cross-chain balance the engine tracks. |
|
rest/public/get_currencies
command
Lists all quote currencies supported on the configured network.
|
Lists all quote currencies supported on the configured network. |
|
rest/public/get_currency
command
Fetches per-asset margin parameters and protocol-asset addresses for one underlying currency.
|
Fetches per-asset margin parameters and protocol-asset addresses for one underlying currency. |
|
rest/public/get_descendant_tree
command
Returns the referee tree rooted at one wallet (or invite code).
|
Returns the referee tree rooted at one wallet (or invite code). |
|
rest/public/get_detailed_maker_snapshot_history
command
Per-quote maker-snapshot rows for one program / epoch.
|
Per-quote maker-snapshot rows for one program / epoch. |
|
rest/public/get_funding_rate_history
command
Fetches historical funding-rate prints for one perpetual instrument and prints the most recent few entries.
|
Fetches historical funding-rate prints for one perpetual instrument and prints the most recent few entries. |
|
rest/public/get_index_chart_data
command
Fetches OHLC candles for one currency's index price feed over the last hour at one-minute resolution.
|
Fetches OHLC candles for one currency's index price feed over the last hour at one-minute resolution. |
|
rest/public/get_instrument
command
Fetches details for one instrument by name.
|
Fetches details for one instrument by name. |
|
rest/public/get_instruments
command
Lists active BTC perpetual instruments.
|
Lists active BTC perpetual instruments. |
|
rest/public/get_interest_rate_history
command
Fetches historical USDC borrow / supply APY prints over the last 24 hours.
|
Fetches historical USDC borrow / supply APY prints over the last 24 hours. |
|
rest/public/get_invite_code
command
Returns the invite code allocated to one wallet plus its remaining-uses counter.
|
Returns the invite code allocated to one wallet plus its remaining-uses counter. |
|
rest/public/get_latest_signed_feeds
command
Fetches the latest oracle signed-feed snapshot.
|
Fetches the latest oracle signed-feed snapshot. |
|
rest/public/get_liquidation_history
command
Lists the network-wide liquidation auction history (paginated).
|
Lists the network-wide liquidation auction history (paginated). |
|
rest/public/get_live_incidents
command
Lists ongoing platform incidents.
|
Lists ongoing platform incidents. |
|
rest/public/get_maker_program_scores
command
Fetches the per-wallet score breakdown for one maker incentive program at one epoch.
|
Fetches the per-wallet score breakdown for one maker incentive program at one epoch. |
|
rest/public/get_maker_programs
command
Lists active maker incentive programs.
|
Lists active maker incentive programs. |
|
rest/public/get_margin
command
Simulates a margin calculation for a hypothetical portfolio.
|
Simulates a margin calculation for a hypothetical portfolio. |
|
rest/public/get_option_settlement_history
command
Lists platform-wide option settlements.
|
Lists platform-wide option settlements. |
|
rest/public/get_option_settlement_prices
command
Fetches the per-expiry settlement prices for one currency's option market.
|
Fetches the per-expiry settlement prices for one currency's option market. |
|
rest/public/get_perp_impact_twap
command
Fetches the time-weighted average impact price for one currency's perpetual book over the last hour.
|
Fetches the time-weighted average impact price for one currency's perpetual book over the last hour. |
|
rest/public/get_points
command
One wallet's points record for one program.
|
One wallet's points record for one program. |
|
rest/public/get_points_leaderboard
command
One page (up to 500 entries) of the points leaderboard for one program.
|
One page (up to 500 entries) of the points leaderboard for one program. |
|
rest/public/get_referral_code
command
Returns the referral code currently associated with one wallet.
|
Returns the referral code currently associated with one wallet. |
|
rest/public/get_referral_performance
command
Fetches the headline referral performance for the configured referral code over the last 30 days.
|
Fetches the headline referral performance for the configured referral code over the last 30 days. |
|
rest/public/get_spot_feed_history
command
Lists historical oracle spot-feed values for one currency.
|
Lists historical oracle spot-feed values for one currency. |
|
rest/public/get_spot_feed_history_candles
command
Fetches OHLC candles for one currency's spot feed over the last hour at one-minute resolution.
|
Fetches OHLC candles for one currency's spot feed over the last hour at one-minute resolution. |
|
rest/public/get_statistics
command
Fetches rolling daily / lifetime statistics (volume, fees, trades, OI) for one instrument and prints the headline numbers.
|
Fetches rolling daily / lifetime statistics (volume, fees, trades, OI) for one instrument and prints the headline numbers. |
|
rest/public/get_stdrv_snapshots
command
One wallet's staked-DRV balance snapshots over a time window.
|
One wallet's staked-DRV balance snapshots over a time window. |
|
rest/public/get_ticker
command
Fetches a ticker (top-of-book + marks).
|
Fetches a ticker (top-of-book + marks). |
|
rest/public/get_tickers
command
Bulk-fetches the per-instrument ticker snapshot for every perp instrument.
|
Bulk-fetches the per-instrument ticker snapshot for every perp instrument. |
|
rest/public/get_time
command
Fetches Derive's server time over REST.
|
Fetches Derive's server time over REST. |
|
rest/public/get_trade_history
command
Paginates the public trade tape — page-sized 5, prints the latest 5 trades plus the total record count and page count Derive reports.
|
Paginates the public trade tape — page-sized 5, prints the latest 5 trades plus the total record count and page count Derive reports. |
|
rest/public/get_tradingview_chart_data
command
Fetches TradingView-format OHLC bars for one instrument over the last hour at one-minute resolution.
|
Fetches TradingView-format OHLC bars for one instrument over the last hour at one-minute resolution. |
|
rest/public/get_tree_roots
command
Lists every root wallet (top-of-tree referrer) the engine tracks.
|
Lists every root wallet (top-of-tree referrer) the engine tracks. |
|
rest/public/get_vault_assets
command
Lists every ERC-20 asset tracked by Derive's vault orderbook.
|
Lists every ERC-20 asset tracked by Derive's vault orderbook. |
|
rest/public/get_vault_balances
command
Lists one wallet's vault-token holdings across every Derive vault.
|
Lists one wallet's vault-token holdings across every Derive vault. |
|
rest/public/get_vault_pools
command
Lists every registered vault ERC-20 pool.
|
Lists every registered vault ERC-20 pool. |
|
rest/public/get_vault_rates
command
Returns the engine's current view of one basis vault's rate components.
|
Returns the engine's current view of one basis vault's rate components. |
|
rest/public/get_vault_share
command
Fetches per-block snapshots of one vault token's price-per-share over the last 24 hours.
|
Fetches per-block snapshots of one vault token's price-per-share over the last 24 hours. |
|
rest/public/get_vault_statistics
command
Lists summary statistics (TVL, total supply, last-trade subaccount value) for every Derive vault.
|
Lists summary statistics (TVL, total supply, last-trade subaccount value) for every Derive vault. |
|
rest/public/margin_watch
command
Calculates the mark-to-market and maintenance-margin snapshot for one subaccount.
|
Calculates the mark-to-market and maintenance-margin snapshot for one subaccount. |
|
rest/public/order_quote
command
Pre-flights a hypothetical order through the matching engine via public/order_quote.
|
Pre-flights a hypothetical order through the matching engine via public/order_quote. |
|
rest/public/user_statistics
command
One wallet's trading statistics.
|
One wallet's trading statistics. |
|
rest/public/validate_invite_code
command
Validates one invite code.
|
Validates one invite code. |
|
ws/private/change_subaccount_label
command
Sets a human-readable label on the configured subaccount over WebSocket.
|
Sets a human-readable label on the configured subaccount over WebSocket. |
|
ws/private/expired_and_cancelled_history
command
Exports the configured subaccount's expired and cancelled orders over WebSocket.
|
Exports the configured subaccount's expired and cancelled orders over WebSocket. |
|
ws/private/get_collaterals
command
Fetches collateral over WebSocket.
|
Fetches collateral over WebSocket. |
|
ws/private/get_deposit_history
command
Paginates deposits over WebSocket.
|
Paginates deposits over WebSocket. |
|
ws/private/get_erc20_transfer_history
command
Lists ERC20 transfers for the configured subaccount over WebSocket.
|
Lists ERC20 transfers for the configured subaccount over WebSocket. |
|
ws/private/get_interest_history
command
Lists interest payments for the configured subaccount over WebSocket.
|
Lists interest payments for the configured subaccount over WebSocket. |
|
ws/private/get_margin
command
Simulates a margin calculation for the configured subaccount over WebSocket.
|
Simulates a margin calculation for the configured subaccount over WebSocket. |
|
ws/private/get_open_orders
command
Fetches open orders over WebSocket.
|
Fetches open orders over WebSocket. |
|
ws/private/get_option_settlement_history
command
Lists option settlements for the configured subaccount over WebSocket.
|
Lists option settlements for the configured subaccount over WebSocket. |
|
ws/private/get_order
command
Fetches one order by id over WebSocket.
|
Fetches one order by id over WebSocket. |
|
ws/private/get_order_history
command
Paginates past orders by time window over WebSocket.
|
Paginates past orders by time window over WebSocket. |
|
ws/private/get_positions
command
Fetches positions over WebSocket.
|
Fetches positions over WebSocket. |
|
ws/private/get_subaccount
command
Fetches the configured subaccount snapshot over WebSocket.
|
Fetches the configured subaccount snapshot over WebSocket. |
|
ws/private/get_subaccount_value_history
command
Lists historical subaccount-value snapshots over WebSocket.
|
Lists historical subaccount-value snapshots over WebSocket. |
|
ws/private/get_subaccounts
command
Lists every subaccount the wallet owns over WebSocket.
|
Lists every subaccount the wallet owns over WebSocket. |
|
ws/private/get_trade_history
command
Paginates user trades over WebSocket.
|
Paginates user trades over WebSocket. |
|
ws/private/get_transaction
command
Fetches one transaction record by id over WebSocket.
|
Fetches one transaction record by id over WebSocket. |
|
ws/private/get_withdrawal_history
command
Paginates withdrawals over WebSocket.
|
Paginates withdrawals over WebSocket. |
|
ws/private/login
command
Authenticates a WebSocket session via public/login.
|
Authenticates a WebSocket session via public/login. |
|
ws/private/mmp/get
command
Reads MMP config over WebSocket.
|
Reads MMP config over WebSocket. |
|
ws/private/mmp/reset
command
Resets MMP for one currency over WebSocket.
|
Resets MMP for one currency over WebSocket. |
|
ws/private/mmp/set
command
Sets MMP config over WebSocket.
|
Sets MMP config over WebSocket. |
|
ws/private/notifications/get
command
Paginates notifications over WebSocket.
|
Paginates notifications over WebSocket. |
|
ws/private/notifications/update
command
Marks specific notifications as seen or hidden over WebSocket.
|
Marks specific notifications as seen or hidden over WebSocket. |
|
ws/private/order_quote
command
Pre-flights a hypothetical order for the configured subaccount over WebSocket.
|
Pre-flights a hypothetical order for the configured subaccount over WebSocket. |
|
ws/private/orders/cancel
command
Cancels one order by id over WebSocket.
|
Cancels one order by id over WebSocket. |
|
ws/private/orders/cancel_all
command
Cancels every open order on the subaccount over WebSocket.
|
Cancels every open order on the subaccount over WebSocket. |
|
ws/private/orders/cancel_by_instrument
command
Cancels orders on one instrument over WebSocket.
|
Cancels orders on one instrument over WebSocket. |
|
ws/private/orders/cancel_by_label
command
Cancels orders by label over WebSocket.
|
Cancels orders by label over WebSocket. |
|
ws/private/orders/cancel_by_nonce
command
Cancels every order on the configured subaccount that carries the given nonce, over WebSocket.
|
Cancels every order on the configured subaccount that carries the given nonce, over WebSocket. |
|
ws/private/orders/place
command
Places one limit order over WebSocket.
|
Places one limit order over WebSocket. |
|
ws/private/rfq/cancel
command
Cancels one RFQ over WebSocket.
|
Cancels one RFQ over WebSocket. |
|
ws/private/rfq/cancel_batch_quotes
command
Bulk-cancels every quote on the configured subaccount over WebSocket.
|
Bulk-cancels every quote on the configured subaccount over WebSocket. |
|
ws/private/rfq/cancel_batch_rfqs
command
Bulk-cancels every outstanding RFQ on the configured subaccount over WebSocket.
|
Bulk-cancels every outstanding RFQ on the configured subaccount over WebSocket. |
|
ws/private/rfq/cancel_quote
command
Cancels one outstanding quote by id over WebSocket.
|
Cancels one outstanding quote by id over WebSocket. |
|
ws/private/rfq/execute_quote
command
Executes (accepts) a quote against the configured subaccount's RFQ over WebSocket.
|
Executes (accepts) a quote against the configured subaccount's RFQ over WebSocket. |
|
ws/private/rfq/get_best_quote
command
Returns the best quote available for a hypothetical RFQ shape over WebSocket.
|
Returns the best quote available for a hypothetical RFQ shape over WebSocket. |
|
ws/private/rfq/get_quotes
command
Paginates the configured subaccount's quotes over WebSocket.
|
Paginates the configured subaccount's quotes over WebSocket. |
|
ws/private/rfq/get_rfqs
command
Paginates the configured subaccount's RFQs over WebSocket.
|
Paginates the configured subaccount's RFQs over WebSocket. |
|
ws/private/rfq/poll
command
Polls outstanding RFQs over WebSocket.
|
Polls outstanding RFQs over WebSocket. |
|
ws/private/rfq/poll_quotes
command
Polls quotes received against the configured subaccount's RFQs over WebSocket.
|
Polls quotes received against the configured subaccount's RFQs over WebSocket. |
|
ws/private/rfq/send
command
Sends a one-leg RFQ over WebSocket.
|
Sends a one-leg RFQ over WebSocket. |
|
ws/private/rfq/send_quote
command
Submits a quote in response to an existing RFQ over WebSocket — the maker side of the RFQ flow.
|
Submits a quote in response to an existing RFQ over WebSocket — the maker side of the RFQ flow. |
|
ws/private/subscribe/balances
command
Streams subaccount balance updates.
|
Streams subaccount balance updates. |
|
ws/private/subscribe/best_quotes
command
Streams the running best-quote state for every open RFQ on the configured subaccount.
|
Streams the running best-quote state for every open RFQ on the configured subaccount. |
|
ws/private/subscribe/multi
command
Subscribes to three private channels for one subaccount and demuxes them in a single select loop.
|
Subscribes to three private channels for one subaccount and demuxes them in a single select loop. |
|
ws/private/subscribe/orders
command
Streams subaccount order updates.
|
Streams subaccount order updates. |
|
ws/private/subscribe/quotes
command
Streams quote updates received against this subaccount's RFQs.
|
Streams quote updates received against this subaccount's RFQs. |
|
ws/private/subscribe/rfqs
command
Streams wallet RFQ status updates.
|
Streams wallet RFQ status updates. |
|
ws/private/subscribe/trades
command
Streams the subaccount's fill events.
|
Streams the subaccount's fill events. |
|
ws/private/subscribe/trades_settled
command
Streams the configured subaccount's fills filtered to settled-only — same payload as ws/private/subscribe/trades but filtered server-side.
|
Streams the configured subaccount's fills filtered to settled-only — same payload as ws/private/subscribe/trades but filtered server-side. |
|
ws/public/connect
command
Opens a WebSocket connection and reports its state.
|
Opens a WebSocket connection and reports its state. |
|
ws/public/get_currencies
command
Lists currencies over WebSocket.
|
Lists currencies over WebSocket. |
|
ws/public/get_instrument
command
Fetches one instrument over WebSocket.
|
Fetches one instrument over WebSocket. |
|
ws/public/get_instruments
command
Lists BTC perp instruments over WebSocket.
|
Lists BTC perp instruments over WebSocket. |
|
ws/public/get_margin
command
Simulates a margin calculation for a hypothetical portfolio over WebSocket.
|
Simulates a margin calculation for a hypothetical portfolio over WebSocket. |
|
ws/public/get_option_settlement_history
command
Lists platform-wide option settlements over WebSocket.
|
Lists platform-wide option settlements over WebSocket. |
|
ws/public/get_spot_feed_history
command
Lists historical oracle spot-feed values over WebSocket.
|
Lists historical oracle spot-feed values over WebSocket. |
|
ws/public/get_ticker
command
Fetches a ticker over WebSocket (single RPC, not a subscription).
|
Fetches a ticker over WebSocket (single RPC, not a subscription). |
|
ws/public/get_time
command
Fetches server time over WebSocket.
|
Fetches server time over WebSocket. |
|
ws/public/get_trade_history
command
Paginates the public trade tape over WebSocket.
|
Paginates the public trade tape over WebSocket. |
|
ws/public/subscribe/auctions_watch
command
Streams the platform-wide auctions.watch feed: every liquidation auction Derive is currently running emits per-state-transition events (one when an auction begins/updates, one when it ends).
|
Streams the platform-wide auctions.watch feed: every liquidation auction Derive is currently running emits per-state-transition events (one when an auction begins/updates, one when it ends). |
|
ws/public/subscribe/margin_watch
command
Streams the platform-wide margin_watch feed: every subaccount whose maintenance margin has crossed the watch threshold gets emitted as part of a per-timestamp batch.
|
Streams the platform-wide margin_watch feed: every subaccount whose maintenance margin has crossed the watch threshold gets emitted as part of a per-timestamp batch. |
|
ws/public/subscribe/multi
command
Subscribes to three public channels for one instrument and demultiplexes them across three goroutines — one per subscription — so a slow handler on one channel cannot starve the others.
|
Subscribes to three public channels for one instrument and demultiplexes them across three goroutines — one per subscription — so a slow handler on one channel cannot starve the others. |
|
ws/public/subscribe/multi_into
command
Multiplexes two trade-channel subscriptions into one shared chan using SubscribeInto.
|
Multiplexes two trade-channel subscriptions into one shared chan using SubscribeInto. |
|
ws/public/subscribe/orderbook
command
Streams orderbook updates for one instrument and demos every SubscribeOption: a larger buffer, DropOldest so the freshest book always wins under back-pressure, and an error handler that surfaces drops to a counter.
|
Streams orderbook updates for one instrument and demos every SubscribeOption: a larger buffer, DropOldest so the freshest book always wins under back-pressure, and an error handler that surfaces drops to a counter. |
|
ws/public/subscribe/reconnect
command
Demonstrates the SDK's auto-reconnect + auto-resubscribe behaviour by subscribing to a ticker_slim feed and printing the update count seen in each 10-second window for 60 seconds total.
|
Demonstrates the SDK's auto-reconnect + auto-resubscribe behaviour by subscribing to a ticker_slim feed and printing the update count seen in each 10-second window for 60 seconds total. |
|
ws/public/subscribe/spot_feed
command
Streams oracle spot-feed updates for one currency.
|
Streams oracle spot-feed updates for one currency. |
|
ws/public/subscribe/ticker
command
Streams ticker_slim updates for one instrument — the compact wire variant.
|
Streams ticker_slim updates for one instrument — the compact wire variant. |
|
ws/public/subscribe/ticker_full
command
Streams the full ticker channel for one instrument — instrument metadata bundled with live market data.
|
Streams the full ticker channel for one instrument — instrument metadata bundled with live market data. |
|
ws/public/subscribe/trades
command
Streams public trade prints.
|
Streams public trade prints. |
|
ws/public/subscribe/trades_by_type
command
Streams every public trade for one (instrument_type, currency) pair.
|
Streams every public trade for one (instrument_type, currency) pair. |
|
ws/public/subscribe/trades_by_type_settled
command
Streams public trades for one (instrument_type, currency) tuple filtered to settled fills only — same payload as ws/public/subscribe/trades_by_type but filtered server-side.
|
Streams public trades for one (instrument_type, currency) tuple filtered to settled fills only — same payload as ws/public/subscribe/trades_by_type but filtered server-side. |
|
internal
|
|
|
codec
Package codec is a small bag of low-level encoding helpers shared between pkg/auth (action signing) and pkg/types.
|
Package codec is a small bag of low-level encoding helpers shared between pkg/auth (action signing) and pkg/types. |
|
jsonrpc
Package jsonrpc implements JSON-RPC 2.0 framing.
|
Package jsonrpc implements JSON-RPC 2.0 framing. |
|
methods
Package methods is the shared implementation of every JSON-RPC method Derive exposes.
|
Package methods is the shared implementation of every JSON-RPC method Derive exposes. |
|
netconf
Package netconf carries the network constants — endpoint URLs, chain IDs, and EIP-712 domain separators — for each Derive environment.
|
Package netconf carries the network constants — endpoint URLs, chain IDs, and EIP-712 domain separators — for each Derive environment. |
|
retry
Package retry contains backoff helpers used by the WebSocket reconnect loop.
|
Package retry contains backoff helpers used by the WebSocket reconnect loop. |
|
testutil
Package testutil exposes test fixtures and mock servers used by the SDK's internal tests.
|
Package testutil exposes test fixtures and mock servers used by the SDK's internal tests. |
|
transport
Package transport defines the JSON-RPC wire interface that pkg/rest and pkg/ws share, plus the HTTP and WebSocket implementations that satisfy it.
|
Package transport defines the JSON-RPC wire interface that pkg/rest and pkg/ws share, plus the HTTP and WebSocket implementations that satisfy it. |
|
pkg
|
|
|
auth
Package auth implements the two cryptographic signing flows Derive's API requires.
|
Package auth implements the two cryptographic signing flows Derive's API requires. |
|
derive
Package derive is the top-level convenience facade for the SDK.
|
Package derive is the top-level convenience facade for the SDK. |
|
enums
Package enums declares the named-string enums used across the SDK.
|
Package enums declares the named-string enums used across the SDK. |
|
errors
Package errors provides the SDK's error types and sentinel values.
|
Package errors provides the SDK's error types and sentinel values. |
|
rest
Package rest is the HTTP-backed client for Derive's JSON-RPC API.
|
Package rest is the HTTP-backed client for Derive's JSON-RPC API. |
|
types
Package types declares the domain types used in REST and WebSocket requests and responses.
|
Package types declares the domain types used in REST and WebSocket requests and responses. |
|
ws
Package ws is the WebSocket-backed client for Derive's JSON-RPC API.
|
Package ws is the WebSocket-backed client for Derive's JSON-RPC API. |
Click to show internal directories.
Click to hide internal directories.