* exchanges: Refactor time handling and other minor improvements
- Updated Kraken wrapper to utilise new time handling methods.
- Simplified Kucoin types by removing unnecessary structures and using direct JSON unmarshalling.
- Improved websocket handling in Kucoin to directly parse candlestick data.
- Modified Lbank types to use the new time representation.
- Adjusted Poloniex wrapper and types to utilise the new time handling.
- Updated Yobit types and wrapper to reflect changes in time representation.
- Introduced DateTime type for better handling of specific time formats.
- Added tests for DateTime unmarshalling to ensure correctness.
- Rid UTC().Unix and UTC().UnixMilli as it's not needed
- Correct Huobi timestamp usage for some endpoints.
- Rid RFC3339 time parsing since Go does that automatically.
* exchanges: Refactor JSON unmarshalling for various types and improve test coverage
* linter: Update error message in TestGetKlines
* refactor: Simplify JSON unmarshalling in MovementHistory and improve test assertions in GetKlines
* refactor: Improve JSON unmarshalling for channel name and clarify comment in wsProcessOpenOrders
* refactor: Update time handling in Huobi types to use types.Time for createdAt fields and relax GetLiquidationOrders test
* refactor: Move wsTicker, wsSpread, wsTrades, and wsCandle types to kraken_types.go for better organistion
* refactor: Add validation for underlying parameter in GetExpirationTime and update tests
* Bitmex: Enhance leaderboard and stats history tests with mock server responses
* Bitmex: Validate HTTP method in leaderboard and stats historical tests
* Bitmex: Improve assertions in leaderboard and stats historical tests for clarity
* exchanges: Improve TestMain usage
* exchanges: Further cleanups
* exchanges/kucoin: update TestProcessOrderbook to use test context
* refactor: rename SetRunning to SetRunningURL for clarity across exchanges
* cmd/documentation: Add GitHub token support for contributor list retrieval
* docs: Clarify GITHUB_TOKEN usage
* cmd/documentation: Improve error logging and handling in GetContributorList function
* fix: Improve error message formatting in GetContributorList function
* docs: Clarify comment on GITHUB_TOKEN usage in documentation.go
* ci: Add GITHUB_TOKEN to CI environment variables
* I've made a comprehensive overhaul of the Makefile for your Go development workflow.
This update brings a significant series of enhancements to the project's Makefile, aimed at modernizing and improving your Go development experience. This includes improvements to linting, formatting, dependency management, Docker integration, and the overall Makefile structure, style, and usability.
Here are the key improvements:
1. **Linting (`golangci-lint`):**
* **Version & Path:** I've upgraded `golangci-lint` to use the v2 path (`github.com/golangci/golangci-lint/cmd/golangci-lint/v2`) and pinned it to a specific version (`v2.1.6`) for consistency.
* **Target Renaming:** The primary linting target was renamed from `linter` to `lint` to align with common conventions.
* **Command Simplification:** The `lint` target's command was streamlined to `$(LINTBIN) run --verbose`, relying directly on `golangci-lint`'s exit code for success/failure reporting.
* **Redundancy Removal:** A superfluous `go install $(GCTPKG)` command was removed from the `lint` target.
2. **Dockerized Linting (`lint_docker`):**
* A new `lint_docker` target (renamed from `lint-docker` for consistent naming) was introduced to execute `golangci-lint` within a Docker container (`golangci/golangci-lint:v2.1.6`).
* This ensures a consistent linting environment across different developer setups and CI.
* The target uses `$(CURDIR)` for reliable Docker volume mounting.
* It includes the `--verbose` flag for detailed linter output and the `-t` flag to allocate a pseudo-TTY, enabling colored output from the linter.
* It incorporates a check for Docker's availability before attempting to run.
* Whitespace in the Docker check command was normalized for readability (single space after `||`).
3. **Code Formatting (`gofmt` & `gofumpt`):**
* **Default Formatter:** The main `fmt` target now consistently uses `gofmt` for standard Go formatting.
* **Stricter Formatting Option:** A new `gofumpt` target has been added, allowing you to use the stricter `gofumpt` formatter. This target includes a command to automatically install `gofumpt` if it's not already present.
* **File Exclusion Control (`GO_FILES_TO_FORMAT`):**
- A Make variable `GO_FILES_TO_FORMAT` was introduced to precisely define the set of Go files to be processed by the formatters.
- This variable is configured to exclude:
- Generated ORM code (e.g., `./database/models/*`).
- Vendored dependencies (`./vendor/*`).
- Protobuf generated files (`*.pb.go`).
- gRPC gateway generated files (`*.pb.gw.go`).
- Both the `fmt` and `gofumpt` targets now utilize this variable, preventing accidental reformatting of generated or third-party code.
4. **Makefile Structure & General Enhancements:**
* **Redundant Target Removal:** The `get` target was removed, as its functionality was fully covered by the more optimized `install` target.
* **`.PHONY` Declarations:**
- The default `all` target was explicitly added to the `.PHONY` list for improved clarity and robustness.
- All relevant Makefile targets, including newly added and renamed ones (`lint`, `gofumpt`, `lint_docker`, `fmt`), are explicitly declared in the `.PHONY` list, adhering to best practices.
- The order of targets in the main `.PHONY` declaration was adjusted to match the sequence of their definitions in the Makefile, enhancing readability.
These comprehensive changes aim to provide you with a more robust, flexible, consistent, and maintainable build and development environment.
* Fix: Ensure GOPATH is defined in Makefile
This commit enhances the Makefile by ensuring that the GOPATH
variable is defined before being used by LINTBIN and GOFUMPTBIN.
The line `GOPATH ?= $(shell go env GOPATH)` has been added.
This means:
- If GOPATH is set in the environment, that value will be used.
- Otherwise, GOPATH will be set to the output of `go env GOPATH`,
which is the canonical way to determine the Go path.
This change makes the Makefile more robust and less dependent on
your shell environment having GOPATH explicitly set.
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* Added TimeInForce type and updated related files
* Linter issue fix and minor coinbasepro type update
* Bitrex consts update
* added unit test and minor changes in bittrex
* Unit tests update
* Fix minor linter issues
* Update TestStringToTimeInForce unit test
* fix conflict with gateio timeInForce
* Update order tests
* Complete updating the order unit tests
* update kucoin and deribit wrapper to match the time in force change
* fix time-in-force related test errors
* linter issue fix
* time in force constants, functions and unit tests update
* shift tif policies to TimeInForce
* Update time-in-force, related functions, and unit tests
* fix linter issue and time-in-force processing
* added a good till crossing tif value
* order type fix and fix related tim-in-force entries
* update time-in-force unmarshaling and unit test
* update order type to support time-in-force and hybrid order type representation
* added tests for type and time-in-force check from order type
* fix time-in-force error in gateio
* fix minor unit test issues
* linter issue fix
* update based on review comments
* add unit test and fix missing issues
* minor fix and added benchmark unit test
* change GTT to GTC for limit
* fix linter issue
* linter issues fix
* update order types declaration and handling by endpoints
* added time-in-force value to place order param
* fix minor issues based on review comment and move tif code to separate files
* update on exchanges linked to time-in-force
* resolve missing review comments
* minor linter issues fix
* added time-in-force handler and update timeInForce parametered endpoint
* minor fixes based on review
* nits fix
* update based on review
* linter fix
* rm getTimeInForce func and minor change to time-in-force
* minor change
* update based on review comments
* wrappers and time-in-force calling approach
* minor change
* update gateio string to timeInForce conversion and unit test
* fix types to string conversion
* fix build errors
* update on order types handling and unit tests
* fix linter issue
* order type unit tests update
* order types string as constant replacement and unit tests update
* update order type-string functions unit test
* codebase: Rid base64/hex to string common funcs
* codebase: Rid local scope variable usage and other improvements
* codebase: Refactor currency pair usage across multiple exchanges
- Updated HitBTC tests to use the new currency pair format.
- Modified Kraken futures types to use currency.Pair instead of string for Symbol.
- Adjusted Kraken wrapper methods to handle currency pairs correctly.
- Refined OKX tests and types to utilize currency.Pair for instrument IDs.
- Enhanced Poloniex tests to consistently use predefined currency pairs.
- Streamlined order and orderbook tests to replace string pairs with currency.NewBTCUSD().
- Improved Yobit tests to utilize a standardized currency pair format.
- Updated validator wrapper to use currency pairs directly instead of string conversions.
* codebase: Use types.Number where possible
* refactor: update PayoutFee type to types.Number for consistency
* Refactor: Remove crypto functions to use standard library and other minor changes
- Removed custom crypto functions for SHA256, SHA512, and MD5 from the common/crypto package.
- Replaced usages of removed functions with standard library implementations in various files including:
- cmd/websocket_client/main.go
- engine/apiserver.go
- exchanges/kraken/kraken.go
- exchanges/lbank/lbank.go
- exchanges/okx/okx_business_websocket.go
- exchanges/kucoin/kucoin_websocket.go
- gctscript/vm/vm.go
- Updated tests to reflect changes in the crypto functions.
- Renamed several functions for clarity, particularly in the context of order book updates across multiple exchanges.
* refactor: replace assert with require for consistency in test assertions
* refactor: Improve Binance futures candlestick test, standardise orderbook update function names and improve test parallelism
* refactor: Replace require.Len with require.Equal for better output in TestGetFuturesKlineData
* types/time, exchanges/kraken: Refactor spot/futures time types
- Updated WSFuturesTickerData, WsFuturesTradeData, and other related structs to replace int64 timestamps with the new types.Time.
- Adjusted related test cases to accommodate changes in timestamp handling.
- Modified functions in kraken_wrapper and kraken_websocket to utilise the new Time type for better time management.
- Enhanced JSON unmarshalling in the Time type to handle various timestamp formats, including "0" and "0.0".
* refactor: Update JSON field name/types and improve perf
* types/time: revert to more precise check, just check for 'n'
* refactor: Ryan the F1 driver is so back 🏎️
* refactor: Enhance UnmarshalJSON error handling and simplify test cases
* ocd: Fix trigger
* tests: Replace !errors.Is(err, target) with testify equivalents
* codebase: Manual !errors.Is(err, target) replacements
* typo: Replace errMisMatchedEvent with errMismatchedEvent
* tests: Enhance error messages for better output
* tests: Refactor error assertions in various test cases to use require and improve clarity
* misc linter: Fix assert should wording
* tests: Simplify assertions in TestCreateSignals for clarity and conciseness
* tests: Enhance assertion message in TestCreateSignals
* Fix(kraken): Protect authToken with RWMutex to prevent race
This commit introduces a sync.RWMutex to protect the global `authToken`
variable in `exchanges/kraken/kraken_websocket.go`.
The race condition occurred due to concurrent read/write access to
`authToken` from different goroutines, notably between `WsConnect` (write)
and functions like `wsCancelOrder`, `wsAddOrder`, `wsCancelAllOrders`,
and `manageSubs` (read).
The fix involves:
- Adding `authTokenMutex.Lock()` before writing to `authToken` in `WsConnect`
and `authTokenMutex.Unlock()` after.
- Adding `authTokenMutex.RLock()` before reading `authToken` in
`wsAddOrder`, `wsCancelOrder`, `wsCancelAllOrders`, and `manageSubs`,
and `authTokenMutex.RUnlock()` after.
This change resolves the data race reported in
https://github.com/thrasher-corp/gocryptotrader/issues/1762.
I ran tests in the `exchanges/kraken` package with the `-race`
detector, and all tests passed without detecting any race conditions.
* kraken: Add common websocketAuthToken func for concurrent read access
* Kraken: Only set authToken on mission success
* Refactor: Adjust websocket authentication handling to use setWebsocketAuthToken method and rename wsAuthMu to wsAuthMtx for clarity
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* Here's how I resolved a race condition in the encryption prompt tests:
I've refactored `promptForConfigEncryption` to accept an `io.Reader`. This allows tests to use `strings.NewReader` instead of relying on the global `os.Stdin`. This change isolates the input source for `TestPromptForConfigEncryption`, preventing concurrent access conflicts with `TestPromptForConfigKey` which uses `withInteractiveResponse` to manipulate `os.Stdin`.
The original issue manifested as a data race detected by `go test -race` between these two test functions due to their parallel execution (`t.Parallel()`) and their interaction with the shared `os.Stdin` resource.
Here are the changes I made:
- `config/config_encryption.go`:
- Modified `promptForConfigEncryption` to `promptForConfigEncryption(r io.Reader) (bool, error)`.
- Introduced `PromptForConfigEncryption()` as a public wrapper that calls the refactored function with `os.Stdin` for application use.
- `config/config.go`:
- Updated the call site for prompting config encryption to use the new `PromptForConfigEncryption()` wrapper.
- `config/config_encryption_test.go`:
- Updated `TestPromptForConfigEncryption` to call the (now unexported) `promptForConfigEncryption` with `strings.NewReader` for various input scenarios.
- `t.Parallel()` was maintained for `TestPromptForConfigEncryption`.
To verify, I confirmed that running `go test -race ./config/...` shows the previously reported race condition is no longer present. All tests in the `config` package now pass with the race detector enabled.
* Refactor(config): Remove redundant loop variable capture in test
I've removed the explicit `tc := tc` line in `TestPromptForConfigEncryption`
as it is no longer necessary for Go versions 1.22 and later.
The project's Go version (1.24.3 as per CI) handles loop variable
scoping correctly for parallel subtests, making this capture redundant.
This change is a follow-up to the fix for the race condition in issue #1928,
addressing your feedback on code style. No functional changes are introduced
by this commit.
* Style(config): Remove explicit empty string in test case
Refactors the "input_empty_eof" test case in
`TestPromptForConfigEncryption` to remove the explicit
assignment of `input: ""`. This relies on Go's default
behavior for struct field initialization (a string field
defaults to an empty string), making the code more concise.
This change is a follow-up to previous refactorings for issue #1928,
addressing your feedback on code style. No functional changes
are introduced by this commit.
* Update config/config_encryption_test.go
Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
* linter: Make indenting a happy bing
* config: Rid PromptForConfigEncryption
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
* Added TimeInForce type and updated related files
* Linter issue fix and minor coinbasepro type update
* Bitrex consts update
* added unit test and minor changes in bittrex
* Unit tests update
* Fix minor linter issues
* Update TestStringToTimeInForce unit test
* fix conflict with gateio timeInForce
* Update order tests
* Complete updating the order unit tests
* update kucoin and deribit wrapper to match the time in force change
* fix time-in-force related test errors
* linter issue fix
* time in force constants, functions and unit tests update
* shift tif policies to TimeInForce
* Update time-in-force, related functions, and unit tests
* fix linter issue and time-in-force processing
* added a good till crossing tif value
* order type fix and fix related tim-in-force entries
* update time-in-force unmarshaling and unit test
* fix time-in-force error in gateio
* linter issue fix
* update based on review comments
* add unit test and fix missing issues
* minor fix and added benchmark unit test
* change GTT to GTC for limit
* fix linter issue
* added time-in-force value to place order param
* fix minor issues based on review comment and move tif code to separate files
* update on exchanges linked to time-in-force
* resolve missing review comments
* minor linter issues fix
* added time-in-force handler and update timeInForce parametered endpoint
* minor fixes based on review
* nits fix
* update based on review
* linter fix
* rm getTimeInForce func and minor change to time-in-force
* minor change
* update based on review comments
* wrappers and time-in-force calling approach
* update slice data processing
* fix linter issues
* remove unnecessary Unmarshal methods and replace type delatration and added unit tests
* minor change
* minor changes to types
* update gateio string to timeInForce conversion and unit test
* removed unused timeInForceString func from kraken
* removed redundant parentheses in slice unmarshaling
* array to slice conversion and other updates
* reverted slice target to array
* Binanceus unit test NotNil check to Len check
* change NotNil to Len check
* rename unmarshal unit test funcs name
* wrap json strings with []byte
* GHA, tests: Add additional checks for common issues
These checks include:
- Ensuring that all testify funcs use their formatted variants (e.g., `assert.Equalf(t, expected, actual)` instead of `assert.Equal(t, expected, actual)`).
- Replacing `%s` with %q
- Enforcing consistent usage of should/must wording for testify assert/require messages
* Add support for checking backticked string format specifiers and fix issues
* tests: Fix error comparisons
* tests: Replace errors.Is(err, nil) usage with testify and automate check
* refactor: Rename ExtractPort to ExtractPortOrDefault
* tests: Replace assert with require for error handling in multiple test files
* tests: Replace assert with require for error handling and improve assertions in data tests
* tests: Fix typo in assertion message for StreamVol test
* OKX: Fix GetOpenInterestAndVolumeStrike test with instrument selection and improved assertions
* OKX: Revert intentional error check
* Improve error message for expiry time check in GetOpenInterestAndVolumeStrike test
* LBank: Fix TestGetWithdrawConfig, assertify tests and other minor changes
* refactor: Update pair var and other tweaks
* refactor: Increase test coverage for crypto funcs and minor adjustments
* refactor: Replace assert with require for error checks in TestCreateOrder
* Update exchanges/lbank/lbank.go
Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
* refactor: Correct spelling of HighestPrice in KlineResponse and increase test coverage
* refactor: Update error handling in CreateOrder and improve GetTrades comment
---------
Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
* chore: Remove apichecker.tmpl
Removed template file related to the decommissioned apichecker.
* chore: Remove apichecker.tmpl
Removed template file related to the decommissioned apichecker.
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* gateio: Add websocket orderbook update manager
* RM println
* glorious: nit
* Adds delivery futures update processing as well
* Change to const value for delivery
* Drop check out of order, can reinstate if required.
* Adds in validation methods to ensure config changes are correct when expanding templates and return errors with correct info if not.
* fix some things and add in todo when this gets updated
* fix spelling
* linter: fix
* gk: initial nits
* gk: nits shift to template only verification with funcmap, rm interface for single sub checking.
* rm unused error
* linter: fix
* update to const frequency
* gk: wrap with panic and single invocation in template, change name
* gk: nits to check across stored subs with incoming subs
* linter: fix
* updates names, makes things slightly more efficient and adds tests
* linter: fix
* gk: sexc patch v2
* glorious: nits
* gk: nits
* Update exchanges/subscription/template.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* gk: nits
* linter: make peace with linter regulations
* glorious: Add TODO for future template integration
* glorious: commentary nits
* fix name
* give me a break, have a kit kat
* revert whoops
* update wording on comment
* revert secondary call to expand templates and update tests
* misc lint: fix
* Add spot orderbook update interval for 20ms, expand tests, piggy back limit/level off loaded subscription. Thanks to @thrasher-
* linter/spell: fix
* ai nits: drop go routine on mtx RUnlock
* Update exchanges/gateio/ws_ob_update_manager.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* gk: revert to 100ms from 20ms waiting for config upgrade patch
* test: fix
* cranktakular: nits
* strings quoted in fmt call
* thrasher-: nits
* Update exchanges/gateio/gateio_test.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* Update exchanges/gateio/gateio_test.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* gk: nits
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* Added TimeInForce type and updated related files
* Linter issue fix and minor coinbasepro type update
* Bitrex consts update
* added unit test and minor changes in bittrex
* Unit tests update
* Fix minor linter issues
* Update TestStringToTimeInForce unit test
* fix conflict with gateio timeInForce
* Update order tests
* Complete updating the order unit tests
* update kucoin and deribit wrapper to match the time in force change
* fix time-in-force related test errors
* linter issue fix
* time in force constants, functions and unit tests update
* shift tif policies to TimeInForce
* Update time-in-force, related functions, and unit tests
* fix linter issue and time-in-force processing
* added a good till crossing tif value
* order type fix and fix related tim-in-force entries
* update time-in-force unmarshaling and unit test
* fix time-in-force error in gateio
* linter issue fix
* update based on review comments
* add unit test and fix missing issues
* minor fix and added benchmark unit test
* change GTT to GTC for limit
* fix linter issue
* added time-in-force value to place order param
* fix minor issues based on review comment and move tif code to separate files
* update on exchanges linked to time-in-force
* resolve missing review comments
* minor linter issues fix
* added time-in-force handler and update timeInForce parametered endpoint
* minor fixes based on review
* nits fix
* update based on review
* linter fix
* rm getTimeInForce func and minor change to time-in-force
* minor change
* update based on review comments
* wrappers and time-in-force calling approach
* minor change
* update gateio string to timeInForce conversion and unit test
* updated order test unit tes functions
* minor fixes on unit tests
* nits fix based on feedback
* update TestDeriveCancel unit test assert messages
* update TestDeriveCancel unit test assert messages
* update timeInForceFromString method to return formatted error and update functions using it
* restructure and fix minor exchanges time-in-force handling issues
* replaced unused getTypeFromTimeInForce with inline switch-based order type check
* separated the repeated timeInForce conversion code to a function
* update exchanges time-in-force handling based on review comments
* limter fix
* edded comment to validTimesInForce var
* added comment to gateio's timeInForceString func
* added goodTillCancel switch case to gateio timeInForceString func
We saw another false negative failure on huobi NW testing [here](https://github.com/thrasher-corp/gocryptotrader/actions/runs/14926487990/job/41932452598?pr=1901#step:11:731)
On Friday 2025-05-09 the end date for the next week moved to 2025-05-25.
This fix relaxes our tests, and handles the predictable failure on Next Quarter in the same manner as Next Week.
For the quarterly tests, we add another 7 days.
Hopefully this will be the end of this recurring test failure.
* OKX: Fix intermittent GetFuturesContractDetails issue and various refactors
* refactor: Update LeadTraderRanksRequest fields for clarity and improve parameter checks
* refactor: Simplify live contract check in GetFuturesContractDetails
* OKX: Fix spread related issues and enhance tests
* OKX: Disable spread websocket support and adjust conditional logic in test
* refactor: Improve error handling in syncLeadTraderUniqueID and clean up variable usage
* refactor: Update LeadTraderRanksRequest State type to bool and adjust rate limit
* refactor: Rename State to HasVacancy in LeadTraderRanksRequest and update related logic
* rm WsResponseMultiplexer with added fixes
* linter: fix
* use const and testnet ctx update
* rename error to status for field name
* rm verbosity for random test
* gk: nits v1
* glorious/gk: nits
* linter: fix
* fix and consolidate this direction
* fix linter
* gk: nits cont
* gk: nits I missed
* gk: counter name change to messageIDSeq
* gk/glorious: nits untested
* glorious: nits and tested live endpoints
* Update exchanges/okx/ws_requests.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update exchanges/okx/ws_requests.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update exchanges/okx/ws_requests.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update exchanges/okx/okx.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update exchanges/okx/okx.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* thrasher-: nits!
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Improve credential handling and error reporting
Swapped out empty credential returns with more specific errors to make things clearer and avoid weird behavior. Added safeguards to handle nil credentials in WebSocket data processing. This gives us better error handling and more reliable fallback options when managing credentials.
* Rewrite gctwrapper test assertions to use substring matching instead of exact string matching
This prevents test failures caused by minor error message formatting changes
* Correct mutex use in GetCredentials
Move mutex from local credentials copy to shares resource access
We were locking the mutex when modifying a local copy instead of when reading from shared credentials
Moved RLock/RUnlock to wrap b.API.credentials access remoived the unnecessary locks when changing the local copy
Reduce lock contention and fix potential race conditions
* Replace test assertions with testify/require package in gctwrapper_test.go
* remove unnecesarry mutex locks in GetCredentials and fix test
* credentials test use require.ErrorIs
* Fix: improve credential handling in BTCMarkets websocket
* Refactor error messages and improve test assertions
* Update exchanges/credentials.go
* Update gctscript/wrappers/gct/gctwrapper_test.go
* credentials: Remove redundant comment for sub account override
---------
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Tests: Use currency.NewUSD and NewUSDT
Simple refactor to use the provided shortcut methods
* Github: Add CI check to ensure NewPair not used
Add a step to ensure NewPair(BTC, USD*) isn't used
* golangci-lint: Enable usetesting and unused linters
* tests: Improve assertions in various test cases for clarity and accuracy
* tests: Enhance error assertions in TestExecuteStrategyFromFile for improved clarity
* tests: Update assertions for improved clarity and accuracy
* tests: Replace assert with require for task count checks
* config/versions/v7: Replace context.Background() with t.Context()
* Bithumb: Centralise and consoliate testPair, relax UpdateTickers check
with some glorious Doom Eternal music
* Bithumb: Use UpdatePairsOnce and update remaining pair string
* Bithumb: Add UpdatePairsOnce to TestUpdateTickers
* Exchanges: Remove cancel order walletAddress
* Order: Refactor TestMatchFilter
TestMatchFilter had inconsistent testing of empty values, and was
painful when a field was removed due to index methodology.
This should provide equal test clarity, but improve maintainability and
improve coverage on empty values.
* Config: v5 Split GateIO futures into CoinM and USDT
* GateIO: Split asset.Futures into CoinM and USDT
* Fix CancelBatchOrders using wrong endpoint for CoinMarginedFutures
* Fix TestGetActiveOrders expecting currency.ErrCurrencyPairsEmpty
* Config: Add config version continuity step to CI
* GateIO: Pin CoinM futures to just BTC/USD
Right now we only have a /btc endpoint available, and only BTCUSD is
available.
If GateIO offers more, we'll need to add a settlement currencies list
again
* Config: Move config versions to separate pacakges
* Config: Move version tests to blackbox texts
* Config: Protect registerVersion from overflow
* Config: Protect against version already registered