mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 15:11:07 +00:00
common: Replace StringDataCompare with slices.Contains and cleanup string funcs (#1631)
* common: Replace StringDataCompare with slices.Contains and cleanup string funcs * common/docs: Update SliceDifference and remove outdated steps from ADD_NEW_EXCHANGE.md * common: Improve SliceDifference
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -1343,7 +1344,7 @@ func (by *Bybit) GetCoinGreeks(ctx context.Context, baseCoin string) (*CoinGreek
|
||||
// GetFeeRate retrieves the trading fee rate.
|
||||
func (by *Bybit) GetFeeRate(ctx context.Context, category, symbol, baseCoin string) (*AccountFee, error) {
|
||||
params := url.Values{}
|
||||
if !common.StringDataContains(validCategory, category) {
|
||||
if !slices.Contains(validCategory, category) {
|
||||
return nil, fmt.Errorf("%w, valid category values are %v", errInvalidCategory, validCategory)
|
||||
}
|
||||
if category != "" {
|
||||
@@ -1470,7 +1471,7 @@ func (by *Bybit) GetCoinExchangeRecords(ctx context.Context, fromCoin, toCoin, c
|
||||
|
||||
// GetDeliveryRecord retrieves delivery records of USDC futures and Options, sorted by deliveryTime in descending order
|
||||
func (by *Bybit) GetDeliveryRecord(ctx context.Context, category, symbol, cursor string, expiryDate time.Time, limit int64) (*DeliveryRecord, error) {
|
||||
if !common.StringDataContains([]string{cLinear, cOption}, category) {
|
||||
if !slices.Contains([]string{cLinear, cOption}, category) {
|
||||
return nil, fmt.Errorf("%w, valid category values are %v", errInvalidCategory, []string{cLinear, cOption})
|
||||
}
|
||||
params := url.Values{}
|
||||
@@ -1493,7 +1494,7 @@ func (by *Bybit) GetDeliveryRecord(ctx context.Context, category, symbol, cursor
|
||||
|
||||
// GetUSDCSessionSettlement retrieves session settlement records of USDC perpetual and futures
|
||||
func (by *Bybit) GetUSDCSessionSettlement(ctx context.Context, category, symbol, cursor string, limit int64) (*SettlementSession, error) {
|
||||
if !common.StringDataContains([]string{cLinear}, category) {
|
||||
if category != cLinear {
|
||||
return nil, fmt.Errorf("%w, valid category value is %v", errInvalidCategory, cLinear)
|
||||
}
|
||||
params := url.Values{}
|
||||
|
||||
Reference in New Issue
Block a user