Commit Graph

1942 Commits

Author SHA1 Message Date
dependabot[bot]
70e66d920c build(deps): Bump github.com/mattn/go-sqlite3 from 1.14.20 to 1.14.22 (#1468)
Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.14.20 to 1.14.22.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](https://github.com/mattn/go-sqlite3/compare/v1.14.20...v1.14.22)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-sqlite3
  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-02-05 16:29:38 +11:00
Adrian Gallagher
d57fefbcfc engine/gRPC proxy: Fix mux regression and add test coverage (#1456)
* engine/gRPC proxy: Fix mux regression and enhance test coverage

* Use a temp dir for TLS creds and add credentials test tables

* Update GetRPCEndpoints grpcProxyName ListenAddr field

* Log unauthorised access attempts
2024-02-05 15:22:54 +11:00
Bea
e0c6e118ed Bitstamp/Kraken: Enhance test coverage (#1423)
* Bitstamp: Improve GetAccountTradingFees

* Bitstamp: Improve test coverage

* Bitstamp: Improve TestWithdrawInternationalBank and TestWithdrawFiat

* Bitstamp: Fix the failing tests WIP

* Bitstamp: Fix TestWithdraw mockTest

* Bitstamp: Fix TestWithdrawFiat

* Bitstamp: Fix TestWithdrawInternationalBank

* Bitstamp: Simplify conditions in TestGetDepositAddress

* Bitstamp: Switch Ws functions Errors to assert.Error

* Bitstamp: Fix TestSubmitOrder, update other errors

* Bitstamp: Fix TestGetOrderStatus, amend error comments

* Bitstamp: Fix TestGetOrderInfo

* Bitstamp: Fix TestTransferAccountBalance

* Bitstamp: Update TestGetWithdrawalsHistory, fix linter errors

* Bitstamp: Update TestGetRecentTrades, change type Withdrawal.Requests.Date

* Bitstamp: Update TestGetDepositAddress, TestBitstamp_OHLC, TestBitstamp_GetHistoricCandles, TestBitstamp_GetHistoricCandlesExtended

* Bitstamp: Fix tests

* Bitstamp: Fix the typos and linter, add a side test to TestGetTicker

* Bitstamp: Update WithdrawFiat and WithdrawFiatFundsToInternationalBank

* Bitstamp: Fix the error description

* Bitstamp: Fixup SkipTestIfCredentialsUnset

* Bitstamp: Fixup tests

* Bitstamp: Fix panic, skip live test TestWithdraw, amend mocktest

* Bitstamp: Fixup

* Bitstamp: Fixup

* Bitstamp: Fixup
2024-02-05 10:39:44 +11:00
Gareth Kirwan
68a6f5828f Binance: Subscribe/unsubscribe response handling (#1444)
* 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
2024-02-02 19:27:17 +11:00
Bea
e16ee53746 Kucoin: Implement GetFuturesTickers, update UpdateTickers and enhance test coverage (#1431)
* Kucoin: update TestUpdateTickers, create GetFuturesTickers

* Kucoin: Update UpdateTickers, getFuturesTickers and testing

* Kucoin: Amend the GetFuturesTickers description, remove currency.ErrPairNotFound, return err

* Kucoin: Parallelilise GetFuturesTickers

* Kucoin: Revert to GetFuturesOpenContracts in GetTickers

* Kucoin: Append the errors, fixup linter

* Kucoin: Fix the race warning

* Kucoin: Fixup

* Kucoin: Move GetFuturesTickers to kucoin_futures
2024-02-02 17:03:48 +11:00
Gareth Kirwan
d7818ea956 Exchanges: Remove bespoke pair upgrade handling and abstract Start/Run (#1424)
* Exchanges: Remove Pair upgrade handling

Now redundant behind #1401. These paths should never be met.

Several legacy coin upgrade paths being deprecated as well: ZUSD and CNY
Expecting any users with bad config from 3+ years ago would have to
reset anyway.

Also: At the time the intention of this was to upgrade the config
format.
However now, instead, it'd mostly serve to reset enabled pairs if
there's a config mistake, which doesn't feel right.

* Kraken: Fix typo in Kraken type struct

* Exchanges: Abstract exchange Start() and Run()

* Exchanges: Add test for abstracted Start

* Exchanges: Move Start to Bootstrap

* Simplify waitgroup usage
* Add call to exchange.Bootstrap to allow overide or supplementation

* Exchanges: Concurrent common bootstap actions

* Gateio: Remove incorrect Run in test

* GateIO: Fix pair dependencies in tests

This ensures that the pairs are initialised no more than needed and
kind-of just-in-time.
Better pattern might be to use a function to get these pairs when we
need them.

* Exchanges: Complete UpdatePairs before ExecLims

If we're going to update pairs, it needs to complete before we check for
limits to avoid errors on old pairs

* Exchanges: Remove Start and Run from tmpl

Since they're replaced by bootstrap now and shouldn't need customisation
normally

* Alphapoint: Move Start to Bootstrap

* GateIO: Fix linter shadow var
2024-01-31 19:29:36 +11:00
Gareth Kirwan
682737f368 Websockets: Fix subscription failure on reconnect (#1457)
* Websockets: Fix subscription failure on reconnect

If a websocket is disconnected then the subscription map was left with
old subscriptions, causing:
`Okx websocket: subscription failure, channel already subscribed for ...`

* fixup! Websockets: Fix subscription failure on reconnect

Fixes review comment https://github.com/thrasher-corp/gocryptotrader/pull/1457#discussion_r1468947509
2024-01-30 12:34:13 +11:00
dependabot[bot]
2016bfca84 build(deps): Bump github.com/mattn/go-sqlite3 from 1.14.19 to 1.14.20 (#1461)
Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.14.19 to 1.14.20.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](https://github.com/mattn/go-sqlite3/compare/v1.14.19...v1.14.20)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-sqlite3
  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-01-30 11:20:44 +11:00
dependabot[bot]
68bb666527 build(deps): Bump google.golang.org/grpc from 1.60.1 to 1.61.0 (#1460)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.60.1 to 1.61.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.60.1...v1.61.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-01-30 10:06:03 +11:00
dependabot[bot]
11204e3f5a build(deps): Bump styfle/cancel-workflow-action from 0.12.0 to 0.12.1 (#1459)
Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.12.0 to 0.12.1.
- [Release notes](https://github.com/styfle/cancel-workflow-action/releases)
- [Commits](https://github.com/styfle/cancel-workflow-action/compare/0.12.0...0.12.1)

---
updated-dependencies:
- dependency-name: styfle/cancel-workflow-action
  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-01-30 10:04:30 +11:00
dependabot[bot]
6e7fbe0108 build(deps): Bump bufbuild/buf-setup-action from 1.28.1 to 1.29.0 (#1458)
Bumps [bufbuild/buf-setup-action](https://github.com/bufbuild/buf-setup-action) from 1.28.1 to 1.29.0.
- [Release notes](https://github.com/bufbuild/buf-setup-action/releases)
- [Commits](https://github.com/bufbuild/buf-setup-action/compare/v1.28.1...v1.29.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-01-30 10:01:58 +11:00
Gareth Kirwan
23c82bead4 Bitfinex: Fix panic on TestUpdateTickers (#1454)
* Bitfinex: Handle Errors in tickers without panic

* Bitfinex: Use TypeAssertError for tickers

* Bitfinex: Refactor and improve ticker handling

* Unify Ticker response handling
* Simplify/Humanify errors in parsing ticker responses
* Remove polymorphic response handling for < 10 fields, seems [antiquated according to docs](https://docs.bitfinex.com/reference/rest-public-ticker)
* Add test coverage for tickers

* Bitfinex: Ignore resp format errs in GetTickers

We're still getting:
`received 'invalid ticker response format for tALT2612:USD field BidSize
from [100 <nil> 100 <nil> <nil> <nil> <nil> <nil> <nil> <nil>]`
too frequently right now.

Considered:
* Special casing tALT2612:*; However if it's happening with this curr
  it'll probably happen again
* Warning about the error; However it'd just be persistent,
  unactionable and annoying  noise in the logs of a running server

So the conclusion is to just silently ignore it

* Bitfinex: Accept locked market in TestUpdateTicker
2024-01-25 16:56:08 +11:00
Adrian Gallagher
804cee4287 ZB: Remove exchange implementation (#1450) 2024-01-25 15:45:55 +11:00
Scott
130642bab6 Kraken: Improve ticker batch performance (#1451)
* Speeds up ticks

* lintBONK

* WHOOPS

* fixes silly old typo 👀

* better error handling

* add some extra fields, use types.Num

* rm redundancy

* Inline single-use function, fix tests

* lint
2024-01-25 15:14:11 +11:00
Gareth Kirwan
e007f69f7c exchanges/websocket: Implement subscription configuration (#1394)
* Websockets: Move Subscription to its own package

This allows the small type to be imported from both `config` and from
`stream` without an import cycle, so we don't have to repeat ourselves

* Subs: Renamed Currency to Pair

This was being mis-used through much of the code, and since we're
already touching everything, we might as well fix it

* Websockets: Add Subscription configuration

* Binance: Add subscription configuration

* Kucoin: Subscription configuration

* Simplify GenerateDefaultSubs
* Improve TestGenSubs coverage
* Test Candle Sub generation
* Support Candle intervals
* Full responsibility for formatting Channel name on GenerateDefaultSubs
  OR consumer of Subscribe
* Simplify generatePayloads as a result
* Fix test coverage of asset types in processMarketSnapshot

* Exchanges: Abstract ParallelChanOp

* Tests: Generic ws mock instances

* Kucoin: Fix intermittent conflict in test currs

Use isolated test instance for `TestGetOpenInterest`.

`TestGetOpenInterest` would occassionally change pairs before
GenerateDefault Subs.
2024-01-24 15:54:07 +11:00
dependabot[bot]
301551ac20 build(deps): Bump actions/cache from 3 to 4 (#1453)
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-23 11:11:00 +11:00
Scott
d907aab576 Huobi: Implement ticker batching (#1439)
* Add huobi ticker batching and tests

* sneaky funding rate fix, don't look

* better processing, better tests

* inline structs per shazbaz

* formatting expansion

* weird

* introduce time param, mini fixes

* linter splinter

* merge fix, kraken fix

* move comment, use require, add len
2024-01-22 15:19:47 +11:00
Gareth Kirwan
45d65c4906 Dispatch: Fix race during stop (#1443)
* Dispatch: Assertify tests

* Dispatch: Fix race during stop

If we have blocking writers, then we need to synchronise them exiting
before closing off their channels.

* Dispatch: Rename Routes mutex for clarity
2024-01-22 15:09:57 +11:00
Ryan O'Hara-Reid
0c40f90ceb requester: purge max request jobs (#1379)
* requester: purge max request jobs

* request: rm unused error

---------

Co-authored-by: shazbert <ryan.oharareid@thrasher.io>
2024-01-22 12:48:45 +11:00
dependabot[bot]
d8ec20576d build(deps)/CI: Bump ikalnytskyi/action-setup-postgres from 4 to 5 and update GHA matrix configuration (#1449)
* build(deps): bump ikalnytskyi/action-setup-postgres from 4 to 5

Bumps [ikalnytskyi/action-setup-postgres](https://github.com/ikalnytskyi/action-setup-postgres) from 4 to 5.
- [Release notes](https://github.com/ikalnytskyi/action-setup-postgres/releases)
- [Commits](https://github.com/ikalnytskyi/action-setup-postgres/compare/v4...v5)

---
updated-dependencies:
- dependency-name: ikalnytskyi/action-setup-postgres
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* CI: Update GHA matrix config based on new postgres update

---------

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-01-21 15:12:10 +11:00
Scott
59916a7869 CoinbasePRO: Fix websocket subscription errors (#1421)
* productids go on individual subs now

* unsubscribe too, support "last_match"
2024-01-16 15:48:28 +11:00
dependabot[bot]
e93a9f72c3 build(deps): bump golang.org/x/net from 0.19.0 to 0.20.0 (#1447)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.19.0 to 0.20.0.
- [Commits](https://github.com/golang/net/compare/v0.19.0...v0.20.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-01-15 16:52:43 +11:00
Scott
b71bf1f3d1 exchanges/futures: Implement open interest (#1417)
* 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
2024-01-12 15:27:35 +11:00
Gareth Kirwan
614042110a Binance: Fix GetHistoricTrades failing live (#1442)
This test was failing with `-tags mock_test_off` because the API imposes
a default limit of 500 now, so we'd just get 500 trades and no batching.

If the user doesn't provide a limit, that means we need to assume
batching
2024-01-11 13:21:04 +11:00
Samuael A
fb6d12ac69 exchanges: Update Bybit exchange to V5 (#1301)
* Adding Bybit public endpoints

* Completed adding market endpoints

* Added trade endpoints

* Adding position endpoints

* completing position endpoints

* Adding Pre-upgrade endpoints

* Completed adding Pre-upgrade and Account endpoints

* Added asset endpoints

* Added user endpoints and unit tests

* Adding spot leverage and margin trade endpoints

* spot margin trade added

* added spot-margin-trade, institutional lending, c2c lending, and broker

* Adding wrapper funnctions

* Working on wrapper public methods

* Added wrapper functions and unit tests

* Added websocket support with unit tests

* Update websocket handlers and added rate-limiter

* wrapper function, websocket handlers, and linter issues fixe

* unit tests fixes and codespell correction

* Update documentation

* Minor websocket handling fix and URL consts merging

* types, unit test other updates

* Updated websocket and methods based on review

* Added GetFeeByType method with unit test and fixes

* add filter for Unified and Normal endpoints

* Mock recording and unit tests update

* minor linter issue fix

* websocket and rest tests and fix

* change asset types and wrapper methods update

* rm: forgotten panic message

* endpoints, websocket  and unit tests update

* Added and updated endpoints and unit test

* linter and spell fix

* unit test and orders update

* Update on endpoints, fields, config pairs and formating, and unit tests

* minor update on responses

* Fix unit test and types

* Unit tests, models, and wrapper issues fix and mock test recording

* rm print statement

* Fix issue, add FundingRate wrapper func, mock record

* minor type and unit test update

* Update on order handling and unit test

* Minor test

* Minor fix in wrapper

* unit tests update, recording, and documentation update

* Unit tests and minor wrapper function update

* minor unit test fix

* Added newly added endpoints, unit tests, and mock recording

* Rename GetInstruments -> GetInstrumentInfo

* doc update

* Minor unit tests update

* Minor unit test and wrapper update

* Fix linter issue

* Add unit test and minor updates

* Revert websocket error declaration

* Revert websocket error declaration

* Balace --> Balance

* Fix config issues

* Added next funding time minor fix

* Update GetLatestFundingRates and record mock test data

* Added LatestFundingRate time

* Fix test issue of TestAllExchangeWrappers

* config pairs update

* configtest spot pairs update

* Minor update on options UpdateOrderExecutionLimits wrapper func

* Linter issue fix and added new currency codes

* Added new currency codes

* Update bybit pairs in config_example

* config assets pair format update
2024-01-11 12:35:46 +11:00
dependabot[bot]
db4f4bf63c build(deps): bump github.com/grpc-ecosystem/grpc-gateway/v2 (#1441)
Bumps [github.com/grpc-ecosystem/grpc-gateway/v2](https://github.com/grpc-ecosystem/grpc-gateway) from 2.18.1 to 2.19.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.18.1...v2.19.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-01-09 11:16:14 +11:00
dependabot[bot]
8835db15e6 build(deps): bump github.com/urfave/cli/v2 from 2.26.0 to 2.27.1 (#1437)
Bumps [github.com/urfave/cli/v2](https://github.com/urfave/cli) from 2.26.0 to 2.27.1.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v2.26.0...v2.27.1)

---
updated-dependencies:
- dependency-name: github.com/urfave/cli/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-01-02 11:38:26 +11:00
Bea
07300d1c70 Bitstamp: Fix GetWithdrawalRequests/GetWithdrawalsHistory date parsing and enhance test coverage (#1406)
* Bitstamp: Fix GetWithdrawalRequests date parsing

* Bitstamp: Add return error to GetWithdrawalsHistory

* Bitstamp: GetWithdrawalsHistory remove log.Errorf, add description to fmt.Errorf

* Bitstamp: Add tests
2023-12-29 14:19:23 +11:00
Gareth Kirwan
e866c8f08d Bitfinex: Fix UpdateTickers (#1427)
* Bitfinex: Fix TestUpdateTickers on ICE

Accept 5% failure rate of available pairs not working as tickers.

When Bitfinex [delisted ICE](https://www.bitfinex.com/posts/990) it's still coming back in all pub:conf and pub:info listings:
```
❯ curl -s https://api.bitfinex.com/v2/conf/pub:info:pair | jq -c '.[0][] | select(.[0] | test("(BTC|ICE|ZIL)USD")) '                                                                   ["BTCUSD",[null,null,null,"0.00006","2000.0",null,null,null,0.1,0.05,null,null]]
["ICEUSD",[null,null,null,"4.0","25000.0",null,null,null,null,null,null,null]]
["ZILUSD",[null,null,null,"40.0","1500000.0",null,null,null,null,null,null,null]]
```
_( I included ZIL to show a tradable pair without Margin fields )_
There's absolutely no sign it's not a tradable pair _until_ you ask for a ticker for it:
```
❯ curl -s https://api.bitfinex.com/v2/ticker/tICEUSD                                                                                                                                   ["error",10020,"symbol: invalid"]⏎
❯ curl -s https://api.bitfinex.com/v2/ticker/tBTCUSD                                                                                                                                   [42854,11.8920918,42855,12.71095442,-290,-0.00672292,42846,725.08132142,43288,41850]⏎
```

* fixup! Bitfinex: Fix TestUpdateTickers on ICE

* fixup! Bitfinex: Fix TestUpdateTickers on ICE

* Bitfinex: Fix UpdateTickers stopping on first error
2023-12-28 15:41:41 +11:00
Adrian Gallagher
e8e0ff3a35 CI: Add macOS, Windows x64 and Linux arm64 test support (#1422)
* CI: Add macOS, Windows and Linux arm64 support

* Modify arm64 job name to be inline with the others

* linter: Prevent cache from causing "Cannot open: File exists" issues

* Use setup-go and setup-node's inbuilt caching
2023-12-28 14:55:50 +11:00
Gareth Kirwan
2b3c63c5b3 Exchanges: Convert bespoke Number types to types.Number (#1429)
* Kucoin: Rename WsSpotTicker => WsSnapshot

* Kucoin: Replace kucoinNumber => types.Number

* Okcoin: Convert to types.Number

* Gateio: Convert to types.Number

* Okx: Convert to types.Number
2023-12-28 14:55:23 +11:00
Gareth Kirwan
9986e80e2d dispatch: Fix intermittent TestMuxPublish issue (#1412)
* Dispatch: Assertify TestMuxPublish

* Dispatch: Fix errDispatcherJobsAtLimit test fails

This test would fail intermittently when the jobs queue drained quickly
enough.
This sets the overload ceiling based on the default settings, and seems
a safe way of ensuring we get an error every time.

It adds a done channel guard around the goro test because otherwise
we'll get a panic occassionally when the goro outlives TestMaxPublish

* Dispatch: Add test for Publish receiving data

* Dispatch: Publish to all subscribers
2023-12-28 14:54:36 +11:00
dependabot[bot]
0a9fdbcdad build(deps): bump github.com/spf13/viper from 1.18.1 to 1.18.2 (#1432)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.18.1 to 1.18.2.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.18.1...v1.18.2)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  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>
2023-12-27 09:44:01 +11:00
dependabot[bot]
9bfbea1e82 build(deps): bump golang.org/x/crypto from 0.16.0 to 0.17.0 (#1434)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.16.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.16.0...v0.17.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>
2023-12-27 09:42:00 +11:00
dependabot[bot]
90e154f492 build(deps): bump google.golang.org/protobuf from 1.31.0 to 1.32.0 (#1435)
Bumps google.golang.org/protobuf from 1.31.0 to 1.32.0.

---
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>
2023-12-27 09:39:32 +11:00
dependabot[bot]
3c5ab63fae build(deps): bump google.golang.org/grpc from 1.60.0 to 1.60.1 (#1433)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.60.0 to 1.60.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.60.0...v1.60.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>
2023-12-27 09:36:29 +11:00
Gareth Kirwan
f05f24da8b Types: Switch convert.StringToFloat64 to types.Number (#1415)
* 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
2023-12-20 13:01:27 +11:00
Bea
5042bf9790 OKX: Change float64 to convert.StringtoFloat64 in okx_types 2023-12-20 09:55:20 +11:00
Gareth Kirwan
a9cdbd16f9 Orderbook: Fix test failures on arm64 (#1407)
* Orderbook: Fix test failures on different arch

Fixes floating point inaccuracies on different architectures
Moves the depth tests over to table driven tests

* Kline: Fix test failures on different arch
2023-12-19 15:13:46 +11:00
Gareth Kirwan
37b1121bbd BTSE: Fix duplicate pair errors on Million pairs (M_*) (#1401)
* 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
2023-12-19 14:40:13 +11:00
dependabot[bot]
dc6873c66f build(deps): bump github.com/mattn/go-sqlite3 from 1.14.18 to 1.14.19 (#1426)
Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.14.18 to 1.14.19.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](https://github.com/mattn/go-sqlite3/compare/v1.14.18...v1.14.19)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-sqlite3
  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>
2023-12-19 09:08:10 +11:00
dependabot[bot]
c673aa3de2 build(deps): bump google.golang.org/grpc from 1.59.0 to 1.60.0 (#1425)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.59.0 to 1.60.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.59.0...v1.60.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>
2023-12-19 09:03:27 +11:00
Gareth Kirwan
8ce30a8375 Okx: Fix GetBlockTrades and enhance test coverage (#1416)
* Okx: Remove UpdateTradablePairs from TestMain

When running individual tests we do not want to be forced to update
trading pairs.
It also does not seem to be required, since disabling UpdateTradingPairs
entirely doesn't stop any tests from passing.

If it is required we can enact this pattern:
```
func TestUpdateTradablePairs(t *testing.T) {
    t.Parallel()
    updatePairsOnce(t)
}
var updatePairsGuard sync.Once
func updatePairsOnce(tb testing.TB) {
	tb.Helper()
	updatePairsGuard.Do(func() {
		err := ok.UpdateTradablePairs(context.Background(), true)
		assert.NoError(tb, err, "UpdateTradablePairs should not error")
	})
```

* Okx: Fix GetBlockTrades url

Endpoint was wrong

Not convinced we should prefix with market vs public, but not
committing a driveby

* Okx: Expand test coverage for GetBlockTrades

* Okx: Fix GetPublicBlockTrades

Was marked as an authenticated API call, and it's not.
Also renames it because without the context of "Block" (or RFQ) it's
misleading.
Adds tests.

* Okx: Fix GetPublicBlockTrades to be public

Expand coverage of GetBlockTrade and GetPublicBlockTrades
2023-12-14 15:53:39 +11:00
Gareth Kirwan
32f08f82f4 Kucoin: Fix unmarshalling of FuturesTicker resp (#1414)
* Kucoin: Fix unmarshalling of FuturesTicker resp

* Fix several string float64 fields not unmarshalling
* Fix time field misnamed; Make a time.Time
* Use order.Side for sides
* Add tests

This change opts to expose float64 instead of StringToFloat64 because
there's no wrapper to convert the type over, and it's not a websocket.
Essentially choosing to not expose internal convert types for methods
called directly.

Possible we'll eventually harmonise this with a types.Number or
something.

* Kucoin: FuturesRealTimeTicker => FuturesTicker

Kucoin only call it RealTime in the first sentence of their docs. None of the API names, endpoints or any thing mention RealTime.
This is just a ticker

* Tests: Improve clarity of failed push data

* Kucoin: Move PushData to a fixture file

This avoids both the linter errors, and the bloat.
Loses the name of the "test", but I think that's okay
2023-12-12 14:57:32 +11:00
dependabot[bot]
7d92206788 build(deps): bump github.com/spf13/viper from 1.17.0 to 1.18.1 (#1418)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.17.0...v1.18.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/viper
  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>
2023-12-11 19:52:11 +11:00
dependabot[bot]
2a72af12cc build(deps): bump actions/setup-go from 4 to 5 (#1419)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-11 19:48:21 +11:00
dependabot[bot]
1f7933fa96 build(deps): bump golang.org/x/time from 0.4.0 to 0.5.0 (#1410)
Bumps [golang.org/x/time](https://github.com/golang/time) from 0.4.0 to 0.5.0.
- [Commits](https://github.com/golang/time/compare/v0.4.0...v0.5.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>
2023-12-04 17:20:41 +11:00
dependabot[bot]
cef7f63f86 build(deps): bump github.com/urfave/cli/v2 from 2.25.7 to 2.26.0 (#1408)
Bumps [github.com/urfave/cli/v2](https://github.com/urfave/cli) from 2.25.7 to 2.26.0.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v2.25.7...v2.26.0)

---
updated-dependencies:
- dependency-name: github.com/urfave/cli/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>
2023-12-04 17:17:44 +11:00
dependabot[bot]
3e4465792a build(deps): bump golang.org/x/net from 0.18.0 to 0.19.0 (#1409)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.18.0 to 0.19.0.
- [Commits](https://github.com/golang/net/compare/v0.18.0...v0.19.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>
2023-12-04 17:05:31 +11:00
Gareth Kirwan
0620ee034d Okx: Fix GetInsuranceFundInformation "" resp (#1405)
* Okx: Fix GetInsuranceFundInformation "" resp

When amount is "" this was erroring

* Test: Standardise configtest.json

Simple jq formatting of configtest
git diff -w or github ignore whitespaces should show no changes.
Any conflicts, just accept --ours and reformat it. Or not :o)
2023-11-28 09:38:37 +11:00