* CI: Add macOS, Windows and Linux arm64 support
* Modify arm64 job name to be inline with the others
* linter: Prevent cache from causing "Cannot open: File exists" issues
* Use setup-go and setup-node's inbuilt caching
* Dispatch: Assertify TestMuxPublish
* Dispatch: Fix errDispatcherJobsAtLimit test fails
This test would fail intermittently when the jobs queue drained quickly
enough.
This sets the overload ceiling based on the default settings, and seems
a safe way of ensuring we get an error every time.
It adds a done channel guard around the goro test because otherwise
we'll get a panic occassionally when the goro outlives TestMaxPublish
* Dispatch: Add test for Publish receiving data
* Dispatch: Publish to all subscribers
* Types: Add Number type
* Types: Switch StringToFloat64 for Number
This change mostly just renames the type.
convert package and StringToFloat64 represent actions, not types,
and make it misleading to use outside of the API context,
especially when using it for a Float64ToString operation.
* Common: Remove StringToFloat64
Replaced by types.Number
* fixup! Types: Switch StringToFloat64 for Number
Second pass at Okx
* Spellcheck: Fix whitespace handling for okx line
* Orderbook: Fix test failures on different arch
Fixes floating point inaccuracies on different architectures
Moves the depth tests over to table driven tests
* Kline: Fix test failures on different arch
* BTSE: Fix duplicate error on Million pairs (M_*)
BTSE has listed Pitbull token with two symbols:
PIT-USD and M_PIT-USD for millons of PIT / USD.
The native token is not tradable, so we ignore them and
get a base of M_PIT because that's what later APIs will accept
* BTSE: Fix test errors on locked market
* Common: Improve AppendError and ExcludeError
This change switches from a stateful multiError to caring more about the
Unwrap() []error interface, the same as [go standard
lib](https://github.com/golang/go/blob/go1.21.4/src/errors/wrap.go#L54-L68)
Notably, if we implement Unwrap() []error and do NOT implement Is() then
we get free compatibility with the core functions.
The only distateful thing here is needing to deeply unwrap fmt.Errorf
errors, since they don't flatten. I can't see any way around that
* Pairs: Fix exchange config Pairs loading
When a pair string contained two punctuation runes, the first one is used,
and the configFormat is ignored.
This fix checks the list and corrects any with the wrong delimiter, or
errors if the format is inconsistent.
* BTSE: Fix all tickers retrieved by GetTicker
PR #764 introduced GetTickers, but it wasn't rolled out to BTSE.
This fix ensures that when one ticker is a locked market, the rest continue to
function. Particularly important if the locked market wasn't even
enabled anyway.
* Kucoin: Fix test config future pairs
* BTSE: Remove PIT tests; Token removed
BTSE have removed the PIT token pairs
All these changes stand, and this just removes the test
* ITBit: Fix fatal error on second run
This fix removes incorrect config pair delimiter, because it would be
re-inserted into config the first run, and then error the second time.
This delimiter doesn't match the config we have.
There's no implementation of fetching pairs, so what's in config files
now is all that matters
* Engine: Fix TestConfigAllJsonResponse
* Clarity of non-matching json improved
* Handling for fixing pair delimiters
* Okx: Remove UpdateTradablePairs from TestMain
When running individual tests we do not want to be forced to update
trading pairs.
It also does not seem to be required, since disabling UpdateTradingPairs
entirely doesn't stop any tests from passing.
If it is required we can enact this pattern:
```
func TestUpdateTradablePairs(t *testing.T) {
t.Parallel()
updatePairsOnce(t)
}
var updatePairsGuard sync.Once
func updatePairsOnce(tb testing.TB) {
tb.Helper()
updatePairsGuard.Do(func() {
err := ok.UpdateTradablePairs(context.Background(), true)
assert.NoError(tb, err, "UpdateTradablePairs should not error")
})
```
* Okx: Fix GetBlockTrades url
Endpoint was wrong
Not convinced we should prefix with market vs public, but not
committing a driveby
* Okx: Expand test coverage for GetBlockTrades
* Okx: Fix GetPublicBlockTrades
Was marked as an authenticated API call, and it's not.
Also renames it because without the context of "Block" (or RFQ) it's
misleading.
Adds tests.
* Okx: Fix GetPublicBlockTrades to be public
Expand coverage of GetBlockTrade and GetPublicBlockTrades
* Kucoin: Fix unmarshalling of FuturesTicker resp
* Fix several string float64 fields not unmarshalling
* Fix time field misnamed; Make a time.Time
* Use order.Side for sides
* Add tests
This change opts to expose float64 instead of StringToFloat64 because
there's no wrapper to convert the type over, and it's not a websocket.
Essentially choosing to not expose internal convert types for methods
called directly.
Possible we'll eventually harmonise this with a types.Number or
something.
* Kucoin: FuturesRealTimeTicker => FuturesTicker
Kucoin only call it RealTime in the first sentence of their docs. None of the API names, endpoints or any thing mention RealTime.
This is just a ticker
* Tests: Improve clarity of failed push data
* Kucoin: Move PushData to a fixture file
This avoids both the linter errors, and the bloat.
Loses the name of the "test", but I think that's okay
* Okx: Fix GetInsuranceFundInformation "" resp
When amount is "" this was erroring
* Test: Standardise configtest.json
Simple jq formatting of configtest
git diff -w or github ignore whitespaces should show no changes.
Any conflicts, just accept --ours and reformat it. Or not :o)
* Currency: Do not use a default forex provider
exchangerate.host now requires an API key.
Instead of finding a new Free (for now) default, this change simply
disables the currency exchange when nothing is enabled.
* SyncManager: Report ?.?? for an unknown forex amount
In a situation where we thought forex was available but we got an error,
this avoids showing 0.00 when there was actually an error.
* Currency: Tests for no default forex
* Currency: Use mock provider for tests
* Currency: Add API key to exchangerate.host
* Currency: Remove Exchangerate.host
Exchangerate.host was bought by apilayer, the old API deprecated, and
replaced with a proxy to the apilayer api.
We already have currencylayer support, so ther's no reason to keep exh.
Worth noting: New ERH keys actually work on currencylayer
* Currencies: Add test coverage for currency layer
* fixup! Currency: Tests for no default forex
Remove duplicate assignment
Fixes [review comment](https://github.com/thrasher-corp/gocryptotrader/pull/1395#discussion_r1395178513)
* fixup! Currency: Add API key to exchangerate.host
Remove unused ErrVar
Fixes [review
comment](https://github.com/thrasher-corp/gocryptotrader/pull/1395#discussion_r1396647418)
* fixup! Currency: Tests for no default forex
Fix spelling of override in test
Fixes [review comment](https://github.com/thrasher-corp/gocryptotrader/pull/1395#discussion_r1396701476)
* fixup! SyncManager: Report ?.?? for an unknown forex amount
Fix display of non-positive currency conversions.
Fixes [review comment](https://github.com/thrasher-corp/gocryptotrader/pull/1395/files#r1398527134)
* Kucoin: Fix ProcessMarketSnapshot and add a test
* Kucoin: ProcessMarketSnapshot: move the check before the ticker
* Kucoin: remove time.sleep from the test, add if statement to processmarketSnapshot
* Kucoin: ProcessMarketSnapshot to send margin, spot and both margin and spot pair data
* Kucoin: range over listOfAssetsCurrencyPairEnabledFor which returns a slice
* Kucoin: linter fix and pointers placed
* Kucoin: removed AssetWebsocketSupport and ku.CurrencyPairs.IsAssetEnabled, linter error fixed, comment amended
* kucoin: fix unmarshal bug
* kucoin: Add time in force handling
* kucoin: fix test
* thrasher: nits
* kucoin_test: shift skip check down for coverage, rm market testing, change buy price to reduce chance of instant match
* kucoin: fix nits and force usage of uuid to rm conflicts
---------
Co-authored-by: shazbert <ryan.oharareid@thrasher.io>
* cmd/exchange_template: Add wrapper function
* exchanges: force UpdateOrderExecutionLimits to wrappers as this is important for order deployment
* kucoin: Add spot order execution limits
* linter: fix
* glorious: nits
* kucoin: change from name to symbol for correct fee fetching and order deployment
* WHAAAAAAAT says Vitalik
* kucoin: Add futures limit support, fix insertion of non margin tradable pairs, update naming and add comments.
* kucoin: implement master branch changes
* Update exchanges/kucoin/kucoin_test.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* kucoin/test: update commentary
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Bitfinex: Replace errTypeAssert with common.GetTypeAssertError
* Bitfinex/common.GetTypeAssertError description to match the documentation
* Bitfinex/Correct typos, fix type in finalResp error
* Bitfinex: Comments amended from.Symbol to .Data
* Bitfinex: fix the typo
* Bitfinex: fix the comments
* adds funding rate implementations and improvements
* merge fixes x1
* lint
* kucoin funding rates func make
* migrate sync-manager to keys
* some kucoin work
* adds some kucoin wrapper funcs
* ehhh, todo
* kucoin position
* start of orders
* adds the kucoin tests yay
* multiplier
* nits, EWS includes order limits
* NotYetImplemented, IsPerp improvements, cleaning
* lint, test fix, huobi time
* fixes issues, improves testing
* fixes linters I WRECKED
* local lint but remote lint, lint, lint, lint
* fixes err
* skip CI
* lint
* Supported rates, binance endpoints
* fixes weird mocktest problems
* no, CZ is invalid
* fixes some new EWS test errors
* Websockets: Add keys to websocket subscriptions
* This switches all RO uses of the mutex to use a RLock method.
* The mutex used for discrete field access has had scope drift from
name 'connectionMutex' so rename to more appropriate fieldsMutex
* The mutex used for Set/CanUseAuthEndpoints moves from the
subscriptions endpoint to the fieldsMutex
* Add GetSubscription by key
* Expose stream.Matcher type
* Bitfinex: Subscribe and Unsubscribe atomicly
* Fix Auth failures ignored
* This change makes it so that Subscribe and Unsubscribe wait for success
** Tells the DataHandler about errors
** Errors are returned to consumers
* Subscribes concurrently to the channels
* It also simplifies the chanId to stream mapping
* Removes unable to locate chanID: %d errors which are just noise
* Paves the way for unified channelSubscription id handling
* Adds support for subId for Book subscriptions, which is more robust
* Vastly simplifies what we need to test TestWsSubscribedResponse
This test was working to ensure that the various fancy key parsing
mechanisms all worked. Now that we use subId, we just need a thorough
test of that
* Expose Match.Set in order to capture websocket incoming data
Can't see another way of doing this. Doesn't seem too bad
* Allow tests to run with auth or WS
These flags made it difficult to run the tests whilst working on
websockets
* Enable API auth and WS in testconfig
This change minimises the changes requires for a full test run against
live endpoints, so that new contributors have a clearer testing path.
I cannot see any reason to turn WS off and Auth endpoints off when we're
not going to run API tests without Creds being set, and we're not going
to do live fire tests without canManipulateRealOrders
* TestWsSubscribe and various fixes
** Enables the websocket for live non-authed integration tests by default
** Adds an integration test for subscriptions
** Changes the Ws tests to respect canManipulateRealOrders
** Uses WsConnect instead of setupWs; fixes seqNo config not sent for WS tests
** Allows api creds to live in config/testdata.json which might be
less likely to accidentally commit, and less obtrusive
* Bitfinex: Support period and timeframe for Candles
* Fixes manual Subscribe() symbol or key formatting
* Unifies handling of params for DefaultSubscriptions and manual
subsrciptions
* Bitfinex: Handle conf and info WS channel events
* Bitfinex: Better tests for subscriptions
* fixup! Websockets: Add keys to websocket subscriptions
* fixup! Bitfinex: Subscribe and Unsubscribe atomicly
* fixup! Websockets: Add keys to websocket subscriptions
* Websockets: Add Pending subscription status
Add a status tracker so that Sub/Unsub can prevent duplicates,
and also fixes when first message comes before we have added the sub
to the tracker
* Websockets: Add State instead of pending
This change allows more clarity about the current state and
checks for specifically already Unsubing
* Bitfinex: Fix first sub message maybe lost
The only link we have between a sub req and the sub resp is the subID.
And the only link we have between a sub message and the sub is the chanID.
We can't derive a link using Pair or anything else.
This meant that by sending the resp and its chanID down the IncomingData
channel, we allowed the channel reader to maybe process the next
message, the first message on the channel, before the runtime executed
the switch back to subscribeToChan waiting on the chan.
To fix this, we key initially on subId.(string), and then replace it
with chanId.(int64) when we have it *inside* the wsHandleData so we
know we've procedurally handled it before the next message.
subscribeToChan is then free to remove the subId keyed Sub regardless of
error or not
If there's an error, we don't need to inline handling because there
won't be any second update.
Expands test coverage to make sure those subId keyed subscriptions are
removed.
* Websocket: Validate state in SetChanState
* fixup! Bitfinex: Fix first sub message maybe lost
* Websockets: Rename RemoveUnsuccessfulSubs
Implementation doesn't imply Unsuccessful or need to.
This change supports the registering of Pending subs
* Bitfinex: Fix race in Tests
* sync manager: don't fall over to rest when websocket connection active
* glorious: nits and fix bug
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>