* okx: fix type for AccountConfigurationResponse
Signed-off-by: Ye Sijun <junnplus@gmail.com>
* OKX: Further AccountConfigurationResponse type adjustments
---------
Signed-off-by: Ye Sijun <junnplus@gmail.com>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* 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
* Fix ws trades stream
Update the raw trade data to match the API docs
Fix extracting the pair from the topic
Update the test
Amend the configtest to enable the trade feed
* Rename the test, exctract pair from symbol
* Add check if neither trade feed or save trade data is enabled
* Update the channel name to match the API docs
* Change side parsing
* Change tradeHistory Side type
* Fix linter and nit
* Fix linter
* Fix the channel trades channel name
* Sonic: Add sonic_on build tag
Thinking about other ways to do this, but they amount to the same thing.
It's messy, but I don't have another idea.
* Okx: Remove redundant useAsIs on slices
Slices are automatically used-as-is, so passing true for these types was
unnecessary.
Removing the field simplifies rationalising inverting the flag
* Okx: Unify timestamp response types
* Okx: Change ResetRFQMMPStatus to return a types.Time
* Okx: Move withdrawData type to types
* Okx: Fix AccountConfiguration slice return
* Okx: Improve SendHTTPRequest documentation
* Okx: Extend tests for UseAsIs non-defaults
* Okx: Fix GetPublicUnderlying with sonic 1.12.9
Using **result for slices with useAsItIs causes sonic to fail.
This might be addressed upstream, but it's also not clear what the
unmarshal behaviour for an untyped reference to a typed reference should
be in the RFC, so we could get a golang.org/encoding/json regression on
this too.
There's no harm in fixing this, for consistency, to match our handling
for non-slice []any wrapping to just use the pointer as is.
Note: As of today this requires sonic:main for this to work, because of
the other bug:
```
M go.mod
- github.com/bytedance/sonic v1.12.9
+ github.com/bytedance/sonic v1.12.10-0.20250224121557-e30ac4f2e4fe
```
* Okx: Remove redundant slice check
This code didn't work, and if I make it look at rv.Elem().Kind() it
errors.
Haven't dug too deeply but right now I think we just remove it.
* Okx: Simplify SendHTTPRequest by removing UseAsIs
Looks to be entirely derivable
* Okx: Remove http check that resps must contain data
GetAnnouncementTyeps failing in US because of empty response.
But also any situation where there really is no data.
e.g. GetCandlesticks might return no candlesticks for a period and instrument, because there aren't any.
That shouldn't be an error.
More saliently if you request orders, or something similar.
So, since that check wasn't working before, and it's causing issues now, I'm going to remove it.
* Okx: Fix TestGetAnnouncementTypes failing in US
announcement-types returns empty in the US, where our github actions
run.
That's kinda okay. Just don't test we get any back
* Sonic: Default to sonic off
We've seen too many fatal panics and races with sonic, both in GCT runs
and being reported in sonic, to default to it being turned on right now.
Whilst we have faith sonic will get through these with time, for now the
sensible thing to do for our users is make sonic opt-in.
This also removes any of the conditions around 386, etc.
If someone wants to run with sonic, they can. Most notably if they're
trying out an experimental sonic branch that supports 386, etc.
* 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