* don't need to verify if checksum available; don't retroactively verify snapshots
* glorious: nits + allow checksum/validation to be done on updateByIDAndAction
* possible slice manipulation issue fix for test
* thrasher: nit
* this should fix it now
* for subsystem usage disallow deploying a book twice
* reverts strict policy using deploy, it's used in a bunch of tests I don't want to touch just yet, left a note
* rm unused variable
* glorious: nits
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* Bybit: Subscription configuration for spot
* Bybit: Enable candles ws sub by default
* Orderbook: Use a RW mutex for depth
* Orderbook: Fix race on depth.VerifyOrderbook
Despite being protected by an ob level mutex, this needed to privatise
and protect the option var.
* CI/build: Update Go version, linters and fix minor issues
* linters: Add intrange, copyloopvar, additional go vet linters to match gopls and fix issues
* Add in extra field for colocation monitoring
* rm tags
* populate through gateio orderbooks
* populate through incremental updates
* Add insert at field for orderbook depth
* I AM A BAD SPELLLLLLA
* add it in
* c change
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* Currency: Variadic Pairs.Add
This version of Pairs.Add is simpler and [more
performant](https://gist.github.com/gbjk/06a1fc1832d04ee41213ca518938cf74)
Behavioural difference: If there's nothing to add, the same slice is
returned unaltered. This seems like good sauce
* Currency: Variadic Remove
* Common: Add Batch function
* Common: Add common.SortStrings for stringers
* Subscriptions: Add batching to templates
* Subscriptions: Sort list of pairs
* Kucoin: Switch to sub templating
* Kucoin: Simplify channel prefix usage
* Kucoin: Fix race on fetchedFuturesOrderbook
* Subscriptions: Filter AssetPairs
Now only the assetPairs relevant to the subscription are in the context
* Subscriptions: Respect subscription Pairs
* Subscriptions: Trim AssetSeparator early
We want to trim before checking for "AssetSeparator vs All" because a
template should be allowed to reuse a range template and generate just one trailing AssetSeparator
whilst using a specific Asset
* Kucoin: Fix empty margin asset added
* Kucoin: Add Subscription batching
Turns out that contary to the documentation, kucoin supports batching of
all symbols and currencies
* Kucoin: Fix checkSubscriptions and coverage
* Subscriptions: Simplify error checking
This reduces the complexity of error checking to just be "do we get the
correct numbers".
Fixes Asset.All with only one asset erroring on xpandPairs, because we
trimmed the only asset separator, and then errored that we're not
xpanding Assets and the asset on the sub is asset.All
This use-case conflicted with commit 6bbd546d74, which required:
```
Subscriptions: Trim AssetSeparator early
We want to trim before checking for "AssetSeparator vs All" because a
template should be allowed to reuse a range template and generate just one trailing AssetSeparator
whilst using a specific Asset
```
Now we set up the assets earlier, and we remove the check for xpandAssets, since the number of asset lines matching is all that matters.
I've removed the asset tests for this, but they were correctly erroring
on the number of asset lines instead.
Everything hits coverage, as well.
* Kucoin: Remove deprecated fundingBook endpoint
* BTCMarkets: Use common.Batch
* 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>
* Orderbook: Fix test failures on different arch
Fixes floating point inaccuracies on different architectures
Moves the depth tests over to table driven tests
* Kline: Fix test failures on different arch
* moves everything to use single map keys, also breaks
* full rollout
* tests
* fix a little bug
* minor test fixups
* Fix Key use
* rm 🔑 from 🔑 struct name
* orderbook: Check assignment of time values and reject if not set.
* linter: fix
* buffer: additional linter winter fixter
* Implement through pending exchanges
* finished push
* linty: minty
* gomod: tidy
* thrasher: nits
* glorious: nits
* orderbook: purge type now in favour of external call allocation
* orderbook: push last param
* orderbook: only 1 unlock call is needed
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* Orderbook: Add GetDepth to Base
Base.GetDepth returns the concrete book of which Base is a copy
This is probably useful for immutably monitoring orderbook health and state
whereas FetchOrderbook would trigger a refresh.
* Orderbook: Reword GetDepth comment
* Orderbook: Add test for Base.GetDepth
* kraken: fix websocket orderbook processing
* kraken: clean
* glorious: nits also add todo
* more: add required checksum to TODO for future, move variable to top
* glorious: get mad
* orderbook: fix retrieve issue
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* initial concept of a nice validation tester for exchanges
* adds some datahandler design
* expand testing
* more tests and fixes
* minor end of day fix for bithumb
* fixes implementation issues
* more test coverage and improvements, but not sure if i should continue
* fix more wrapper implementations
* adds error type, more fixes
* changes signature, fixes implementations
* fixes more wrapper implementations
* one more bit
* more cleanup
* WOW things work?
* lintle 1/1337
* mini bump
* fixes all linting
* neaten
* GetOrderInfo+ asset pair fixes+improvements
* adds new websocket test
* expand ws testing
* fix bug, expand tests, improve implementation
* code coverage of a lot of new codes
* fixes everything
* reverts accidental changes
* minor fixes from reviewing code
* removes Bitfinex cancelBatchOrder implementation
* fixes dumb baby typo for babies
* mini nit fixes
* so many nits to address
* addresses all the nits
* Titlecase
* switcheroo
* removes websocket testing for now
* fix appveyor, minor test fix
* fixes typo, re-kindles killed kode
* skip binance wrapper tests when running CI
* expired context, huobi okx fixes
* kodespull
* fix ordering
* time fix because why not
* fix exmo, others
* hopefully this fixes all of my life's problems
* last thing today
* huobi, more like hypotrophy
* golangci-lint, more like mypooroldknee-splint
* fix huobi times by removing them
* should fix okx currency issues
* blocks the application
* adds last little contingency for pairs
* addresses most nits and new problems
* lovely fixed before seeing why okx sucks
* fixes issues with okx websocket
* the classic receieieivaier
* lintle
* adds test and fixes existing tests
* expands error handling messages during setup
* fixes dumb okx bugs introduced
* quick fix for lint and exmo
* fixes nixes
* fix exmo deposit issue
* lint
* fixes issue with extra asset runs missing
* fix surprise race
* all the lint and merge fixes
* fixes surprise bugs in OKx
* fixes issues with times and chains
* fixing all the merge stuff
* merge fix
* rm logs and a panic potential
* lovely lint lament
* an easy demonstration of scenario, but not of initial purpose
* put it in the bin
* Revert "put it in the bin"
This reverts commit 15c6490f713233d43f10957367fcbf18e3818bdd.
* re-add after immediate error popup
* fix mini poor test design
* okx okay
* merge fixes
* fixes issues discovered in lovely test
* I FORGOT TO COMMIT THIS
* nit fixaroonaboo
* forgoetten test fix
* revert old okx asset intrument work
* fixes
* revert problems I didnt understand. update bybit
* fix merge bugs
* test cleanup
* further improvements
* reshuffle and lint
* rm redundant CI_TEST by rm the CI_TEST field that is redundant
* path fix
* move to its own section, dont run on 32 bit + appveyor
* lint
* fix lbank
* address nits
* let it rip
* fix failing test time range
* niteroo boogaloo
* mod tidy, use common.SimpleTimeFormat
* bitfinex: filter security pairs from spot trading
* asset: add securities type
* bitfinex: remove print
* linter: fix
* gomod tidy
* glorious: nits
* bitfinex: just some orderbook fun and added a pass through for bitfinex funding rate when rate == 0
* bitfinex: move update function from testmain to localised test
* test: fix up
* glorious:nits
* bitfinex; fix casing test
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* orderbook/buffer: data integrity and resubscription pass
* btcmarkets: REMOVE THAT LIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIINE!!!!!!!!!!!!!!!!!
* buffer: reinstate publish, refaactor, invalidate more and comments
* buffer/orderbook: improve update and snapshot performance. Move Update type to orderbook package to util. pointer through entire function calls. (cleanup). Change action string to uint8 for easier comparison. Add parsing helper. Update current test benchmark comments.
* dispatch: change publish func to variadic id param
* dispatch: remove sender receiver wait time as this adds overhead and complexity. update tests.
* dispatch: don't create pointers for every job container
* rpcserver: fix assertion issues with data publishing change
* linter: fixes
* glorious: nits addr
* depth: change validation handling to incorporate and store err
* linter: fix more issues
* dispatch: fix race
* travis: update before fetching
* depth: wrap and return wrapped error in invalidate call and fix tests
* btcmarkets: fix commenting
* workflow: check
* workflow: check
* orderbook: check error
* buffer/depth: return invalidation error and fix tests
* gctcli: display errors on orderbook streams
* buffer: remove unused types
* orderbook/bitmex: shift function to bitmex
* orderbook: Add specific comments to unexported functions that don't have locking require locking.
* orderbook: restrict published data functionality to orderbook.Outbound interface
* common: add assertion failure helper for error
* dispatch: remove atomics, add mutex protection, remove add/remove worker, redo main tests
* dispatch: export function
* engine: revert and change sub logger to manager
* engine: remove old test
* dispatch: add common variable ;)
* btcmarket: don't overflow int in tests on 32bit systems
* ci: force 1.17.7 usage for go
* Revert "ci: force 1.17.7 usage for go"
This reverts commit af2f95563bf218cf2b9f36a9fcf3258e2c6a2d91.
* golangci: bump version add and remove linter items
* Revert "golangci: bump version add and remove linter items"
This reverts commit 3c98bffc9d030e39faca0387ea40c151df2ab06b.
* dispatch: remove unsused mutex from mux
* order: slight optimizations
* nits: glorious
* dispatch: fix regression on uuid generation and input inline with master
* linter: fix
* linter: fix
* glorious: nit - rm slice segration
* account: fix test after merge
* coinbasepro: revert change
* account: close channel instead of needing a receiver, push alert in routine to prepare for waiter.
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
* btcmarkets: add websocket checksum, fetch different book via REST
* Update exchanges/btcmarkets/btcmarkets_test.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* buffer: add explicit type for buffer related variables and comments, do all checks buffer side and load in setup as per glorious recom.
* buffer: fix tests add error
* buffer: test re-add code cov
* depth/stream/ws: fix tests, change field name to be more specific.
* buffer: rm unused field and small comment fixes
* btcm: remove redundant field
* glorious: nits
* buffer: fix commenting
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* 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>
* 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
* gct: phase one context awareness pass
* exchanges: context propagation pass
* common/requester: force context requirement
* gctcli/exchanges: linter fix
* rpcserver: fix test using dummy rpc server
* backtester: fix comments
* grpc: add correct cancel and timeout for commands
* rpcserver_test: add comment on dummy server
* common: deprecated SendHTTPGetRequest
* linter: fix
* linter: turn on no context check
* apichecker: fix context linter issue
* binance: use param context
* common: remove checks as this gets executed before main
* common: change mutex to RW as clients can be used by multiple go routines.
* common: remove init and JIT default client. Unexport global variables and add protection.
* common: Add comments
* bithumb: after dinner mints fix
* [FIX] Enable ws orderbook sync recovery by:
- Testing if books have been cleared
- Assigning options when loading snapshot
* orderbooks: remove setlastupdate method and on select depth method that updates linked list, this reduced lock contention across code base and fixes buffer bug on applying buffered updates
* WS - Introduce signaling for the need to fetch the orderbook
* Address nits
* Update error messages to include exchange name
Co-authored-by: shazbert <oharareid.ryan@gmail.com>
* Fixed issues that led to incorrect partially-cancelled status
* Fixes all compatibleOrderVars args.Adds tests.Allow Offline fee testing
Co-authored-by: Mark Dzulko <mark@dzulko-clan.de>
* 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
* improved functions and new helper functions
* bitfinex margin info func
* small rate change
* rate changes
* adding some currencies for margin funding translation
* adding index candles
* added test
* slight improvement in params
* time func
* orderbook helper avgprice func
* broken test + removing some tlogs and prints
* adding test cases
* error fix
* remove unused
* another unused
* shazbert changes
* wip
* bitfinex func and more nits
* final shazzy nits
* most shazzy nits
* few prior requested changes
* shazbert nits final WIP
* shazbert changes
* minor linter issue
* unused val
* glorious changes
* more verbositiy improvements
* quick changes
* unused remaining amount oops
* thrasher changes
* reverting changes that were only for testing purposes and bymistake pushed up
* bfx shadow dec + huobi fetch tradable pairs formatted so as to return config format for ease of comparison and requests
* more linters
* glorious final nits wip
* formatting tradable pairs for different asset types + remove println
* glorious changes
* 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
* Exchanges: Initial implementation after rebase of depth (WIP)
* orderbook/buffer: convert and couple orderbook interaction functionality from buffer to orderbook linked list - Use single point reference for orderbook depth
* buffer/orderbook: conversion continued (WIP)
* exchange: buffer/linkedlist handover (WIP)
* Added some tests for yesterday
* linkedList: added more testing and trying to figure out broken things
* Started tying everything in
* continuous integration and testing
* orderbook: expanded tests
* go mod tidy
* Add in different synchornisation levels for protocols
Add in timer for the streaming system to reduce updates to datahandler
Add in more test code as I integrate more exchanges
* Depth: Add tests, add length check to call linked list updating, add in constructor.
Linked List: Improve tests, add in checks for zero liquidity on books.
Node: Added in cleaner POC, add in contructor.
Buffer: Fixed tests, checked benchmarks.
* orderbook: reinstate dispatch calls
* Addr glorious & madcozbad nits
* fix functionality and add tests
* Address linterinos
* remove label
* expanded comment
* fix races and and bitmex test
* reinstate go routine for alerting changes
* rm line :D
* fix more tests
* Addr glorious nits
* rm glorious field
* depth: defer unlock to stop deadlock
* orderbook: remove unused vars
* buffer: fix test to what it should be
* nits: madcosbad addr
* nits: glorious nits
* linkedlist: remove unused params
* orderbook: shift time call to outside of push to inline, add in case for update inster price for zero liquidity, nits
* orderbook: nits addressed
* engine: change stream -> websocket convention and remove unused function
* nits: glorious nits
* Websocket Buffer: Add verbosity switch
* linked list: Add comment
* linked list: fix spelling
* nits: glorious nits
* orderbook: Adds in test and explicit time type with constructor, fix nits
* linter
* spelling: removed the dere fence
* depth: Update alerting mechanism to a more battle tested state
* depth: spelling
* nits: glorious nits
* linked list: match cases
* buffer: fix linter issue
* golangci: increase timeout by 30 seconds
* nodes: update atomic checks
* spelling: fix
* node: add in commentary
* exchanges/syncer: add function to switch over to REST when websocket functionality is not available for a specific asset type
* linter: exchange linter issues
* syncer: Add in warning
* nits: glorious nits
* AssetWebsocketSupport: unexport map
* Nits: Adrr
* rm letter
* exchanges: Orderbook verification change for naming, deprecate checksum bypass as it has the potential to obfuscate errors that are at the tail end of the book, add in verification for websocket stream updates
* general: fix spelling remove breakpoint
* nits: fix more glorious nits until more are found
* orderbook: fix tests
* orderbook: fix wait tests and add in more checks
* nits: addr
* orderbook: remove dispatch reference
* linkedlist: consolidate bid/ask functions
* linked lisdt: remove words
* fix spelling
* Backtester: event handler completed, basic back tester support is working
* Backtester: support for ticker data added, general code clean up, start of risk & size manageR
* Backtester: WIP
* Me: I am going to write tests and comment as I go this time, also me: doesn't write any tests or comments as i go
* Backtester: work on orderbook system to track orders, increased test coverage
* Backtester: further test coverage, output json, start of js chart output
* Backtester: test coverage, output strat name
* Backtester: WIP
* WIP backtest charts
* WIP on template
* Backtester: further test coverage added
* Backtester: WIP
* backtester: attempting easier to read template for backtesting output
* comments, and tests
* Backtester: end of day WIP started work on risk management for handling leveraged positions
* Backtester: WIP
* Backtester: started heavy documentation phase for handover
* Backtester: started heavy documentation phase for handover
* Backtester: further comments, also work on making chart solution modular to allow for usage outside backtester (e.g OHCLV data)
* Backtester: CHART LIBRARY
* Backtester: move backtester over to new chart library
* Backtester: removed old chart templates, template updates
* Chart: add advancedintervaldata, convert from stats -> chart
* Chart: gctscript hookup to generate chart from OHLCV data
* Chart: reworked template to load from generated data if no template path is set
* chart: template wip
* correclty generate backtester readme, readme generation for charts, chart data generation
* Removed old read file methods
* Removed chart library from backtest as its now standalone
* Remove reference to unfinish TA code. Removes value calculation from order signal. It belongs with portfolio signal
* regen
* Re-jiggles everything around to not have import cycle issues and makes it look like a normal application
* End of day commit creates a new function to setup a backtester from a settings struct. Doesn't work though lol
* Builds up more backtest work to allow to be run from the command line
* Regen RPC
* End of day mind mine field of RSI calculation5
* Finishes basic main.go application
* Minor updates while theorising
* Rearranging things like the size and data types. Adds portfolio setup like a normal human. Allows positions to be decimal based since this is for CRYPTOCURRENCIES :o
* Moves code around to related positions. Adds compatibility to ordermanager to handle order submission. Fails to do things
* End of day commit. Adding config based loading for indiviual strats. Attempting to allow for multiple cps per strategy as well as loading fees
* End of day commit. Expanding config definition and loading implementation. Attempting to setup backtester wide multi currency support in a strategy.
* Moves risk, attempts to revert multi currency, but also supports more in depth multi currency for later...... in the portfolio
* End of day commit for realsies. Updates the strat and sets the invalid backtester
* No more panics. Finishes config loading. Renames buyandhold to dollarcostaverage
* Extends strategy to include a reason why its performing an action. Adds 420blazeit.strat. Expands statistics output. Moves folders around some more. Reduces amount of processing when "DO NOTHING" is the direction
* Commit before home time. Looks to expand the order manager to cater to the backtester. Fleshes out risk manager to think about leverage and holdings in other currencies
* Some basic expanding of strategy definitions. Changes weird package naming.
* Expands size and risk validations. Expands config settings for the validation. Starts looking at loading from live data source
* Merge branch 'master' into backscratcher
* Work towards having backtester load data
* Adds support and tests for all data source loading except for LIVE
* Some basic additions looking to append to data streams instead of load all at once, for the purpose of live data analysis
* End of day commit where I broke functions
* Adds live backtesting
* Adds FANCY MATHS to correctly size orders before slippage. Rearranges minmaxing in config and strats
* Prints out initial settings. Creates a lame slippage calculator. Ensures that order price/amounts respect OHLCV data. Adds customisable config variables that can influence a strategy
* Fixes minor issues with rendering. Fixes portfolio buying and selling now
* ALL OVER THE PLACE END OF DAY COMMIT! In order to expand stats, thing must be tracked appropriately, which they arent. Here we add the addition of a compliance.go to track orders specifically. This will allow for the holdings manager to keep track of base stats such as how much we hold versus whats in use along with profits Compliance holds snapshots of every tick and what orders were there across exchanges. Also added a random slippage calculator which will allow a user to set their own slippage rates
* Another fun end of day commit where nothing works. In order to have accurate stats, you need accurate positions, to have accurate positions you need to break things down to individual levels and store them. This is part of that process of ensuring that we can have multiple settings and everything processed appropriately.
* Finalises multi currency config and support at most levels with exception to data loading.
Simplifies some struct property definitions by removing redundancy
Allows tracking of entire portfolio snapshots after each interval to track the entire process
Lowercases use of exchange names
* Sets the different prices to track across time. Attempts to sort out compliance snapshots
* end of day commit. Moving compliance to the portfolio to manager and track all transactions at each interval.
* Moves compliance calculation to portfolio.go. Adds a nice little decorator on the compliance manager orders to keep track of slippage, cost basis, volume adjusted price and close price. Moves "positions" to "hodlings" to be more accurate. Ensures exchange value calculations are accurate. Begins looking at Statistics and hodlings
* Moves statistics to eventhandlers. Removes ticker work as not needed. Redefines hodler properties
* hodlings are actually part of the portfolio
* Renamed 420blazeit.strat file. Renamed hodlings to holdings. Moved Datahandler to data_types.go. Expanded holdings calculations, doesn't work, but we're getting somewhere. Renamed bad var names in backtest.go. Added new order side types to highlight lack of action reasons
* Adds tests for holdings to ensure that holding snapshot calculation is accurate for the length of a strategy. Removes portfolio.Funds because its now handled via the holdings snapshots. Adds helper functions to Holding snapshots to retrieve relevant holdings. Updates sizing calculation to properly handle sell events. Expands holdings definitions to allow for comparison. Expands risk calculations to include holding snapshots so as to analyse all positions simultaneously
* Changing the statistics results to consider all datas, with the ultimate goal to replace the current statistics package with this multi currency output
* Made "Why" more generic. Expands statistics output. Removes time tying to stats map. Moves order event to correct location. Removes some debug lines.
* Adds some raw funky drawdown statistics 🎉
* End of day commit. experimentation leaves little code changes
* An attempt at expanding statistics. Need to have ones dedicated to exchange, asset, pair. Early work for having global map to track all the asset things to minimise all the maps throughout the application
* 🎉 ADDS MULTI CURRENCY SUPPORT TO FOR THE BACKTESTER 🎉 Can either execute strategies by assessing multiple currencies individually, or as a group and make strategic decisions on what currency to signal in. Adds new strat files to demonstrate
* End of day shenanigans. Moving codes around, making more fun stats. Expanding DCA strat to check if DCA is better than the market longer term
* Adds sharpe ratio and total stats for final output if more than one currency is considered
* Adds sortino ratio and test for validation
* Adds information ratio
* Adds calmar ratio
* Adds CAGR
* Slims down the statistics file to only include my work. Updates everything to use interfaces rather than direct code references to make it easier to swap out codes. Begins looking at serialising statistics for reports
* More neatening. Removal of old FAKE tests. Can now output a report in JSON
* End of day commit. Creation of reporting. Uses tradingview charting library and some basic bootstrap CDN to render content nicely. Will be updating everything to have a special kline item to annotate chart results
* Minor formatting changes before all the reviews
* End of day commit. Expands reporting to have an enhanced candle. These candles contain metadata on whether an order has been placed and to mark charts appropriately. This will be expanded to have all the stats and make it pretty
* Extra code I forgot to commit!
* Fixes an issue where data cannot render above 1,100 candles by stopping it from rendering more than that..
* End of day commit. There is no inclusivity with candle requests and I cant figure it out right now.
* Fixes issue with missing data by adding events when data isnt present and classifying it. Adds new way for klines to verify data with a bit more clarity
* Completes report generation
* Improves cagr. removes butts. Replaces old kline function with new supercalc
* Adds readme templates and files across whole backtester. Renames 420rsi to more appropriate name. Moves interfaces to common
* Some extra documentation
* New header
* Adds some nice coverage to backtest.go. Updats readmes to use new backtester header template
* End of day crappy test commit
* Adds report coverage... Somewhat. Adds template path and output path to allow custom properties and easier testing. Fixes interface duplication
* Adds some lame tests.
* Fixes test
* Adds coverage to the exchange event handler
* Minor test changes
* Fixes slippage calculations based on buying and selling. Adds more tests to compliance and holdings
* Rejiggles risk assessment to properly consider leverage if it were ever to be implemented fully. Removes bot dependency and adds coverage to the risk package
* Expands coverage to sizing
* Rejiggles code to add coverage for the portfolio package and its compatriots.
* Adds additional testing to the backtester along with some data gathering tests
* Tried and failed attempt to expand testing for the database.
* Adds testing for kline, data, statistics
* into the 70%s of coverage! Adds tests for base, DCA, statistics
* Adds test coverage of strategies
* Adds test coerage to statistics. updates template generation to not require CurrencyStatistics to have EAP. Removes EAP from currencystatistics
* Adds coverage to currencystatistics.go BUT ITS NOT COMPLETE
* 86% coverage wow. Fixes 2 tests
* Fixes data races due to engine dependency craziness. Changes order manager to not have a global dependency
* Completes currencystatistics test coverage
* Some linting fixes
* Adds new documentation to the bakctester config. Updates how risk leverage/ratios work with a single map.
* Minor documentation changes. Its difficult to describe how it all works
* Redefines strats and strat tests. Adds some really light documentation
* Updates some basic documentation.
* Fixes lazy bugs
* Fixes bug in fill event processing. Fixes bug in statistics crashing. Fixes report generation. Fixes multi-currency processing to still process non-errored signals
* More documentation.
* Fixes ALL LINTING ISSUES
* Cuts off unnecessary limbs/interface functions. linting. Adding comments to all functions. Adding ability to use whalebomb to calculate slippage for live orders. Adds testing for it too. Simplifies adding events to statistics.
* Removes a weird overlap of holding features that made no sense and the writer of those functions should be ASHAMED. Adds additional documentation
* Fixes issue with data being outside ranges. Adds some extra validation to areas where people can mess around. Makes generating configs easier with consistent dates. Adds more documentation. Cleans up okex/okcoin implementation to some functions since people aren't understanding that they share a based okgroup and that anything that is the same between two functions only needs to be written once...................... Also fixes some bad gct script code
* Updated image and slight change to readme
* Removes unused code. Fixes up verbose and removes old comment
* Fixes issues with data validation for other data sources. Fixes bad reference in template
* Fixes missing data problem for last candle considered missing. Fixes issue where fill order crashes when sizing error occurs. Adds documentation
* Fixes issue with drawdown calculations. Fixes live data usage
* Adds some comments for good measure
* Default strat fix
* Fixes surprise linting issues
* gofmt
* New linting issue with every commit
* Fixes testing. Adds new config setting to set a custom gocryptotrader config path. Updates config tests to use dryrun. Results now include the nickname in the file for easier identification
* Fixes live testing bitstamp. Fixes some template issues. Adds comments.
* Updates max drawdown calculation to go peak vs trough. Fixes minor return issue. Removes unnecessary Data implementations. Removes weird verbose false. Fixes holdings calculations for boughtvalue. Removes Swingholder and just uses Swing. Fixes time calculation issue in kline
* End of day commit that breaks things. Fixes issue with documentation generation only going one space deep. Adds exchange name to warnings of missing candle data. Renames missing candle data function. Adds some testing to kline functions. Adds new ability to size modified orders to portfolio allowance. Addresses defer close and other small nits. Fixes slow loop
* End of day commit. There are too many mini changes to list. DateType to int. Default switch case. Returning earlier. Nil returns instead of ok. High low price in data, now used in max drop down. Missing data shown in the report.
* End of day commit moving things from stats to maths.
* Move the rest to math package and add testing
* Ammends slippage calculations for live. Adds sizing funds to order event. Improves CAGR calculation
* Mini fix commit for test
* End of day mini change for documentation
* Fixes in documentation and expanded error messages. Pretties up the report
* minor adjustments to sharpe ratio and other ratio calculations
* Fixes test by taking it out back. linting
* Fixes tests
* Fixes some tests, addresses some poor nits
* More test and lint fixes
* Fixes binance translation issue
* Further craziness into reducing the concurrent test issues
* lint
* Mini fix
* Geometric average added and tested. Adjusts application to support it. End of day experiementation with negative geometric mean. Fixes typo in currencystatistics package name
* Fixes geometric calculation. Adds sweet CMD logo
* fixes geometric mean 😆 can now disable logo output if you hate everything good in life
* lint
* Should fix test in appveyor by not being nil
* Fixes chance of getting no trades error. Maybe making nil events in the test will stop this poorly formed appveyor error
* Forgotten Y tail
* Check-ch-check-check-check-ch-check it out, minimising stutter is what its all about... Also provides more verbose error messages
* de-ooopsies the whoopsie
* Attempts to further address race issues when using global logs during start stop process
* Includes a copy of the logger itself when logging so that no log.Debug action can create a data race upon being changed globally
* Reduces bot usage further
* Removes sharpie from b-acktester
* comments, renames and bears, oh my!
* Fixes git merge issues/tests. Splits average calculation into their own functions. Clarifies math function and sell position comments. Removes taker fee from final report. Adds warning when maker and taker aren't appropriately set. Fixes config testing issue where the config was saved when running exchange_template tests. Adds new test to ensure the testconfig isn't changed unnecessarily
* More why to reason
* Remove test due to hash discrepancy.
* Updates maths to use errors. Updates tests to support it.
* Fixes error handling for some packages. Uses position value instead of position size. Fixes leverage ratio work. Removes extra binance windows
* Removes references to "multi currency" to shiny new verbiage "simultaneous processing"
* Fixes issue with extra data be appended and then declared missing
* Removes redundant code via code removal
* Does a larger transition to using error types. Addresses math related nits
* eat a mint while you lint
* Completes err definition sweep
* replaces over 80 instances of the same typo!
* Renames more properties with Maximum ratios. Adds examples to config readme. Updates config maker takers. Adds cool kline error
* Adds 'InclusiveEndDate' config property to API and Database datas. Adds testing for it. Updates readme for it
* splint
* Minor naming fix. Minor drawdown fix. Attempts to lower the bot usage when heaps of candles are requested.
* Large data set processing improvements
* Speeds up backtesting processing. Ensures rate limits are set
Processing of most events is done in a linear fashion. So functions that
relied on checking an events time for example, will now check the latest
before processing every interval. The functions will still work normally
in the event that someone wishes to use them out of order, but for
general backtesting, it greatly speeds up all processing.
Further, rather than comparing times all the time, I've introduced
offsets for comparisons of ints for events and with candle data tests
* Fixes build issue
* Adds committed funds stat. Adds config goal
Committed funds are calculated as the total amount of money currently in position
It allows for a strategist to get the maximum returns for the smallest funds
The goal function is to allow a strategist to set a goal description
* Fixes data race
* Adds unfinished config builder application
* End of day broken commit
I focussed on too many things at once and there are many things left to resolve
* Fixees panics
* Finishes config builder
* Fixes order manager start/stop. Improves config manager
* Fixes writefile reference
* Adds some extra readme
* Makes a more user friendly config builder. Fixes initial nil. Adds more order size reasons
* lint
* Adds warnings for when data is missing and ratios will be skewed
* bodMISSED bodmas
* Does not consider initial entry in performance calculations
Adds strategy description field
Adds cost basis to chart
Fixes time rendering on default configs
* Fixes bug in ratio calculations
* saveConfig := !(!false != !true) == true
* lint
* Fixes start end single day drawdowns. Expands cmd drawdown explanation
* Comment on rounding, updated report rounding
* Addresses readme link issues
* Actually fixes readme references
* Should truly solve readme links....
* Includes filename for report log
* Fixes panics, reduces csv trade candle size, no more science
* Removes more science
* test123
* Adds extra config validation
* Fixes the date validation
* Shows smaller fees
* Changes perfectly cromulent error message to start >= end
Co-authored-by: Andrew Jackson <andrew@disvelop.net>
* Exchanges: Add config variable to set bypassing of orderbook verification
* Exchanges: Consolidate orderbook variables into config struct
* Exchanges: Addr nit; set verification bypass on websocket book implementations
* Exchanges: Bypass websocket book validation on exchanges when checksum is implemented, fix FTX test, go mod tidy
* Orderbook: Change orderbook base field name
* port orderbook binance management from draft singular asset (spot) processing add additional updates to buffer management
* integrate port
* shifted burden of proof to exchange and remove repairing techniques that obfuscate issues and could caause artifacts
* WIP
* Update exchanges, update tests, update configuration so we can default off on buffer util.
* Add buffer enabled switching to all exchanges and some that are missing, default to off.
* lbtc set not aggregate books
* Addr linter issues
* EOD wip
* optimization and bug fix pass
* clean before test and benchmarking
* add testing/benchmarks to sorting/reversing functions, dropped pointer to slice as we aren't changing slice len or cap
* Add tests and removed ptr for main book as we just ammend amount
* addr exchange test issues
* ci issues
* addr glorious issues
* Addr MCB nits, fixed funding rate book for bitfinex and fixed potential panic on nil book return
* addr linter issues
* updated mistakes
* Fix more tests
* revert bypass
* Addr mcb nits
* fix zero price bug caused by exchange. Filted out bid result rather then unsubscribing. Updated orderbook to L2 so there is no aggregation.
* Allow for zero bid and ask books to be loaded and warn if found.
* remove authentication subscription conflicts as they do not have a channel ID return
* WIP - Batching outbound requests for kraken as they do not give you the partial if you subscribe to do many things.
* finalised outbound request for kraken
* filter zero value due to invalid returned data from exchange, add in max subscription amount and increased outbound batch limit
* expand to max allowed book length & fix issue where they were sending a zero length ask side when we sent a depth of zero
* Updated function comments and added in more realistic book sizing for sort cases
* change map ordering
* amalgamate maps in buffer
* Rm ln
* fix kraken linter issues
* add in buffer initialisation
* increase timout by 30seconds
* Coinbene: Add websocket orderbook length check.
* Engine: Improve switch statement for orderbook summary dissplay.
* Binance: Added tests, remove deadlock
* Exchanges: Change orderbook field -> IsFundingRate
* Orderbook Buffer: Added method to orderbookHolder
* Kraken: removed superfluous integer for sleep
* Bitmex: fixed error return
* cmd/gctcli: force 8 decimal place usage for orderbook streaming
* Kraken: Add checksum and fix bug where we were dropping returned data which was causing artifacts
* Kraken: As per orderbook documentation added in maxdepth field to update to filter depth that goes beyond current scope
* Bitfinex: Tracking down bug on margin-funding, added sequence and checksum validation websocket config on connect (WIP)
* Bitfinex: Complete implementation of checksum
* Bitfinex: Fix funding book insertion and checksum - Dropped updates and deleting items not on book are continuously occuring from stream
* Bitfinex: Fix linter issues
* Bitfinex: Fix even more linter issues.
* Bitmex: Populate orderbook base identification fields to be passed back when error occurrs
* OkGroup: Populate orderbook base identification fields to be passed back when error occurrs
* BTSE: Change string check to 'connect success' to capture multiple user successful strings
* Bitfinex: Updated handling of funding tickers
* Bitfinex: Fix undocumented alignment bug for funding rates
* Bitfinex: Updated error return with more information
* Bitfinex: Change REST fetching to Raw book to keep it in line with websocket implementation. Fix woopsy.
* Localbitcoins: Had to impose a rate limiter to stop errors, fixed return for easier error identification.
* Exchanges: Update failing tests
* LocalBitcoins: Addr nit and bumped time by 1 second for fetching books
* Kraken: Dynamically scale precision based on str return for checksum calculations
* Kraken: Add pair and asset type to validateCRC32 error reponse
* BTSE: Filter out zero amount orderbook price levels in websocket return
* Exchanges: Update orderbook functions to return orderbook base to differentiate errors.
* BTSE: Fix spelling
* Bitmex: Fix error return string
* BTSE: Add orderbook filtering function
* Coinbene: Change wording
* BTSE: Add test for filtering
* Binance: Addr nits, added in variables for buffers and worker amounts and fixed error log messages
* GolangCI: Remove excess 0
* Binance: Reduces double ups on asset and pair in errors
* Binance: Fix error checking
* Adds mock testing to ZB
* STEALS improved time validation code from the original STOLEN validation code :D
* Mini fixes from review
* happy fun comment stealing
* Moves the loop checker earlier to ensure no double appendages
* Fixes sneaky test
* Fixes the important part where mock tests work instead of live tests
* Skips authenticated endpoints for mock testing.
* lint
* Updates candle wrapper functions to respect design
* basic linting fix
* Reverts configtest.json, updates readme to be way better, adds coverage to validateCandlesRequest
* Tiniest grammatical fix
* Fixes more outdated code references
* Closing out a high
* Fixes spacing
* Replaces all instances of 4 spaces in tmpl files with a tab
* fixes spacing and tab related readme issues once and for all 🤞
* tidy
* indentation violation identification situation
* Kraken - wsProcessOrderBook, the method was returning wrong bids data
* additional map check to prevent panic
* linter issue fix
* The RPC method GetOrderbook has a race condition and causes panic - refactored and speed up
* The method Retrieve (package orderbook) now return pointer of a copy of s.Books[exchange][p.Base.Item][p.Quote.Item][a].b
* using extra var to optomize code
* bids and asks slices filling optimisation
Co-authored-by: Vazha Bezhanishvili <vazha.bezhanishvili@elegro.eu>