* 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
* Currency: Do not use a default forex provider
exchangerate.host now requires an API key.
Instead of finding a new Free (for now) default, this change simply
disables the currency exchange when nothing is enabled.
* SyncManager: Report ?.?? for an unknown forex amount
In a situation where we thought forex was available but we got an error,
this avoids showing 0.00 when there was actually an error.
* Currency: Tests for no default forex
* Currency: Use mock provider for tests
* Currency: Add API key to exchangerate.host
* Currency: Remove Exchangerate.host
Exchangerate.host was bought by apilayer, the old API deprecated, and
replaced with a proxy to the apilayer api.
We already have currencylayer support, so ther's no reason to keep exh.
Worth noting: New ERH keys actually work on currencylayer
* Currencies: Add test coverage for currency layer
* fixup! Currency: Tests for no default forex
Remove duplicate assignment
Fixes [review comment](https://github.com/thrasher-corp/gocryptotrader/pull/1395#discussion_r1395178513)
* fixup! Currency: Add API key to exchangerate.host
Remove unused ErrVar
Fixes [review
comment](https://github.com/thrasher-corp/gocryptotrader/pull/1395#discussion_r1396647418)
* fixup! Currency: Tests for no default forex
Fix spelling of override in test
Fixes [review comment](https://github.com/thrasher-corp/gocryptotrader/pull/1395#discussion_r1396701476)
* fixup! SyncManager: Report ?.?? for an unknown forex amount
Fix display of non-positive currency conversions.
Fixes [review comment](https://github.com/thrasher-corp/gocryptotrader/pull/1395/files#r1398527134)
* adds funding rate implementations and improvements
* merge fixes x1
* lint
* kucoin funding rates func make
* migrate sync-manager to keys
* some kucoin work
* adds some kucoin wrapper funcs
* ehhh, todo
* kucoin position
* start of orders
* adds the kucoin tests yay
* multiplier
* nits, EWS includes order limits
* NotYetImplemented, IsPerp improvements, cleaning
* lint, test fix, huobi time
* fixes issues, improves testing
* fixes linters I WRECKED
* local lint but remote lint, lint, lint, lint
* fixes err
* skip CI
* lint
* Supported rates, binance endpoints
* fixes weird mocktest problems
* no, CZ is invalid
* fixes some new EWS test errors
* sync manager: don't fall over to rest when websocket connection active
* glorious: nits and fix bug
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* okx: books 5 (cherry-pick)
* okx: shift types to types file, remove commented code and updated field name to better reflect pushed type
* linter: fix
* remove slowness
* * Introduce function checksubscriptions and shift check of subscriptions to internal websocket package
* Shift Max websocket connection int to Websocket setup (temp) for this use case only.
* glorious: nits
* linter: fix
* websocket: don't try and subscribed with nothing to subscribe to.
* Update exchanges/stream/websocket_test.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>
* OrderManager: Fix race condition in submit with ws
If the ws sees the order before processSubmittedOrder then it will have
assigned it an internal order id already and added it to the store.
Don't treat that as an error. Instead just use the newer ws details
* OrderManager: Fix error comparisson
Should always use errors.Is when possible
* Tests: Simplify btcusd test pair declaration
* OrderManager: Improve test readability
* OrderManager: Add orderstore.getByDetail test
* Return a fresh pointer from orderstore.getByDetail
This protects the order.Details in the store from direct access.
The use-case was to allow the returned objects to be references so that
future changes to them would be reflected.
However we're not ready yet to allow people to touch the orders
directly, because they're not protected directly by a mutex, and nothing
would stop consumers contaminating the integrity of the data.
We can revisit this topic later atomicly, but it's definitely tangental
to the cause of action for PR #1336.
* Fix GetByDetail tests to assert a new pointer
* OrderManager: Avoid possible lock races
This fix internalises the getByDetail because the implication of moving
lock ownership out of exists/getByDetail to consumers breaks the order
store struct encapsulation in a way we really don't want to.
It's also more efficient
* Fix spelling mistake
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* OrderManager: Fix TestSubmitOrder... description
* OrderManager: Improve clarity of comment
* OrderManager: Capitalise error message
On failure to add to orderstore, capitalise the error message
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
---------
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* engine: changes (cherry_pick_me_pls_ser)
* engine/helpers: refactor
* glorious nits: purge code
* engine/helpers: update tests so that we can ensure a default exchange and setup is good to go.
* -_-
* glorious: nits
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* moves everything to use single map keys, also breaks
* full rollout
* tests
* fix a little bug
* minor test fixups
* Fix Key use
* rm 🔑 from 🔑 struct name
* all in a days work
* cleanup
* cleanup for real, also stop it binance.json
* minor coverage
* adds gateio to the slurry
* cleanup of types
* verbose verbose verbose verbose verbose verbose
* fixes huobi parsing issue
* fix bybit contract identification
* cleanup
* merge fixes
* addresses many big problems raised by SHAZ
* tracking errors and fixes
* funding rate if avail, fixes currency formatting
* Addresses nits and sneaks in extra fixes
* lint
* minor fixes after rebase
* better contract splitter for currencies like T-USDT
* forgot to add the exchange name like a fool
* merge fixes x1
* kucoin, direction, contract size
* rn direction, fix kucoin time
* WHOOPS
* Update exchanges/kucoin/kucoin_wrapper.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* misdirection
---------
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* init
* updates config
* wrapper configuration
* updates exchange readme
* adds SendAuthHTTPRequest and SendHTTPRequest
* adds ratelimit file
* adds test case and minor fixes
* improve error handling
* update testcases and improve GetSymbols API
* adds SPOT API's
* minor fix
* WIP
* WIP
* adds test case
* adds check in test case
* fixes in Auth. HTTP
* improvements
* adds trade, kline support and testcases
* adds SPOT API and testcases for same
* adds SPOT API and testcases
* adds SPOT API and testcase
* WIP
* adds API's
* adds API's
* adds test cases
* adds comment to exported data types
* adds API and test cases
* adds API
* adds API
* rearrange functions
* WIP: adds API
* adds API for Post Order SPOT
* adds API and few fixes
* fixes
* WIP
* WIP
* add PostBulkOrder API and its test case
* fix issues
* adds cancel order APIs and test cases for same
* add minor test fixes
* add API
* adds API
* fixes
* add API
* adds API and test cases
* fix test
* adds API
* adds test
* fix test
* adds API and test
* adds deposit API and test cases
* WIP
* adds API and test cases
* WIP
* WIP
* add public future API and test cases
* WIP
* remove v2 API and replace them with v1
* update test cases
* adds future order API and test cases
* adds futures order API
* adds API
* add API and test cases
* adds API and test cases
* adds API and test cases
* adds API and test cases
* Adding wrapper functions
* Fix on wrapper function
* Adding websocket support
* Complete addressing WS push datas
* Adding spot push data unit tests
* adding futures websocket push data handlers
* Adding futures websocket push data handlers
* Added unit tests
* Updating unit tests
* Updating wrapper and unit test functions
* Adding missing wrapper functions and code cleaning up
* Resolved linter issues
* Fixing websocket issues
* Fixing websocket issues
* Slight fix on config_example file
* Minor update
* Basic nits updates
* Fix minor linter issues
* Minor update
* Minor unit test update
* Minor unit test update
* Code update and linter issues fix
* Removed unnecessary type conversion codes
* Monor update based on review comment
* Fix based on review comments
* Adding rate-limiter
* Websocket update and overall minor fixes
* Removed IsAssetTypeEnabled method implementation
* Fix connection and formatting issues
* Updating orderbook issues
* Very minor label fix
* Minor error returning fix
* code cleaning up and minor spelling fix
* Updates on unit test
* Update on unit tests and slight code structure
* unit test update
* orderbook update and minor fix
* fix on race
* Mini linter fix
* fix minor parameter and unit test issues
* handler funcs and models update
* Fixing websocket and unit test issues
* order side string for active orders
* Fix on websocket and unit tests
* Minor type changes
* Minor Orderbook fix and unit test update
* Small fix on orderbook
* Updating orderbook functionality
* FIx on websocket orderbook handlers
* Small update on kucoin websocket
* fix missed review comments
* fix based on review comments
* Updating websocket orderbook and fixing unit tests
* Minor fixes
* unit test update
* Updating unit test according to enabled asset type
* toggle canManipulateRealOrders const
* Unit test update
* Fix minor issues
* minor fix
* documentation fix
* wrapper coverage and unused params fix
* testing and minor changes
* documentation, websocket and unit test update
* minor linter fix
* Websocket spot/margin subscription update
* minor ticker update fix
* minor fixes on endpoints
* timestamp and number convert method and unit tests
* timestamp convert minor update
* minor type and conversion fix
* create a common timestamp convert and fix minor issues
* linter and ticker fix
* Updating unit tests and order placing endpoint methods
* Added a pairs check
* Fix config test error
* rm unused error variable
* Fix source of linter issue
* code update: convert, wrapper and websocket fix
* minor code update
* Websocket code and unit tests update
* Websocket ticker ask/bid type change and small error msg fix
* docs update
* fix: websocket orderbook handling
* change orderbook channel to marketOrderbookLevel2Channels and fix websocket orderbook update
* Minor func rename and reciever change
* Minor orderbook unit test issue fix
* comment: about why we used a random delimiter '-' for futures
* update config files and FetchTradablePair func for futures pairs
* futures config pairs update
* remove ConnextionMonitorDelay from websocket setup
* fix on types and futures pair conversion
* updating config pairs
* change NewPairFromString to DeriveFrom
* unit tests update
* unit tests update
* Added TickerBatching
* added GetStandardConfig to GetDefaultConfig
---------
Co-authored-by: Jaydeep Rajpurohit <jaydeeppurohit1996@gmail.com>
* init
* surprise train commit
* basic distinctions
* the terms of binance are confusing
* renames and introduction of allocatedMargin
* add new margin funcs
* pulling out wires
* implement proper getposition stuff
* bad coding day
* investigate order manager next
* a broken mess, but a progressing one
* finally completes some usdtmargined stuff
* coinMfutures eludes me
* expand to okx
* imports fix
* completes okx wrapper implementations
* cleans and polishes before rpc implementations
* rpc setup, order manager features, exch features
* more rpc, collateral and margin things
* mini test
* looking at rpc response, expansion of features
* reorganising before the storm
* changing how futures requests work
* cleanup and tests of cli usage
* remove silly client side logic
* cleanup
* collateral package, typo fix, margin err, rpc derive
* uses convert.StringToFloat ONLY ON STRUCTS FROM THIS PR
* fix binance order history bug
* niteroos
* adds new funcs to exchange standards testing
* more post merge fixes
* fix binance
* replace simepletimeformat
* fix for merge
* merge fixes
* micro fixes
* order side now required for leverage
* fix up the rest
* global -> portfolio collateral
* Update exchanges/collateral/collateral_test.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* adds fields and todos
* rm field redundancy
* lint fix oopsie daisy
* fixes panic, expands error and cli explanations (sorry shaz)
* ensures casing is appropriate for underlying
* Adds a shiny TODO
---------
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* exchanges: Add function to get standard config
* exchanges: add tests (cherry-pick here and above)
* after pick stuff
* cleanup
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* Engine: Fix false test passes for nil OrderManager
TestWebsocketRoutineManagerSetup tests that passing a nil value returns errNilOrderManager;
However that's not actually what would happen when order manager is configured off.
The arguments to setupWebsocketRoutineManager are interface types.
When a nil pointer of interface type is passed, it does NOT equal nil.
nil is a primitive type.
A nil pointer of interface type has the value (nil;type).
See [the Go lang spec](https://golang.org/ref/spec#Comparison_operators):
```
Interface values are comparable. Two interface values are equal if they have identical dynamic types and equal dynamic values or if both have value nil.
```
So that means that whilst this test was passing, because it was sending
in a real nil value and comparing it to a real nil, that's not what
would happen at runtime. At runtime the bot.OrderManager would be a nil
pointer to a concrete type *OrderManager, and so not comparible to nil.
This commit just fixes that oversight, and explains the often
misunderstood mechanics of comparing interface types to nil.
In practical terms this means that the tests assert that the WSRM would
not run without a OM, but in fact it actually would. And panic later.
This commit SHOULD introduce a FAILing test. Sorry if you're bisecting.
* WSM: Fix error on OrderManager not enabled
It's okay for OrderManager to not be enabled; It's configurable.
Remove the WSM setup protection and move it to runtime using IsRunning.
Left the WSM deps so they can be fixed as apporpriate to each.
* orderbook: Check assignment of time values and reject if not set.
* linter: fix
* buffer: additional linter winter fixter
* Implement through pending exchanges
* finished push
* linty: minty
* gomod: tidy
* thrasher: nits
* glorious: nits
* orderbook: purge type now in favour of external call allocation
* orderbook: push last param
* orderbook: only 1 unlock call is needed
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* Kraken: Fix error on WS update without status
* Kraken: Fix parsing of WS updates without Desc
* Kraken: Fix WS market order handling
* Kraken: Fix tests in parallel using DataHandler
* WebsocketManager: Fix order summary printing
* Kraken: Fix parallel tests race with DataHandler
* Kraken: Issue a classification err on asset 404
* Kraken: Switch to testify and close fixture
* allows sync manager customisation for values and logs
* config-example add
* who doesnt like more coverage?
* ensures you can actually disable it via config el oh el
* less ifs, better control
* fix verbose
* sync trades default false
* fix summary being printed when not enabled
* fixes config checker and output
* nits
* I can put this behind me now
* Fixed logCaSiNg
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* combines if statements
---------
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* starting public endpoints
* Adding public endpoints
* added public spot market endpoints
* websocket subscriptions updates
* websocket push data handlers completing
* linter fix
* Added funding private endpoints
* Adding authenticated account endpoints
* Added fiat and OTC-RFQ authenticated endpoints
* trading authenticated endpoints
* completing trade endpoints and add public wrapper endpoints
* Authenticated wrapper functions and corresponding unit test
* Adding authenticated websocket endpoint and fixing wrapper functions
* Documentation and exchange websocket update
* update websocket orderbook checksum handling
* linter issues fix and unit test update
* remove invalid orderbook endpoint and unit test
* Documentation, handlers, and model types update
* minot fix
* Minor fixes
* Updating unit tests and added missing endpoints
* Add missing credential check
* Minor unit test fixes
* fix minor linter issue
* add snaphot test unit test
* Fix on update checksum and documentation update
* update exchange, add UpdateOrderExecutionLimits, and update documentation
* Minor fix on tickers fetching
* Minor websocket fix and smaill unit tests
* Minor websocket and naming fixes
* uncomment default channels
* Fix type and unit test issues
* websocket channels and data handling update
* Update Advanced-Algo websocket handling and minor fixes
* documentation and minor code fixes
* Fix name changes
* documentation contribution update
* intervalToString method update
* fix exchange_wrapper_standard tests
* Fix minor issues based on exchange_wrapper_standards_test
* Fix wrapper extended candlestick check
* websocket orders fetching error check method update
* Exchange name check and change
* docs: Add missing contributors
---------
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* fixes tests
* pair formats and extra fixes
* quick change before shazbert sees
* sneaky lint
* adds bybit mock testing and fixes test
* whoops
* error response instead
* classic forgetting to lint
* bybit live test no longer auto-records results
* ty thrasher- Update exchanges/bybit/bybit_wrapper.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
---------
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* SyncManager: Optimise and fixes
This is a fairly invasive change which addresses the amount of work the
sync manager does each cycle and the cycle intervals.
We switch to using discrete locks for each type of work on each pair,
so each worker can take a discrete chunk of work safely.
For performance and simplicity we now use a map for the currencyPairs.
* fix reporting when a websocket is reconnected
* fix not switching REST off after websocket available again
* fix race condition in isProcessing flag
This PR still could go further by avoiding cycling through everything
each time, and by pushing some one-time work for adding enabled pairs
down to a later stage off the hot path.
This was the smallest chunk of refactoring I felt could address
everything without changing too much.
Significant manual testing done with a variety of Timeouts to test for
edgecases and handling.
* SyncManager: Fix ticker/orderbook tracker linked
* SyncManager: Fix sync complete logging in update
* SyncManager: Fix pair format breaking sync key
Kraken seems to always switch to XBT_USDT format, but websockets still
pass around XBTUSDT format. Just to be safe this just removes the
delimiter to avoid any such issues
* SyncManager: Remove unused error
* SyncManager: Remove unused IsProcessing flag
* SyncManager: Fix Update test add() pair format
We had to unify pair format inside sync manager, so test needs to do the
same
* engine: Fix data race on err var
Found with go run -race:
```
WARNING: DATA RACE
Write at 0x00c0005c5740 by goroutine 125: github.com/thrasher-corp/gocryptotrader/engine.(*Engine).Start.func2()
/Users/gbjk/go/pkg/mod/github.com/gbjk/gocryptotrader@v0.0.0-20230619070715-ae6f283f6be6/engine/engine.go:524 +0x58
Previous write at 0x00c0005c5740 by main goroutine: github.com/thrasher-corp/gocryptotrader/engine.(*Engine).Start()
/Users/gbjk/go/pkg/mod/github.com/gbjk/gocryptotrader@v0.0.0-20230619070715-ae6f283f6be6/engine/engine.go:576 +0x47e4
```
err should be localised, and that avoids this race and doesn't introduce
any other risk
* engine: Fix linter shadow gripe
* engine: Add nolint for indent-error-flow
These are false positives in revive, fixed in PR#821.
This commit can be reverted once a revive release is cut from master,
which is likely to be the next one
* switch over to package defined const for time layout
* bump appveyor playa
* bumperino to latest while setting patherino
* whoooops
* bump VS version set GOROOT
* puge build cache
* Revert "puge build cache"
This reverts commit 315bb578afc19529457f435e52af2172f5143bc5.
* bumperino to test
* purge setting of golang directory for version and allow default
* purge cache state when file change
* whoops
* thrasher: nits
* don't need to flusherino the cacherino
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* initial concept of a nice validation tester for exchanges
* adds some datahandler design
* expand testing
* more tests and fixes
* minor end of day fix for bithumb
* fixes implementation issues
* more test coverage and improvements, but not sure if i should continue
* fix more wrapper implementations
* adds error type, more fixes
* changes signature, fixes implementations
* fixes more wrapper implementations
* one more bit
* more cleanup
* WOW things work?
* lintle 1/1337
* mini bump
* fixes all linting
* neaten
* GetOrderInfo+ asset pair fixes+improvements
* adds new websocket test
* expand ws testing
* fix bug, expand tests, improve implementation
* code coverage of a lot of new codes
* fixes everything
* reverts accidental changes
* minor fixes from reviewing code
* removes Bitfinex cancelBatchOrder implementation
* fixes dumb baby typo for babies
* mini nit fixes
* so many nits to address
* addresses all the nits
* Titlecase
* switcheroo
* removes websocket testing for now
* fix appveyor, minor test fix
* fixes typo, re-kindles killed kode
* skip binance wrapper tests when running CI
* expired context, huobi okx fixes
* kodespull
* fix ordering
* time fix because why not
* fix exmo, others
* hopefully this fixes all of my life's problems
* last thing today
* huobi, more like hypotrophy
* golangci-lint, more like mypooroldknee-splint
* fix huobi times by removing them
* should fix okx currency issues
* blocks the application
* adds last little contingency for pairs
* addresses most nits and new problems
* lovely fixed before seeing why okx sucks
* fixes issues with okx websocket
* the classic receieieivaier
* lintle
* adds test and fixes existing tests
* expands error handling messages during setup
* fixes dumb okx bugs introduced
* quick fix for lint and exmo
* fixes nixes
* fix exmo deposit issue
* lint
* fixes issue with extra asset runs missing
* fix surprise race
* all the lint and merge fixes
* fixes surprise bugs in OKx
* fixes issues with times and chains
* fixing all the merge stuff
* merge fix
* rm logs and a panic potential
* lovely lint lament
* an easy demonstration of scenario, but not of initial purpose
* put it in the bin
* Revert "put it in the bin"
This reverts commit 15c6490f713233d43f10957367fcbf18e3818bdd.
* re-add after immediate error popup
* fix mini poor test design
* okx okay
* merge fixes
* fixes issues discovered in lovely test
* I FORGOT TO COMMIT THIS
* nit fixaroonaboo
* forgoetten test fix
* revert old okx asset intrument work
* fixes
* revert problems I didnt understand. update bybit
* fix merge bugs
* test cleanup
* further improvements
* reshuffle and lint
* rm redundant CI_TEST by rm the CI_TEST field that is redundant
* path fix
* move to its own section, dont run on 32 bit + appveyor
* lint
* fix lbank
* address nits
* let it rip
* fix failing test time range
* niteroo boogaloo
* mod tidy, use common.SimpleTimeFormat
* Add test for dispatch channel reuse
* Dispatcher - make chans bidirectional
* No need to to keep the type assertion separate from the Get()
* Unexport Pipe's channel and add getter
* 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
* 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
* 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>
* engine: shutdown and unload exchange when engine is stopped
* linter: fixes
* engine/exchMan: add nil check
* engine/exchanges: add shutdown method to exchanges, rm len check lock not needed, expanded code coverage, address some nits
* exchMan: report all failed shutdowns across exchanges, implement timer and monitoring routines.
* exchMan: improve shutdown sequence and aloc.
* further improvement
* exchman: log from warn to error
* websockconnection: Suppress error return when closure is caused by library
* linter: fix
* fix racies
* add note on why not parallel tests
* glorious: nits
* spelling kween
* thrasher: nits
* engine: change print of setting using reflection, I keep forgetting to implement this so program around forgetfulness
* engine/exchange_management: remove wait group and just rely on intermediary lock
* glorious: nits
* Update common/common.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update main.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>
* wrapper_coverage/exchanges: cancel context to not send rest requests/ populate context through functions that do rest requests
* linter: fix
* exchange_template: fix test
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* common: adjust common error slice to allow multi errors.Is matching and conform to interface better
* zb: forgot to save?
* linties: fixies
* linties: word change as well.
* nitters: glorious
* buts
* nitters: fix glorious bug
* Update common/common.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* nitters: shifty
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* add backtester support
* Prevent live data custom candles, prevent nanosecond candles
* test coverage
* a more interesting rsi strategy result
* actual custom candle and proper strat date
* add test to old funk
* typos 🌞🌞
* this was definitely worth failing linting for
* Adds stricter processing and adapts to it
* now compat with partial and absent candles
* test fixes, zb fixes
* fix more introduced bugeroos
* fix more introduced bugeroosx2
* linting for one space is so annoying
* addresseroos niteroos
* Update backtester/engine/setup.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* kline: Add builder and testing
* Ideas
* kline: deploy builder functionality across GCT
* exchanges: implement across gct
* exchanges: Add tests and fix implementations before kline package testing and veri.
* kline: Add tests and start to fix ConvertToNewInterval
* kline: fix ConvertToNewInterval add tests
* kline: complete overarching tests now on to exchanges
* kline: finish exchange tests and implement limits
* exchanges: more fixes
* linter: fix
* engine: fix tests
* kraken: fix recent trades and other fixes
* zb: fix tests
* bithumb: fix empty insertion
* kline: refactor/optimize CreateKline function
* kline: remove the mooos!
* kline: prealloc CalculateCandleDateRanges
* linter: fix
* exchanges: prealloc extended
* fix whoopsie
* reverse fix because this is a whoopsie
* okx: fix risidual issues
* linter: fix
* kline: initial nits from @gloriouscode
* kline: rename builder -> request and cascade change
* linter: fix + test
* kline: update forced alignment on start and end times when CreateKlineRequest is called.
* nits: more more more
* NITS: Addressed
* tests: fix race issue
* Update exchanges/kline/request.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* kline: add method AddPadding() to automatically fill in holes in kline.Request functionality and reject if missing data when converting
* kline: Add params start and end to addPadding() to insert blanks in between block
* kline: remove test comment code as it's not needed anymore
* kline: fix lint and test
* kline: sort slice without extra bool check every iteration
* okx: fix issues with timeing and candles and such from niterinos & address typo
* Update exchanges/kline/kline.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: niterinos
* Update exchanges/poloniex/poloniex_wrapper.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits now onto conflicts YAYA!!!
* Update exchanges/exchange_test.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits again
* thrasher: nitters
* thrasher: niterinos - adds partial flag for incomplete recent candles and fetching.
* kline: rm fmtizzle packageizzle
* glorious: nitters
* glorious: more niterinos
* fix last niterinos
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Modifications for a smoother live run
* Fixes data appending
* Successfully allows multi-currency live trading. Adds multiple currencies to live DCA strategy
* Attempting to get cash and carry working
* Poor attempts at sorting out data and appending it properly with USD in mind
* =designs new live data handler
* Updates cash and carry strat to work
* adds test coverage. begins closeallpositions function
* Updates cash and carry to work live
* New kline.Event type. Cancels orders on close. Rn types
* =Fixes USD funding issue
* =fixes tests
* fixes tests AGAIN
* adds coverage to close all orders
* crummy tests, should override
* more tests
* more tests
* more coverage
* removes scourge of currency.Pair maps. More tests
* missed currency stuff
* Fixes USD data issue & collateral issue. Needs to close ALL orders
* Now triggers updates on the very first data entry
* All my problems are solved now????
* fixes tests, extends coverage
* there is some really funky candle stuff going on
* my brain is melting
* better shutdown management, fixes freezing bug
* fixes data duplication issues, adds retries to requests
* reduces logging, adds verbose options
* expands coverage over all new functionality
* fixes fun bug from curr == curr to curr.Equal(curr)
* fixes setup issues and tests
* starts adding external wallet amounts for funding
* more setup for assets
* setup live fund calcs and placing orders
* successfully performs automated cash and carry
* merge fixes
* funding properly set at all times
* fixes some bugs, need to address currencystatistics still
* adds 'appeneded' trait, attempts to fix some stats
* fixes stat bugs, adds cool new fetchfees feature
* fixes terrible processing bugs
* tightens realorder stats, sadly loses some live stats
* this actually sets everything correctly for bothcd ..cd ..cd ..cd ..cd ..!
* fix tests
* coverage
* beautiful new test coverage
* docs
* adds new fee getter delayer
* commits from the correct directory
* Lint
* adds verbose to fund manager
* Fix bug in t2b2 strat. Update dca live config. Docs
* go mod tidy
* update buf
* buf + test improvement
* Post merge fixes
* fixes surprise offset bug
* fix sizing restrictions for cash and carry
* fix server lints
* merge fixes
* test fixesss
* lintle fixles
* slowloris
* rn run to task, bug fixes, close all on close
* rpc lint and fixes
* bugfix: order manager not processing orders properly
* somewhat addresses nits
* absolutely broken end of day commit
* absolutely massive knockon effects from nits
* massive knockon effects continue
* fixes things
* address remaining nits
* jk now fixes things
* addresses the easier nits
* more nit fixers
* more niterinos addressederinos
* refactors holdings and does some nits
* so buf
* addresses some nits, fixes holdings bugs
* cleanup
* attempts to fix alert chans to prevent many chans waiting?
* terrible code, will revert
* to be reviewed in detail tomorrow
* Fixes up channel system
* smashes those nits
* fixes extra candles, fixes collateral bug, tests
* fixes data races, introduces reflection
* more checks n tests
* Fixes cash and carry issues. Fixes more cool bugs
* fixes ~typer~ typo
* replace spot strats from ftx to binance
* fixes all the tests I just destroyed
* removes example path, rm verbose
* 1) what 2) removes FTX references from the Backtester
* renamed, non-working strategies
* Removes FTX references almost as fast as sbf removes funds
* regen docs, add contrib names,sort contrib names
* fixes merge renamings
* Addresses nits. Fixes setting API credentials. Fixes Binance limit retrieval
* Fixes live order bugs with real orders and without
* Apply suggestions from code review
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update backtester/engine/live.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update backtester/engine/live.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Update backtester/config/strategyconfigbuilder/main.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* updates docs
* even better docs
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>