mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 07:26:46 +00:00
modernise: Run new gopls modernise tool against the codebase and fix minor issues (#1826)
* modernise: Run new gopls modernise tool against codebase
* Address shazbert's nits
* apichecker, gctcli: Simplify HTML scraping functions and improve depth limit handling
* refactor: Create minSyncInterval const and update order book limit handling for binance and binanceUS
* refactor: Various slice usage improvements and rename TODO
* tranches: Revert deleteByID changes due to performance decrease
Shazbert was a F1 driver in a past lifetime 🏎️
* tranches: Simply retrieve copy
Thanks to shazbert
* documentation: Sort contributors list by contributions
* tranches: Remove deadcode in deleteByID
This commit is contained in:
@@ -837,8 +837,8 @@ func (b *Bitmex) GetWalletSummary(ctx context.Context, currency string) ([]Trans
|
||||
}
|
||||
|
||||
// SendHTTPRequest sends an unauthenticated HTTP request
|
||||
func (b *Bitmex) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, params Parameter, result interface{}) error {
|
||||
var respCheck interface{}
|
||||
func (b *Bitmex) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, params Parameter, result any) error {
|
||||
var respCheck any
|
||||
endpoint, err := b.API.Endpoints.GetURL(ep)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -871,7 +871,7 @@ func (b *Bitmex) SendHTTPRequest(ctx context.Context, ep exchange.URL, path stri
|
||||
}
|
||||
|
||||
// SendAuthenticatedHTTPRequest sends an authenticated HTTP request to bitmex
|
||||
func (b *Bitmex) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, verb, path string, params Parameter, result interface{}) error {
|
||||
func (b *Bitmex) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, verb, path string, params Parameter, result any) error {
|
||||
creds, err := b.GetCredentials(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -881,7 +881,7 @@ func (b *Bitmex) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.U
|
||||
return err
|
||||
}
|
||||
|
||||
var respCheck interface{}
|
||||
var respCheck any
|
||||
newRequest := func() (*request.Item, error) {
|
||||
expires := time.Now().Add(time.Second * 10)
|
||||
timestamp := expires.UnixNano()
|
||||
@@ -937,7 +937,7 @@ func (b *Bitmex) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.U
|
||||
}
|
||||
|
||||
// CaptureError little hack that captures an error
|
||||
func (b *Bitmex) CaptureError(resp, reType interface{}) error {
|
||||
func (b *Bitmex) CaptureError(resp, reType any) error {
|
||||
var Error RequestError
|
||||
|
||||
marshalled, err := json.Marshal(resp)
|
||||
|
||||
@@ -19,7 +19,7 @@ type Parameter interface {
|
||||
|
||||
// StructValsToURLVals converts a struct into url.values for easy encoding
|
||||
// can set json tags for outgoing naming conventions.
|
||||
func StructValsToURLVals(v interface{}) (url.Values, error) {
|
||||
func StructValsToURLVals(v any) (url.Values, error) {
|
||||
values := url.Values{}
|
||||
|
||||
if reflect.ValueOf(v).Kind() != reflect.Ptr {
|
||||
|
||||
@@ -25,15 +25,15 @@ type Announcement struct {
|
||||
|
||||
// APIKey Persistent API Keys for Developers
|
||||
type APIKey struct {
|
||||
Cidr string `json:"cidr"`
|
||||
Created string `json:"created"`
|
||||
Enabled bool `json:"enabled"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Nonce int64 `json:"nonce"`
|
||||
Permissions []interface{} `json:"permissions"`
|
||||
Secret string `json:"secret"`
|
||||
UserID int32 `json:"userId"`
|
||||
Cidr string `json:"cidr"`
|
||||
Created string `json:"created"`
|
||||
Enabled bool `json:"enabled"`
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Nonce int64 `json:"nonce"`
|
||||
Permissions []any `json:"permissions"`
|
||||
Secret string `json:"secret"`
|
||||
UserID int32 `json:"userId"`
|
||||
}
|
||||
|
||||
// Chat Trollbox Data
|
||||
@@ -514,32 +514,32 @@ type User struct {
|
||||
|
||||
// UserPreferences user preferences
|
||||
type UserPreferences struct {
|
||||
AlertOnLiquidations bool `json:"alertOnLiquidations"`
|
||||
AnimationsEnabled bool `json:"animationsEnabled"`
|
||||
AnnouncementsLastSeen string `json:"announcementsLastSeen"`
|
||||
ChatChannelID float64 `json:"chatChannelID"`
|
||||
ColorTheme string `json:"colorTheme"`
|
||||
Currency string `json:"currency"`
|
||||
Debug bool `json:"debug"`
|
||||
DisableEmails []string `json:"disableEmails"`
|
||||
HideConfirmDialogs []string `json:"hideConfirmDialogs"`
|
||||
HideConnectionModal bool `json:"hideConnectionModal"`
|
||||
HideFromLeaderboard bool `json:"hideFromLeaderboard"`
|
||||
HideNameFromLeaderboard bool `json:"hideNameFromLeaderboard"`
|
||||
HideNotifications []string `json:"hideNotifications"`
|
||||
Locale string `json:"locale"`
|
||||
MsgsSeen []string `json:"msgsSeen"`
|
||||
OrderBookBinning interface{} `json:"orderBookBinning"`
|
||||
OrderBookType string `json:"orderBookType"`
|
||||
OrderClearImmediate bool `json:"orderClearImmediate"`
|
||||
OrderControlsPlusMinus bool `json:"orderControlsPlusMinus"`
|
||||
ShowLocaleNumbers bool `json:"showLocaleNumbers"`
|
||||
Sounds []string `json:"sounds"`
|
||||
StrictIPCheck bool `json:"strictIPCheck"`
|
||||
StrictTimeout bool `json:"strictTimeout"`
|
||||
TickerGroup string `json:"tickerGroup"`
|
||||
TickerPinned bool `json:"tickerPinned"`
|
||||
TradeLayout string `json:"tradeLayout"`
|
||||
AlertOnLiquidations bool `json:"alertOnLiquidations"`
|
||||
AnimationsEnabled bool `json:"animationsEnabled"`
|
||||
AnnouncementsLastSeen string `json:"announcementsLastSeen"`
|
||||
ChatChannelID float64 `json:"chatChannelID"`
|
||||
ColorTheme string `json:"colorTheme"`
|
||||
Currency string `json:"currency"`
|
||||
Debug bool `json:"debug"`
|
||||
DisableEmails []string `json:"disableEmails"`
|
||||
HideConfirmDialogs []string `json:"hideConfirmDialogs"`
|
||||
HideConnectionModal bool `json:"hideConnectionModal"`
|
||||
HideFromLeaderboard bool `json:"hideFromLeaderboard"`
|
||||
HideNameFromLeaderboard bool `json:"hideNameFromLeaderboard"`
|
||||
HideNotifications []string `json:"hideNotifications"`
|
||||
Locale string `json:"locale"`
|
||||
MsgsSeen []string `json:"msgsSeen"`
|
||||
OrderBookBinning any `json:"orderBookBinning"`
|
||||
OrderBookType string `json:"orderBookType"`
|
||||
OrderClearImmediate bool `json:"orderClearImmediate"`
|
||||
OrderControlsPlusMinus bool `json:"orderControlsPlusMinus"`
|
||||
ShowLocaleNumbers bool `json:"showLocaleNumbers"`
|
||||
Sounds []string `json:"sounds"`
|
||||
StrictIPCheck bool `json:"strictIPCheck"`
|
||||
StrictTimeout bool `json:"strictTimeout"`
|
||||
TickerGroup string `json:"tickerGroup"`
|
||||
TickerPinned bool `json:"tickerPinned"`
|
||||
TradeLayout string `json:"tradeLayout"`
|
||||
}
|
||||
|
||||
// AffiliateStatus affiliate Status details
|
||||
|
||||
@@ -14,7 +14,7 @@ type WebsocketRequest struct {
|
||||
type WebsocketErrorResponse struct {
|
||||
Status int64 `json:"status"`
|
||||
Error string `json:"error"`
|
||||
Meta interface{} `json:"meta"`
|
||||
Meta any `json:"meta"`
|
||||
Request WebsocketRequest `json:"request"`
|
||||
}
|
||||
|
||||
@@ -79,10 +79,10 @@ type AnnouncementData struct {
|
||||
// WsAffiliateResponse private api response
|
||||
type WsAffiliateResponse struct {
|
||||
WsDataResponse
|
||||
ForeignKeys interface{} `json:"foreignKeys"`
|
||||
ForeignKeys any `json:"foreignKeys"`
|
||||
Attributes WsAffiliateResponseAttributes `json:"attributes"`
|
||||
Filter WsAffiliateResponseFilter `json:"filter"`
|
||||
Data []interface{} `json:"data"`
|
||||
Data []any `json:"data"`
|
||||
}
|
||||
|
||||
// WsAffiliateResponseAttributes private api data
|
||||
@@ -179,10 +179,10 @@ type WsOrderResponseForeignKeys struct {
|
||||
// WsTransactResponse private api response
|
||||
type WsTransactResponse struct {
|
||||
WsDataResponse
|
||||
ForeignKeys interface{} `json:"foreignKeys"`
|
||||
ForeignKeys any `json:"foreignKeys"`
|
||||
Attributes WsTransactResponseAttributes `json:"attributes"`
|
||||
Filter WsTransactResponseFilter `json:"filter"`
|
||||
Data []interface{} `json:"data"`
|
||||
Data []any `json:"data"`
|
||||
}
|
||||
|
||||
// WsTransactResponseAttributes private api data
|
||||
@@ -199,7 +199,7 @@ type WsTransactResponseFilter struct {
|
||||
// WsWalletResponse private api response
|
||||
type WsWalletResponse struct {
|
||||
WsDataResponse
|
||||
ForeignKeys interface{} `json:"foreignKeys"`
|
||||
ForeignKeys any `json:"foreignKeys"`
|
||||
Attributes WsWalletResponseAttributes `json:"attributes"`
|
||||
Filter WsWalletResponseFilter `json:"filter"`
|
||||
Data []WsWalletResponseData `json:"data"`
|
||||
@@ -213,31 +213,31 @@ type WsWalletResponseAttributes struct {
|
||||
|
||||
// WsWalletResponseData private api data
|
||||
type WsWalletResponseData struct {
|
||||
Account int64 `json:"account"`
|
||||
Currency string `json:"currency"`
|
||||
PrevDeposited float64 `json:"prevDeposited"`
|
||||
PrevWithdrawn float64 `json:"prevWithdrawn"`
|
||||
PrevTransferIn float64 `json:"prevTransferIn"`
|
||||
PrevTransferOut float64 `json:"prevTransferOut"`
|
||||
PrevAmount float64 `json:"prevAmount"`
|
||||
PrevTimestamp string `json:"prevTimestamp"`
|
||||
DeltaDeposited float64 `json:"deltaDeposited"`
|
||||
DeltaWithdrawn float64 `json:"deltaWithdrawn"`
|
||||
DeltaTransferIn float64 `json:"deltaTransferIn"`
|
||||
DeltaTransferOut float64 `json:"deltaTransferOut"`
|
||||
DeltaAmount float64 `json:"deltaAmount"`
|
||||
Deposited float64 `json:"deposited"`
|
||||
Withdrawn float64 `json:"withdrawn"`
|
||||
TransferIn float64 `json:"transferIn"`
|
||||
TransferOut float64 `json:"transferOut"`
|
||||
Amount float64 `json:"amount"`
|
||||
PendingCredit float64 `json:"pendingCredit"`
|
||||
PendingDebit float64 `json:"pendingDebit"`
|
||||
ConfirmedDebit int64 `json:"confirmedDebit"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
Addr string `json:"addr"`
|
||||
Script string `json:"script"`
|
||||
WithdrawalLock []interface{} `json:"withdrawalLock"`
|
||||
Account int64 `json:"account"`
|
||||
Currency string `json:"currency"`
|
||||
PrevDeposited float64 `json:"prevDeposited"`
|
||||
PrevWithdrawn float64 `json:"prevWithdrawn"`
|
||||
PrevTransferIn float64 `json:"prevTransferIn"`
|
||||
PrevTransferOut float64 `json:"prevTransferOut"`
|
||||
PrevAmount float64 `json:"prevAmount"`
|
||||
PrevTimestamp string `json:"prevTimestamp"`
|
||||
DeltaDeposited float64 `json:"deltaDeposited"`
|
||||
DeltaWithdrawn float64 `json:"deltaWithdrawn"`
|
||||
DeltaTransferIn float64 `json:"deltaTransferIn"`
|
||||
DeltaTransferOut float64 `json:"deltaTransferOut"`
|
||||
DeltaAmount float64 `json:"deltaAmount"`
|
||||
Deposited float64 `json:"deposited"`
|
||||
Withdrawn float64 `json:"withdrawn"`
|
||||
TransferIn float64 `json:"transferIn"`
|
||||
TransferOut float64 `json:"transferOut"`
|
||||
Amount float64 `json:"amount"`
|
||||
PendingCredit float64 `json:"pendingCredit"`
|
||||
PendingDebit float64 `json:"pendingDebit"`
|
||||
ConfirmedDebit int64 `json:"confirmedDebit"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
Addr string `json:"addr"`
|
||||
Script string `json:"script"`
|
||||
WithdrawalLock []any `json:"withdrawalLock"`
|
||||
}
|
||||
|
||||
// WsWalletResponseFilter private api data
|
||||
@@ -336,7 +336,7 @@ type WsDataResponse struct {
|
||||
// WsMarginResponse private api response
|
||||
type WsMarginResponse struct {
|
||||
WsDataResponse
|
||||
ForeignKeys interface{} `json:"foreignKeys"`
|
||||
ForeignKeys any `json:"foreignKeys"`
|
||||
Attributes WsMarginResponseAttributes `json:"attributes"`
|
||||
Filter WsMarginResponseFilter `json:"filter"`
|
||||
Data []WsMarginResponseData `json:"data"`
|
||||
@@ -350,47 +350,47 @@ type WsMarginResponseAttributes struct {
|
||||
|
||||
// WsMarginResponseData private api data
|
||||
type WsMarginResponseData struct {
|
||||
Account int64 `json:"account"`
|
||||
Currency string `json:"currency"`
|
||||
RiskLimit float64 `json:"riskLimit"`
|
||||
PrevState string `json:"prevState"`
|
||||
State string `json:"state"`
|
||||
Action string `json:"action"`
|
||||
Amount float64 `json:"amount"`
|
||||
PendingCredit float64 `json:"pendingCredit"`
|
||||
PendingDebit float64 `json:"pendingDebit"`
|
||||
ConfirmedDebit float64 `json:"confirmedDebit"`
|
||||
PrevRealisedPnl float64 `json:"prevRealisedPnl"`
|
||||
PrevUnrealisedPnl float64 `json:"prevUnrealisedPnl"`
|
||||
GrossComm float64 `json:"grossComm"`
|
||||
GrossOpenCost float64 `json:"grossOpenCost"`
|
||||
GrossOpenPremium float64 `json:"grossOpenPremium"`
|
||||
GrossExecCost float64 `json:"grossExecCost"`
|
||||
GrossMarkValue float64 `json:"grossMarkValue"`
|
||||
RiskValue float64 `json:"riskValue"`
|
||||
TaxableMargin float64 `json:"taxableMargin"`
|
||||
InitMargin float64 `json:"initMargin"`
|
||||
MaintMargin float64 `json:"maintMargin"`
|
||||
SessionMargin float64 `json:"sessionMargin"`
|
||||
TargetExcessMargin float64 `json:"targetExcessMargin"`
|
||||
VarMargin float64 `json:"varMargin"`
|
||||
RealisedPnl float64 `json:"realisedPnl"`
|
||||
UnrealisedPnl float64 `json:"unrealisedPnl"`
|
||||
IndicativeTax float64 `json:"indicativeTax"`
|
||||
UnrealisedProfit float64 `json:"unrealisedProfit"`
|
||||
SyntheticMargin interface{} `json:"syntheticMargin"`
|
||||
WalletBalance float64 `json:"walletBalance"`
|
||||
MarginBalance float64 `json:"marginBalance"`
|
||||
MarginBalancePcnt float64 `json:"marginBalancePcnt"`
|
||||
MarginLeverage float64 `json:"marginLeverage"`
|
||||
MarginUsedPcnt float64 `json:"marginUsedPcnt"`
|
||||
ExcessMargin float64 `json:"excessMargin"`
|
||||
ExcessMarginPcnt float64 `json:"excessMarginPcnt"`
|
||||
AvailableMargin float64 `json:"availableMargin"`
|
||||
WithdrawableMargin float64 `json:"withdrawableMargin"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
GrossLastValue float64 `json:"grossLastValue"`
|
||||
Commission interface{} `json:"commission"`
|
||||
Account int64 `json:"account"`
|
||||
Currency string `json:"currency"`
|
||||
RiskLimit float64 `json:"riskLimit"`
|
||||
PrevState string `json:"prevState"`
|
||||
State string `json:"state"`
|
||||
Action string `json:"action"`
|
||||
Amount float64 `json:"amount"`
|
||||
PendingCredit float64 `json:"pendingCredit"`
|
||||
PendingDebit float64 `json:"pendingDebit"`
|
||||
ConfirmedDebit float64 `json:"confirmedDebit"`
|
||||
PrevRealisedPnl float64 `json:"prevRealisedPnl"`
|
||||
PrevUnrealisedPnl float64 `json:"prevUnrealisedPnl"`
|
||||
GrossComm float64 `json:"grossComm"`
|
||||
GrossOpenCost float64 `json:"grossOpenCost"`
|
||||
GrossOpenPremium float64 `json:"grossOpenPremium"`
|
||||
GrossExecCost float64 `json:"grossExecCost"`
|
||||
GrossMarkValue float64 `json:"grossMarkValue"`
|
||||
RiskValue float64 `json:"riskValue"`
|
||||
TaxableMargin float64 `json:"taxableMargin"`
|
||||
InitMargin float64 `json:"initMargin"`
|
||||
MaintMargin float64 `json:"maintMargin"`
|
||||
SessionMargin float64 `json:"sessionMargin"`
|
||||
TargetExcessMargin float64 `json:"targetExcessMargin"`
|
||||
VarMargin float64 `json:"varMargin"`
|
||||
RealisedPnl float64 `json:"realisedPnl"`
|
||||
UnrealisedPnl float64 `json:"unrealisedPnl"`
|
||||
IndicativeTax float64 `json:"indicativeTax"`
|
||||
UnrealisedProfit float64 `json:"unrealisedProfit"`
|
||||
SyntheticMargin any `json:"syntheticMargin"`
|
||||
WalletBalance float64 `json:"walletBalance"`
|
||||
MarginBalance float64 `json:"marginBalance"`
|
||||
MarginBalancePcnt float64 `json:"marginBalancePcnt"`
|
||||
MarginLeverage float64 `json:"marginLeverage"`
|
||||
MarginUsedPcnt float64 `json:"marginUsedPcnt"`
|
||||
ExcessMargin float64 `json:"excessMargin"`
|
||||
ExcessMarginPcnt float64 `json:"excessMarginPcnt"`
|
||||
AvailableMargin float64 `json:"availableMargin"`
|
||||
WithdrawableMargin float64 `json:"withdrawableMargin"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
GrossLastValue float64 `json:"grossLastValue"`
|
||||
Commission any `json:"commission"`
|
||||
}
|
||||
|
||||
// WsMarginResponseFilter private api data
|
||||
@@ -480,7 +480,7 @@ type WsPositionResponseForeignKeys struct {
|
||||
|
||||
// WsPrivateNotificationsResponse private api response
|
||||
type WsPrivateNotificationsResponse struct {
|
||||
Table string `json:"table"`
|
||||
Action string `json:"action"`
|
||||
Data []interface{} `json:"data"`
|
||||
Table string `json:"table"`
|
||||
Action string `json:"action"`
|
||||
Data []any `json:"data"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user