* signaler: improve cross-platform signal compatibility
- Add runtime-based platform detection for signal handling
- Include os.Kill only on Windows (cannot be caught/ignored on Unix)
- Refactor signal initialization into separate getPlatformSignals function
* signaler: add dependency injection and improve docs
- Introduce SignalNotifier interface for testability
- Add osSignalNotifier implementation and factory function
- Enhance package and function documentation
- Maintain backward compatibility with existing API
* [signaler] simplify shutdown handling; drop SIGABRT/os.Kill
* skip signaler tests on windows
* support signaler interrupt tests and improve signal handling tests
* removing getPlatformSignal function
* remove signaler readme
* Signaler: Return a channel from WaitForInterrupt
* Signaler: fix comment
Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
* Signaler: require NoError to NoErrorf
Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
---------
Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
* Testing: Fix FixtureToDataHandlerWithErrors logging []byte
* Kucoin: Fix global mutexes and maps
Highlighted by:
```
go test -count 2 -run TestPushData
```
that the second run wasn't finding a futures orderbook, because the
instance had changed but kucoin was using a global map
* Add WithNoDelayPermitted and fix bug on cancel all
* rm reservations as it is only for last reservation when cancelling and needed to take into account of the actual offset delay for correct returning of tokens, update tests
* export error
* misc fix
* more misc fix
* Add concurrent protection, cancel in reverse and add tests
* lint: fix
* Update exchanges/request/limit.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* Update exchanges/request/limit.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* Update exchanges/request/limit.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* Update exchanges/request/limit.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* gk: nits doo
* linter: fix
* boss king: nits
* crank: nits
* crank: test patch which was cooked and had to be done manually
* Update exchanges/request/limit.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* gk: nits
* linter: fix
* thrasher: nits
* use error collector in tests
* nolint: direction
* gk: fixup!
* my life has elapsed
* thrasher-: Because of synctest, we can now be deterministic with values. This rids a lot of the redundant wait calls which served no purpose
* thrasher-: patched
---------
Co-authored-by: shazbert <ryan.oharareid@thrasher.io>
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
Co-authored-by: shazbert <shazbert@DESKTOP-3QKKR6J.localdomain>
* Updating wrapper template, updating documentation, regenerating documentation
* Renaming "streaming api" to "websocket"
* Context is now t
* Update docs/ADD_NEW_EXCHANGE.md
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update cmd/documentation/root_templates/root_readme.tmpl
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Fixes an improper example and regenerates documentation
* Corrects typos
* Makes a table label consistent across files
---------
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Initial plan
* Add order execution limit errors to acceptableErrors list
Add all order execution limit validation errors from the limits package
to the acceptableErrors list. This fixes intermittent test failures when
exchanges have different minimum/maximum limits for price and amount that
don't match the hardcoded test values.
The test uses hardcoded values (150) for price and amount, but exchanges
like Binance have varying limits (e.g., BTCUSDPERP has a minimum price of
1000). By treating these limit validation errors as acceptable, the test
properly validates that exchanges correctly enforce their limits without
causing false test failures.
Fixes the CheckOrderExecutionLimits failure for Binance coinmarginedfutures
BTCUSDPERP where the hardcoded price of 150 is below the minimum limit of
1000.
Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com>
* Remove self-explanatory comments from limit errors
Remove comments that don't add information beyond the error names
for the newly added order execution limit errors, as requested in
code review feedback.
Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com>
Deribit seems to have opened up more instruments for future combos and
is using a `-` delimiter in them, throwing off our parsing rule that
it's always 3 parts for them.
This change adds in the "FS" part, which seems consistent.
I would have added checking for such a part to option_combo but some of
them are missing it :/
* Bybit: Fix race in TestUpdateAccountInfo and TestWSHandleData
* DriveBy rename TestWSHandleData
* This doesn't address running with -race=2+ due to the singleton
* Accounts: Add account.GetService()
* exchange: Assertify TestSetupDefaults
* Exchanges: Add account.Service override for testing
* Exchanges: Remove duplicate IsWebsocketEnabled test from TestSetupDefaults
* Dispatch: Replace nil checks with NilGuard
* Engine: Remove deprecated printAccountHoldingsChangeSummary
* Dispatcher: Add EnsureRunning method
* Accounts: Move singleton accounts service to exchange Accounts
* Move singleton accounts service to exchange Accounts
This maintains the concept of a global store, whilst allowing exchanges
to override it when needed, particularly for testing.
APIServer:
* Remove getAllActiveAccounts from apiserver
Deprecated apiserver only thing using this, so remove it instead of
updating it
* Update comment for UpdateAccountBalances everywhere
* Docs: Add punctuation to function comments
* Bybit: Coverage for wsProcessWalletPushData Save
* Exchanges: Remove example BespokeGenerateMessageID
* Okx: Replace conn.RequestIDGenerator with MesssageID
Continued overall direction to remove the closed-loop of e => conn => e
roundtrip for message ids
* Exchanges: Add MessageSequence
This method removes the either/or nature of message id generation.
We don't tie the message ids to connections, or to anything.
Consumers just call whichever they want, or even combine them as they
want.
Anything more complicated will need a separate installation anyway
* GateIO: Split usage of MessageID and MessageSequence
* Binance: Switch to UUID message IDs
* Kraken: Switch to e.MessageSequence
* Kucoin: Switch to MessageID
* HitBTC: Switch to UUIDv7 for ws message ID
* Bybit: Switch to UUIDv7 for ws message ID
* Bitfinex: Switch to UUIDv7 and MessageSequence
Tested CID - It accepts 53 bits only for an int, so MessageSequence
makes sense. Can't use MessageID
* Websocket: Remove now unused MessageID function
Moved all MessageID usage into funcs and onto base methods, to remove
the closed loop of message IDs
* Docs: Update guidance for message signatures
```
❯ go test ./engine/... -run TestGetDefaultConfig
--- FAIL: TestGetDefaultConfigurations (2.01s)
--- FAIL: TestGetDefaultConfigurations/hitbtc (0.39s)
panic: runtime error: slice bounds out of range [:-1] [recovered, repanicked]
```
The code was using strings.Index to find the quote currency position in the
symbol ID, then slicing the ID. When Index returns -1 (not found), it caused
a panic with 'slice bounds out of range [:-1]'.
Fixed by using the BaseCurrency and QuoteCurrency fields directly from the
Symbol struct, which is the correct approach and what the API provides.
* Initial plan
* Fix intermittent race condition in TestExecuteStrategy
Add synchronization point after async ExecuteStrategy call to wait for
background goroutine completion before resetting metadata. This prevents
the race condition where Stop() could be called after metadata reset,
causing errAlreadyRan instead of the expected errLiveOnly.
Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com>
* Use assert.Eventually instead of manual polling loop
Replace manual for-loop polling with assert.Eventually for cleaner
and more idiomatic test synchronization.
Co-authored-by: gloriousCode <9261323+gloriousCode@users.noreply.github.com>
* Use require.Eventually instead of assert.Eventually
Change to require.Eventually to ensure test stops immediately if the
async goroutine doesn't complete, preventing potential race conditions
from leaking into subsequent test assertions.
Co-authored-by: shazbert <9391715+shazbert@users.noreply.github.com>
* Change error message from "should" to "must"
Update assertion message to reflect mandatory nature of the condition
when using require.Eventually.
Co-authored-by: shazbert <9391715+shazbert@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com>
Co-authored-by: gloriousCode <9261323+gloriousCode@users.noreply.github.com>
Co-authored-by: shazbert <9391715+shazbert@users.noreply.github.com>