* 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
* set limiter to first level mock data list and updated unit tests
* address nested slices length limit
* minor fix recording file and update unit tests
* minor updates on unit tests
* re-record mock files and minor fix on the unit tests ti adapt the mock data change
* improve http recording limit value and fix issues with mock data in binance
* added MockDataSliceLimit in request items and resolve minor unit test issues
* resolve missed conflict
* rename mock variables, resolve unit test issues, and other updates
* minor fix to CheckJSON and update unit tests
* minor unit test fix
* further optimization on mock CheckJSON method, unit tests, and re-record poloniex
* common and recording unit tests fix
* minor linter issues fix
* unit tests format fix
* fix miscellaneous error
* unit tests fix and minor docs update
* re-record and reduce mock file size
* indentation fix
* minor assertion test fix
* reverted log.Printf line in live testing
* rename variables
* update NewVCRServer unit test
* replace string comparison with *net.OpError check
* restructur net error test
* exchanges/mock: Remove redundant error assertion message in TestNewVCRServer
---------
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* build/linters: Bump Go to v1.25 and golangci-lint to v2.4.0
* refactor: Update TODO comments for net.Listen and net.DialTimeout; improve variable naming in websocket and exchange methods
* refactor: Rename massageMissingData to backfillMissingData for clarity and update references in RSI and MFI calculations
* fix: Correct typo in TODO comment for net.Listen in RPC server
* 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
* 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
* Websocket: Rename stream package
* Websocket: Rename Websocket to Manager
* Websocket: Replace explicit errs with common.NilGuard
* Websocket: Move websocket_types.go to types.go
* Websocket: Minor field comment and alignment in types
* Webosocket: Rename WebsocketConnection to Connection
* Alphapoint: Make gorilla ws import explicit
Just to avoid confusion with our own packages.
* Websocket: Move stream_match to match
* Websocket: Move websocket_connection to connection
* Websocket: Move websocket.go to manager.go
* Websocket: Break out all subscription methods into subscriptions.go
* Websocket: Move connection type into its file
* Websocket: Remove PositionUpdated
Type is not used anywhere
* Kraken: Use local constant for pong
Was the only use of websocket.Pong and doesn't really feel right to
represent kraken's api resp in one of our packages
* Websocket: Move connection sub-types to connection package
* Websocket: Move manager types into manager
* Websocket: Move ConnectionWrapper into manager
* Websocket: Move websocket_test to manager_test
* Websocket: Privatise connectionWrapper
* Websocket: Remaining types into types.go
These really belong somewhere else mostly, but this will do for now
* Websocket: Tidy up connection method vars
* Gofumpt: Moving package imports around
* Websocket: Rename errDuplicateConnectionSetup
* Websocket: Fix duplicate import of gws
* Websocket: Fix gofumpt -extra
* Websocket: Standardise import of gws across other pkgs
* Kraken: Remove unused sub conf consts
These were replaced by the generic Levels and Depth fields on all subs
* Websocket: Privitise ConnectioWrapper fields
* Websocket: inline single use var WebsocketNotAuthenticatedUsingRest
* Websocket: Move documentation to template
* Bithumb: Assertify TestWsHandleData
* 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
* tag optional sonic and allow full library conversion
* Add workflow and disallow arm and darwin usage
* Add basic hotswap benchmark
* linter: fix
* use bash
* linter: fix?
* Fix whoopsie, add to make file, also add mention in features list.
* test enforcement
* actually read documentation see if this works
* linter: fix
* linter: fix
* sonic: bump tagged version
* encoding/json: drop build tag arch and os filters
* encoding/json: consolidate tests
* encoding/json: log build tag usage
* rm superfluous builds
* glorious/nits: add template change and regen docs
* glorious/nits: update commentary on nolint directive
* glorious/nits: rm init func and log results in main.go
* Test to actually pull flag in
* linter: fix
* thrasher: nits
* gk: nits 4 goflags goooooooooo!
* gk: nits rn
* make sonic default json implementation
* screen 386
* linter: fix
* Add commentary
* glorious: nits Makefile not working
* gk: nits
* gk: nits whoops
* whoopsirino
* mention 32bit systems won't be sonic
* gk: super-duper nit of extremes
---------
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* CI/build: Update Go version, linters and fix minor issues
* Bump golangci-lint to v1.56.1
* BinanceUS: Make uint usage consistent
* Throw blank identifiers into the trash
* fix_communications_authorised_clients
* Telegram: Link config to authorised clients list
* Telegram: Prevent multiple spam messages from unauthed user
* Telegram: Improve command handling for authenticated users
Telegram doesn't allow you to easily fetch the user ID of a user unless they have previously sent you a message and is currently waiting to be processed, or if they message you on the fly once the bot is connected. This ensures that the user ID is stored for future usage upon a single successful auth command.
It also fixes the offset as the previous code wouldn't be able to process incoming messages once connected and instead only relay them.
* Bump docs
* default to UTC time in case bot is run on a server with diff time zones
* Enhance config for already upgraded configs
---------
Co-authored-by: shanhuhai5739 <shanhu5739@gmail.com>
* 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
* 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
* 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
* Speeds up tests
* Reduces time.Sleeps, lowers CreateTestBot complexity. Breaks things
* Removal of unecessary config reads. Parallel tests. Lower times
* Speeds up recent trades results
* mini update
* zoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooom
* Removes the dupes
* Lint
* post cherrypick
* Fix rare kraken data race
* Fixes banking global issues. Fixes postgres trades
* rmline for appveyor test
* Expands timeout in event that channel is closed before send
* Fix data race
* No rows, no bows and definitely no shows
* Removes parallel from createsnapshot tests
* Extends timedmutext test a smidge. Exchange fatality
* Shorter end timeframe and bigger candle
* 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
* 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>
* End of day commit moving packages and setting foundation into how trade processing will go
* Conformity
* tdd candle generation based on received trade data, renames orderbookbuffer back to buffer for now...
* Formalises test functions and designs the trade processor
* Theoretical amending old candles to allow any trades that were part of an old processed candle to be more accurate. Saving of candles will only occur on previous cycles, extending memory usage a bit longer
* Figures out sqlboiler for sqlite. Updates websocket entries to process trade data
* One more trade data
* Adds more exchange support
* Adds PSQL stuff
* Begins creating sql implementation
* End of day commit. Helper functions and understanding sql usage in GCT
* Adds delete and cleans up table design
* Finishes trades conceptually. Awaits candle data update in order to translate trades to candles
* Initial handling of trades in coinbene
* Proto
* Fixing of some bugs, attempting to address coinbene asset type ws issues
* Fixes up coinbene websocket implementation for the most part
* finalises coinbene websocket implementation. Adds new ability to parse currencies without a delimiter
* Implements rpc commands and adds testing
* updates the following to be compatible with trade data update: Theoretical amending old candles to allow any trades that were part of an old processed candle to be more accurate. Saving of candles will only occur on previous cycles, extending memory usage a bit longer
* Changes trade to be its own entity rather than attached to a websocket.
* Adds coverage to trades. Changes signature of `AddTradesToBuffer` to return error. Now automatically shuts down without need for channel listening. Will automatically start up again if it gets data
* Implements trade fetching at the wrapper level for a bunch of exchanges. Adds trade id to script updoot. Probably breaking change
* Implements trade fetching for all wrappers hurray hurrah. Updates all the tests
* Adds new interface func to get recent trades. Ensures GetExchangeHistory continues until conditions are met
* Adds new readme, tests all new wrapper endpoints, updates exchange_wrapper_issues to test new endpoints. Updates exchange_wrapper_coverage with new coverage... Fixes lame bug causing wrapper tests to fail from being poorly setup. Adds loopy loop to ensure that all data is captured when requesting exchange history
* Bugfix on psql migrations. Rebases latest changes, updates table design to use base and quote, updates trades to use exchange_name_id
* Adds new config field for saving trades to the database per exchange. Now exits trade processing when trade saving is not enabled. Similarly for wrapper, does not save if not enabled
* Minor bitfinex trade fixes. continues on buffer processing errors, now saves transactionid to the db
* Adds support for generating candles from candlesextended. May extend it further, idk
* Updates trade candles to be able to fill missing data with trades. Adds more tests. Also does a thing where you can forcefully override a candle based on internal trade data instead of API data
* Fixes bug where force deletions did not follow up with insertions. Adds force to candle commands
* Fixes specific exchange based issues. Extends recent trades to 24 hours where possible
* Fixes issue with saved tests. Fixes tests for trades. Adds parallel to tests. Pre-fixes people's nits
* Adds new GRPC functions to find out what data is missing from trades and candles. Fixes some assumptions from missing period code.
* Adds unique constraint. Fixes up niggling issues for wrappers and websockets
* Fixes issues with using unix times in the database trying to retrieve data via the CLI. Reduces save time to 15 seconds
* Updates trades to use timestamps instead of int64 unix
* Adds missing FTX wrapper implementation. Regens docs
* Linting the linters. Updating readme
* Adds new command to set whether an exchange can process trades
* Doc update
* Adds recent trades and historic trade endpoints to grpc
* formats pair_test.go to appease linter gods
* Addresses data race. Removes logging of missing intervals on unrelated function (now that it has its own rpc command). The buffer time isnt customisable, but I don't feel it needs to be at a config level at all really.
* Fixes a few niterinos regarding spacing, type conversion, a weird Bitmex 0 trade value error, unsubscriptions and cli command references
* Reduces map lookups. Adds base func and moves wrappers to use it
* Uses better currency formatter. Adds time based validation to trade history. Reverts configtest.json
* Reverts config and updates test names. Also WAYYYYY LESS SPAMMY
* oopsie doopsie missed a whoopsie
* mint flavoured lint
* Fixes issues caused by rebase
* Fixes issue with timestamps not converting properly from command to RPCServer. Adds new error type. Adds shorthand entries to some commands. Removes os.Exit from tests. Makes Gemini test rolling. Adds enabled exchange check to RPC function. Escapes timestamp on bitstamp. Renames var
* fixes whoopsie oopsie doopsie I forgot to remove code shoopsie
* missed a line
* 🎉🎉 :tada:Breaks everything in an end of day commit 🎉🎉🎉
* Modifies function 'createlocaloffset' to return a string instead. Uses strings for all time based start and end commands. Uses UTC times in RPC server and updates SQLITE to use formatted time based queries
* Adds concurrency-safe way of changing SaveTradeData and checking it. Fixes embarrassing typo
* End of day fix, adds bitfinex update to loop until either the return trades shows no new dates, or meets specifications. Fixes egregious typo
* Improves testing and handling of historical trades function
* Fixes tests after latest changes
* Fix potential fatal err now that db is enabled in test config now
* Fixes up some database settings to use a local engine instead of global var
* DELICIOUS LINT CHOCOLATE FIXES
* Fixes data race by slashing competitor's tyres
* Adds mock test fixes to allow for live and stored data test
* Removes verbosity in engine level tests. Adds new timezone format to highlight the timezone for RPC functions. Removes reference to Preix index fund
* Oopsie doopsie, fixed a whoopsie
* Loggers can no longer do data drag races on my lawn 👴
* Removes bad lock
* Addresses command nits. End of day conceptual commit, trying to calculate spans of time in the context of missing periods. Tests will fail
* Adds new stream response for retrieving trade history as it can take time to do. Unsuccessfully attempts to simplify time range calculation for missing trades response
* Adds new timeperiods package to calculate time periods, time ranges and whether data is in those ranges. Removes kline basic implementation of same concept
* Fixes lint issues. Fixes test. Moves trade cli commands to their own trade subcommands
* Updates lakebtc to no longer have gethistorictrades as it is unsupported. Adds more validation to rpc functions
* Removes requirement to have trades when testing trade wrapper functions. Doesn't really prove it works if there are no trades for a given currency in a time period.
* Addresses nits, runs linting fix and ensures a test is consistent
* Fix merge issues
* Moves sort to timeperiods. Adds test coverage. Fixes typo
* Removes log package in CLI
* Fixes `GetTrades` url
* Reorders all instances of validation occuring after settingup RPC connection
* Fixes test to ensure that it is setup before testing that it is setup
* Fixed issue with bool retrieval. Removes double append
* Fixes Binance times, fixes bitfinex sell sides, fixes huobi times, sorts all responses
* Fixes poloniex trade id consistency. Makes recent trade for poloniex consistent with others (15 minutes). Fixes coinbene. Fixes localbitcoins to use quote currency. Fixes coinut times. Updates huobi trade id, saves okgroup trades. Fixes bid and ask to buy and sell
* Removes websocket trades for lakebtc as it did not meet our requirements for processing. Adds new constraints to the database to ensure we have uniqueness on trades where ID doesn't exist and doesn't trigger errors for trades where the tid does
* Fixes migration for postgres to downscale properly
* Really really fixes the psql index changes
* Fixes broken tests
* Now with working tests and no pocket lint
* Makes the side column nullable with no more constraint for it. adds migrations and runs generation. comments lakebtc
* Lint & Sprüngli
* Updates zb to use more appropriate side
* Fixes oopsie
* Attempts to address a data race from globals
* Fixes build
* Fixes missed regen rpc files
* Updates readme to point to trade readme. Fixes exchange_wrapper_coverage wrapper count and untested panics, tests bitfinex funding pair test for `fUSD`, adds shiny new param `tradeprocessinginterval`
* mint flavoured lint
* Uses the real default to set the default value by default
* Fixes some extra tests surrounding email sending and number incompatibility
* Reverts test config
* re-adds gom2/usdt currency
* Fixes typo, don't look!
* Fixes minor codelingo pickups
* Adds more precision to handling of trade data from Kraken. Expands test
* interface christmas tree
* lint
* 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
* renamed package to log to stop side import requirement
* reverted comment changes
* reverted comment changes
* one more reverting wording back to logger
* wording changes on comments
* Add exchange manager to engine
* Several improvements for engine and friends
1) New file.Exists func
2) gRPC TLS cert expiration date check and regeneration
3) New donation var for use across the codebase
4) Use Go log package until the logger is initialised
* Add cert tests and create dir tree if it doesn't exist for file.Write
* Link up donation address to documentation tool plus minor adjustments
* Fix remaining donation addrs
* Move non-needed reload exchange funcs
* Revert accidental config_example.json changes 🕯️
* Use go logger for logging until the logger has initiliased, otherwise no output will be seen
* Link up portfolio delay val and other fixes
* Run go mod tidy after dependabot PR
* Address nitterinos
* drop common uuid v4 func and imported package as needed
* removed common functions regarding json marshal and unmarshal and used the json package directly. WRT unmarshal it was calling reflect and converted to string which is also checked in the JSON package so it was doing a double up, this will be a tiny gain as it was directly used in the requester package for all our outbound requests.
* add in string
* explicitly throw away return error value
* atleast return the error that websocket initialise returns
* return error when not connected
* fix comment
* Adds comments
* move package declarations
* drop append whenever we call supported
* remove unused import
* Change incorrect spelling
* fix tests
* fix go import issue
* Add directories to exclusion list && change default repo string
* Add in .idea folder to directory exclusion list
* cleaned
* Added support for calling the tool outside of its file
* fix formatting
* changed strings
* 1) Update Dockerfile/docker-compose.yml
2) Remove inline strings for buy/sell/test pairs
3) Remove dangerous order submission values
4) Fix consistency with audit_events (all other spec files use
CamelCase)
5) Update web websocket endpoint
6) Fix main param set (and induce dryrun mode on specific command line
params)
* Engine QA
Link up exchange syncer to cmd params, disarm market selling bombs and fix OKEX endpoints
* Fix linter issue after merge
* Engine QA changes
Template updates
Wrapper code cleanup
Disarmed order bombs
Documentation updates
* Daily engine QA
Bitstamp improvements
Spelling mistakes
Add Coinbene exchange to support list
Protect API authenticated calls for Coinbene/LBank
* Engine QA changes
Fix exchange_wrapper_coverage tool
Add SupportsAsset to exchange interface
Fix inline string usage and add BCH withdrawal support
* Engine QA
Fix Bitstamp types
Inform user of errors when parsing time accross the codebase
Change time parsing warnings to errors (as they are)
Update markdown docs [with linter fixes]
* Engine QA changes
1) Add test for dryrunParamInteraction
2) Disarm OKCoin/OKEX bombs if someone accidently sets canManipulateRealOrders to true and runs all package tests
3) Actually check exchange setup errors for BTSE and Coinbene, plus address this in the wrapper template
4) Hardcode missing/non-retrievable contributors and bump the contributors
5) Convert numbers/strings to meaningful types in Bitstamp and OKEX
6) If WS is supported for the exchange wrapper template, preset authWebsocketSupport var
* Fix the shadow people
* Link the SyncContinuously paramerino
* Also show SyncContinuously in engine.PrintSettings
* Address nitterinos and use correct filepath for logs
* Bitstamp: Extract ALL THE APM
* Fix additional nitterinos
* Fix time parsing error for Bittrex
* Attempts to update orderbook so it doesn't need to sort
* Reverts the ws ob stuff. Gets rid of sorting because it happens later. Adds some exchange features
* update existing feature lists. Expands list definition to match my emotions
* Adds bithumb bitmex and bitstamp. adds a couple more types
* Features for you, features for me, features for bittrex, btcmarkets, btse, coinbasepro, coinut, exmo, gateio and gemini
* Features for hitbtc, huobi, itbit, kraken, lakebtc, lbank, localbitcoins, okcoin, okex, poloniex, yobit, zb
* Who can forget good old alphapoint?
* Adds btcmarksets websocket :glitch_crab: fixes alphapoint features
* Adds extra data not in the documentation :/
* Replaces websocket features by using protocol features. However, it breaks it due to import cycles. I'm not sure what I'll do just yet
* Removes import cycle via duplicate structs.
* Increases coverage of config with `TestCheckCurrencyConfigValues`. Moves all currency pair package types into their own files or places it at the bottom of files if necessary
* Increase coverage in code.go
* One way of determining a test has failed, is when to it fails. Removed redundant explanation
* Increases code coverage of conversion
* Lint fixes
* Fixes orderbook tests
* Re-adds sorting because its important to still have the internal pre-processed orderbook to be representative of a real orderbook
* Secret lints that did not show up via Windows linting
* Adds protocol package to contain exchange features
* Fixes protocol implementation
* Fixes ws tests
* Addresses the following: Removes st-st-stutters in config types, changes GetAvailableForexProviders -> GetSupportedForexProviders, removes errors from tests where error is nil, removes orderbook setup when not necessary, removes import newlines, removes false bools from declaration, changes should of to should have
* imports and casing
* Fixes two more nil error checks
* Fix bug where on parsing an alternate new config it will overwrite main config.json in gct dir
* Stop movement of config.json file from root dir when a new config is parsed in
* Stop overiding config.json at gct dir with new config.json from root directory
* RM LN :D
* Fix bug where promptforconfig in config_encryption.go overwrites default config
Ensure periphery command packages do not interact or save over configuration
Ensure tests to not save over or change current testdata/config
* Establishes new websocket functionality. Begins the creation of the websocket request
* Adding a wrapper over gorilla websocket connect,send,receive to handle ID messages. Doesn't work
* Successfully moved exchange_websocket into its own wshandler namespace. oof
* Sets up ZB to use a round trip WS request system
* Adds Kraken ID support to subscriptions. Renames duplicate func name UnsubscribeToChannels to RemoveSubscribedChannels. Adds some helper methods in the WebsocketConn to reduce duplicate code. Cleans up ZB implementation
* Fixes double locking which caused no websocket data to be read. Fixes requestid for kraken subscriptions
* Completes Huobi and Hadax implementation. Extends ZB error handling. Adds GZip support for reading messages
* Adds HitBTC support. Adds GetCurrencies, GetSymbols, GetTrades WS funcs. Adds super fun new parameter to GenerateMessageID for Unix and UnixNano
* Adds GateIO id support
* Adds Coinut support. Prevents nil reference error in constatus when there isnt one
* Standardises all Exchange websockets to use the wshandler websocket. Removes the wsRequestMtx as wshandler handles that now. Makes the Dialer a dialer, its not externally referenced that I can see.
* Fixes issue with coinut implementation. Updates bitmex currencies. Removes redundant log messages which are used to log messages
* Starts testing. Renames files
* Adds tests for websocket connection
* Reverts request.go change
* Linting everything
* Fixes rebase issue
* Final changes. Fixes variable names, removes log.Debug, removes lines, rearranges test types, removes order correlation websocket type
* Final final commit, fixing ZB issues.
* Adds traffic alerts where missed. Changes empty struct pointer addresses to nil instead. Removes empty lines
* Fixed string conversion
* Fixes issue with ZB not sending success codes
* Fixes issue with coinut processing due to nonce handling with subscriptions
* Fixes issue where ZB test failure was not caught. Removes unnecessary error handling from other ZB tests
* Removes unused interface
* Renames wshandler.Init() to wshandler.Run()
* Updates template file
* Capitalises cryptocurrencies in struct. Moves websocketResponseCheckTimeout and websocketResponseMaxLimit into config options. Moves connection configuration to main exchange Setup (where appropriate). Reverts currencylastupdated ticks. Improves reader close error checking
* Fixes two inconsistent websocket delay times
* Creates a default variable for websocket ResponseMaxLimit and ResponseCheckTimeout, then applies it to setdefaults and all tests
* Updates exchange template to set and use default websocket response limits
* First pass at adding new logging system
* NewLogger
* NewLogger
* WIP
* silly bug fix
* :D removed files
* removed old logging interface
* added tests
* added tests
* Started to add new lines to all f calls
* Added subsystem log types
* Logger improvements
* Further performance improvements
* changes to logger and sublogger creation
* Renamed Logging types
* removed old print statement
* changes based on feedback
* moved sublogger types to own file
* :)
* added console as output type
* added get level command
* added get/set log level via grpc command
* added check for output being empty for migration support
* first pass at log rotation
* added log rotation
* :D derp fixed
* added tests
* changes based on feedback
* changed log type
* comments
* renamed file -> fileSettings
* typo fix
* changes based on feedback
* gofmt ran on additional files
* gofmt ran on additional files