Skip to content

Commit 7536d71

Browse files
samuaelgbjk
andauthored
exchanges: Update Poloniex exchange API (thrasher-corp#2105)
* wrappers and time-in-force calling approach * minor change * update gateio string to timeInForce conversion and unit test * set limiter to first level mock data list and updated unit tests * address nested slices length limit * minor fix recording file and update unit tests * minor updates on unit tests * mock data update using the mock data trimmer * fix minor linter issues * mock file re-recording * feedback: overall update based on feedback * misc issue fix * update websocket based on multi connection and other wrapper updates * overall update with unit tests added and endpoints removed * endpoint functions and unit tests update * update endpoints and types naming * nitpicks * unit tests update * overall unit tests update and websocket handlers fix * overall update on endpoints, websocket handlers, and testing * rm comments based on gk's feedback * response declaration and return change, and diverse update * feedback: apply change requests * fix websocket runtime errors * minor orderbook fix * improve code coverage and overall code update * shorten error check expression * types, unit tests, and websocket handlers update * endpoints, websocket handlers, and unit tests update * apply websocket templating with minor fix * update websocket handlers * update unit endpoints, and mock file * mock file update and reduction * rm HTTPRecording value assign * update wrapper, fix unit text and websocket update * config and wrapper endpoints fix and unit tests update * suppress misc error * revert the last * split spot public and private subscriptions and handlers * minor cleanups * futures websocket update, added endpoints, updated endpoints and types * added and updated endpoint methods and fix websocket issues * wrapper loops and error returns update * unit test functions naming updates * wrapper methods and types update * input validation fix and testing * rest endpoints and unit tests fix * fix ID generation * updated SubmitOrder parameter validations and update unit tests accordingly. * change based og gks feedback * actioned gk's feedback comments * based on shazberts feedback: updated futures endpoints and correcsponding unit tests * overall wrapper, unit tests, and types marshaling update * remove unnecessary code * update on wrapper request params types * rm * update smart orders, live tested, and unit tests update * based on gk's and scott's feedback: wrapper and types update * types, unmarshalers, wrapper handler update * wrapper params fix * comments, code coverage update, and mock recording * overall types, wrapper functions, and mock records update * types, time handling, ratelimiter,and endpoints update * rate-limiters update * uint8 to string * added missing state order PENDING_CANCEL * added missing state order PENDING_CANCEL * overall update on types, endpoints, wrapper, and rate limiters * ROCK ROCK ROCK ROCK ROBOT * Update docs/ADD_NEW_EXCHANGE.md * Update cmd/documentation/root_templates/root_readme.tmpl * Fixes an improper example and regenerates documentation * Corrects typos * Makes a table label consistent across files * gatio: fix MessageID regression (cherry-pick me) * Update exchanges/gateio/gateio_wrapper_test.go * glorious: AI * Update exchanges/gateio/gateio_wrapper.go * thrasher: use optimisation in okx as well * okx: Add length check in tests for string -> uuid conversion * thrasher: nits --------- common: Update ErrorCollector to use mutex and simplify error collection in concurrent operations (thrasher-corp#2090) * refactor: Update ErrorCollector to use mutex and simplify error collection in concurrent operations * glorious: nits * linter: fix * another find * Apply suggestion from @gbjk Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Apply suggestion from @gbjk Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * one liner defer * Update common/common.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * gk: nits * Update common/common_test.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * thrasher-: nits --------- Co-authored-by: shazbert <ryan.oharareid@thrasher.io> Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> Co-authored-by: shazbert <shazbert@DESKTOP-3QKKR6J.localdomain> Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * gateio: Add func GetEstimatedInterestRate (cherry-pickable) * Add tests * Update exchanges/gateio/gateio.go * Update exchanges/gateio/gateio.go * gk: nits * thrasher-: nits --------- * wrapper endpoints input type change * overall wrapper and unit tests update, and live tests fix * Trigger CI * revert linter version * poloniex overall update * gk and scotts review feedbacks: unit test and wrapper update * update linter to 2.6.1 * linter issues resolve * Poloniex: Proof of Concept resps can contain errors * trade endpoints response update * rm panic and fix endpoint limit * trade endpoints and requester error wrapper and checker update * update smartorder endpoints and types * smart orders endpoint and mock data update * rename Test name to TestStatusCodeUnmarshal * Proof-of-simplicity * rn unit test name * updata onceWebsocketOrderbookCache lock in loop * spot websocket order book update and endpoints fix * manual update mock file and revert nil result check * update wrapper and websocket handlers * wrapepr batch order cancellation and minor updates * linter issues fix * fix linter issue * change v2 currency endpoint limiter * added poloniex config upgrade * minor linter fix * rm legacy url migration from wrapper * move config change to v11 and register * GetOrders feedback * getorder update and version upgrade fix * update futures websocket iteration and wrapper handlers * minor linter fix * fix race condition and update websocket slice object access * fix linter issue * rm lock var * change v11 config upgrade from replace to delete * improve v11 config unit test * added test coverage and updated endpoints and types * update on types, requester, and unit tests * minor linter fix * update type to use currency.Pair and revert order.Type use * minor fixes on websocket data handling * websocket subscriptions and handlers update * update way of subscribing parallely * reuse manage subscriptions and update subscription handling * rm time.Sleep * gk's nits: minor types and websocket update * sams feedbacks: websocket, types, and websocket handlers update * linter issue fix * removed interface check * gks feedback: update websocket trade endpoint and minor fixed on wrapper * minot linter fix * improve unit tests and test coverage, and update on wrapper and mock file * add more coverage and unti test update * rm print stmts * gk and scott's feedback: updated requester functions and others * futures type variables, endpoints, and wrapper handlers update * minor fixes on types * added boolean type and fixed futures and websocket handler, and mock test * remove some non-sense from code * resolve websocket response error check from within slice * update to websocket wrapper handlers and minor fix to unit tests * suppress a nillness check * resolve issue with websocket requester * fix minor linter issue * linter fix 2 * update websocekt slice interfaces wrapper handlers * gk and sams feedback: overall update * codespell fix * sams feedback: futures endpoint functions update * add new requesters for batched validated order response handling * linter issue fix * fix test issue, added missing endpoint, and improve test coverage * sam's feedback: update types, and add unit test coverage * minor change to smart order unit test * futures types update * add candle interval hour_8 * fix futures mark price candles fields unmarshal sequence * update authenticated requester and update on wrapper and endpoint functions * fix test issues caused by update on requester * lint * sams feedback: types update, increase unit test coverage * sams feedbacks: futures websocket update * unit tests improvement and mock file update * update wrapper, endpoints, and unit tests handling * re- add missing comment * minor fix on types * change to types handling * update webscket handlers, endpoints, and add unit test coverage * codespell fix * minor unit test fixes * fix live test issues * comment fix * rm casting * temporrary fix to GetOrderbook unit test scale value * update mock file, improve wrapper, and added test coverage * rm unnecessary comment * rn ineffectual assignment * fix platform-dependent error * add ticker processor to UpdateTicker * linter fix * error return from DataHandler * Minor stream data test fix * fix live test issue * fix to wrapper balance handling * orderbook depth update fix * fix sams feedbacks * update wrapper handlers, types, and mock data * fix linter issue * minor fix to unmarshaler * minor improvement on unmarshaler unit test * rename filename * added test coverage and update wrapper handlers * improve trade order wrapper functions * fix linter issue * minor order unit test fix * adrian's feedback: added unit tests, fix nits, update types, and others * codespell fixes * formatting issue fix * revert codespell fixes on other exchanges * linter issue fix * update on unit tests --------- Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
1 parent 4f2072f commit 7536d71

33 files changed

+23254
-22800
lines changed

cmd/exchange_wrapper_standards/exchange_wrapper_standards_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,7 @@ var unsupportedAssets = []asset.Item{
612612
var unsupportedExchangeNames = []string{
613613
"testexch",
614614
"bitflyer", // Bitflyer has many "ErrNotYetImplemented, which is true, but not what we care to test for here
615-
"btse", // TODO rm once timeout issues resolved
616-
"poloniex", // outdated API // TODO rm once updated
615+
"btse", // TODO rm once timeout issues resolved
617616
}
618617

619618
// cryptoChainPerExchange holds the deposit address chain per exchange

config/versions/register.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
v0 "github.com/thrasher-corp/gocryptotrader/config/versions/v0"
55
v1 "github.com/thrasher-corp/gocryptotrader/config/versions/v1"
66
v10 "github.com/thrasher-corp/gocryptotrader/config/versions/v10"
7+
v11 "github.com/thrasher-corp/gocryptotrader/config/versions/v11"
78
v2 "github.com/thrasher-corp/gocryptotrader/config/versions/v2"
89
v3 "github.com/thrasher-corp/gocryptotrader/config/versions/v3"
910
v4 "github.com/thrasher-corp/gocryptotrader/config/versions/v4"
@@ -26,4 +27,5 @@ func init() {
2627
Manager.registerVersion(8, &v8.Version{})
2728
Manager.registerVersion(9, &v9.Version{})
2829
Manager.registerVersion(10, &v10.Version{})
30+
Manager.registerVersion(11, &v11.Version{})
2931
}

config/versions/v11/v11.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package v11
2+
3+
import (
4+
"context"
5+
"errors"
6+
7+
"github.com/buger/jsonparser"
8+
)
9+
10+
// Version is an ExchangeVersion to replace deprecated WS and REST endpoints for Poloniex
11+
type Version struct{}
12+
13+
// Exchanges returns just Poloniex
14+
func (v *Version) Exchanges() []string { return []string{"Poloniex"} }
15+
16+
// UpgradeExchange replaces deprecated WS and REST endpoints
17+
func (v *Version) UpgradeExchange(_ context.Context, e []byte) ([]byte, error) {
18+
for _, key := range []string{"WebsocketSpotURL", "RestSpotURL"} {
19+
url, err := jsonparser.GetString(e, "api", "urlEndpoints", key)
20+
if err != nil && !errors.Is(err, jsonparser.KeyPathNotFoundError) {
21+
return e, err
22+
}
23+
switch url {
24+
case "wss://api2.poloniex.com", "https://poloniex.com":
25+
e = jsonparser.Delete(e, "api", "urlEndpoints", key)
26+
}
27+
}
28+
return e, nil
29+
}
30+
31+
// DowngradeExchange is a no-op for v11
32+
func (v *Version) DowngradeExchange(_ context.Context, e []byte) ([]byte, error) {
33+
return e, nil
34+
}

config/versions/v11/v11_test.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package v11_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
"github.com/stretchr/testify/require"
8+
v11 "github.com/thrasher-corp/gocryptotrader/config/versions/v11"
9+
)
10+
11+
func TestExchanges(t *testing.T) {
12+
t.Parallel()
13+
assert.Equal(t, []string{"Poloniex"}, new(v11.Version).Exchanges())
14+
}
15+
16+
func TestUpgradeExchange(t *testing.T) {
17+
t.Parallel()
18+
19+
for _, tt := range []struct {
20+
in string
21+
urlType string
22+
exp string
23+
}{
24+
{"https://poloniex.com", "RestSpotURL", ""},
25+
{"https://poloniex.private-proxy.com", "RestSpotURL", `"RestSpotURL": "https://poloniex.private-proxy.com"`},
26+
{"wss://api2.poloniex.com", "WebsocketSpotURL", ""},
27+
{"wss://poloniex.private-proxy.com", "WebsocketSpotURL", `"WebsocketSpotURL": "wss://poloniex.private-proxy.com"`},
28+
} {
29+
t.Run(tt.in, func(t *testing.T) {
30+
t.Parallel()
31+
in := []byte(`{"name":"Poloniex","api":{"urlEndpoints":{"` + tt.urlType + `": "` + tt.in + `"}}}`)
32+
out, err := new(v11.Version).UpgradeExchange(t.Context(), in)
33+
require.NoError(t, err)
34+
exp := `{"name":"Poloniex","api":{"urlEndpoints":{` + tt.exp + `}}}`
35+
assert.Equal(t, exp, string(out))
36+
})
37+
}
38+
39+
in := []byte(`{"name":"Poloniex","api":{}`)
40+
out, err := new(v11.Version).UpgradeExchange(t.Context(), in)
41+
require.NoError(t, err, "UpgradeExchange must not error when urlEndpoints is missing")
42+
assert.Equal(t, string(in), string(out), "UpgradeExchange should return same input and no error when urlEndpoints is missing")
43+
44+
_, err = new(v11.Version).UpgradeExchange(t.Context(), []byte(`{"name":"Poloniex","api":{"urlEndpoints":{"WebsocketSpotURL": 42}}}`))
45+
require.ErrorContains(t, err, "Value is not a string", "UpgradeExchange must error correctly on string value")
46+
}
47+
48+
func TestDowngradeExchange(t *testing.T) {
49+
t.Parallel()
50+
in := []byte(`{"name":"Poloniex","api":{"urlEndpoints":{"WebsocketSpotURL": 42}}}`)
51+
out, err := new(v11.Version).DowngradeExchange(t.Context(), in)
52+
require.NoError(t, err)
53+
require.Equal(t, string(in), string(out), "DowngradeExchange must not change json")
54+
}

config_example.json

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,31 +2308,36 @@
23082308
"delimiter": "_"
23092309
},
23102310
"useGlobalFormat": true,
2311-
"assetTypes": [
2312-
"spot"
2313-
],
23142311
"pairs": {
23152312
"spot": {
2313+
"assetEnabled": true,
23162314
"enabled": "BTC_LTC,BTC_ETH,BTC_DOGE,BTC_DASH,BTC_XRP",
23172315
"available": "BTC_SC,BTC_GNT,USDC_LTC,PAX_ETH,USDT_BSVBEAR,BUSD_BNB,USDT_WRX,USDT_IBVOL,USDT_ETH,BTC_ETC,USDC_ETH,BTC_POLY,BTC_ATOM,USDT_ATOM,TRX_STEEM,USDT_NEO,USDT_XRPBULL,USDT_AVA,USDT_DASH,USDT_ZRX,USDT_TRXBEAR,USDT_PAX,DAI_ETH,BTC_NEO,TRX_JST,BTC_FXC,USDT_ETC,USDT_ZEC,BTC_STORJ,USDT_GNT,USDT_QTUM,BTC_FOAM,TRX_BTT,USDT_BCHC,BTC_XFIL,USDC_XMR,TRX_WIN,USDT_SNX,BTC_LEND,USDT_BSVBULL,BTC_DOGE,BTC_REP,USDT_REP,BTC_STRAT,USDT_EOS,BTC_BAT,BTC_BCHABC,USDT_BUSD,BTC_XRP,BTC_ARDR,USDT_LINKBULL,BTC_CHR,USDT_CUSDT,TRX_WRX,USDT_XRP,ETH_ZEC,BTC_KNC,USDT_DOGE,BTC_LPT,USDT_BTT,ETH_COMP,USDC_GRIN,USDC_DASH,USDT_GRIN,USDT_XTZ,BTC_GAS,USDT_DAI,TRX_NEO,USDT_LINKBEAR,TRX_CHR,BTC_MDT,USDT_XMR,BTC_DCR,BTC_CVC,USDT_BNB,BTC_NXT,BTC_LSK,BTC_OMG,BTC_QTUM,BTC_BCHSV,BTC_SNX,BTC_MANA,USDC_EOS,DAI_BTC,BTC_SWFTC,TRX_BNB,BTC_STEEM,USDJ_BTC,USDJ_BTT,USDT_LRC,USDT_BAL,BNB_BTC,USDC_DOGE,BTC_TRX,BTC_XTZ,TRX_XTZ,USDT_MATIC,USDT_BCHBEAR,USDT_SWFTC,BTC_LTC,USDC_XRP,BTC_NMR,TRX_MATIC,USDT_XRPBEAR,BTC_ZEC,BTC_SNT,USDT_SC,USDT_BCHSV,TRX_ETH,BUSD_BTC,BTC_DASH,ETH_BAT,BTC_LOOM,TRX_SNX,ETH_ZRX,USDC_BCHABC,USDC_ETC,USDT_BULL,PAX_BTC,USDJ_TRX,BTC_WRX,BTC_BTS,USDT_LTC,BTC_LINK,USDT_USDJ,TRX_SWFTC,USDT_LINK,TRX_AVA,USDC_USDT,USDT_JST,TRX_FXC,USDT_CHR,USDT_XFIL,BTC_ETHBNT,BTC_LRC,USDT_BAT,USDC_ATOM,USDT_WIN,ETH_EOS,USDT_TRX,TRX_MDT,BTC_AVA,BTC_XEM,USDT_BTC,BTC_EOS,USDT_LSK,BTC_MATIC,USDT_FXC,USDT_STEEM,USDC_BCHSV,USDT_TRXBULL,USDT_EOSBULL,USDT_LEND,ETH_ETC,USDT_MANA,USDT_ETHBULL,USDT_REN,USDT_COMP,BTC_XMR,BTC_ETH,BTC_ZRX,USDC_BTC,TRX_XRP,USDT_ETHBEAR,USDT_BVOL,ETH_BAL,USDT_MDT,BTC_BNT,USDC_ZEC,USDT_BCHABC,TRX_LINK,BTC_MKR,USDT_BCN,USDT_EOSBEAR,BTC_REN,USDT_STR,USDC_STR,USDT_BEAR,USDT_BCHBULL,BTC_STR,USDC_TRX,USDT_MKR"
2316+
},
2317+
"futures": {
2318+
"assetEnabled": true,
2319+
"enabled": "XBT_USDT_PERP,ETH_USDT_PERP,BCH_USDT_PERP",
2320+
"available": "BNB_USDT_PERP,TRX_USDT_PERP,LTC_USDT_PERP,APT_USDT_PERP,1000PEPE_USDT_PERP,1000SHIB_USDT_PERP,BTC_USDT_PERP,DOGE_USDT_PERP,AVAX_USDT_PERP,XRP_USDT_PERP,SOL_USDT_PERP,ETH_USDT_PERP,BCH_USDT_PERP"
23182321
}
23192322
}
23202323
},
23212324
"api": {
23222325
"authenticatedSupport": false,
23232326
"authenticatedWebsocketApiSupport": false,
2324-
"endpoints": {
2325-
"url": "NON_DEFAULT_HTTP_LINK_TO_EXCHANGE_API",
2326-
"urlSecondary": "NON_DEFAULT_HTTP_LINK_TO_EXCHANGE_API",
2327-
"websocketURL": "NON_DEFAULT_HTTP_LINK_TO_WEBSOCKET_EXCHANGE_API"
2328-
},
23292327
"credentials": {
2330-
"key": "Key",
2331-
"secret": "Secret"
2328+
"key": "",
2329+
"secret": ""
23322330
},
23332331
"credentialsValidator": {
23342332
"requiresKey": true,
23352333
"requiresSecret": true
2334+
},
2335+
"urlEndpoints": {
2336+
"RestSpotURL": "https://api.poloniex.com",
2337+
"WebsocketPrivateURL": "wss://ws.poloniex.com/ws/private",
2338+
"WebsocketSpotURL": "wss://ws.poloniex.com/ws/public",
2339+
"WebsocketFuturesURL": "wss://ws.poloniex.com/ws/v3/public",
2340+
"WebsocketFuturesPrivateURL": "wss://ws.poloniex.com/ws/v3/private"
23362341
}
23372342
},
23382343
"features": {
@@ -2347,7 +2352,7 @@
23472352
},
23482353
"enabled": {
23492354
"autoPairUpdates": true,
2350-
"websocketAPI": false
2355+
"websocketAPI": true
23512356
}
23522357
},
23532358
"bankAccounts": [

exchanges/exchange.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,10 @@ func (u URL) String() string {
13641364
return websocketPrivateURL
13651365
case WebsocketSpotSupplementary:
13661366
return websocketSpotSupplementaryURL
1367+
case WebsocketFutures:
1368+
return websocketFuturesURL
1369+
case WebsocketFuturesPrivate:
1370+
return websocketFuturesPrivateURL
13671371
case ChainAnalysis:
13681372
return chainAnalysisURL
13691373
case EdgeCase1:
@@ -1414,6 +1418,10 @@ func getURLTypeFromString(ep string) (URL, error) {
14141418
return WebsocketPrivate, nil
14151419
case websocketSpotSupplementaryURL:
14161420
return WebsocketSpotSupplementary, nil
1421+
case websocketFuturesURL:
1422+
return WebsocketFutures, nil
1423+
case websocketFuturesPrivateURL:
1424+
return WebsocketFuturesPrivate, nil
14171425
case chainAnalysisURL:
14181426
return ChainAnalysis, nil
14191427
case edgeCase1URL:

exchanges/exchange_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,8 @@ func TestString(t *testing.T) {
16491649
{WebsocketTrade, websocketTradeURL},
16501650
{WebsocketPrivate, websocketPrivateURL},
16511651
{WebsocketSpotSupplementary, websocketSpotSupplementaryURL},
1652+
{WebsocketFutures, websocketFuturesURL},
1653+
{WebsocketFuturesPrivate, websocketFuturesPrivateURL},
16521654
{ChainAnalysis, chainAnalysisURL},
16531655
{EdgeCase1, edgeCase1URL},
16541656
{EdgeCase2, edgeCase2URL},
@@ -1813,6 +1815,8 @@ func TestGetGetURLTypeFromString(t *testing.T) {
18131815
{Endpoint: websocketTradeURL, Expected: WebsocketTrade},
18141816
{Endpoint: websocketPrivateURL, Expected: WebsocketPrivate},
18151817
{Endpoint: websocketSpotSupplementaryURL, Expected: WebsocketSpotSupplementary},
1818+
{Endpoint: websocketFuturesURL, Expected: WebsocketFutures},
1819+
{Endpoint: websocketFuturesPrivateURL, Expected: WebsocketFuturesPrivate},
18161820
{Endpoint: chainAnalysisURL, Expected: ChainAnalysis},
18171821
{Endpoint: edgeCase1URL, Expected: EdgeCase1},
18181822
{Endpoint: edgeCase2URL, Expected: EdgeCase2},

exchanges/exchange_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ const (
282282
WebsocketTrade
283283
WebsocketPrivate
284284
WebsocketSpotSupplementary
285+
WebsocketFutures
286+
WebsocketFuturesPrivate
285287
ChainAnalysis
286288
EdgeCase1
287289
EdgeCase2
@@ -304,6 +306,8 @@ const (
304306
websocketTradeURL = "WebsocketTradeURL"
305307
websocketPrivateURL = "WebsocketPrivateURL"
306308
websocketSpotSupplementaryURL = "WebsocketSpotSupplementaryURL"
309+
websocketFuturesURL = "WebsocketFuturesURL"
310+
websocketFuturesPrivateURL = "WebsocketFuturesPrivateURL"
307311
chainAnalysisURL = "ChainAnalysisURL"
308312
edgeCase1URL = "EdgeCase1URL"
309313
edgeCase2URL = "EdgeCase2URL"
@@ -328,6 +332,8 @@ var keyURLs = []URL{
328332
WebsocketTrade,
329333
WebsocketPrivate,
330334
WebsocketSpotSupplementary,
335+
WebsocketFutures,
336+
WebsocketFuturesPrivate,
331337
ChainAnalysis,
332338
EdgeCase1,
333339
EdgeCase2,

exchanges/kline/kline_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ type Candle struct {
147147
Low float64
148148
Close float64
149149
Volume float64
150+
QuoteVolume float64
150151
ValidationIssues string
151152
}
152153

exchanges/mock/server.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,13 @@ func MatchAndGetResponse(mockData []HTTPResponse, requestVals url.Values, isQuer
253253
}
254254

255255
mockVals := url.Values{}
256-
var err error
257256
if json.Valid([]byte(data)) {
258-
something := make(map[string]any)
259-
err = json.Unmarshal([]byte(data), &something)
260-
if err != nil {
257+
dataMap := make(map[string]any)
258+
if err := json.Unmarshal([]byte(data), &dataMap); err != nil {
261259
return nil, err
262260
}
263261

264-
for k, v := range something {
262+
for k, v := range dataMap {
265263
switch val := v.(type) {
266264
case string:
267265
mockVals.Add(k, val)
@@ -277,6 +275,7 @@ func MatchAndGetResponse(mockData []HTTPResponse, requestVals url.Values, isQuer
277275
}
278276
}
279277
} else {
278+
var err error
280279
mockVals, err = url.ParseQuery(data)
281280
if err != nil {
282281
return nil, err

0 commit comments

Comments
 (0)