2418 Commits

Author SHA1 Message Date
Samuael A.
5c892307c7 exchanges: Okx Update (#1420)
* 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
2025-02-10 10:44:48 +11:00
Gareth Kirwan
e6d456162a Codespell: Fix failures with v2.4.0 (#1790)
* 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
2025-01-31 13:46:43 +11:00
dependabot[bot]
070f17cab8 build(deps): Bump github.com/grpc-ecosystem/grpc-gateway/v2 (#1788)
Bumps [github.com/grpc-ecosystem/grpc-gateway/v2](https://github.com/grpc-ecosystem/grpc-gateway) from 2.25.1 to 2.26.0.
- [Release notes](https://github.com/grpc-ecosystem/grpc-gateway/releases)
- [Changelog](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/.goreleaser.yml)
- [Commits](https://github.com/grpc-ecosystem/grpc-gateway/compare/v2.25.1...v2.26.0)

---
updated-dependencies:
- dependency-name: github.com/grpc-ecosystem/grpc-gateway/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-28 15:04:15 +11:00
dependabot[bot]
42f8ff2c0b build(deps): Bump google.golang.org/protobuf from 1.36.3 to 1.36.4 (#1787)
Bumps google.golang.org/protobuf from 1.36.3 to 1.36.4.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-28 14:55:52 +11:00
dependabot[bot]
6a7efb8329 build(deps): Bump google.golang.org/grpc from 1.69.4 to 1.70.0 (#1789)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.69.4 to 1.70.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.69.4...v1.70.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-28 14:44:20 +11:00
Bea
63f49860ed Binance: Add order side to trade data (#1782)
* Add the initiating side to Binance trades

* Update TradeStream type, move trades declaraction

* Make side declaration in Binance trades consistent
2025-01-24 10:39:41 +11:00
dependabot[bot]
f0c785de89 build(deps): Bump bufbuild/buf-setup-action from 1.49.0 to 1.50.0 (#1781)
Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.49.0 to 1.50.0.
- [Release notes](https://github.com/bufbuild/buf-setup-action/releases)
- [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.49.0...v1.50.0)

---
updated-dependencies:
- dependency-name: bufbuild/buf-setup-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-20 17:07:24 +11:00
dependabot[bot]
d412ae74ad build(deps): Bump google.golang.org/grpc from 1.69.2 to 1.69.4 (#1780)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.69.2 to 1.69.4.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.69.2...v1.69.4)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-20 16:53:31 +11:00
dependabot[bot]
f419f6e614 build(deps): Bump google.golang.org/protobuf from 1.36.2 to 1.36.3 (#1779)
Bumps google.golang.org/protobuf from 1.36.2 to 1.36.3.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-20 16:40:02 +11:00
Gareth Kirwan
4c7f48ae0e GateIO: Fix GetFuturesContractDetails for delivery futures and minor other fixes (#1766)
* 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
2025-01-14 15:19:17 +11:00
dependabot[bot]
861054ceb0 build(deps): Bump google.golang.org/protobuf from 1.36.1 to 1.36.2 (#1775)
Bumps google.golang.org/protobuf from 1.36.1 to 1.36.2.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-13 18:45:25 +11:00
dependabot[bot]
7677d07cd7 build(deps): Bump bufbuild/buf-setup-action from 1.48.0 to 1.49.0 (#1772)
Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.48.0 to 1.49.0.
- [Release notes](https://github.com/bufbuild/buf-setup-action/releases)
- [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.48.0...v1.49.0)

---
updated-dependencies:
- dependency-name: bufbuild/buf-setup-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-13 18:44:36 +11:00
dependabot[bot]
87641a43a8 build(deps): Bump golang.org/x/net from 0.33.0 to 0.34.0 (#1773)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.34.0.
- [Commits](https://github.com/golang/net/compare/v0.33.0...v0.34.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-13 18:43:06 +11:00
Gareth Kirwan
e4479557de Kucoin: Margin subscription fix and improvements (#1761)
As a GCT user with spot and margin assets enabled, but only margin asset enabled websocket subscriptions,
I should still get subscriptions for all the pairs in margin which are also in spot
Currently it only works when spot subscriptions are enabled. Otherwise the spot pairs are ignored.

Fixes #1755
2025-01-10 14:38:56 +11:00
Gareth Kirwan
1efd8e0db0 Subscriptions: Fix IBotExchange not implementing sub.IExchange (#1765)
Thusfar ExpandTemplates had only been called internally.
All methods consumers might want to get, in this case GetPairFormat,
need to be in the interface we're passing out, otherwise users can't
call them (or things that use them, like ExpandTemplates)
2025-01-10 11:21:02 +11:00
Adrian Gallagher
b3e640ef5e CI: Add stale activity check for issues and PRs GHA (#1689) 2025-01-10 11:17:10 +11:00
Ryan O'Hara-Reid
fcd78add96 bybit: Add protected subtype for account checking to reduce outbound requests (#1739)
* bybit: Add protected sub type for account checking to reduce outbound requests

* add type and string method plus fix linter with comment

* linter: fix

* whoops

* Update exchanges/bybit/bybit.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* Update exchanges/bybit/bybit.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* glorious: nits

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
2025-01-07 12:03:32 +11:00
dependabot[bot]
5ae149a063 build(deps): Bump golang.org/x/term from 0.27.0 to 0.28.0 (#1767)
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.27.0 to 0.28.0.
- [Commits](https://github.com/golang/term/compare/v0.27.0...v0.28.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-06 17:33:36 +11:00
dependabot[bot]
6da0b7dce5 build(deps): Bump golang.org/x/time from 0.8.0 to 0.9.0 (#1768)
Bumps [golang.org/x/time](https://github.com/golang/time) from 0.8.0 to 0.9.0.
- [Commits](https://github.com/golang/time/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: golang.org/x/time
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-06 17:07:30 +11:00
Gareth Kirwan
4fcee8489e Deribit: Add subscription configuration (#1636)
* Kline: Fix Raw Short, Marshal and Unmarshal

* Deribit: Rename GenerateDefaultSubs

* Deribit: Remove custom GetDefaultConfig

Moved to exchange base by #1472

* Deribit: Straight Rename of eps to endpoints

Since I had to ask what this abbreviation meant, I think we should
abandon it

* Deribit: Add Subscription configuration

* Deribit: Fix race on Setup with optionsRegex

Calling Setup twice would race on the assignment to this package var.

There was an option to just move the assignment to the package var declaration, but this
change improves the performance and allocations:
```
BenchmarkOptionPairToString-8            1000000              1239 ns/op             485 B/op         10 allocs/op
BenchmarkOptionPairToString2-8           3473804               656.2 ns/op           348 B/op          7 allocs/op
```

I've also removed the t.Run because even success the -v output from
tests would be very noisy, and I don't think we were getting any benefit
from it at all:
```
=== RUN   TestOptionPairToString
=== PAUSE TestOptionPairToString
=== CONT  TestOptionPairToString
=== RUN   TestOptionPairToString/BTC-30MAY24-61000-C
=== PAUSE TestOptionPairToString/BTC-30MAY24-61000-C
=== RUN   TestOptionPairToString/ETH-1JUN24-3200-P
=== PAUSE TestOptionPairToString/ETH-1JUN24-3200-P
=== RUN   TestOptionPairToString/SOL_USDC-31MAY24-162-P
=== PAUSE TestOptionPairToString/SOL_USDC-31MAY24-162-P
=== RUN   TestOptionPairToString/MATIC_USDC-6APR24-0d98-P
=== PAUSE TestOptionPairToString/MATIC_USDC-6APR24-0d98-P
=== CONT  TestOptionPairToString/BTC-30MAY24-61000-C
=== CONT  TestOptionPairToString/SOL_USDC-31MAY24-162-P
=== CONT  TestOptionPairToString/ETH-1JUN24-3200-P
=== CONT  TestOptionPairToString/MATIC_USDC-6APR24-0d98-P
--- PASS: TestOptionPairToString (0.00s)
    --- PASS: TestOptionPairToString/BTC-30MAY24-61000-C (0.00s)
    --- PASS: TestOptionPairToString/ETH-1JUN24-3200-P (0.00s)
    --- PASS: TestOptionPairToString/SOL_USDC-31MAY24-162-P (0.00s)
    --- PASS: TestOptionPairToString/MATIC_USDC-6APR24-0d98-P (0.00s)
```

( And that got worse with me adding more tests )
2025-01-03 08:55:58 +11:00
dependabot[bot]
b209b0e1a1 build(deps): Bump google.golang.org/protobuf from 1.35.2 to 1.36.1 (#1763)
Bumps google.golang.org/protobuf from 1.35.2 to 1.36.1.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-30 11:27:37 +11:00
dependabot[bot]
0bc9f23aea build(deps): Bump github.com/grpc-ecosystem/grpc-gateway/v2 (#1760)
Bumps [github.com/grpc-ecosystem/grpc-gateway/v2](https://github.com/grpc-ecosystem/grpc-gateway) from 2.24.0 to 2.25.1.
- [Release notes](https://github.com/grpc-ecosystem/grpc-gateway/releases)
- [Changelog](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/.goreleaser.yml)
- [Commits](https://github.com/grpc-ecosystem/grpc-gateway/compare/v2.24.0...v2.25.1)

---
updated-dependencies:
- dependency-name: github.com/grpc-ecosystem/grpc-gateway/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-24 10:07:39 +11:00
dependabot[bot]
9b4e63c523 build(deps): Bump google.golang.org/grpc from 1.69.0 to 1.69.2 (#1758)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.69.0 to 1.69.2.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.69.0...v1.69.2)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-24 09:54:01 +11:00
dependabot[bot]
737fb31902 build(deps): Bump bufbuild/buf-setup-action from 1.47.2 to 1.48.0 (#1756)
Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.47.2 to 1.48.0.
- [Release notes](https://github.com/bufbuild/buf-setup-action/releases)
- [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.47.2...v1.48.0)

---
updated-dependencies:
- dependency-name: bufbuild/buf-setup-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-24 09:29:56 +11:00
dependabot[bot]
3bc0aa730a build(deps): Bump golang.org/x/net from 0.32.0 to 0.33.0 (#1759)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.32.0 to 0.33.0.
- [Commits](https://github.com/golang/net/compare/v0.32.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-24 09:28:50 +11:00
Ryan O'Hara-Reid
50448ec6a0 websocket/gateio: Add request functions for websocket multi-connection [SPOT] (#1598)
* 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

* 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

* 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

* 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

* 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

* bitstamp: fix issue

* glorious: nits

* ch name and commentary

* fix bug add test

* rm a thing

* fix test

* Update engine/engine.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* thrasher: nits

* Update exchanges/stream/stream_match_test.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* Update exchanges/stream/stream_match_test.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* GK: nits rn websocket functions

* explicit function names for single to multi outbound orders

* linter: fix

---------

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>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
2024-12-20 13:50:31 +11:00
Adrian Gallagher
143e336c03 exchanges: Fix GateIO/Coinbase test failures and OKX race (#1753)
* exchanges: Fix gateio/coinbase test failures

* OKX: Fix TestGetAssetsFromInstrumentTypeOrID race

* GateIO: Add/improve comments

* GateIO: Rid additional API call for FetchTradablePairs and provide additional context for test

* GateIO: Prompt test reviewers to take action if BTC settlement is supported again
2024-12-20 12:07:46 +11:00
Gareth Kirwan
16e5398dd5 HitBTC: Add subscription configuration (#1639)
* HitBTC: Upgrade test config

* HitBTC: Add subscription configuration
2024-12-17 11:04:23 +11:00
dependabot[bot]
0d7b776e87 build(deps): Bump google.golang.org/grpc from 1.68.1 to 1.69.0 (#1750)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.68.1 to 1.69.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.68.1...v1.69.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-16 17:04:20 +11:00
dependabot[bot]
f9682741b1 build(deps): Bump golang.org/x/crypto from 0.30.0 to 0.31.0 (#1751)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.30.0 to 0.31.0.
- [Commits](https://github.com/golang/crypto/compare/v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-16 17:00:38 +11:00
Ryan O'Hara-Reid
068a4535ed gateio: update rate limit definitions (#1733)
* 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

* gateio: fix race

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
2024-12-12 15:08:24 +11:00
Gareth Kirwan
2a4c2d24a7 Bitstamp: Add subscription configuration (#1620)
* Bitstamp: Add subscription configuration

* Bitstamp: Handle sub/unsub responses

* Bitstamp: Fix TestWsOrderbook
2024-12-12 14:08:06 +11:00
dependabot[bot]
ca62b0a4c2 build(deps): Bump google.golang.org/grpc from 1.68.0 to 1.68.1 (#1745)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.68.0 to 1.68.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.68.0...v1.68.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-09 17:22:04 +11:00
dependabot[bot]
9d0796a3f0 build(deps): Bump golang.org/x/net from 0.31.0 to 0.32.0 (#1742)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.31.0 to 0.32.0.
- [Commits](https://github.com/golang/net/compare/v0.31.0...v0.32.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-09 16:36:59 +11:00
Gareth Kirwan
219ed903bc Config: Add versioning (#1671)
* 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
2024-12-09 15:04:16 +11:00
Gareth Kirwan
00556f274d Subscriptions: Respect DisableAssetWebsocketSupport for assets (#1693)
* Bitmex: Add index asset to test config

* Subscriptions: Fix unsupported WS assets included

fixed 1692

* Bitmex: Assertify and fix tests

* Subscriptions: Fix all asset subs erroring on no enabled assets

Only subs with Empty asset should do anything when assets are empty.
If asset is set to all and no assets are enabled, we should return
nothing
2024-12-06 17:01:36 +11:00
Gareth Kirwan
66a3ff021e Gemini: Add subscription configuration (#1625)
* Gemini: Upgrade test config

* Gemini: Add subscription configuration

* Gemini: Fix negative waitgroup on shutdown

Fixes #1738
2024-12-06 13:13:32 +11:00
Gareth Kirwan
0c4b070ebc BTCMarkets: Add subscription configuration (#1624)
* Subscription: Add List.GroupByPairs

* BTCMarkets: Add subscription conf

* BTCMarkets: Upgrade test config
2024-12-05 14:50:10 +11:00
Gareth Kirwan
6b79e4c0b4 Bithumb: Add subscription configuration (#1618) 2024-12-05 12:02:23 +11:00
Ryan O'Hara-Reid
b98e82db54 types/time: filter string that cannot be a unix timestamp (#1715)
* types/time: strict usage of time type for usage with unix timestamps

* Update types/time_test.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* @cranktakular: nits

* glorious: nits

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
2024-12-04 10:00:09 +11:00
Scott
291b7b58ea exchanges/Bybit: Fix UpdateOrderExecutionLimits (#1731)
* potentially resolved

* fixes bug with symbol formatting

* fixing lints

* actually uses nextPageCursor

* refactor transforming symbols, add test

* shazbert1000
2024-12-03 10:12:39 +11:00
Ryan O'Hara-Reid
a0d82f2a7d common/math: Add math.Abs to PercentageDifference calculation (#1617)
* fix bug and add decimal calc

* pew pew

* Update common/math/math.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* glorious: nits

* nits: plus change name convention

* gk: nits and splits

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
2024-11-27 10:27:15 +11:00
dependabot[bot]
0fb27542fe build(deps): Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#1727)
* build(deps): Bump github.com/stretchr/testify from 1.9.0 to 1.10.0

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* subscription: Fix assert.NotSame param usage

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
2024-11-26 11:19:49 +11:00
Ryan O'Hara-Reid
3c73d973f6 order: Add Side type MarshalJSON method (#1726)
* Add side MarshalJSON

* glorious: nits

* more removal

* Update exchanges/order/order_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: Adrian Gallagher <adrian.gallagher@thrasher.io>
2024-11-26 11:19:13 +11:00
dependabot[bot]
d8de945ee6 build(deps): Bump github.com/grpc-ecosystem/grpc-gateway/v2 (#1728)
Bumps [github.com/grpc-ecosystem/grpc-gateway/v2](https://github.com/grpc-ecosystem/grpc-gateway) from 2.23.0 to 2.24.0.
- [Release notes](https://github.com/grpc-ecosystem/grpc-gateway/releases)
- [Changelog](https://github.com/grpc-ecosystem/grpc-gateway/blob/main/.goreleaser.yml)
- [Commits](https://github.com/grpc-ecosystem/grpc-gateway/compare/v2.23.0...v2.24.0)

---
updated-dependencies:
- dependency-name: github.com/grpc-ecosystem/grpc-gateway/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-25 17:50:57 +11:00
Ryan O'Hara-Reid
3b2b15e256 gateio: Fix futures subscription generation (#1725)
* gateio/websocket: fix futures filtering when generating subscriptions

* rework test

* gk: nits

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
2024-11-25 17:49:19 +11:00
Gareth Kirwan
fa9549d142 Assets: Fix LinearContracts support (#1724)
* Assets: Fix LinearContracts support

* Assets: Fix False positives with IsValid

supportedFlag&a is true for every even number, making the test pretty
close to meaningless.

[This
fix](5b33bc5324)
was a viable fix maintaining bit shifted iota, but there's no benefit to
it at all.

Simplifying.
2024-11-25 15:35:25 +11:00
Ryan O'Hara-Reid
4bbaf75d34 currency: Fix edge case in NewCode where all string characters are digits (#1593)
* 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>
2024-11-25 14:51:35 +11:00
Ryan O'Hara-Reid
1fab9c72d2 gateio: Remove listOfAssetsCurrencyPairEnabledFor method and optimise websocket asset processing (#1723)
* remove listOfAssetsCurrencyPairEnabledFor and optimise paths

* add helper method and further optimise

* glorious: nits thanksssss!

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
2024-11-20 16:15:38 +11:00
dependabot[bot]
105591b2a8 build(deps): Bump bufbuild/buf-setup-action from 1.46.0 to 1.47.2 (#1718)
Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.46.0 to 1.47.2.
- [Release notes](https://github.com/bufbuild/buf-setup-action/releases)
- [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.46.0...v1.47.2)

---
updated-dependencies:
- dependency-name: bufbuild/buf-setup-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 17:23:32 +11:00