* 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
* codebase: Remove web frontend and related services
* refactor: Update StartPPROF to accept context and adjust related tests
* refactor: Simplify SetIfZero functions and update related tests
* config: Clarify DowngradeConfig method documentation regarding permanent removal of deprecated fields
* refactor: Rename setIfZeroAndWarn to setDefaultIfZeroWarn for clarity and update related calls
* refactor: Update error handling in DataHistoryManager and remove redundant error variable
* docs: Create new CODING_GUIDELINES doc
Rids excess contribution instructions from other packages
Adds AGENTS.md file for the AI overlords
Rids unused templates
Updates ADD_NEW_EXCHANGE.md with minor fixes
* docs: Fix linter issues and minor adjustments based on Copilot feedback
* docs: Update coding guidelines for API parameters and testing practices
* docs: Remove redundant GoDoc references
Adds copilot-instructions.md
* docs: Update CODING_GUIDELINES with export recommendations and test commentary
* docs: Fix formatting inconsistencies in ADD_NEW_EXCHANGE.md links
* docs: Update struct naming conventions for request and response types
* docs: Improve clarity and consistency in ADD_NEW_EXCHANGE.md and CODING_GUIDELINES.md
* refactor: Simplify error handling in QueryOrder method
* 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
* 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
* 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
* 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
* modernise: Run new gopls modernise tool against codebase
* Address shazbert's nits
* apichecker, gctcli: Simplify HTML scraping functions and improve depth limit handling
* refactor: Create minSyncInterval const and update order book limit handling for binance and binanceUS
* refactor: Various slice usage improvements and rename TODO
* tranches: Revert deleteByID changes due to performance decrease
Shazbert was a F1 driver in a past lifetime 🏎️
* tranches: Simply retrieve copy
Thanks to shazbert
* documentation: Sort contributors list by contributions
* tranches: Remove deadcode in deleteByID
* Config: Move assetEnabled upgrade to Version management
* Assets: Do not error on asset not enabled, or disabled
This became more messy with Disabling something that's defaulted to
disabled.
Taking an idealogical stance against erroring that what you want to have
done is already done.
* CurrencyManager: Set AssetEnabled when StorePairs(enabled)
* RPCServer: Fix tests expecting StoreAssetPairFormat to enable the asset
Also assertifies
* Bitfinex: Fix tests for MarginFunding subs
* GCTWrapper: Improve TestMain clarity
* BTSE: Add futures to testconfig
* Exchanges: Rename StoreAssetPairStore
Previously we were calling it "Format", but accepting everything from
the PairStore.
We were also defaulting to turning the Asset on.
Now callers need to get their AssetEnabled set as they want it, so
there's no magic
This change also moves responsibility for error wrapping outside to the
caller.
* Config: AssetEnabled upgrade should respect assetTypes
Previously we ignored the field and just turned on everything.
I think that was because we couldn't get at the old value.
In either case, we have the option to do better, and respect the
assetEnabled value
* Config: Improve exchange config version upgrade error messages
* build/ci: Update Go to v1.24, golangci-lint to v1.64.5 and fix issues
* Address shazbert's nitters
* linter/config: Fix new linter issue and use versionSize const
* Address gk's nitters and fix additional linter issue after rebase
* Address glorious nits
* staticcheck: Fix additional linter issues after upgrading to Go 1.24.1 and golangci-lint v1.64.6
Also addresses nits
* Improve testing, assertify usage and use common.ErrParsingWSField
* TestCreateNewStrategy: Replace must > should wording
* tag optional sonic and allow full library conversion
* Add workflow and disallow arm and darwin usage
* Add basic hotswap benchmark
* linter: fix
* use bash
* linter: fix?
* Fix whoopsie, add to make file, also add mention in features list.
* test enforcement
* actually read documentation see if this works
* linter: fix
* linter: fix
* sonic: bump tagged version
* encoding/json: drop build tag arch and os filters
* encoding/json: consolidate tests
* encoding/json: log build tag usage
* rm superfluous builds
* glorious/nits: add template change and regen docs
* glorious/nits: update commentary on nolint directive
* glorious/nits: rm init func and log results in main.go
* Test to actually pull flag in
* linter: fix
* thrasher: nits
* gk: nits 4 goflags goooooooooo!
* gk: nits rn
* make sonic default json implementation
* screen 386
* linter: fix
* Add commentary
* glorious: nits Makefile not working
* gk: nits
* gk: nits whoops
* whoopsirino
* mention 32bit systems won't be sonic
* gk: super-duper nit of extremes
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* GateIO: Fix GetFuturesContractDetails for Deliveries
Was returning the product of all the contracts, so 1444 instead of 38
contracts.
* GateIO: Fix GetOpenInterest returning asset.ErrNotEnabled
Using wrong error for pair not enabled
* GateIO: Rename GetSingleContract and GetSingleDeliveryContracts
Especially fixes GetSingleContract, which seems misleading to not say
Futures.
There's a load of `GetSingle*` here that should probably also be fixed,
but these two justified a dyno
* GateIO: Rename GateIOGetPersonalTradingHistory to GetMySpotTradingHistory
* GateIO: Rename GetMyPersonalTradingHistory to GetMyFuturesTradingHistory
* GateIO: Remove duplicate DeliveryTradingHistory
* GateIO: Rename Get*PersonalTradingHistory to GetMy*TradingHistory
* Linter: Disable shadow linting for err
It's been a year, and I'm still getting caught out by govet demanding I
don't shadow a var I was deliberately shadowing.
Made worse by an increase in clashes with stylecheck when they both want
opposite things on the same line.
* GateIO: Add missing Futures and tradinghistory fields
* GateIO: Improve WS Header parsing
This unifies handling for time_ms and time in response headers, since
options and delivery have only time, but spot has time_ms as well.
We use the better of the two results.
Also [improves performance 2x](https://gist.github.com/gbjk/7cacb63b9a256e745534bb05ca853c48)
* GateIO: Use time_ms WS fields where available
Removes the deprecated _time json fields and populates our Time fields
with the time_ms values
* add fixes and test
* glorious: nits, privatise upper case field, add item field for case sensitivity for format checks, rm dead code.
* fix potential panic
* gk/glorious: nits
* gk: nits and other things
* improve commentary lol
* glorious+gk: nits and improvements (with no sillyness this time)
* Update currency/pairs.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* thrasher: nitssssss
* linter: fix
* bye bye silly boy
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Convert: Fix TimeFromUnixTimestampDecimal using local
All parsed times should be in UTC
* Subscriptions: Add IgnoringAssetsKey
* Tests: Pass tb to curried WS handlers
* Websocket: Make ErrNoMessageListener a public error
* Kraken: Fix URLMap ignored for websocket URLs
* Kraken: Move SeedAssets from Setup to Bootstrap
Having SeedAssets in Setup is cruel and unusual because it calls the
API. Most other interactive data seeding happens in Bootstrap.
This made it so that fixing and creating unit tests for Kraken was
painfully slow, particularly on flaky internet.
* Kraken: Remove convert test
Duplicate of convert_test.go TestTimeFromUnixTimestampDecimal
* Kraken: Test config upgrades
* Kraken: Sub Channel improvements
* Use Websocket subscriptionChannels instead of local slice
* Remove ChannelID - Deprecated in docs
* Simplify ping handlers and hardcodes message
* Add Depth as configurable orderbook channel param
* Simplify auth/non-auth channel updates
* Add configurable Book depth
* Add configurable Candle timeframes
Kraken: Simplify all WS handlers with reqId
* Kraken: Subscription templating
* Generate N+ subs for pairs
If we generate one sub for all pairs, but then fan it out in the
responses, we end up with a mis-match between the sub store and
GenerateSubs, and when we do FlushChannels it will try to resub
everything again.
* Kraken: Rename channelName var throughout
Avoid shadowing func of same name
* Kraken: Add TestEnforceStandardChannelNames
* Websocket: Fix Resubscribe erroring Duplicate
* CI/build: Update Go version, linters and fix minor issues
* linters: Add intrange, copyloopvar, additional go vet linters to match gopls and fix issues
* Currency: Variadic Pairs.Add
This version of Pairs.Add is simpler and [more
performant](https://gist.github.com/gbjk/06a1fc1832d04ee41213ca518938cf74)
Behavioural difference: If there's nothing to add, the same slice is
returned unaltered. This seems like good sauce
* Currency: Variadic Remove
* Common: Add Batch function
* Common: Add common.SortStrings for stringers
* Subscriptions: Add batching to templates
* Subscriptions: Sort list of pairs
* Kucoin: Switch to sub templating
* Kucoin: Simplify channel prefix usage
* Kucoin: Fix race on fetchedFuturesOrderbook
* Subscriptions: Filter AssetPairs
Now only the assetPairs relevant to the subscription are in the context
* Subscriptions: Respect subscription Pairs
* Subscriptions: Trim AssetSeparator early
We want to trim before checking for "AssetSeparator vs All" because a
template should be allowed to reuse a range template and generate just one trailing AssetSeparator
whilst using a specific Asset
* Kucoin: Fix empty margin asset added
* Kucoin: Add Subscription batching
Turns out that contary to the documentation, kucoin supports batching of
all symbols and currencies
* Kucoin: Fix checkSubscriptions and coverage
* Subscriptions: Simplify error checking
This reduces the complexity of error checking to just be "do we get the
correct numbers".
Fixes Asset.All with only one asset erroring on xpandPairs, because we
trimmed the only asset separator, and then errored that we're not
xpanding Assets and the asset on the sub is asset.All
This use-case conflicted with commit 6bbd546d74, which required:
```
Subscriptions: Trim AssetSeparator early
We want to trim before checking for "AssetSeparator vs All" because a
template should be allowed to reuse a range template and generate just one trailing AssetSeparator
whilst using a specific Asset
```
Now we set up the assets earlier, and we remove the check for xpandAssets, since the number of asset lines matching is all that matters.
I've removed the asset tests for this, but they were correctly erroring
on the number of asset lines instead.
Everything hits coverage, as well.
* Kucoin: Remove deprecated fundingBook endpoint
* BTCMarkets: Use common.Batch
* Making Pairs(Add) Variatic
* Slight improvements
* Implementation overhaul
* Improvements
* Changing code which can use the variadic functionality
* Fixing silliness
* thing left over
* Websocket: Use ErrSubscribedAlready
instead of errChannelAlreadySubscribed
* Subscriptions: Replace Pair with Pairs
Given that some subscriptions have multiple pairs, support that as the
standard.
* Docs: Update subscriptions in add new exch
* RPC: Update Subscription Pairs
* Linter: Disable testifylint.Len
We deliberately use Equal over Len to avoid spamming the contents of large Slices
* Websocket: Add suffix to state consts
* Binance: Subscription Pairs support
* Bitfinex: Subscription Pairs support
* Bithumb: Subscription Pairs support
* Bitmex: Subscription Pairs support
* Bitstamp: Subscription Pairs support
* BTCMarkets: Subscription Pairs support
* BTSE: Subscription Pairs support
* Coinbase: Subscription Pairs support
* Coinut: Subscription Pairs support
* GateIO: Subscription Pairs support
* Gemini: Subscription Pairs support and improvement
* Hitbtc: Subscription Pairs support
* Huboi: Subscription Pairs support
* Kucoin: Subscription Pairs support
* Okcoin: Subscription Pairs support
* Poloniex: Subscription Pairs support
* Kraken: Add subscription Pairs support
Note: This is a naieve implementation because we want to rebase the
kraken websocket rewrite on top of this
* Bybit: Subscription Pairs support
* Okx: Subscription Pairs support
* Bitmex: Subsription configuration
* Fixes unauthenticated websocket left as CanUseAuth
* Fixes auth subs happening privately
* CoinbasePro: Subscription Configuration
* Consolidate ProductIDs when all subscriptions are for the same list
* Websocket: Log actual sent message when Verbose
* Subscriptions: Improve clarity of which key is which in Match
* Subscriptions: Lint fix for HugeParam
* Subscriptions: Add AddPairs and move keys from test
* Subscriptions: Simplify subscription keys and add key types
* Subscriptions: Add List.GroupPairs Rename sub.AddPairs
* Subscription: Fix ExactKey not matching 0 pairs
* Subscriptions: Remove unused IdentityKey and HasPairKey
* Subscriptions: Fix GetKey test
* Subscriptions: Test coverage improvements
* Websocket: Change State on Add/Remove
* Subscriptions: Improve error context
* Subscriptions: Fix Enable: false subs not ignored
* Bitfinex: Fix WsAuth test failing on DataHandler
DataHandler is eaten by dataMonitor now, so we need to use ToRoutine
* Deribit: Subscription Pairs support
* Websocket: Accept nil lists for checkSubscriptions
If the user passes in a nil (implicitly empty) list, we would not panic.
Therefore the burden of correctness about that data lies with them.
The list of subscriptions is empty, and that's okay, and possibly
convenient
* Websocket: Add context to NilPointer errors
* Subscriptions: Add context to nil errors
* Exchange: Fix error expectations in UnsubToWSChans
* initial consolidation of rate limiting code to request package to reduce bespoke code implementation
* continued
* finish abstraction
* lint
* exchanges: fix tests
* linter: fix
* poloniex: fix auth rate limit not being set
* ratelimiter: convert from token to weight
* glorious: nits addressed with fire
* linter: rip
* change func name set -> get
* fix test
* derbit: impl
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* deribit implementation
* add ws impll
* cleanup
* Update deribit_wrapper.go
* Add missing endpoints
* Fix config file
* asset type update
* Update code structure
* Update authenticated private endpoints unit tests
* Updating websocket
* Updating websocket connection and subscription handling
* Finishing up adding subscription push data
* Adding websocket public endpoint
* Adding WS endpoints
* Adding websocket unit tests
* Minor clean-up
* Integrating websocket endpoints into the wrapper funcs
* Updating exchange documentations
* Fixing test issues
* Code cleaning-up
* fix test issues
* Updating validations and logic errors
* Updating wrapper issues
* fix test issues
* Slight test update
* Unit test and code structure update
* Update websocket tempos
* Slight update on code structure
* Minor update on unit tests
* Update depending on review comments
* Minor code fix and doc re-generating
* Update on Candlestick wrapper functions
* Minor updates
* minor unit test updates
* Minor updates on weboscket and unit tests
* minor linter fix
* codespell and rate limiter issues
* single linter issue fix
* adding rate limiter
* Add ratelimiter to websocket conn and overall code update
* fix websocket push data issue
* Implementing missing wrapper function
* Websocket fix
* Minor update on missing endpoint and other
* fixing websocket issues and cleaningup
* Minor tempo fix
* Minor linter issues
* unit test update
* Indexing error fix
* Websocket connection fix
* string formatting fix
* Small fix on unit tests
* fix minor json conversion issue
* websocket and documentation update
* websocket, wrapper and unit test updates
* Documentation and unit tests update
* Fix unit tests
* wrapper fix for new change
* Unit test fix
* timestamp conversion and unit tests update
* Minor instrument ID conversion fix
* instrument formats and unit test update
* formatting and unit test fix
* config update
* Updating websocket and adding the Spot support
* Add small unit test fix
* unit test and websocket handlers update
* Linter issues fix
* minor documentation and code update
* Minor fix
* added a wrapper func GetLatestFundingRates
* Types, wrapper update, and unit tests
* Minor config update
* fix wrapper unit tests
* Resolve all panic and wrapper test issues
* minor unit test fix
* fix issues and adding newly added endpoints
* updates and added remaining endpoints with unit tests
* Update unit tests using assert
* Added missing endpoints and unit tests
* Minor updates and clean-ups
* Resolve tradable pair fetching panic
* Mutex fix
* Added Options assets test and minor fixes
* subscription mothod updated
* Remove misadded code lines
* resolve websocket
* Updating tests, types, endpoint methods and others
* Added GetFuturesContractDetails and minor fix
* fix linter issue
* revert change on candlestic time
* Added filters to candles
* minor unit test and wrapper fix
* Minor unit tests update
* cahnge param key for GetOrderMarginByID
* updating unit tests and resolve issues
* Update websocket unit tests
* Minor fix based on review
* Revert unit test change
* fix pair config issue
* Added missing wrapper functions
* Fix missing review changes
* Fix options request pair formatting
* fix AllExchangeWrappers test issue
* Changes with unit test and wrapper based on the review
* Fix to options reg-exp
* wrapper functions fix
* Update MaximumFundingRateHistory filter and minor fixes
* Fix besed on review comment
* Fix issues on review comment
* linter fix
* fix minor unit test issue
* Fix unit test issues
* Update trade order cancellation responses
* fix config files issue
* lint update config files
* Update unit tests
* Update return values and response handling
* added missing endpoint and fixes based on review comment
* toggle useTestNet back
* Update cancel by label and other fix
* fix forgotten cancel all response type
* update CancelResp type
* Fix unmarshaling error
* updated websocket orderbook load issue
* fix websocket lock and groups
* Change Items to Tranche and fix linter issues
* Fix orderbook issue
* Update unit tests offline error handling, and endpoints argument and error handling
* Contributors documentation update and change error return type
* Updated unit tests based on review comment
* Update unit tests and removed password change endpoint
* Fix race condition
* Update on tests, test pairs, and wrapper config
* Update test tradable pairs loading
* Update unit tests, fix linter issues, and update wrapper functions
* remove credentials
* Update test and fix authentication method and few authenticated endpoints
* fix codespell issue
* group the repeated currency code check to a func
* added unit test for repeated pair check func
* Added a base coin and related updates
---------
Co-authored-by: E Sequeira <earncef@earncef.com>
* currency/manager: remove deadlock potential in concurrent operations
* fix kucoin test, lets see what this does shalllllll weeeeee.
* another fix in the deep dark depths
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* Tests: Move and simplify TestFixtureToDataHandler
* Currency: Fix PairsManager.Load breaking matcher
* Tests: Add multi-instance cache to UpdatePairsOnce
* Kraken: Fix TestUpdateTickers race error
Calling StorePairs on global instance can lead to race
* Bitfinex: Fix TestUpdateTickers racing intermittently
* Currency: Fix concurrent access to PM formats
* Currency: Fix SupportsAsset implementation
This should delegate entirely to PairManager's IsAssetSupported
* Okx: Fix PM intrusion, rm GetPairFromInstrumentID
* Exchange: Fix SetGlobalPairsManager to set asset enabled
* Bitflyer: Fix race on set TestGetCurrURL
TestGetCurrencyTradeURL would fail sometimes due to sequencing of
enabling futures but not having pairs for it.
* Tests: Simplify usage pattern for FixtureToDH
* Currency: Remove Pair Index formatting/parsing
This feature was originally for exchanges with only one pair (e.g. KRW) which made parsing easier.
However there's no examples of this left, and we can reduce complexity
overall by removing it.
* Exchange: Partial assertify tests and fixes
* Currency: Fix panic on a delimiterless small currency
* gateio: fix unmarshal bug and update fields
* gateio: fix wrapper function function, add helper methods
* update order types and add kucoin wrapper fix
* currency pairs
* Add tests
* gateio; inspect error and continue for no funds in account, kucoin: fetch all settlement amounts
* futures: order fixit
* finish off gateio updates for market orders
* cute line
* Update exchanges/kucoin/kucoin_wrapper.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update exchanges/kucoin/kucoin_wrapper.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update exchanges/gateio/gateio.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update exchanges/gateio/gateio_wrapper.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update exchanges/gateio/gateio_wrapper.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits
* glorious: nits - filter by pair match and fix bug where the endpoint returns details instead of message
* Add fix for leverage check (non-merge) my ip has been blocked from gateio still... scammmmmmmm
* glorious: nitters
* Update exchanges/gateio/gateio_test.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update exchanges/gateio/gateio_test.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update exchanges/gateio/gateio_test.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* CI/build: Update Go version, linters and fix minor issues
* Bump golangci-lint to v1.56.1
* BinanceUS: Make uint usage consistent
* Throw blank identifiers into the trash
* Websockets: Move Subscription to its own package
This allows the small type to be imported from both `config` and from
`stream` without an import cycle, so we don't have to repeat ourselves
* Subs: Renamed Currency to Pair
This was being mis-used through much of the code, and since we're
already touching everything, we might as well fix it
* Websockets: Add Subscription configuration
* Binance: Add subscription configuration
* Kucoin: Subscription configuration
* Simplify GenerateDefaultSubs
* Improve TestGenSubs coverage
* Test Candle Sub generation
* Support Candle intervals
* Full responsibility for formatting Channel name on GenerateDefaultSubs
OR consumer of Subscribe
* Simplify generatePayloads as a result
* Fix test coverage of asset types in processMarketSnapshot
* Exchanges: Abstract ParallelChanOp
* Tests: Generic ws mock instances
* Kucoin: Fix intermittent conflict in test currs
Use isolated test instance for `TestGetOpenInterest`.
`TestGetOpenInterest` would occassionally change pairs before
GenerateDefault Subs.
* adds open interest to exchanges
* ADDS TESTING YEAH
* New endpoints, BTSE, RPCS, cached
* slight design change, begin gateio
You will need to get cached for
each exchange that supports it
* gateio, huobi, rpc
* fix up kraken, cache retrieval
* okx, gateio
* finalising all implementations and tests
* definitely my final ever commit on this
* Well, well, well
* final v2
* quick fix of bug
* test coverage, assert notempty, test helper
Added a new testhelper for currency
management because its very annoying
in a parallel test setting which wastes
so much space otherwise
* minimises REST requests for Open Interest
* types.Number merge misses
* Minimises Kraken REST calls
* len change, value -> pointer receiver
* further fixup
* fixes gateio, batch calculates open interest
* single gateio, lint const fixes
* rejig and more thorough oi for huobi
* formatting expansion
* minor fix for handling expiring contracts
* rm unused Binance strings
* add bybit support, fix bybit issues
* oopsie doopsie, dont look at my whoopsie
* Fix issue, remove feature
* move an irrelevant function for the pr
* mini bybit upgrades
* fixes cli request bug
* Adding Bybit public endpoints
* Completed adding market endpoints
* Added trade endpoints
* Adding position endpoints
* completing position endpoints
* Adding Pre-upgrade endpoints
* Completed adding Pre-upgrade and Account endpoints
* Added asset endpoints
* Added user endpoints and unit tests
* Adding spot leverage and margin trade endpoints
* spot margin trade added
* added spot-margin-trade, institutional lending, c2c lending, and broker
* Adding wrapper funnctions
* Working on wrapper public methods
* Added wrapper functions and unit tests
* Added websocket support with unit tests
* Update websocket handlers and added rate-limiter
* wrapper function, websocket handlers, and linter issues fixe
* unit tests fixes and codespell correction
* Update documentation
* Minor websocket handling fix and URL consts merging
* types, unit test other updates
* Updated websocket and methods based on review
* Added GetFeeByType method with unit test and fixes
* add filter for Unified and Normal endpoints
* Mock recording and unit tests update
* minor linter issue fix
* websocket and rest tests and fix
* change asset types and wrapper methods update
* rm: forgotten panic message
* endpoints, websocket and unit tests update
* Added and updated endpoints and unit test
* linter and spell fix
* unit test and orders update
* Update on endpoints, fields, config pairs and formating, and unit tests
* minor update on responses
* Fix unit test and types
* Unit tests, models, and wrapper issues fix and mock test recording
* rm print statement
* Fix issue, add FundingRate wrapper func, mock record
* minor type and unit test update
* Update on order handling and unit test
* Minor test
* Minor fix in wrapper
* unit tests update, recording, and documentation update
* Unit tests and minor wrapper function update
* minor unit test fix
* Added newly added endpoints, unit tests, and mock recording
* Rename GetInstruments -> GetInstrumentInfo
* doc update
* Minor unit tests update
* Minor unit test and wrapper update
* Fix linter issue
* Add unit test and minor updates
* Revert websocket error declaration
* Revert websocket error declaration
* Balace --> Balance
* Fix config issues
* Added next funding time minor fix
* Update GetLatestFundingRates and record mock test data
* Added LatestFundingRate time
* Fix test issue of TestAllExchangeWrappers
* config pairs update
* configtest spot pairs update
* Minor update on options UpdateOrderExecutionLimits wrapper func
* Linter issue fix and added new currency codes
* Added new currency codes
* Update bybit pairs in config_example
* config assets pair format update
* 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
* 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)
* 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
* Bitstamp: Add auth channel subscription handling
* Bitstamp: Avoid searching for asset type
We've hardcoded asset.Spot in order to find the pair.
Looking the asset up from the pair makes no sense.
* Bitstamp: Add type for wsOrders
* Bitstamp: Working test of Generic DataHandler
* Bitstamp: WS Order chan tests and remove type
orderType could be derived from status == New and Buy & price == 9+e9 or Sell & price == 0
But it would only be true for the first update and it really doesn't feel worth the risk
Consumers are going to have to merge to original request anyway
* Bitstamp: Linter fixes
* Kraken: Switch to shared fixture test
* Bitstamp: Fix lint on TestFixtureToDataHandler
* Engine: Add Clone for PairsManager
go-vet highlighted that the mutex here is a value when we copied the
PairsManager in a test.
Options to fix:
* Add a deep clone method to PairsManager
* Add a shallow clone method with a disclaimer
* Make the mutex a pointer
* Make the PairsManager itself a pointer
Options 3 and 4 are too invasive to justify changing at this point.
There's an inherent risk of PM being passed by value, but govet should
catch the copylock.
There's more risk in changing everything to use a pointer at this stage.
* Engine: Fix linter again, ironically
* Bitstamp: Rename OHLC const
* Bitstamp: Minor fixes to syntax
* Bitstamp: Simplify chanSymb=>pair
* Bitstamp: Still process order updates without ID
If there's a ClientOrderID we'll still process the order.
It doesn't seem likely we'd have this happen, but if it does we still
want consumers to get something.
* Bitstamp: Replace Clone with Lock methods
* Engine: Expose PairsManager's Mutex
Makes more sense than wrapping functions
* Bitstamp: Fix linter copylock (again)
* fixup! Engine: Expose PairsManager's Mutex
Omit Mutex from Json
* fixup! Bitstamp: Add auth channel subscription handling
Remove unused wsAuthToken
* Bitstamp: Simplify OrderData Unmarshal
* Bitstamp: Remove unused contexts
I added these following best practices, but the reality is that when/if
we get context awareness in GCT, there will be a lot more to fix and
this will be a drop in the ocean anyway.
* Bitstamp: Only call handleWSOrder for MyOrders
* Bitstamp: Avoid allocating again in handleWSOrder
* CurrencyPairs: Remove public mutex
Simplified to a Load method to avoid making mutex public
* Tests: Improve test readability and clarity
* Bitstamp: Wrap errWSPairParsingError
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Bitstamp: FetchWSAuth mock and live test
---------
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* all in a days work
* cleanup
* cleanup for real, also stop it binance.json
* minor coverage
* adds gateio to the slurry
* cleanup of types
* verbose verbose verbose verbose verbose verbose
* fixes huobi parsing issue
* fix bybit contract identification
* cleanup
* merge fixes
* addresses many big problems raised by SHAZ
* tracking errors and fixes
* funding rate if avail, fixes currency formatting
* Addresses nits and sneaks in extra fixes
* lint
* minor fixes after rebase
* better contract splitter for currencies like T-USDT
* forgot to add the exchange name like a fool
* merge fixes x1
* kucoin, direction, contract size
* rn direction, fix kucoin time
* WHOOPS
* Update exchanges/kucoin/kucoin_wrapper.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* misdirection
---------
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>