Deribit: Remove deprecated RFQ endpoints (#2078)

* Initial plan

* Remove deprecated Deribit RFQ endpoints

Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com>

* Remove extra newline before TestGetTradeVolumes

Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com>

* Remove extra newline before TestSetMMPConfig

Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com>
This commit is contained in:
Copilot
2025-10-14 09:08:45 +11:00
committed by GitHub
parent 85a4ea6b3f
commit a9f23018e3
5 changed files with 0 additions and 141 deletions

View File

@@ -19,7 +19,6 @@ import (
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
"github.com/thrasher-corp/gocryptotrader/exchanges/kline"
"github.com/thrasher-corp/gocryptotrader/exchanges/nonce"
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
"github.com/thrasher-corp/gocryptotrader/exchanges/request"
"github.com/thrasher-corp/gocryptotrader/types"
)
@@ -65,7 +64,6 @@ const (
getMarkPriceHistory = "public/get_mark_price_history"
getOrderbook = "public/get_order_book"
getOrderbookByInstrumentID = "public/get_order_book_by_instrument_id"
getRFQ = "public/get_rfqs"
getTradeVolumes = "public/get_trade_volumes"
getTradingViewChartData = "public/get_tradingview_chart_data"
getVolatilityIndex = "public/get_volatility_index_data"
@@ -116,7 +114,6 @@ const (
getUserTradesByInstrumentAndTime = "private/get_user_trades_by_instrument_and_time"
getUserTradesByOrder = "private/get_user_trades_by_order"
resetMMP = "private/reset_mmp"
sendRFQ = "private/send_rfq"
setMMPConfig = "private/set_mmp_config"
getSettlementHistoryByInstrument = "private/get_settlement_history_by_instrument"
getSettlementHistoryByCurrency = "private/get_settlement_history_by_currency"
@@ -568,20 +565,6 @@ func (e *Exchange) GetSupportedIndexNames(ctx context.Context, priceIndexType st
return resp, e.SendHTTPRequest(ctx, exchange.RestSpot, nonMatchingEPL, common.EncodeURLValues("public/get_supported_index_names", params), &resp)
}
// GetRequestForQuote retrieves RFQ information.
func (e *Exchange) GetRequestForQuote(ctx context.Context, ccy currency.Code, kind string) ([]RequestForQuote, error) {
if ccy.IsEmpty() {
return nil, currency.ErrCurrencyCodeEmpty
}
params := url.Values{}
params.Set("currency", ccy.String())
if kind != "" {
params.Set("kind", kind)
}
var resp []RequestForQuote
return resp, e.SendHTTPRequest(ctx, exchange.RestFutures, nonMatchingEPL, common.EncodeURLValues(getRFQ, params), &resp)
}
// GetTradeVolumes gets trade volumes' data of all instruments
func (e *Exchange) GetTradeVolumes(ctx context.Context, extended bool) ([]TradeVolumesData, error) {
params := url.Values{}
@@ -2102,29 +2085,6 @@ func (e *Exchange) ResetMMP(ctx context.Context, ccy currency.Code) error {
return nil
}
// SendRequestForQuote sends RFQ on a given instrument.
func (e *Exchange) SendRequestForQuote(ctx context.Context, instrumentName string, amount float64, side order.Side) error {
params, err := checkInstrument(instrumentName)
if err != nil {
return err
}
if amount > 0 {
params.Set("amount", strconv.FormatFloat(amount, 'f', -1, 64))
}
if side != order.UnknownSide {
params.Set("side", side.String())
}
var resp string
err = e.SendHTTPAuthRequest(ctx, exchange.RestFutures, nonMatchingEPL, http.MethodGet, sendRFQ, params, &resp)
if err != nil {
return err
}
if resp != "ok" {
return fmt.Errorf("rfq couldn't send for %v", instrumentName)
}
return nil
}
// SetMMPConfig sends a request to set the given parameter values to the mmp config for the provided currency
func (e *Exchange) SetMMPConfig(ctx context.Context, ccy currency.Code, interval kline.Interval, frozenTime int64, quantityLimit, deltaLimit float64) error {
if ccy.IsEmpty() {

View File

@@ -857,24 +857,6 @@ func TestWsRetrieveSupportedIndexNames(t *testing.T) {
assert.NotNil(t, result)
}
func TestGetRequestForQuote(t *testing.T) {
t.Parallel()
_, err := e.GetRequestForQuote(t.Context(), currency.EMPTYCODE, e.GetAssetKind(asset.Futures))
require.ErrorIs(t, err, currency.ErrCurrencyCodeEmpty)
result, err := e.GetRequestForQuote(t.Context(), currency.BTC, e.GetAssetKind(asset.Futures))
require.NoError(t, err)
assert.NotNil(t, result)
}
func TestWSRetrieveRequestForQuote(t *testing.T) {
t.Parallel()
_, err := e.WSRetrieveRequestForQuote(t.Context(), currency.EMPTYCODE, e.GetAssetKind(asset.Futures))
require.ErrorIs(t, err, currency.ErrCurrencyCodeEmpty)
result, err := e.WSRetrieveRequestForQuote(t.Context(), currency.BTC, e.GetAssetKind(asset.Futures))
require.NoError(t, err)
assert.NotNil(t, result)
}
func TestGetTradeVolumes(t *testing.T) {
t.Parallel()
result, err := e.GetTradeVolumes(t.Context(), false)
@@ -2624,26 +2606,6 @@ func TestWSResetMMP(t *testing.T) {
assert.NoError(t, err)
}
func TestSendRequestForQuote(t *testing.T) {
t.Parallel()
err := e.SendRequestForQuote(t.Context(), "", 1000, order.Buy)
require.ErrorIs(t, err, errInvalidInstrumentName)
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
err = e.SendRequestForQuote(t.Context(), formatFuturesTradablePair(futuresTradablePair), 1000, order.Buy)
assert.NoError(t, err)
}
func TestWSSendRequestForQuote(t *testing.T) {
t.Parallel()
err := e.WSSendRequestForQuote(t.Context(), "", 1000, order.Buy)
require.ErrorIs(t, err, errInvalidInstrumentName)
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
err = e.WSSendRequestForQuote(t.Context(), formatFuturesTradablePair(futuresTradablePair), 1000, order.Buy)
assert.NoError(t, err)
}
func TestSetMMPConfig(t *testing.T) {
t.Parallel()
err := e.SetMMPConfig(t.Context(), currency.EMPTYCODE, kline.FiveMin, 5, 0, 0)

View File

@@ -901,15 +901,6 @@ type wsSubscriptionResponse struct {
Result []string `json:"result"`
}
// RequestForQuote RFQs for instruments in given currency.
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"`
}
// ComboDetail retrieves information about a combo
type ComboDetail struct {
ID string `json:"id"`
@@ -1252,15 +1243,6 @@ type wsQuoteTickerInformation struct {
BestAskAmount float64 `json:"best_ask_amount"`
}
// wsRequestForQuote represents a notifications about RFQs for instruments in given currency.
type wsRequestForQuote struct {
State bool `json:"state"`
Side any `json:"side"`
LastRFQTimestamp types.Time `json:"last_rfq_tstamp"`
InstrumentName string `json:"instrument_name"`
Amount any `json:"amount"`
}
// wsTrade represents trades for an instrument.
type wsTrade struct {
TradeSequence int64 `json:"trade_seq"`

View File

@@ -273,9 +273,6 @@ func (e *Exchange) wsHandleData(ctx context.Context, respRaw []byte) error {
return e.processData(respRaw, platformState)
case "quote": // Quote ticker information.
return e.processQuoteTicker(respRaw, channels)
case "rfq":
rfq := &wsRequestForQuote{}
return e.processData(respRaw, rfq)
case "ticker":
return e.processInstrumentTicker(respRaw, channels)
case "trades":

View File

@@ -12,7 +12,6 @@ import (
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/encoding/json"
"github.com/thrasher-corp/gocryptotrader/exchanges/kline"
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
"github.com/thrasher-corp/gocryptotrader/exchanges/request"
"github.com/thrasher-corp/gocryptotrader/log"
)
@@ -447,22 +446,6 @@ func (e *Exchange) WsRetrieveSupportedIndexNames(ctx context.Context, priceIndex
return resp, e.SendWSRequest(ctx, nonMatchingEPL, "public/get_supported_index_names", input, &resp, false)
}
// WSRetrieveRequestForQuote retrieves RFQ information.
func (e *Exchange) WSRetrieveRequestForQuote(ctx context.Context, ccy currency.Code, kind string) ([]RequestForQuote, error) {
if ccy.IsEmpty() {
return nil, currency.ErrCurrencyCodeEmpty
}
input := &struct {
Currency currency.Code `json:"currency"`
Kind string `json:"kind,omitempty"`
}{
Currency: ccy,
Kind: kind,
}
var resp []RequestForQuote
return resp, e.SendWSRequest(ctx, nonMatchingEPL, getRFQ, input, &resp, false)
}
// WSRetrieveTradeVolumes retrieves trade volumes' data of all instruments through the websocket connection.
func (e *Exchange) WSRetrieveTradeVolumes(ctx context.Context, extended bool) ([]TradeVolumesData, error) {
input := &struct {
@@ -1802,31 +1785,6 @@ func (e *Exchange) WSResetMMP(ctx context.Context, ccy currency.Code) error {
return nil
}
// WSSendRequestForQuote sends RFQ on a given instrument through the websocket connection.
func (e *Exchange) WSSendRequestForQuote(ctx context.Context, instrumentName string, amount float64, side order.Side) error {
if instrumentName == "" {
return errInvalidInstrumentName
}
input := &struct {
Instrument string `json:"instrument_name"`
Amount float64 `json:"amount,omitempty"`
Side string `json:"side,omitempty"`
}{
Instrument: instrumentName,
Amount: amount,
Side: side.String(),
}
var resp string
err := e.SendWSRequest(ctx, nonMatchingEPL, sendRFQ, input, &resp, true)
if err != nil {
return err
}
if resp != "ok" {
return fmt.Errorf("rfq couldn't send for %v", instrumentName)
}
return nil
}
// WSSetMMPConfig sends a request to set the given parameter values to the mmp config for the provided currency through the websocket connection.
func (e *Exchange) WSSetMMPConfig(ctx context.Context, ccy currency.Code, interval kline.Interval, frozenTime int64, quantityLimit, deltaLimit float64) error {
if ccy.IsEmpty() {