* 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
* cmd/documentation: Add pagination support for contributors
* Drop break and return immediately
* documentation: change defaultGithubAPIPerPageLimit to an integer and update usage in GetContributorList
* deribit: Update FetchTradablePairs to not need a currency code
* gk: nits
* t.Context() usage in tests
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* gateio: Add multi asset websocket support WIP.
* meow
* Add tests and shenanigans
* integrate flushing and for enabling/disabling pairs from rpc shenanigans
* some changes
* linter: fixes strikes again.
* Change name ConnectionAssociation -> ConnectionCandidate for better clarity on purpose. Change connections map to point to candidate to track subscriptions for future dynamic connections holder and drop struct ConnectionDetails.
* Add subscription tests (state functional)
* glorious:nits + proxy handling
* Spelling
* linter: fixerino
* instead of nil, dont do nil.
* clean up nils
* cya nils
* don't need to set URL or check if its running
* stream match update
* update tests
* linter: fix
* glorious: nits + handle context cancellations
* stop ping handler routine leak
* * Fix bug where reader routine on error that is not a disconnection error but websocket frame error or anything really makes the reader routine return and then connection never cycles and the buffer gets filled.
* Handle reconnection via an errors.Is check which is simpler and in that scope allow for quick disconnect reconnect without waiting for connection cycle.
* Dial now uses code from DialContext but just calls context.Background()
* Don't allow reader to return on parse binary response error. Just output error and return a non nil response
* Allow rollback on connect on any error across all connections
* fix shadow jutsu
* glorious/gk: nitters - adds in ws mock server
* linter: fix
* fix deadlock on connection as the previous channel had no reader and would hang connection reader for eternity.
* glorious: whooops
* gk: nits
* Leak issue and edge case
* Websocket: Add SendMessageReturnResponses
* whooooooopsie
* gk: nitssssss
* Update exchanges/stream/stream_match.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* Update exchanges/stream/stream_match_test.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* linter: appease the linter gods
* gk: nits
* gk: drain brain
* started
* more changes before merge match pr
* gateio: still building out
* gateio: finish spot
* fix up tests in gateio
* Add tests for stream package
* rm unused field
* glorious: nits
* rn files, specifically set function names to asset and offload routing to websocket type.
* linter: fix
* Add futures websocket request support
* gateio: integrate with IBOTExchange (cherry pick my nose)
* linter: fix
* glorious: nits
* add counter and update gateio
* fix collision issue
* Update exchanges/stream/websocket.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits
* add tests
* linter: fix
* After merge
* Add error connection info
* upgrade to upstream merge
* Fix edge case where it does not reconnect made by an already closed connection
* stream coverage
* glorious: nits
* glorious: nits removed asset error handling in stream package
* linter: fix
* rm block
* Add basic readme
* fix asset enabled flush cycle for multi connection
* spella: fix
* linter: fix
* Add glorious suggestions, fix some race thing
* reinstate name before any routine gets spawned
* stop on error in mock tests
* glorious: nits
* Set correct price
* glorious: nits found in CI build
* Add test for drain, bumped wait times as there seems to be something happening on macos CI builds, used context.WithTimeout because its instant.
* mutex across shutdown and connect for protection
* lint: fix
* test time withoffset, reinstate stop
* fix whoops
* const trafficCheckInterval; rm testmain
* y
* fix lint
* bump time check window
* stream: fix intermittant test failures while testing routines and remove code that is not needed.
* spells
* cant do what I did
* protect race due to routine.
* update testURL
* use mock websocket connection instead of test URL's
* linter: fix
* remove url because its throwing errors on CI builds
* connections drop all the time, don't need to worry about not being able to echo back ws data as it can be easily reviewed _test file side.
* remove another superfluous url thats not really set up for this
* spawn overwatch routine when there is no errors, inline checker instead of waiting for a time period, add sleep inline with echo handler as this is really quick and wanted to ensure that latency is handing correctly
* linter: fixerino uperino
* fix ID bug, why I do this, I don't know.
* glorious: panix
* linter: things
* whoops
* dont need to make consecutive Unix() calls
* websocket: fix potential panic on error and no responses and adding waitForResponses
* rm json parser and handle in json package instead
* in favour of json package unmarshalling
* linter: fix
* linter: fix again
* * change field name OutboundRequestSignature to WrapperDefinedConnectionSignature for agnostic inbound and outbound connections.
* change method name GetOutboundConnection to GetConnection for agnostic inbound and outbound connections.
* drop outbound field map for improved performance just using a range and field check (less complex as well)
* change field name connections to connectionToWrapper for better clarity
* spells and magic and wands
* glorious: nits
* comparable check for signature
* mv err var
* glorious: nits and stuff
* attempt to fix race
* glorious: nits
* gk: nits; engine log cleanup
* gk: nits; OCD
* gk: nits; move function change file names
* gk: nits; 🚀
* gk: nits; convert variadic function and message inspection to interface and include a specific function for that handling so as to not need nil on every call
* gk: nits; continued
* gk: engine nits; rm loaded exchange
* gk: nits; drop WebsocketLoginResponse
* stream: Add match method EnsureMatchWithData
* gk: nits; rn Inspect to IsFinal
* gk: nits; rn to MessageFilter
* linter: fix
* gateio: update rate limit definitions (cherry-pick)
* Add test and missing
* Shared REST rate limit definitions with Websocket service, set lookup item to nil for systems that do not require rate limiting; add glorious nit
* integrate rate limits for websocket trading spot
* conform to match upstream changes
* standardise names to upstream style
* fix wrapper standards test when sending a auth request through a websocket connection
* whoops
* Update exchanges/gateio/gateio_types.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits
* linter: fix
* linter: overload
* whoops
* spelling fixes on recent merge
* glorious: nits
* linter: fix?
* glorious: nits
* gk: assert errors touched
* gk: unexport derive functions
* gk: nitssssssss
* fix test
* gk: nitters v1
* gk: http status
* gk/nits: Add getAssetFromFuturesPair
* gk: nits single response when submitting
* gk: new pair with delimiter in tests
* gk: param update slice to slice of pointers
* gk: add asset type in params, includes t.Context() for tests
* linter: fix
* linter: fix
* fix merge whoopsie
* glorious: nits
* gk: nit
* shift over to websocket package error
* internal/exchange/websocket -> exchange/websocket
* PEAK OCD!
* appease the OCD gods
* thrasher: nits
---------
Co-authored-by: shazbert <ryan.oharareid@thrasher.io>
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This test ensures we have eyes on what the subscription limit per
session is.
They've increased it from 300 to 400.
I think when I first did this, the code actually needed to know, but
it's still useful to ensure we know exactly where it sits.
* Websocket: Rename stream package
* Websocket: Rename Websocket to Manager
* Websocket: Replace explicit errs with common.NilGuard
* Websocket: Move websocket_types.go to types.go
* Websocket: Minor field comment and alignment in types
* Webosocket: Rename WebsocketConnection to Connection
* Alphapoint: Make gorilla ws import explicit
Just to avoid confusion with our own packages.
* Websocket: Move stream_match to match
* Websocket: Move websocket_connection to connection
* Websocket: Move websocket.go to manager.go
* Websocket: Break out all subscription methods into subscriptions.go
* Websocket: Move connection type into its file
* Websocket: Remove PositionUpdated
Type is not used anywhere
* Kraken: Use local constant for pong
Was the only use of websocket.Pong and doesn't really feel right to
represent kraken's api resp in one of our packages
* Websocket: Move connection sub-types to connection package
* Websocket: Move manager types into manager
* Websocket: Move ConnectionWrapper into manager
* Websocket: Move websocket_test to manager_test
* Websocket: Privatise connectionWrapper
* Websocket: Remaining types into types.go
These really belong somewhere else mostly, but this will do for now
* Websocket: Tidy up connection method vars
* Gofumpt: Moving package imports around
* Websocket: Rename errDuplicateConnectionSetup
* Websocket: Fix duplicate import of gws
* Websocket: Fix gofumpt -extra
* Websocket: Standardise import of gws across other pkgs
* Kraken: Remove unused sub conf consts
These were replaced by the generic Levels and Depth fields on all subs
* Websocket: Privitise ConnectioWrapper fields
* Websocket: inline single use var WebsocketNotAuthenticatedUsingRest
* Websocket: Move documentation to template
* Bithumb: Assertify TestWsHandleData
* Fix sending trades to the DataHandler
Additionally set trade direction type to order.Side and set the time to UTC
* Amend the len check to make it scalable
* Fix the nit
* Config: Replace consts for Version2 from/to
Could have moved them to v2/consts.go but doesn't seem enough RoI
* Config: Use generic error in Version4
* Config: Fix Version5 pkg vars
* Config: Fix Version6 test func names and shared test var
* portfolio: Fix CryptoID balance issue and assertify tests
* portfolio: Expand context usage, enhance tests and a few other minor improvements
* portfolio: Further improvements and enhance common.IsValidCryptoAddress
* config, portfolio: Use v6.DefaultConfig, switch to context.WithCancel