* Config: Allow missing Versions
This allows easier development of non-stacked version upgrades.
Though the PRs still need to be merged sequentially, or renumbered right
before merging
* Config: Move OrderManager upgrade to Version management
Looks like "Within 2 weeks" fails on 22nd November during leap years.
On 2025-02-21 we saw NW come up with 2025-03-07 for a few hours,
and I'm guessing it's because they use local time.
Added 1 day leeway to account for that timezone difference.
* 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
* Send trades down the DataHandler, add test
* Send the trades down to the DataHandler
Update the test to process trades for each asset type
Add raw trade data from OKX
Update the timestamp in the method
* Replace pair repetition with p var
* Update the test, remove repetition
* Rename trade var in the test
* Fix nits and slice sorting
* Compare trades
* Fix nits
* binance: use types.Time instead of time.Time
Signed-off-by: Ye Sijun <junnplus@gmail.com>
* binance: remove type_convert.go
Signed-off-by: Ye Sijun <junnplus@gmail.com>
---------
Signed-off-by: Ye Sijun <junnplus@gmail.com>
* add updatedAt for account balance
Signed-off-by: Ye Sijun <junnplus@gmail.com>
* add nil pointer test for load
Signed-off-by: Ye Sijun <junnplus@gmail.com>
* account: set default updatedAt to balance for Update
Signed-off-by: Ye Sijun <junnplus@gmail.com>
* engine: add UpdatedAt for account info
Signed-off-by: Ye Sijun <junnplus@gmail.com>
* account: force updatedAt for load balance
Signed-off-by: Ye Sijun <junnplus@gmail.com>
* minor change for test
Signed-off-by: Ye Sijun <junnplus@gmail.com>
---------
Signed-off-by: Ye Sijun <junnplus@gmail.com>
* Send trades down the DataHandler
* Send individual trades down the DataHandler
Update the test to send the multiple trades
Remove the ID setting to 0 in the test
Iterate through the trades to send them down individually
Rename the test to match the method
* Fix the timestamp conversion
* Fix the wording
* Update the expected data format
* Update the test name and description
* Fix error case
* 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
* Config: Tighten config version handling as uint16
This constrains the versions to uint16 and improves error handling.
LatestVersion becomes literally that.
Fixes handling for negative or overflowing versions in config
* Config: Rename LatestVersion to UseLatestVersion
If one asset is enabled but has no enabled pairs, we should ignore that
asset, even for non-pair related subscriptions.
That matches the existing code, but wasn't happening in the context of
asset.All subscriptions with just one asset in this state.
If a user wanted to have non-pair subscriptions, they should use
asset.Empty. Would expect other breakages with no pairs enabled, too.
Note: No enabled pairs for an enabled asset is a transient issue which
can occur due to enableOnePair racing against no available pairs. The
second run, available pairs would be populated and enableOnePair would
work. This situation could persist due to running with --dry or
containerised, though.
Fixes:
`
Okx websocket: subscription failure, myOrders all : subscription template did not generate the expected number of pair records for spread: Got 1;
Expected 0
`
Relates to #1420
* 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
* Add check for subscription store insertion and validation with tests
* bybit: fix subscriptions
* deribit: fix subscriptions
* linter: fix
* glorious/nits: add test for updateChannelSubscriptions RM GetChannelDifference method as its only used locally and Diff method can be accessed directly
* glorious/nits: add to store in the loop; add correct formatting to template for edge case perps with settlement
* spelling: fix
* glorious/nit: silly billy
* gk: nits
* gk/nits: split PartitionByPresence into Contained and Missing
* gk/nits: formatPerpetualPairWithSettlement -> formatChannelPair
* stream/websocket: stop full websocket disconnect on Connect when encountering subscription specific error paths
* stream/websocket: rm nil assignment
* glorious: nits
* gk: niterinos
* Update exchanges/stream/websocket_test.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update exchanges/stream/websocket_test.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update exchanges/stream/websocket_test.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* thrasher: nits
---------
Co-authored-by: shazbert <ryan.oharareid@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* CI: Replace docker amd64 with native runner, switch Docker test arch to amd64
* tests: Remove spaces and new lines from test JSON timestamp fields
* builds: Disable sonic for arm64 due to OKX unmarshal issue
* nits: Improve Dockerfile comment and fix build tag
* 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>
* Config: Rename DecryptConfigFile to DecryptConfigData
Because this isn't really a file, it's a byte slice
* Config: Rename EncryptConfigFile to EncryptConfigData
Because it's not actually a file
* Config: Fix config version downgrade
Fixes#1769
* Bitfinex: Fix WS trade processing
* Add handling for funding trades
Fixes#1746
* 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.
* Bitfinex: Move websocket constants to websocket file
* Bitfinex: Rename channel consts
* Bitfinex: Send individual WS trades down the DataHandler
* 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
* Codespell: Fix new violations in 2.4.0
* Codespell: Move currency ignoring to regex
* Codespell: Add vendor to ignored files
* Codespell: Remove github action params duplicated from .codespellrc
.codespellrc already exists in the project
* Codespell: Remove unused freez from ignore words