* CI/build: Update Go version, linters and fix minor issues
* linters: Add intrange, copyloopvar, additional go vet linters to match gopls and fix issues
* Websocket: Use ErrSubscribedAlready
instead of errChannelAlreadySubscribed
* Subscriptions: Replace Pair with Pairs
Given that some subscriptions have multiple pairs, support that as the
standard.
* Docs: Update subscriptions in add new exch
* RPC: Update Subscription Pairs
* Linter: Disable testifylint.Len
We deliberately use Equal over Len to avoid spamming the contents of large Slices
* Websocket: Add suffix to state consts
* Binance: Subscription Pairs support
* Bitfinex: Subscription Pairs support
* Bithumb: Subscription Pairs support
* Bitmex: Subscription Pairs support
* Bitstamp: Subscription Pairs support
* BTCMarkets: Subscription Pairs support
* BTSE: Subscription Pairs support
* Coinbase: Subscription Pairs support
* Coinut: Subscription Pairs support
* GateIO: Subscription Pairs support
* Gemini: Subscription Pairs support and improvement
* Hitbtc: Subscription Pairs support
* Huboi: Subscription Pairs support
* Kucoin: Subscription Pairs support
* Okcoin: Subscription Pairs support
* Poloniex: Subscription Pairs support
* Kraken: Add subscription Pairs support
Note: This is a naieve implementation because we want to rebase the
kraken websocket rewrite on top of this
* Bybit: Subscription Pairs support
* Okx: Subscription Pairs support
* Bitmex: Subsription configuration
* Fixes unauthenticated websocket left as CanUseAuth
* Fixes auth subs happening privately
* CoinbasePro: Subscription Configuration
* Consolidate ProductIDs when all subscriptions are for the same list
* Websocket: Log actual sent message when Verbose
* Subscriptions: Improve clarity of which key is which in Match
* Subscriptions: Lint fix for HugeParam
* Subscriptions: Add AddPairs and move keys from test
* Subscriptions: Simplify subscription keys and add key types
* Subscriptions: Add List.GroupPairs Rename sub.AddPairs
* Subscription: Fix ExactKey not matching 0 pairs
* Subscriptions: Remove unused IdentityKey and HasPairKey
* Subscriptions: Fix GetKey test
* Subscriptions: Test coverage improvements
* Websocket: Change State on Add/Remove
* Subscriptions: Improve error context
* Subscriptions: Fix Enable: false subs not ignored
* Bitfinex: Fix WsAuth test failing on DataHandler
DataHandler is eaten by dataMonitor now, so we need to use ToRoutine
* Deribit: Subscription Pairs support
* Websocket: Accept nil lists for checkSubscriptions
If the user passes in a nil (implicitly empty) list, we would not panic.
Therefore the burden of correctness about that data lies with them.
The list of subscriptions is empty, and that's okay, and possibly
convenient
* Websocket: Add context to NilPointer errors
* Subscriptions: Add context to nil errors
* Exchange: Fix error expectations in UnsubToWSChans
* Currency: Remove Pair Index formatting/parsing
This feature was originally for exchanges with only one pair (e.g. KRW) which made parsing easier.
However there's no examples of this left, and we can reduce complexity
overall by removing it.
* Exchange: Partial assertify tests and fixes
* Currency: Fix panic on a delimiterless small currency
* 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
* 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.
* 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)
* cmd/exchange_template: Add wrapper function
* exchanges: force UpdateOrderExecutionLimits to wrappers as this is important for order deployment
* kucoin: Add spot order execution limits
* linter: fix
* glorious: nits
* kucoin: change from name to symbol for correct fee fetching and order deployment
* WHAAAAAAAT says Vitalik
* kucoin: Add futures limit support, fix insertion of non margin tradable pairs, update naming and add comments.
* kucoin: implement master branch changes
* Update exchanges/kucoin/kucoin_test.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* kucoin/test: update commentary
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.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>
* 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>
* 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
* 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>
* stream: set connection monitor delay.
- this fixes a bug where the connection monitor delay config value does not
get set to the websocket on intialization.
* multi: add connection monitor delay to exchange config.
- this adds the connection monitor delay config option to the exchange type.
- the validate function of the exchange type has been updated to validate the
connection monitor delay value as well.
* multi: resolve review issues.
* public endpoints methods added
* Completing mapping REST endpoints
* Binanceus Wrapper methods -Partially
* Binanceus Wrapper methods -Partially
* BinaWra functions with test funs; Not Completed
* Finalizing wrapper methods & test
* Fix & Complete wrapper functions
* Finalizing wrapper methods & test
* Adding Stream Datas
* WS Test functions
* CI: Fix golangci-lint linter issues
* CI: Fix reverting unnessesary changes and type conversion issues
* CI: Fix reverting unnessesary changes and type conversion issues
* Adding Public endpoints and tests
* Adding Market and Public Endpoints
* Adding Public endoints
* Public Trading Endpoints & Authenticated Trade order methods
* Adding Authenticated Methods and Tests
* Adding algo and Funding Authenticated endpoints
* Adding funding trading endpoints and correspondint tests
* adding authenticated endpoints
* Completing Block Trading endpoints and added subaccount endpoints
* Completing sub account and grid Trading endpoints
* Adding Rate Limit and missing endpoints
* Wrapper and Websocket handlers
* Fixing Websocket Test and Push Data Handler Issues
* Fixing Websocket Test and Push Data Handler Issues
* Fixing linter issues, package dependency, and other slight tempos
* Fixing linter and slight tempos
* Update on test functions, and Rest and Websocket Endpoint handlers
* Remove okex, adding comments, and slight fixes on endpoints.
* Fixing linter issues and adding comments
* Slight code changes, updating documentation, and n and linter issues
* Fix context and configuration endpoint issues
* slight fixes on config and test files
* adding some missing test and fix linter issues
* fix linter issue
* Slight fixes on code structure, shorthand exp,and ot and other
* Fix slight linter issue
* Slight code fixes and fixing linter issues
* fixing linter iissues
* fixing linter iissues
* slight linter issue fix
* slight linter issue fix
* Fix on models, type convert funcs and endpoints
* Adding Error messages map and update of models
* Fix on error message string and linter issues
* Fix slight linter issue
* Fix slight linter issue
* Fixing type converts, models, and linter issues
* Adding Ws fixes
* Slight fix on websocket and other issues
* Adding slight websocket fixes
* Remove 'books5' channel default subscription
* Small changes on default subscription and checksum
* Fix slight websocket tempos
* Fix Wrapper function tempost and linter issues
* Resolving slight naming and other issues
* Resolve slight pointer issues
* resolve slight linter issues
* Resolve config files issue
* Update websocket and wrapper funcs with test and docs
* fixs on websocket multiplexer, types, and other slight issues
* fix slight linter issues
* slight update on web-socket orderbook and tickers
* fix slight issues and websocket runtime errors
* Slight unit test fix and assing simple semaphore
* FIx race issue
* Update on authenticated endpoints
* Fix wsSetupRun check in websocket 'setupWsAuth' func
* Update wsSetupRun check in websocket 'setupWsAuth' func
* Slight update on websocket handling
* Fix some race conditions
* fix slight tempos
* fix authenticated test issues
* Update on conditional statements
* slight update on unit test
* fix unit test tempos
* Fix slight tempos
* Change check map from struct valued to bool valued
* slight fix trial
* Slight unit test update
* Fix websocket timeout error
* Updating websocket subscription endpoints, and unit tests
* update unit tests
* Slight issue on wrapper method 'GetActiveOrders'
* Overall code update
* Addressing missing review comments
* Fix unit test tempo and linter issue
* Monor fix
* Slight update
* Slight unit test fix
* Slight fixes
* Slight fixes
* Fixing on missing review comments
* Adding WS Fixes
* slight fix
* Monor fix on unit test
* Minor convert issue
* Minor change on WS
* Monor logic fix
* Fix code structure and logic issues
* Fixing small typos
* fix slight data format issue
* Update on trade and order wrapper methods
* Adding slight update
* fix on order detail
* Slight update on FetchTradablePairs wrapper method
* Slight update on wrapper
* Update on deserialization and other slight issues
* Final update
* Resolve missing review comments
* Slight update on config and unit test
* minor fix on GetDepositAddress param
* Minor fix
* logger: reduce go routine generation
* logger: shift most of processing and prep work to the worker pool, add pool for fields because each log we are pushing the struct to the heap, has better segregation now and includes a buffer in scope instead of relying on a pool
* logger: shift fmt package calls to worker pool
* logger: conform tests to new design
* linter: fix issues
* Update log/logger_test.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update log/logger_test.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* UN-GLORIOUS: nits
* logger: Handle config variable
* logger: NITERINOS BY GLORIOUS CODE
* logger: revert
* glorious: nits
* Panic at the disco: fix
* Panic at the disco: fix
* logger: make sure logger closed and job channel emptied on start up error
* fix tests
* logger: reduce globals
* logger: finished reduces globals, reduce workers to one too keep everything in line.
* logger: remove comments
* logger/exhchange: linter issues
* db/test: fix linter
* logger: add tests shift wait before unlock
* logger: consolidate worker code; fix linter issue and make sure we can sustain writing for external testing.
* logger: fix race and warn for conflict in config
* logger: fix name and add to tests
* logger: remove zero value field
* glorious: panic fix and removal of code
* logger: reinstate channels in close
* logger: shift reinstate processing to SetupGlobalLogger
* logger: segregate config.json from internal log.Config
* logger: fix silly mistake that is silly
* engine: Add protection for nil issues and implement new constructor in tests
* logger: Force singular mutex usage throughout package, throw away funcs that are not used outside of this package, unexport a bunch. Fix tests.
* logger: actually set advanced settings
* Update log/loggers.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update log/loggers.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update log/loggers.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update log/loggers.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update log/logger_multiwriter.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits
* logger: test issue when not purging temp file and contents
* loggertest: add more protections for the panics
* linter: fix
* glorious: nits
* cleanup
* logger: linter fix
* linter: fix(?) :/
* linter: revert change
* linter: fix
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* Adds basic PoC for calculating/retrieving position data
* A very unfortunate day of miscalculations
* Adds position summary and funding rate details to RPC
* Offline funding rate calculations
* More helpers, more stats, refining data, automated retrieval
* Adds new rpc server commands and attempts some organisation
* lower string, lower stress
* Adds ordermanager config. Fleshes outcli. Tracks positions automatically
* Adds new separation for funding payments/rates
* Combines funding rates and payments
* Fun test coverage
* ALL THE TESTS... I hope
* Fixes
* polishes ftx tests. improves perp check. Loops rates
* Final touches before nit attax
* buff 💪
* Stops NotYetImplemented spam with one simple trick!
* Some lovely little niteroos
* linteroo
* Clarifies a couple of errors to help narrow likely end user problems
* Fixes asset type bug, fixes closed position order return, fixes unset status bug
* Fixes order manager handling when no rates are available yet
* Continues on no funding rates instead. Removes err
* Don't show predicted rate if the time is zero
* Addresses scenario with no funding rate payments
* Bug fixes and commentary before updating maps to use *currency.Item
* Adds a pair key type
* Polishes pKey, fixes map order bug
* key is not a property in the event someone changes the base/quote
* Adds improvements to order processing...Breaks it all
* Shakes up the design of things by removing a function
* Fixes issues with order manager positions. Limits update range
* Fixes build issues. Identification of bad tests.
* Merges and fixes features from master and this branch
* buff linter 💪
* re-gen
* proto regen
* Addresses some nits. But not all of them.
* Fixes issue where funding rates weren't returned 🎉
* completes transition futures tracking to map[*currency.Item]map[*currency.Item]
* who did that? not me
* removes redundant check on account of being redundant and unnecessary
* so buf
* addresses nits: duplications, startTime, loops, go tidy, typos
* fixes minor mistakes
* fixes 🍣🐻 changes to int64
* test: use `T.TempDir` to create temporary test directory
This commit replaces `ioutil.TempDir` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.
Prior to this commit, temporary directory created using `ioutil.TempDir`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
defer func() {
if err := os.RemoveAll(dir); err != nil {
t.Fatal(err)
}
}
is also tedious, but `t.TempDir` handles this for us nicely.
Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* test: fix TestEncryptTwiceReusesSaltButNewCipher on Windows
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* test: fix TestCheckConnection on Windows
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* test: fix TestRPCServer_GetTicker_LastUpdatedNanos on Windows
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* test: cleanup TestGenerateReport
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* Bump CI versions
* Specifically set go version as 1.17.x bumps it to 1.18
* Another
* Adjust AppVeyor
* Part 1 of linter issues
* Part 2
* Fix various linters and improvements
* Part 3
* Finishing touches
* Tests and EqualFold
* Fix nitterinos plus bonus requester jobs bump for exchanges with large number of tests
* Fix nitterinos and bump golangci-lint timeout for AppVeyor
* Address nits, ensure all books are returned on err due to syncer regression
* Fix the wiggins
* Fix duplication
* Fix nitterinos
* currency: Add method to derive pair
* currency: Add method to lower entire charset but used the slice copy and returned that. This will change the original, just gotta see if this is an issue, but the slice usually goes out of scope anyway.
* currency/pairs: add filter method
* currency: add function to derive select currencies from currency pairs
* currency/engine: slight adjustments
* currency: fix linter issue also shift burden of proof to caller instead of repair, more performant.
* currency: more linter
* pairs: optimize; reduce allocs/op and B/op
* currency: Add in function 'NewPairsFromString' for testing purposes
* currency: don't suppress error
* currency: stop panic on empty currency code
* currency: Add helper method to match currencies between exchanges
* currency: fixed my bad spelling
* currency: Implement stable coin checks, refactored base code methods, optimized upper and lower case strings for currency code/pairs
* currency: add pairs method to derive stable coins from internal list.
* Currency: Cleanup, fix tests.
* engine/exchanges/currency: fix whoops
* Currency: force govet no copy on Item datatype
* Currency: fix naughty linter issues
* exchange: revert change
* currency/config: fix config upgrade mistake
* currency: re-implement currency sub-systems
* *RetrieveConfigCurrencyPairs removed
*CheckCurrencyConfigValues to only provide warnings, add additional support when, disable when support is lost or not available and set default values.
*Drop Cryptocurrencies from configuration as this is not needed.
*Drop REST Poll delay field as this was unused.
*Update default values for currencyFileUpdateDuration & foreignExchangeUpdateDuration.
*Allow Role to be marshalled for file type.
*Refactor RunUpdater to verify and check config values and set default running foreign exchange provider.
* currency: cleanup
* currency: change match -> equal for comparison which is more of a standard and little easier to find
* currency: address nits
* currency: fix whoops
* currency: Add some more pairs methods
* currency: linter issues
* currency: RM unused field
* currency: rm verbose
* currency: fix word
* currency: gocritic
* currency: fix another whoopsie
* example_config: default to show log system name
* Currency: Force all support packages to use Equal method for comparison as there is a small comparison bug when checking upper and lower casing, this has a more of a pronounced impact between exchanges and client instances of currency generation
* currency: fix log name
* ordermanager: fix potential panic
* currency: small optim.
* engine: display correct bool and force shutdown
* currency: add function and fix regression
* Change ConvertCurrency -> ConvertFiat to be more precise
* ADD GetForeignExchangeRate to get specific exchange rate for fiat pair
* Fix currency display and formatting regression and tied in with config.Currency fields
* engine: fix tests
* currency: return the amount when no conversion needs to take place
* currency: reduce method name
* currency: Address nits glorious nits
* currency: fix linter
* currency: addr nits
* currency: check underlying role in test
* gct: change to EMPTYCODE and EMPTYPAIR across codebase
* currency: fix nits
* currency: this fixes test race but this issue has not been resolved. Please see: https://trello.com/c/54eizOIo/143-currency-package-upgrades
* currency: Add temp dir for testing
* Update engine/engine.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* documentation: update and regen
* currency: Address niterinos
* currency: Add test case for config upgrade when falling over to exchange rate host as default from exchangeRates provider
* currency: addr nits
* currency: fix whoops
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* log: fix bugs expand coverage and optimise
* log: fix linter issues
* log: fix linter issue and pack methods in same file
* log: drop defer
* logger: move global check inside getfields and remove unused test function
* logger: Increase note thanks @gloriouscode
* logger: wrap error with writer type
* logger: change variable name
* logger: change variable names and remove validsublogger func as it doesn't add functionality over a standard map call
* logs: error when unsupported output is applied on setup calls
* logs: add glorious suggestion
* logger: add protection to reduce olympic gold medal races
* logger: fix linter issues
* log: glorious niterinos
* cmd/tools/exchange: fix regression and implement reflection so as this can dynamically scale to our interface
* exchanges: add comment and fix whoopsie
* exchanges: fix linter issues
* wrapper_cov_tool: add actual full interface method count to get a better perceived deployment
* exchanges/tool: addr glorious nits
* kraken: remove string in test
* exchange_template_tool: fix tmpl issue
* Expose trade feed websocket exchange data through data channel
Most relevant to applications that import GCT as a lib, this allows
them to (through configuration, disabled by default) receive trade data
through the data channel similarly to the orderbook feed.
* exchanges: allow exposure of trade websocket feed through data channel
* Expose fill feed websocket abstracted exchange data through data channel
* exchanges: allow exposure of fill websocket feed through data channel
* Allow configuration of orderbook publish period
For some applications that import GCT it's more interesting to be
immediately notified of an exchange orderbook update instead of
only getting notified every 10 seconds. This option allows that
to happen while keeping the previous default.
* exchanges: allow configuration of orderbook update period
* golangci-lint/CI: Bump versions
Fix remaining linter issues
* Specifically set AppVeyor version
* Fix the infamous typos 👀
* Add go env cmd to AppVeyor
* Add go version cmd to AppVeyor
* Specify AppVeyor image, adjust linters
* Update go get to go install due to deprecation
* Bump golangci-lint timeout time for AppVeyor
* Change NW contract to NQ
* Address nitters
* GetRandomPair -> Pair{}
* Address nits
* Address time nitterinos plus additional tweaks
* More time inception upgrades!
* Bending time and space
* golangci: Enable err checking linter to expose unchecked errors.
* gct: handle errors across the board
* gct: handle errors NOTE: Found bug in FTX (WIP)
* linter: fix issues
* ftx/exchanges: fix bug where error was being returned when setting pair management variables to an already enabled state
* bitmex: fix bug where a dangly supported asset in config danglied up the place.
* linter: fix more linter issues
* linter: fix my terrible spelling.
* currency: fix test
* exchanges: fix tests
* logger: fix test
* exchanges: fix tests
* glorious: nits
* vm: revert rm variable and instigate test
* Remove old concept. Introduce new job types and candle scaling
* Adds extra processing, commands
* new concept for queued jobs. Jobs can pause. New commands to manage status
* =End of day commit designing tables and implementing prerequisites further.
* Adds postgres data history relations
* Fixes table design for sqlite. Fixes all issues from merge
* Fixes craziness of database design. Adds some functions to get related jobs
* Fixes errors
* Updates some documentation, manages prerequisite jobs a little better, adds rpc funcs
* Fixes database design and adjust repo functions
* Tests database relationship
* Test coverage of new job functions
* Finishes coverage of new functions
* Commands and RPC coverage
* New database modifications for new job types
* Adds db support of new columns. Adds conversion validation. lint
* command blurb changes
* Allows websocket test to pass consistently
* Fixes merge issue preventing datahistorymanager from starting via config
* Minor fixes for different job type processing
* Fixes rangeholder issue, fixes validation, does not address jobs not starting or wrong status
* Fixes database tests, but at what cost. Fixes dhm tests
* Fixes dhj completion issue. Adds prerequisite by nickname
* Fixes validation processing. Adds db tests and validation
* Fixes validation job processing range
* Fixes trade sql. Reduces defaults. Validation processing and errors
* Updates cli job commands. adds validation decimal. fix job validation
* Expands run job handling and tests
* Validation work
* Fixes validation processing
* candle relations. new job type. updating database design
* Adds secondary exchange support. Sets stage for candle override
* Re adds accidentally deleted relationship
* Updates loading and saving candles to have relationship data when relevant
* Now validates and replaces candle data appropriately
* Fixes getting and setting datahistory data. Neatens DHM
* Test coverage
* Updates proto for new db types. New test coverage. Secondary exchange work
* Investigation into never-ending validation jobs. Now that intervals are ruled out, now need to complete the job....
* Fixes issues with validation job completion. Fixes validation volume issue for secondary exchange
* Adds candle warning support to the backtester
* Fixes warnings
* lint and begin docs
* Documentation updates. Final testing changes
* Minor fixes
* docs, prerequisite checks, more testing
* Fixes binance trade test. Rename err
* Documentation fixes. Figure fixes
* documentation update
* Fixes remote PSQL tests
* Fix binance mock test
* Remove unnecessary JSON
* regen proto
* Some minor nit fixes
* Var usage, query sorting, log improving, sql mirroring
* Extra coverage
* Experimental removal of m.jobs and mutex. Fix messaging
* Fixes error
* Lint fixes, command description improvements. More isRunning gates
* description improvements
* Lint
* BUFF regenerate
* Rough concept to fix insertions taking up long periods of time
* New calculation for trade data. Adds batch saving
This also adds an experimental request feature to shut down lingering requests. However, its uncertain whether or not this is having any impact. Initially thought it was the trades that was taking time and not SQL. Will investigate further
* Removes experimental requester. Adds documentation. Fixes typo
* rm unused error
* re-adds more forgotten contributors
* Now with proper commit count
* orderbook: export orderbook nodes for external strategy inspection
* orderbook: Add in methods for locking and unlocking multiple books at the same time e.g. book1.LockWith(book2); defer book1.UnlockWith(book2)
* include waiting functionality for depth change alert
* backtester: add word.
* log: include logger changes to impl with downstream integration
* engine: reduce params for loading exchange
* assort: rm verbose in tests, change wording in ob, expose sync.waitgroup for ext. sync options
* ticker: reduce map look ups and contention when using RW mutex when there are over 80% writes adds find last function to get the latest rate
* engine/syncmanager: add in waitgroup for step over for external package calls
* cleaup
* engine: linter fix
* currency/fx: include all references to fiat currencies to default
* orderbook: Add in fields to Unsafe type for strategies to detect potential out of sync book operations
* syncmanager: changed config variable to display correct time
* ordermanager: Add time when none provided
* currency/manager: update getasset param to get enabled assets for minor optimizations
* ftx: use get all wallet balances for a better accounts breakdown
* orderbook: unlock in reverse order
* bithumb: fixes bug on market buy and sell orders
* bithumb: fix bug for nonce is also time window sensitive
* bithumb: get orders add required parameter
* bithumb: Add asset type to account struct
* currency: improve log output when checking currency and it fails
* bithumb: Add error return on incomplete pair
* ticker:unexport all service related methods
* ticker/currency: fixes
* orderbook: fix comment
* engine: revert variable name in LoadExchange method
* sync_manager: fix panic when enabling disabling manager
* engine: fix naming convention of exported function and comments
* engine: update comment
* orderbook: fix comment for unsafe type
* config: add remoteControl/gRPC/timeInNanoSeconds
* grpc: consult with remoteControl/gRPC/timeInNanoSeconds whether timestamps should be in seconds or nanos
* engine: test if RPCServer.unixTimestamp() respects config/remoteControl/gRPC/timeInNanoSeconds
* engine: implement TestRPCServer_GetTicker_LastUpdatedNanos that makes sure TickerResponse.LastUpdated is returned in nanoseconds if configured
* config_example.json: add remoteControl/gRPC/timeInNanoSeconds
* engine: (1) test RPCServer.unixTimestamp() in parallel, (2) increase time tolerance of TestRPCServer_GetTicker_LastUpdatedNanos()
* engine: TestRPCServer_GetTicker_LastUpdatedNanos() now fetches a mock-up ticker to check timestamps
* Speeds up tests
* Reduces time.Sleeps, lowers CreateTestBot complexity. Breaks things
* Removal of unecessary config reads. Parallel tests. Lower times
* Speeds up recent trades results
* mini update
* zoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooom
* Removes the dupes
* Lint
* post cherrypick
* Fix rare kraken data race
* Fixes banking global issues. Fixes postgres trades
* rmline for appveyor test
* Expands timeout in event that channel is closed before send
* Fix data race
* No rows, no bows and definitely no shows
* Removes parallel from createsnapshot tests
* Extends timedmutext test a smidge. Exchange fatality
* Shorter end timeframe and bigger candle
* Adds lovely initial concept for historical data doer
* Adds ability to save tasks. Adds config. Adds startStop to engine
* Has a database microservice without use of globals! Further infrastructure design. Adds readme
* Commentary to help design
* Adds migrations for database
* readme and adds database models
* Some modelling that doesn't work end of day
* Completes datahistoryjob sql.Begins datahistoryjobresult
* Adds datahistoryjob functions to retreive job results. Adapts subsystem
* Adds process for upserting jobs and job results to the database
* Broken end of day weird sqlboiler crap
* Fixes issue with SQL generation.
* RPC generation and addition of basic upsert command
* Renames types
* Adds rpc functions
* quick commit before context swithc. Exchanges aren't being populated
* Begin the tests!
* complete sql tests. stop failed jobs. CLI command creation
* Defines rpc commands
* Fleshes out RPC implementation
* Expands testing
* Expands testing, removes double remove
* Adds coverage of data history subsystem, expands errors and nil checks
* Minor logic improvement
* streamlines datahistory test setup
* End of day minor linting
* Lint, convert simplify, rpc expansion, type expansion, readme expansion
* Documentation update
* Renames for consistency
* Completes RPC server commands
* Fixes tests
* Speeds up testing by reducing unnecessary actions. Adds maxjobspercycle config
* Comments for everything
* Adds missing result string. checks interval supported. default start end cli
* Fixes ID problem. Improves binance trade fetch. job ranges are processed
* adds dbservice coverage. adds rpcserver coverage
* docs regen, uses dbcon interface, reverts binance, fixes races, toggle manager
* Speed up tests, remove bad global usage, fix uuid check
* Adds verbose. Updates docs. Fixes postgres
* Minor changes to logging and start stop
* Fixes postgres db tests, fixes postgres column typo
* Fixes old string typo,removes constraint,error parsing for nonreaders
* prevents dhm running when table doesn't exist. Adds prereq documentation
* Adds parallel, rmlines, err fix, comment fix, minor param fixes
* doc regen, common time range check and test updating
* Fixes job validation issues. Updates candle range checker.
* Ensures test cannot fail due to time.Now() shenanigans
* Fixes oopsie, adds documentation and a warn
* Fixes another time test, adjusts copy
* Drastically speeds up data history manager tests via function overrides
* Fixes summary bug and better logs
* Fixes local time test, fixes websocket tests
* removes defaults and comment,updates error messages,sets cli command args
* Fixes FTX trade processing
* Fixes issue where jobs got stuck if data wasn't returned but retrieval was successful
* Improves test speed. Simplifies trade verification SQL. Adds command help
* Fixes the oopsies
* Fixes use of query within transaction. Fixes trade err
* oopsie, not needed
* Adds missing data status. Properly ends job even when data is missing
* errors are more verbose and so have more words to describe them
* Doc regen for new status
* tiny test tinkering
* str := string("Removes .String()").String()
* Merge fixups
* Fixes a data race discovered during github actions
* Allows websocket test to pass consistently
* Fixes merge issue preventing datahistorymanager from starting via config
* Niterinos cmd defaults and explanations
* fixes default oopsie
* Fixes lack of nil protection
* Additional oopsie
* More detailed error for validating job exchange
* Initial codes for a trade tracker
* Moving everything in a broken fashion
* Removes tradetracker. Removes some errors for subsystems
* Cleans up some subsystems, renames stuttering types. Removes some global Bot usage
* More basic subsystem renaming and file moving
* Removes engine dependency from events,ntpserver,ordermanager,comms manager
* Exports eventManager, fixes rpcserver. puts rpcserver back for now
* Removes redundant error message, further removes engine dependencies
* experimental end of day interface usage
* adds ability to build the application
* Withdraw and event manager handling
* cleans up apiserver and communications manager
* Cleans up some start/setup processes. Though should separate
* More consistency with Setup Start Stop IsRunning funcs
* Final consistency pass before testing phase
* Fixes engine tests. Fixes stop nil issue
* api server tests
* Communications manager testing
* Connection manager tests and nilsubsystem error
* End of day currencypairsyncer tests
* Adds databaseconnection/databaseconnection_test.go
* Adds withdrawal manager tests
* Deposit address testing. Moved orderbook sync first as its more important
* Adds test for event manager
* More full eventmanager testing
* Adds testfile. Enables skipped test.
* ntp manager tests
* Adds ordermanager tests, Extracts a whole new subsystem from engine and fanangles import cycles
* Adds websocket routine manager tests
* Basic portfolio manager testing
* Fixes issue with currency pair sync startup
* Fixes issue with event manager startup
* Starts the order manager before backtester starts
* Fixes fee tests. Expands testing. Doesnt fix races
* Fixes most test races
* Resolves data races
* Fixes subsystem test issues
* currency pair syncer coverage tests
* Refactors portfolio. Fixes tests. Withdraw validation
Portfolio didn't need to exist with a portfolio manager. Now the porfolio manager
is in charge how the portfolio is handled and all portfolio functions are attached
to the base instead of just exported at the package level
Withdrawal validation occurred at the exchange level when it can just be run at the
withdrawal manager level. All withdrawal requests go through that endpoint
* lint -fix
* golang lint fixes
* lints and comments everything
* Updates GCT logo, adds documentation for some subsystems
* More documentation and more logo updates
* Fixes backtesting and apiserver errors encountered
* Fixes errors and typos from reviewing
* More minor fixes
* Changes %h verb to %w
* reverbs to %s
* Humbly begins reverting to more flat engine package
The main reasoning for this is that the subsystem split doesn't make sense
in a golang environment. The subsystems are only meant to be used with engine
and so by placing them in a non-engine area, it does not work and is
inconsistent with the rest of the application's package layout.
This will begin salvaging the changes made by reverting to a flat
engine package, but maintaining the consistent designs introduced.
Further, I will look to remove any TestMains and decrease the scope
of testing to be more local and decrease the issues that have been
caused from our style of testing.
* Manages to re-flatten things. Everything is within its own file
* mini fixes
* Fixes tests and data races and lints
* Updates docs tool for engine to create filename readmes
* os -> ioutil
* remove err
* Appveyor version increase test
* Removes tCleanup as its unsupported on appveyor
* Adds stuff that I thought was in previous merge master commit
* Removes cancel from test
* Fixes really fun test-exclusive data race
* minor nit fixes
* niterinos
* docs gen
* rm;rf test
* Remove typoline. expands startstop helper. Splits apiserver
* Removes accidental folder
* Uses update instead of replace for order upsert
* addresses nits. Renames files. Regenerates documentation.
* lint and removal of comments
* Add new test for default scenario
* Fixes typo
* regen docs
* Add initial workflows config
* Add PSQL service
* Add 32bit and frontend jobs
* Add gcc-multilib and fix typo
* Fix backtester test for linux/unix filesystem errors and npm commands
* 32-bit Add -race to purposefully throw an error to ensure envs are set correctly (will revert)
* Revert "32-bit Add -race to purposefully throw an error to ensure envs are set correctly (will revert)"
This reverts commit b97e66c49fca859f8738e01107f96f9ca4040b2e.
* Bump workers count for orderbook processing
* Remove comments to trigger 32-bit cache hit after job success
* Cancel addition plus version bump, spawn more overlords
* Update build badge to Github Actions
* Brach -> Branch
* Add new forex provider ExchangeRateHost.io
* Fix linter paramTypeComine
* Add templates and README files
* Convert all times to UTC
* Fix cosmetic issue and address nits
* Add support for fx exchangerate.host engine override
* Address nit plus use remove plural
* Updates starting and stopping routines to be a bit more parallel with less waiting required
* Removes stop, removes debugging output
* linting and test fixes
* Add extra kill switch for exiting on exchange loading delay
* Fixes fun math
* breaks loop instead of switch. Moves param warns higher
* Removes unceccary gos. passes in cfg to remove data race
* Removes os signal processing. Fixes bad master merge