* Bybit: Fix race in TestUpdateAccountInfo and TestWSHandleData
* DriveBy rename TestWSHandleData
* This doesn't address running with -race=2+ due to the singleton
* Accounts: Add account.GetService()
* exchange: Assertify TestSetupDefaults
* Exchanges: Add account.Service override for testing
* Exchanges: Remove duplicate IsWebsocketEnabled test from TestSetupDefaults
* Dispatch: Replace nil checks with NilGuard
* Engine: Remove deprecated printAccountHoldingsChangeSummary
* Dispatcher: Add EnsureRunning method
* Accounts: Move singleton accounts service to exchange Accounts
* Move singleton accounts service to exchange Accounts
This maintains the concept of a global store, whilst allowing exchanges
to override it when needed, particularly for testing.
APIServer:
* Remove getAllActiveAccounts from apiserver
Deprecated apiserver only thing using this, so remove it instead of
updating it
* Update comment for UpdateAccountBalances everywhere
* Docs: Add punctuation to function comments
* Bybit: Coverage for wsProcessWalletPushData Save
* codebase: Remove web frontend and related services
* refactor: Update StartPPROF to accept context and adjust related tests
* refactor: Simplify SetIfZero functions and update related tests
* config: Clarify DowngradeConfig method documentation regarding permanent removal of deprecated fields
* refactor: Rename setIfZeroAndWarn to setDefaultIfZeroWarn for clarity and update related calls
* refactor: Update error handling in DataHistoryManager and remove redundant error variable
* docs: Create new CODING_GUIDELINES doc
Rids excess contribution instructions from other packages
Adds AGENTS.md file for the AI overlords
Rids unused templates
Updates ADD_NEW_EXCHANGE.md with minor fixes
* docs: Fix linter issues and minor adjustments based on Copilot feedback
* docs: Update coding guidelines for API parameters and testing practices
* docs: Remove redundant GoDoc references
Adds copilot-instructions.md
* docs: Update CODING_GUIDELINES with export recommendations and test commentary
* docs: Fix formatting inconsistencies in ADD_NEW_EXCHANGE.md links
* docs: Update struct naming conventions for request and response types
* docs: Improve clarity and consistency in ADD_NEW_EXCHANGE.md and CODING_GUIDELINES.md
* refactor: Simplify error handling in QueryOrder method
* codebase: Rid base64/hex to string common funcs
* codebase: Rid local scope variable usage and other improvements
* codebase: Refactor currency pair usage across multiple exchanges
- Updated HitBTC tests to use the new currency pair format.
- Modified Kraken futures types to use currency.Pair instead of string for Symbol.
- Adjusted Kraken wrapper methods to handle currency pairs correctly.
- Refined OKX tests and types to utilize currency.Pair for instrument IDs.
- Enhanced Poloniex tests to consistently use predefined currency pairs.
- Streamlined order and orderbook tests to replace string pairs with currency.NewBTCUSD().
- Improved Yobit tests to utilize a standardized currency pair format.
- Updated validator wrapper to use currency pairs directly instead of string conversions.
* codebase: Use types.Number where possible
* refactor: update PayoutFee type to types.Number for consistency
* Refactor: Remove crypto functions to use standard library and other minor changes
- Removed custom crypto functions for SHA256, SHA512, and MD5 from the common/crypto package.
- Replaced usages of removed functions with standard library implementations in various files including:
- cmd/websocket_client/main.go
- engine/apiserver.go
- exchanges/kraken/kraken.go
- exchanges/lbank/lbank.go
- exchanges/okx/okx_business_websocket.go
- exchanges/kucoin/kucoin_websocket.go
- gctscript/vm/vm.go
- Updated tests to reflect changes in the crypto functions.
- Renamed several functions for clarity, particularly in the context of order book updates across multiple exchanges.
* refactor: replace assert with require for consistency in test assertions
* refactor: Improve Binance futures candlestick test, standardise orderbook update function names and improve test parallelism
* refactor: Replace require.Len with require.Equal for better output in TestGetFuturesKlineData
* tests: Replace !errors.Is(err, target) with testify equivalents
* codebase: Manual !errors.Is(err, target) replacements
* typo: Replace errMisMatchedEvent with errMismatchedEvent
* tests: Enhance error messages for better output
* tests: Refactor error assertions in various test cases to use require and improve clarity
* misc linter: Fix assert should wording
* tests: Simplify assertions in TestCreateSignals for clarity and conciseness
* tests: Enhance assertion message in TestCreateSignals
* GHA, tests: Add additional checks for common issues
These checks include:
- Ensuring that all testify funcs use their formatted variants (e.g., `assert.Equalf(t, expected, actual)` instead of `assert.Equal(t, expected, actual)`).
- Replacing `%s` with %q
- Enforcing consistent usage of should/must wording for testify assert/require messages
* Add support for checking backticked string format specifiers and fix issues
* tests: Fix error comparisons
* tests: Replace errors.Is(err, nil) usage with testify and automate check
* refactor: Rename ExtractPort to ExtractPortOrDefault
* tests: Replace assert with require for error handling in multiple test files
* tests: Replace assert with require for error handling and improve assertions in data tests
* tests: Fix typo in assertion message for StreamVol test
* OKX: Fix GetOpenInterestAndVolumeStrike test with instrument selection and improved assertions
* OKX: Revert intentional error check
* Improve error message for expiry time check in GetOpenInterestAndVolumeStrike test
* Improve credential handling and error reporting
Swapped out empty credential returns with more specific errors to make things clearer and avoid weird behavior. Added safeguards to handle nil credentials in WebSocket data processing. This gives us better error handling and more reliable fallback options when managing credentials.
* Rewrite gctwrapper test assertions to use substring matching instead of exact string matching
This prevents test failures caused by minor error message formatting changes
* Correct mutex use in GetCredentials
Move mutex from local credentials copy to shares resource access
We were locking the mutex when modifying a local copy instead of when reading from shared credentials
Moved RLock/RUnlock to wrap b.API.credentials access remoived the unnecessary locks when changing the local copy
Reduce lock contention and fix potential race conditions
* Replace test assertions with testify/require package in gctwrapper_test.go
* remove unnecesarry mutex locks in GetCredentials and fix test
* credentials test use require.ErrorIs
* Fix: improve credential handling in BTCMarkets websocket
* Refactor error messages and improve test assertions
* Update exchanges/credentials.go
* Update gctscript/wrappers/gct/gctwrapper_test.go
* credentials: Remove redundant comment for sub account override
---------
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Tests: Use currency.NewUSD and NewUSDT
Simple refactor to use the provided shortcut methods
* Github: Add CI check to ensure NewPair not used
Add a step to ensure NewPair(BTC, USD*) isn't used
* golangci-lint: Enable usetesting and unused linters
* tests: Improve assertions in various test cases for clarity and accuracy
* tests: Enhance error assertions in TestExecuteStrategyFromFile for improved clarity
* tests: Update assertions for improved clarity and accuracy
* tests: Replace assert with require for task count checks
* config/versions/v7: Replace context.Background() with t.Context()
* Bithumb: Centralise and consoliate testPair, relax UpdateTickers check
with some glorious Doom Eternal music
* Bithumb: Use UpdatePairsOnce and update remaining pair string
* Bithumb: Add UpdatePairsOnce to TestUpdateTickers
* modernise: Run new gopls modernise tool against codebase
* Address shazbert's nits
* apichecker, gctcli: Simplify HTML scraping functions and improve depth limit handling
* refactor: Create minSyncInterval const and update order book limit handling for binance and binanceUS
* refactor: Various slice usage improvements and rename TODO
* tranches: Revert deleteByID changes due to performance decrease
Shazbert was a F1 driver in a past lifetime 🏎️
* tranches: Simply retrieve copy
Thanks to shazbert
* documentation: Sort contributors list by contributions
* tranches: Remove deadcode in deleteByID
* Config: Move assetEnabled upgrade to Version management
* Assets: Do not error on asset not enabled, or disabled
This became more messy with Disabling something that's defaulted to
disabled.
Taking an idealogical stance against erroring that what you want to have
done is already done.
* CurrencyManager: Set AssetEnabled when StorePairs(enabled)
* RPCServer: Fix tests expecting StoreAssetPairFormat to enable the asset
Also assertifies
* Bitfinex: Fix tests for MarginFunding subs
* GCTWrapper: Improve TestMain clarity
* BTSE: Add futures to testconfig
* Exchanges: Rename StoreAssetPairStore
Previously we were calling it "Format", but accepting everything from
the PairStore.
We were also defaulting to turning the Asset on.
Now callers need to get their AssetEnabled set as they want it, so
there's no magic
This change also moves responsibility for error wrapping outside to the
caller.
* Config: AssetEnabled upgrade should respect assetTypes
Previously we ignored the field and just turned on everything.
I think that was because we couldn't get at the old value.
In either case, we have the option to do better, and respect the
assetEnabled value
* Config: Improve exchange config version upgrade error messages
* build/ci: Update Go to v1.24, golangci-lint to v1.64.5 and fix issues
* Address shazbert's nitters
* linter/config: Fix new linter issue and use versionSize const
* Address gk's nitters and fix additional linter issue after rebase
* Address glorious nits
* staticcheck: Fix additional linter issues after upgrading to Go 1.24.1 and golangci-lint v1.64.6
Also addresses nits
* Improve testing, assertify usage and use common.ErrParsingWSField
* TestCreateNewStrategy: Replace must > should wording
* add fixes and test
* glorious: nits, privatise upper case field, add item field for case sensitivity for format checks, rm dead code.
* fix potential panic
* gk/glorious: nits
* gk: nits and other things
* improve commentary lol
* glorious+gk: nits and improvements (with no sillyness this time)
* Update currency/pairs.go
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* thrasher: nitssssss
* linter: fix
* bye bye silly boy
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* CI/build: Update Go version, linters and fix minor issues
* linters: Add intrange, copyloopvar, additional go vet linters to match gopls and fix issues
* initial purge and benchmarks proof before rn overhaul
* rn LinkedList -> Tranche(s) and purge references
* roll out acrost exchanges
* linterino
* rn silly billy label
* linter strikes AAAAAGAIN!
* fix some things
* rm comment
* Add actual comparison from master to branch benchmark for sorting algorithms
* lower case via git mv YAAY!
* drop code
* convert type name
* glorious: nits
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* Shift wrapper function GetDefaultConfig to exchange.Base method definition, to ensure set defaults doesn't get called twice and to reduce code
* rm alphapoint bootstrap method as is defined as exchange.Base method
* add tests
* glorious: make it a function and make it IBOTEXCHANGE
---------
Co-authored-by: shazbert <ryan.oharareid@thrasher.io>
* Exchanges: Remove Pair upgrade handling
Now redundant behind #1401. These paths should never be met.
Several legacy coin upgrade paths being deprecated as well: ZUSD and CNY
Expecting any users with bad config from 3+ years ago would have to
reset anyway.
Also: At the time the intention of this was to upgrade the config
format.
However now, instead, it'd mostly serve to reset enabled pairs if
there's a config mistake, which doesn't feel right.
* Kraken: Fix typo in Kraken type struct
* Exchanges: Abstract exchange Start() and Run()
* Exchanges: Add test for abstracted Start
* Exchanges: Move Start to Bootstrap
* Simplify waitgroup usage
* Add call to exchange.Bootstrap to allow overide or supplementation
* Exchanges: Concurrent common bootstap actions
* Gateio: Remove incorrect Run in test
* GateIO: Fix pair dependencies in tests
This ensures that the pairs are initialised no more than needed and
kind-of just-in-time.
Better pattern might be to use a function to get these pairs when we
need them.
* Exchanges: Complete UpdatePairs before ExecLims
If we're going to update pairs, it needs to complete before we check for
limits to avoid errors on old pairs
* Exchanges: Remove Start and Run from tmpl
Since they're replaced by bootstrap now and shouldn't need customisation
normally
* Alphapoint: Move Start to Bootstrap
* GateIO: Fix linter shadow var
* 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>
* 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
* 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>
* 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>
* 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
* implements futures functions and GRPC functions on new branch
* lint and test fixes
* Fix uneven split pnl. Adds collateral weight test. docs. New clear func
* Test protection if someone has zero collateral
* Uses string instead of double for accuracy
* Fixes old code panic
* context, match, docs
* Addresses Shazniterinos, var names, expanded tests
* Returns subaccount name, provides USD values when offlinecalc
* Fixes oopsie
* Fixes cool bug which allowed made up subaccount results
* Subaccount override on FTX, subaccount results for collateral
* Strenghten collateral account info checks. Improve FTX test
* English is my first language
* Fixes oopsies
* Adds some conceptual futures order details to track PNL
* Initial design of future order processing in the backtester
* Introduces futures concept for collateral and spot/futures config diffs
* Fixes most tests
* Simple designs for collateral funding pair concept
* Expands interface use so much it hurts
* Implements more collateral interfaces
* Adds liquidation, adds strategy, struggles with Binance
* Attempts at getting FTX to work
* Adds calculatePNL as a wrapper function and adds an `IsFutures` asset check
* Successfully loads backtester with collateral currency
* Fails to really get much going for supporting futures
* Merges master changes
* Fleshes out how FTX processes collateral
* Further FTX collateral workings
* hooks up more ftx collateral and pnl calculations
* more funcs to flesh out handling
* Adds more links, just can't fit the pieces together :(
* Greatly expands futures order processing
* Fleshes out position tracker to also handle asset and exchange +testing
* RM linkedOrderID. rn positioncontroller, unexport
* Successfully tracks futures order positions
* Fails to calculate PNL
* Calculates pnl from orders accurately with exception to flipping orders
* Calculates PNL from orders
* Adds another controller layer to make it ez from orderstore
* Backtester now compiles. Adds test coverage
* labels things add scaling collateral test
* Calculates pnl in line with fees
* Mostly accurate PNL, with exception to appending with diff prices
* Adds locks, adds rpc function
* grpc implementations
* Gracefully handles rpc function
* beautiful tests!
* rejiggles tests to polish
* Finishes FTX testing, adds comments
* Exposes collateral calculations to rpc
* Adds commands and testing for rpcserver.go functions
* Increase testing and fix up backtester code
* Returns cool changes to original branch
* end of day fixes
* Fixing some tests
* Fixing tests 🎉
* Fixes all the tests
* Splits the backtester setup and running into different files
* Merge, minor fixes
* Messing with some strategy updates
* Failed understanding at collateral usage
* Begins the creation of cash and carry strategy
* Adds underlying pair, adds filldependentevent for futures
* Completes fill prerequsite event implementation. Can't short though
* Some bug fixes
* investigating funds
* CAN NOW CREATE A SHORT ORDER
* Minor change in short size
* Fixes for unrealised PNL & collateral rendering
* Fixes lint and tests
* Adds some verbosity
* Updates to pnl calc
* Tracks pnl for short orders, minor update to strategy
* Close and open event based on conditions
* Adds pnl data for currency statistics
* Working through PNL calculation automatically. Now panics
* Adds tracking, is blocked from design
* Work to flesh out closing a position
* vain attempts at tracking zeroing out bugs
* woww, super fun new subloggers 🎉
* Begins attempt at automatically handling contracts and collateral based on direction
* Merge master + fixes
* Investigating issues with pnl and holdings
* Minor pnl fixes
* Fixes future position sizing, needs contract sizing
* Can render pnl results, focussing on funding statistics
* tracking candles for futures, but why not btc
* Improves funding statistics
* Colours and stats
* Fixes collateral and snapshot bugs
* Completes test
* Fixes totals bug
* Fix double buy, expand stats, fixes usd totals, introduce interface
* Begins report formatting and calculations
* Appends pnl to receiving curr. Fixes map[time]. accurate USD
* Improves report output rendering
* PNL stats in report. New tests for futures
* Fixes existing tests before adding new coverage
* Test coverage
* Completes portfolio coverage
* Increase coverage exchange, portfolio. fix size bug. NEW CHART
* WHAT IS GOING ON WITH PNL
* Fixes PNL calculation. Adds ability to skip om futures tracking
* minor commit before merge
* Adds basic liquidation to backtester
* Changes liquidation to order based
* Liquidationnnnnn
* Further fleshes out liquidations
* Completes liquidations in a honorable manner. Adds AppendReasonf
* Beginnings of spot futures gap chart. Needs to link currencies to render difference
* Removes fake liquidation. Adds cool new chart
* Fixes somet tests,allows for zero fee value v nil distinction,New tests
* Some annoying test fixes that took too long
* portfolio coverage
* holding coverage, privatisation funding
* Testwork
* boring tests
* engine coverage
* More backtesting coverage
* Funding, strategy, report test coverage
* Completes coverage of report package
* Documentation, fixes some assumptions on asset errors
* Changes before master merge
* Lint and Tests
* defaults to non-coloured rendering
* Chart rendering
* Fixes surprise non-local-lints
* Niterinos to the extremeos
* Fixes merge problems
* The linter splintered across the glinting plinths
* Many nits addressed. Now sells spot position on final candle
* Adds forgotten coverage
* Adds ability to size futures contracts to match spot positions.
* fixes order sell sizing
* Adds tests to sizing. Fixes charting issue
* clint splintered the linters with flint
* Improves stats, stat rendering
* minifix
* Fixes tests and fee bug
* Merge fixeroos
* Microfixes
* Updates orderPNL on first Correctly utilises fees. Adds committed funds
* New base funcs. New order summary
* Fun test updates
* Fix logo colouring
* Fixes niteroonies
* Fix report
* BAD COMMIT
* Fixes funding issues.Updates default fee rates.Combines cashcarry case
* doc regen
* Now returns err
* Fixes sizing bug issue introduced in PR
* Fixes fun fee/total US value bug
* Fix chart bug. Show log charts with disclaimer
* sellside fee
* fixes fee and slippage view
* Fixed slippage price issue
* Fixes calculation and removes rendering
* Fixes stats and some rendering
* Merge fix
* Fixes merge issues
* go mod tidy, lint updates
* New linter attempt
* Version bump in appveyor and makefile
* Regex filename, config fixes, template h2 fixes
* Removes bad stats.
* neatens config builder. Moves filename generator
* Fixes issue where linter wants to fix my spelling
* Fixes pointers and starts
* orders: deprecate SubmitResponse return and change to *order.Detail construct detail from order.Submit struct
* orders: add coverage, fix tests
* coinut: rm test for checking
* orders: revert change for return and change field ID to a more explicit name OrderID
* orders: Add method to see if the order was placed
* order: change field name in Cancel type to be more explicit
* orders: standardize field -> OrderID
* backtester: populate change
* orders: add test
* gctscript: fix field name
* linter: fix issues
* linter: more fixes
* linter: forever
* exchanges_tests: populate order.Submit field exchange name
* Update exchanges/order/order_types.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update exchanges/order/orders.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits
* glorious: nits
* thrasher: nits
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* order: slight optimizations
* orders: add benchmarks, small optimize and change order side to uin8 for comparitive optimizations.
* orders: continue to convert string type -> uint
* orders/backtester: interim move type to orders package, later can expand or deprecate.
* orders: handle errors
* orders: optimize filters and remove error returns when its clearly not needed
* orders: remove log call
* backtester: zero value check
* orders/futures: zero value -> flag
* linter: fix
* linter: more fixes
* linters: rides again
* glorious: nits
* common: Add zero value unix check for time values; also addresses glorious nits
* glorious scott: nits
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* 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
* implements futures functions and GRPC functions on new branch
* lint and test fixes
* Fix uneven split pnl. Adds collateral weight test. docs. New clear func
* Test protection if someone has zero collateral
* Uses string instead of double for accuracy
* Fixes old code panic
* context, match, docs
* Addresses Shazniterinos, var names, expanded tests
* Returns subaccount name, provides USD values when offlinecalc
* Fixes oopsie
* Fixes cool bug which allowed made up subaccount results
* Subaccount override on FTX, subaccount results for collateral
* Strenghten collateral account info checks. Improve FTX test
* English is my first language
* Fixes oopsies
* Fixes for unrealised PNL & collateral rendering
* Fixes lint and tests
* Shaznit fixes
* Secret Shaznit
* Updates account information across wrappers to include more fields
* Updates online collateral calculations. Updates RPC data
* Accurately calculates collateral offline and online minus testing
* Tests and lint chocolate
* Simplifies accountinfo results
* Fixes shaznits
* Adds new func
* Increases collateral accuracy again again again x 200
* Increases accuracy of collateral rendering
* Fixes minor merge/test issues
* Linterino
* Fixes ws test. Improves collateral calculations and rendering
* Make it prettier
* Removes the lock I put on 👀
* Adds `additional_collateral_used` field, renders orig currency
* Fixes unrelated test
* Fix test
* Correctly calculate spot margin borrow collateral
* Address fun lint surprise
See https://github.com/golangci/golangci-lint/issues/741#issuecomment-1017014331
* Strange lint fixing x2
* Continued lint journey
* Nolint the nolint to not lint the lint
* Adds two new fields to response
* More linting issues arising
* fIX3s_c4s|NG
* Fixes command flags' incorrect numbering
* FairMarket = Won
* 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>