* Okx: Fix Instrument unmarshal
This fixes: `json: invalid use of ,string struct tag, trying to unmarshal "" into float64`
when TwapSz or other fields are empty, which happened briefly today.
As a DriveBy it also simplifies the exposed Instrument type to native
types only.
* Okx: Add missing InstrumentFamily to Instrument
* Okx: Add Instrument Unmarshal tests
DriveBy: Removes stray newline in type conversions
* Okx: Fix empty line upsetting linter
* orders: Fix manager not processing immediately
This ensures that orders are processed as soon as orderManager claims to have started.
Specifically this will fix an eager call to CancelAllOrders not finding
anything until after the first Interval run.
* orders: Fix reset timer call
This fix is small niggle.
The existing code was more complicated than it needed to be, whilst also
ignoring the return of timer.Reset and the conditional need to drain the
channel. It's unlikely but possible during transient resource
starvation.
* OrderManager: Simplify startup process
This simplifies the sequence and Adds to the wg first.
We won't bail from the run() during any type of processOrders, and
that's something we can fix later
* bitfinex: filter security pairs from spot trading
* asset: add securities type
* bitfinex: remove print
* linter: fix
* gomod tidy
* glorious: nits
* bitfinex: just some orderbook fun and added a pass through for bitfinex funding rate when rate == 0
* bitfinex: move update function from testmain to localised test
* test: fix up
* glorious:nits
* bitfinex; fix casing test
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
When an existing ws disconnects the connection manager goro will call Connect.
This prevents Connect trying to start another connection manager if it's
already running
* fix_communications_authorised_clients
* Telegram: Link config to authorised clients list
* Telegram: Prevent multiple spam messages from unauthed user
* Telegram: Improve command handling for authenticated users
Telegram doesn't allow you to easily fetch the user ID of a user unless they have previously sent you a message and is currently waiting to be processed, or if they message you on the fly once the bot is connected. This ensures that the user ID is stored for future usage upon a single successful auth command.
It also fixes the offset as the previous code wouldn't be able to process incoming messages once connected and instead only relay them.
* Bump docs
* default to UTC time in case bot is run on a server with diff time zones
* Enhance config for already upgraded configs
---------
Co-authored-by: shanhuhai5739 <shanhu5739@gmail.com>
* Adding Public Endpoints and test functions
* Adding public endpoints and test functions
* Adding private spot endpoints
* Adding private endpoints and corresponding tests for margin
* Adding Margin Private endpoints
* Adding cross margin and flash swap endpoints
* Adding futures private endpoints
* Adding futures private endpoints and corresponding tests
* Adding Options and SubAccount endpoints and their unit tests
* Adding Wrapper functions
* Complete wrapper functions and corresponding unit test functions
* Fixing wrapper issues and adding websocket functions
* Update of Spot websocket and adding futures websocket handlers
* completed futures WS push data endpoints
* Completed Options websocket endpoints
* Adding websocket support for delivery futures and slight update on endpoint funcs
* Added Delivery websocket support and fix linter issues
* Update on Unit tests
* fix slight currency format error
* Fix slight endpoint tempos
* Update on conditional statements and unit tests issues
* fixing slight tempos
* Slight model and websocket data push method change
* Fix unit test tempos and updating models
* Fix on code structures and update on unit tests
* Slight code fix
* Remove print statements
* Update on tradable pairs fetch eps
* Fix websocket tempos
* Adding types to websocket routine manager
* Fix slight issues
* Slight fixes
* Updating wrapper funcs and models
* Slight update
* Update on test
* Update on tradable pairs
* update conditional statements
* Fixing slight issues
* Updating unit tests
* Minor fixes depending review comments
* Remove redundant method declaration
* Adding missing intervals
* Updating fetch tradable pairs
* update tradable pairs issues
* Addressing small tempos
* Slight fix on ticker
* Minor Fixes
* Minor review comment fixes
* Unit test and minor code updates
* Slight code updates
* Minor updates depending review comments
* Fixes
* Updating incoming message matcher
* Fix missing merge issue
* Fix minor wrapper issues
* Updating ratelimit and other issues
* Updating endpoint models and adding missing eps
* Update on code structure and models
* Minor codespell fixes
* Minor update on models
* fix unit test panic
* Minor race fix
* Fix issues in generating signature and unit tests
* Minor update on wrapper and unit tests
* Minor fix on wrapper
* Mini linter issues fix
* Minor fix
* endpoint fixes and slight update
* Minor fixes
* Updating exchange functions and unit tests
* Unit test and wrapper updates
* Remove options candlestick support
* Minor unit test and wrapper fix
* Unit test update
* minor fix on unit test and wrapper
* endpoints constants name change
* Add minor wrapper issues
* endpoint constants update
* endpoint url updates
* Updating subscriptions
* fixing dual mode endpoint methods
* minor fix
* rm small tempo
* Update on websocket orderbook handling
* Orderbook and currency pair update
* fix linter and test issues
* minor helper function update
* Fix wrapper coverage and wrapper issues
* delete unused variables
* Minor fix on ReadData() call
* separating websocket handlers
* separating websocket handlers
* Minor fix on enabled pair
* minor fix
* check instrument availability in spot
* create a separate subscriber for sake of multiple websocket connection
* linter fix
* minor websocket and gateio endpoints fix
* fix nil pointer exception
* minor fixes
* spelling fix decerializes -> deserializes
* fix Bitfinex unit test issues
* minor unknown currency pair labling fix
* minor currency pair handling fix
* slight update on GetDepositAddress wrapper unit test
* setting max request job to 200
* fixing numerical and timestamp type convert
* fix value overflow error
* change method of parsing orderbook price
* unifying timestamp conversion types to gateioTime
---------
Co-authored-by: Samuael Adnew <samuaelad@Samuaels-MacBook-Air.local>
* Engine: Expose WebsocketRoutineManager
Without exposing the manager users don't know when it's ready to use.
* wsManager: Remove duplicate shutdown chan make
The shutdown channel was already in setup.
Consumers could reasonably expect it to not be replaced in between the
two, and it's not really part of Start to assign it.
* wsManager: Fix IsRunning true before flushed
Consumers must be able to tell when it's safe to start new
subscriptions. Before this fix any new subscriptions would get unsubbed
as part of the flush during `websocketRoutine`.
* WSM: Fix Stop/Start/Stop failing
We previously removed the shutdown channel from Start to avoid duplicate
allocation.
However that will result in a closed channel after the first Stop
So it's better to remove it from the setup.
It's private anyway.
* WSM: Export WebsocketRoutineManager type
Ping handler for okx is not the RFC compat version gorilla would
support. Even if it was, I think the UseGorillaHandler is
broken/misconceived because it does not send keepalive pings, it responds to them.
This also increases the delay to 27, in keeping with the 30 second
timeout documented.
I think this issue was hidden by the noisy default subs.
When just using funding-rates, it showed straight away.
* Binance: Fix Exchange Order Limits not populating
The order of the filters cannot be trusted. New filters have been added
after the 2nd filter, breaking all filter passing afterwards.
This adds a basic test that the data is being populated, but more could
be done on testing.
We should have stricter typing on the filters, perhaps by unmarshalling into
json.RawMessage initially and then into typed stuct fields based on the
filterType. Finally we should spot both missing and unhandled filters, at least in
tests.
* Binance: Add TODO for unhandled filterTypes
* OKX: Support exchange order limits
Adds support for PriceStepIncrementSize and MinAmount limits
* OKX: Test UpdateOrderExecutionLimits on all assets
* OKX: Added asset types for order limit tests
It looks like this was an oversight.
No other exchange uses the funding account for balance and it wouldn't
make sense.
Again, this aims to be minimally invasive and backwards compatible, so
GetBalance is left alone to preserve compat.
* exmo: filter pairs that are not currently enabled by last update time
* stop filtering, add tests to qualify all deployable can be retrieved
* glorious: nits
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* okx: fix get cryptocurrency deposit address for chain bug
* Update exchanges/okx/okx_wrapper.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update exchanges/okx/okx_wrapper.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Revert "Update exchanges/okx/okx_wrapper.go"
This reverts commit 4345f57ce0e984f562ec576aeebc09407a1d2544.
* okx: temp filter for available transfer chain
* glorious: nits
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
The channels for the ws multiplexer weren't made;
so any interaction with it would block.
Tests passed because they invasively setup the multiplexer.
There are quite a few architectural risks with this implementation
pattern, such as leaking an uncancellable goro in a for-select loop.
Ideally WsConnect should take a cancellable context and any selects
should watch for ctx.Done()
That's a very invasive and pervasive change though, so this fix is as minimal and
atomic as possible.
Will consider opening a PR for cancellable context or improving this
multiplexer pattern.
* exchanges/sharedtestvalues: implement new functions to handle test skipping and announcements for standardising.
* exchanges: fin test impl.
* linter: fixes
* exchange_template: fix test
* allocate so it doesn't make a panic at the disco
* glorious: nits
* glorious: nits
* Update exchanges/sharedtestvalues/sharedtestvalues.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update exchanges/sharedtestvalues/sharedtestvalues.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits
* linter: fix
* linter: shhhh
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* exchanges: add setTimeWindow boolean to GetKlineRequest params to differentiate between a set time period return from endpoint.
* glorious: nits
* exchange: conjugation
* Update exchanges/exchange.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits and an assortment of differences
* exchanges: remove some comments
* glorious: nits
* cleanup
* tests: fix
* Update exchanges/hitbtc/hitbtc_wrapper.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update exchanges/kline/kline.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update exchanges/kline/kline_test.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits
* kline: fix test
* rm unused variables
* almost: nits
* glorious: nits
* linter: fix
* rm unused variable
* Refactored comment in the okex tests to ensure that it accurately reflects the variable name and the issue related to the time window, as requested by GloriousCode. The previous comment did not align with the identifier assigned to the property, which could cause confusion and misunderstanding among other programmers or stakeholders. The updated comment will improve the clarity and readability of the codebase and make it easier to understand the intended purpose of the associated variables. The change was made with the aim of improving the overall quality and maintainability of the code.
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>