* 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
* 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
* bybit: enable multiconnection handling across websocket endpoints
* rm debug lines
* rm json parser and handle in json package instead
* in favour of json package unmarshalling
* fix processing issues with tickers
* 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
* merge: fixup
* linter: fix
* spelling: fix
* glorious: nits
* comparable check for signature
* mv err var
* glorious: nits and stuff
* attempt to fix race
* linter: fix
* fix tests
* types/time: strict usage of time type for usage with unix timestamps
* fix tests etc
* 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
* bybit: split public and private processing to dedicated handler add supporting function and tests
* use correct handler for private inbound connection
* 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
* linter: fix
* glorious: nits
* linter/misc: fix and remove meows
* okx: update requestID gen func without func wrapping
* RM: functions not needed
* Update docs/ADD_NEW_EXCHANGE.md
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* gk: nitsssssss
* linter: fix
* Update exchanges/bybit/bybit_test.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* Update exchanges/bybit/bybit_test.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* gk: nit words
* cranktakular: nits
* linter: fix
* cranktakular: nits and expand coverage
* linter: fix?
* misc fix
* cranktakular: missing nit which I thumbed up but did not do. Sillllllly billlyyyy nilllyyy
* cranktakular: nits
* cranktakular: purge DCP ref/handling and add another TODO
* Update exchanges/bybit/bybit_websocket.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits
* fix test
* fix alignment issue and rm println
* Update exchanges/bybit/bybit_websocket.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update exchanges/bybit/bybit_websocket.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: fix
* Update exchanges/bybit/bybit_websocket.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update common/common.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* Update common/common_test.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* Update exchanges/bybit/bybit_test.go
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
* gk: nits
* gk: nit with test
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* 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
* 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
* 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
* 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
* 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
* 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>
* 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
* 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
* 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
* 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
* Send trades down the DataHandler
When the tradeFeed is enabled, send the trades down the DataHandler
Add TestWSProcessTrades
* Update assertions
* Add check against null references in slices
* Add an error for ws parsing field to common
* Update kraken websocket ProcessTrades
Send individual trades down the DataHandler
Send multiple trades in test
Test error if the trade length is too short
Nits
* Fix nits
* update acccount ratelimits and added missing endpoints
* completed mapping missing trade accoung REST endpoints and Rate Limit
* added orderbook trading missing REST endpoints
* Added few missing endpoints and unit tests
* Completed grid trading and signal bot trading with unit tests
* Added Recurring Buy endpoints and corresponding unit tests
* Added copy trading endpoints and unit tests
* added newly added block trading and spread endpoints
* completed mapping spread endpoints
* Added new endpoints and unit tests
* Added round 1: Okx types and converts update.
* Update endpoints handling and types update
* Removed constants, updated unit tests, and updated endpoint methods
* Slight endpoint and unit test update
* Added spread and other websocket endpoints and update
* completed Spread WS Orderbook handler
* Added missing spread channels and handlers
* Adding Bussinss websocket and missing subscriptions, update unit tests, and endpoints
* Added spread endpoints to wrapper and unit tests update
* Added missing websocket subscriptions and copy trading endpoints
* Added missing endpoints and re-organize business websocket handlers
* Docs update
* Endpoints code updates
* types, unit test and endpoints update
* Minor unit tests update
* spelling fix
* fix unit test issues
* Updating unit tests error handling
* Updating unit tests error handling
* Unit tests assertion handling update
* Unit tests update
* Resolve linter issues
* linter issues fix
* Orderbook unit test error fix
* Minor fixes
* Change on test handling and types
* Updating unit tests and cleanups
* Fix unit test issues
* Add ratelimit test and update unit tests and methods
* Update method parameters and error declarations
* Added lending endpoints, unit tests, and update endpoint methods and error declarations
* Update ratelimiters, add missing lending and trading endpoints and unit tests
* Update websocket authentication and subscription handling
* Minor update to unit test and types
* Types, error handling, and other minor updates
* Update unit tests and endpoint functions
* error declarations update and unit tests
* Overall update on unit endpoint, unit tests, and types
* Adding review fixes
* Update on endpoints, order types, and unit tests
* Update unit tests and endpoint functions
* Update on endpoint and update missing parameters
* Implemented and tested newly added trading endpoints
* endpoints update and unit tests
* Update missing endpoints and update overall code
* added and testing funding and fiat related endpoints
* Update on convert and fiat related endpoints
* linter fix, types, endpoints, and unit tests update
* linter issues fix
* revert changes on tempos
* Fix Panic and update websocket auth calls handling
* config linter issue fix
* Fix panic issues and update unit tests
* Fix race condition, TestAllExchangeWrappers unit test issues
* Fix withdrawal manager test issue
* Rename ClosePositionForContractrID --> ClosePositionForContractID
* Rename ClosePositionForContractrID --> ClosePositionForContractID
* Fix error
* endpoints update and fix unit test issues
* added unit tests, updated comments, and code sections
* revert change in defaultSubscriptions
* few types comments update
* Minor changes
* remove lending endpoints
* rm mistakenly added code
* fix unit test
* minor unit test fix
* Adding offline error tests, update endpoints function, config update
* Update unit test coverage for offline error handliing
* Updating wrapper algo order coverage, endpoint calls, and unit tests
* Updating wrapper trade functions to accomodate algo orders
* update wrapper unit tests
* Fix wrapper order functions offline errors handling
* Tested and updated wrapper order functions
* Address review comments
* update order unit tests, and okx endpoint functions
* finalize affected order, endpoint, and margin endpoints
* Slight change on margin unit test
* fix margin unit test issues
* Minor change on unit test
* updates on contract settlement and future contract wrapper function
* add test coverage for contract functions and minor fix on wrapper
* Overall update and unit testing
* codespell, unit tests, type declaration and naming, and code-structure updates
* margin types value and validation function fix
* Update tests and helper funcs
* Improve test coverage
* helper functions and unit tests update
* Fix margin unit test
* Minor review updates
* minor fix on if statement
* Update helper functions
* error handling and functions naming update
* update comment
* minor error return fixes
* minor unit test fix
* Minor fix on spread websocket orders handling
* codespell fix
* skip orderbook depth with incomplete price
* skip orderbook depth with incomplete price
* Config: Version Management
* Engine: Improve visibility of TestConfigAllJsonResponse failures
* Config: Update cmd/config to allow upgrades
* Config: Add Version2 to rename GDAX
* Config: Restructure versioning to share types
This restructure allows us to share types between versions, avoids
needing to import the versions, and puts the test fixtures in same
package.
It's a win on all fronts
* Config: Fix SetNTPCheck using log
Called from engine before logger is inited, and also just wrong to use
log to communicate with user
* Config: Improve TestMigrateConfig
* Config: Drop requirement for versions to be registered in sequence
Checking the versions at Deploy is much saner.
* Config: Fix file encrypted but flag not set
* Config: Add -edit and encryption upgrade to cmd/config
This simplifies the handling for encryption prompts by moving it to a
field on config, allowing us to simplify all the places were were
passing around config
Also moves password entry to being secure (echo-off)
* Tests: Fix inconsistent should/must assertions
* 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
* consolidate type to types package and share across code base
* rm convert type and convert codebase
* rm irrelavant test cases
* Fix tests
* glorious nits
* Update exchanges/gateio/gateio_types.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>
* types and orderbook handling fix
* Minor types and endpoints update
* Minor fixes on Kucoin
* Add benchmarking test
* Unit tests update and minor endpoints update
* Adding updates and newly added endpoints
* Add and correct funding, withdrawal, and deposit endpoints
* linter and codespell fix
* Adding and correcting spot trading endpoints
* Completed Spot HF endpoints
* Minor fix
* Added OCO and Margin HF trade and other endpoints
* Adding missing endpoints
* Updating Isolated margin, margin v3, and v3market lending endpoints
* minor codespell fix
* Completed adding and fixing futures endpoints
* wrapper update and fix unit tests
* Updating endpoint ratelimits
* Complete ratelimiter setup and endpoint functions update
* Unit test configuration and update
* fix linter issue
* Added a ratelimiter test and heavy update on unit tests
* Adding websocket update based on ChangeLog
* Added newly added Earn General, Kucoin Earn and Staking endpoints
* Added VIP lending endpoints
* Minor linter and endpoints fix
* Added unit tests, publicised functions, and minor updates
* Update on wrapper funcs, unit tests, and other methods
* Enexport exchange specific websocket methods
* remove deprecated topic
* Update wrapper based on Type, add and fix unit tests
* Added a margin configuration endpoint and unit test
* Update methods, types, and unit tests
* Update error declaration and handling unit tests
* Update method parameters and error handling
* Updating unit tests and error handling
* Update methods arguments, added and update unit tests
* Fix unit tests and wrapper methods
* Resolving unit test issues and fix faulty endpoints
* Fix on unit tests and working on passphrase errors
* Minor fixed on websocket and endpoint url
* comment and wrapper filters issue fix
* Unit tests and other minor updates
* Update wrapper functions, endpoint methods, and unit tests
* change require to change on two unit tests
* Update unit tests, types, and endpoints
* Refine and update wrapper tempo for minor adjustments
* Remove code that enabled logging
* Update wrapper functions, missing endpoints, response and parameter values, and unit tests
* removed High-frequency orders from wrapper functions, and updated unit tests and types
* Added missing fields and minor update on wrapper
* Update types
* Update tests and websocket channels
* Update unit tests and methods error returns
* CI/build: Update Go version, linters and fix minor issues
* linters: Add intrange, copyloopvar, additional go vet linters to match gopls and fix issues
* Kraken: Fix TestGetOpenInterest
We see daily failures on OpenInterest for Kraken.
This fix assumes that the issue might be related to volume of ETHUSD
open interest, and switches the single pair test to XBTUSD instead
Also isolates the test from others, since we're changing stored pairs
and we might be colliding on the global k
* Kraken: Handle Errors field in futures response
* 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
* Common: DriveBy sanitisation of vars
* BTSE: Unify to exchange OrderLimits
* BTSE: Remove SeedAssets and test GetOrderExcutionLimit
* BTSE: Fix handling for K_* pairs
In addition to the M_ pairs we previously handled, BTSE has now
introduced K_* pairs (K_SATS-USD*).
This change moves the handling over to look for an exponent, and moves
the filtering to happen on all market data.
The original MarketSummary is still availiable, but I can't see any of
our current use-cases wanting to get the unfiltered list
* BTSE: Fix marketSummary futures field
BTSE returns no futures field for futures api marketInfo, and the documentation for the futures api shows returning false.
When we know we asked for futures, it makes the data flow much saner if
we can trust this field and not have to track what asset we asked for
* BTSE: Abstract marketPair.Pair()
* BTSE: Fix UpdateTicker symbol format
* Kraken: Fix wsCancelOrders not erroring order id
We were using the "cancel many" facility of the Kraken api.
However since that doesn't actually report errors individually, it seems
saner to just multiplex over it.
We were going to get N+ responses anyway. Might as well send N+ requests
* Common: Add ErrorCollector and methods
* improv. timed mutex
* Add all protection back in and jankyness because races. :'(
* Add intial benchmarkeroos
* Add master benchmarks
* goodness me
* what?
* what again?
* glorious: nits
* just a swaperino instead
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Retain the .msg field of a go fmt.Errorf .msg field returned by .Error()
when wrapping multiple errors.
This fixes a situation where a nested stack of errors would lose
formatting information, which is often used to supply identifying
context.
e.g.
```
err = fmt.Errorf("%w `%s`: %w", errParsingField, fieldName,
parsingError)
errs = common.AppendError(errs, err)
```
This isn't really an issue with our implementation; Calling Unwrap() on a
fmt.Errorf() which returns a wrapErrors will lose that formatting.
Our issue was that we were using just Unwrap() to bind together our
chain-of-custody.
* 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
* Binance: Fix subscription failures ignored
* Testing: Fix race on shared config singleton
* Config: Privatise Global config var
We should *either* use a private var *or* use an accessor, but it
doesn't make sense to mix paradigms.
Since GetConfig() is well established this instead removes the limited uses of direct public access and adds a Setter
* Zip: Fix test failure on http mocks
* 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
* 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
* 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
* 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
* moves everything to use single map keys, also breaks
* full rollout
* tests
* fix a little bug
* minor test fixups
* Fix Key use
* rm 🔑 from 🔑 struct name
* init
* updates config
* wrapper configuration
* updates exchange readme
* adds SendAuthHTTPRequest and SendHTTPRequest
* adds ratelimit file
* adds test case and minor fixes
* improve error handling
* update testcases and improve GetSymbols API
* adds SPOT API's
* minor fix
* WIP
* WIP
* adds test case
* adds check in test case
* fixes in Auth. HTTP
* improvements
* adds trade, kline support and testcases
* adds SPOT API and testcases for same
* adds SPOT API and testcases
* adds SPOT API and testcase
* WIP
* adds API's
* adds API's
* adds test cases
* adds comment to exported data types
* adds API and test cases
* adds API
* adds API
* rearrange functions
* WIP: adds API
* adds API for Post Order SPOT
* adds API and few fixes
* fixes
* WIP
* WIP
* add PostBulkOrder API and its test case
* fix issues
* adds cancel order APIs and test cases for same
* add minor test fixes
* add API
* adds API
* fixes
* add API
* adds API and test cases
* fix test
* adds API
* adds test
* fix test
* adds API and test
* adds deposit API and test cases
* WIP
* adds API and test cases
* WIP
* WIP
* add public future API and test cases
* WIP
* remove v2 API and replace them with v1
* update test cases
* adds future order API and test cases
* adds futures order API
* adds API
* add API and test cases
* adds API and test cases
* adds API and test cases
* adds API and test cases
* Adding wrapper functions
* Fix on wrapper function
* Adding websocket support
* Complete addressing WS push datas
* Adding spot push data unit tests
* adding futures websocket push data handlers
* Adding futures websocket push data handlers
* Added unit tests
* Updating unit tests
* Updating wrapper and unit test functions
* Adding missing wrapper functions and code cleaning up
* Resolved linter issues
* Fixing websocket issues
* Fixing websocket issues
* Slight fix on config_example file
* Minor update
* Basic nits updates
* Fix minor linter issues
* Minor update
* Minor unit test update
* Minor unit test update
* Code update and linter issues fix
* Removed unnecessary type conversion codes
* Monor update based on review comment
* Fix based on review comments
* Adding rate-limiter
* Websocket update and overall minor fixes
* Removed IsAssetTypeEnabled method implementation
* Fix connection and formatting issues
* Updating orderbook issues
* Very minor label fix
* Minor error returning fix
* code cleaning up and minor spelling fix
* Updates on unit test
* Update on unit tests and slight code structure
* unit test update
* orderbook update and minor fix
* fix on race
* Mini linter fix
* fix minor parameter and unit test issues
* handler funcs and models update
* Fixing websocket and unit test issues
* order side string for active orders
* Fix on websocket and unit tests
* Minor type changes
* Minor Orderbook fix and unit test update
* Small fix on orderbook
* Updating orderbook functionality
* FIx on websocket orderbook handlers
* Small update on kucoin websocket
* fix missed review comments
* fix based on review comments
* Updating websocket orderbook and fixing unit tests
* Minor fixes
* unit test update
* Updating unit test according to enabled asset type
* toggle canManipulateRealOrders const
* Unit test update
* Fix minor issues
* minor fix
* documentation fix
* wrapper coverage and unused params fix
* testing and minor changes
* documentation, websocket and unit test update
* minor linter fix
* Websocket spot/margin subscription update
* minor ticker update fix
* minor fixes on endpoints
* timestamp and number convert method and unit tests
* timestamp convert minor update
* minor type and conversion fix
* create a common timestamp convert and fix minor issues
* linter and ticker fix
* Updating unit tests and order placing endpoint methods
* Added a pairs check
* Fix config test error
* rm unused error variable
* Fix source of linter issue
* code update: convert, wrapper and websocket fix
* minor code update
* Websocket code and unit tests update
* Websocket ticker ask/bid type change and small error msg fix
* docs update
* fix: websocket orderbook handling
* change orderbook channel to marketOrderbookLevel2Channels and fix websocket orderbook update
* Minor func rename and reciever change
* Minor orderbook unit test issue fix
* comment: about why we used a random delimiter '-' for futures
* update config files and FetchTradablePair func for futures pairs
* futures config pairs update
* remove ConnextionMonitorDelay from websocket setup
* fix on types and futures pair conversion
* updating config pairs
* change NewPairFromString to DeriveFrom
* unit tests update
* unit tests update
* Added TickerBatching
* added GetStandardConfig to GetDefaultConfig
---------
Co-authored-by: Jaydeep Rajpurohit <jaydeeppurohit1996@gmail.com>
* init
* surprise train commit
* basic distinctions
* the terms of binance are confusing
* renames and introduction of allocatedMargin
* add new margin funcs
* pulling out wires
* implement proper getposition stuff
* bad coding day
* investigate order manager next
* a broken mess, but a progressing one
* finally completes some usdtmargined stuff
* coinMfutures eludes me
* expand to okx
* imports fix
* completes okx wrapper implementations
* cleans and polishes before rpc implementations
* rpc setup, order manager features, exch features
* more rpc, collateral and margin things
* mini test
* looking at rpc response, expansion of features
* reorganising before the storm
* changing how futures requests work
* cleanup and tests of cli usage
* remove silly client side logic
* cleanup
* collateral package, typo fix, margin err, rpc derive
* uses convert.StringToFloat ONLY ON STRUCTS FROM THIS PR
* fix binance order history bug
* niteroos
* adds new funcs to exchange standards testing
* more post merge fixes
* fix binance
* replace simepletimeformat
* fix for merge
* merge fixes
* micro fixes
* order side now required for leverage
* fix up the rest
* global -> portfolio collateral
* Update exchanges/collateral/collateral_test.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* adds fields and todos
* rm field redundancy
* lint fix oopsie daisy
* fixes panic, expands error and cli explanations (sorry shaz)
* ensures casing is appropriate for underlying
* Adds a shiny TODO
---------
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>