* implements futures functions and GRPC functions on new branch
* lint and test fixes
* Fix uneven split pnl. Adds collateral weight test. docs. New clear func
* Test protection if someone has zero collateral
* Uses string instead of double for accuracy
* Fixes old code panic
* context, match, docs
* Addresses Shazniterinos, var names, expanded tests
* Returns subaccount name, provides USD values when offlinecalc
* Fixes oopsie
* Fixes cool bug which allowed made up subaccount results
* Subaccount override on FTX, subaccount results for collateral
* Strenghten collateral account info checks. Improve FTX test
* English is my first language
* Fixes oopsies
* Adds some conceptual futures order details to track PNL
* Initial design of future order processing in the backtester
* Introduces futures concept for collateral and spot/futures config diffs
* Fixes most tests
* Simple designs for collateral funding pair concept
* Expands interface use so much it hurts
* Implements more collateral interfaces
* Adds liquidation, adds strategy, struggles with Binance
* Attempts at getting FTX to work
* Adds calculatePNL as a wrapper function and adds an `IsFutures` asset check
* Successfully loads backtester with collateral currency
* Fails to really get much going for supporting futures
* Merges master changes
* Fleshes out how FTX processes collateral
* Further FTX collateral workings
* hooks up more ftx collateral and pnl calculations
* more funcs to flesh out handling
* Adds more links, just can't fit the pieces together :(
* Greatly expands futures order processing
* Fleshes out position tracker to also handle asset and exchange +testing
* RM linkedOrderID. rn positioncontroller, unexport
* Successfully tracks futures order positions
* Fails to calculate PNL
* Calculates pnl from orders accurately with exception to flipping orders
* Calculates PNL from orders
* Adds another controller layer to make it ez from orderstore
* Backtester now compiles. Adds test coverage
* labels things add scaling collateral test
* Calculates pnl in line with fees
* Mostly accurate PNL, with exception to appending with diff prices
* Adds locks, adds rpc function
* grpc implementations
* Gracefully handles rpc function
* beautiful tests!
* rejiggles tests to polish
* Finishes FTX testing, adds comments
* Exposes collateral calculations to rpc
* Adds commands and testing for rpcserver.go functions
* Increase testing and fix up backtester code
* Returns cool changes to original branch
* end of day fixes
* Fixing some tests
* Fixing tests 🎉
* Fixes all the tests
* Splits the backtester setup and running into different files
* Merge, minor fixes
* Messing with some strategy updates
* Failed understanding at collateral usage
* Begins the creation of cash and carry strategy
* Adds underlying pair, adds filldependentevent for futures
* Completes fill prerequsite event implementation. Can't short though
* Some bug fixes
* investigating funds
* CAN NOW CREATE A SHORT ORDER
* Minor change in short size
* Fixes for unrealised PNL & collateral rendering
* Fixes lint and tests
* Adds some verbosity
* Updates to pnl calc
* Tracks pnl for short orders, minor update to strategy
* Close and open event based on conditions
* Adds pnl data for currency statistics
* Working through PNL calculation automatically. Now panics
* Adds tracking, is blocked from design
* Work to flesh out closing a position
* vain attempts at tracking zeroing out bugs
* woww, super fun new subloggers 🎉
* Begins attempt at automatically handling contracts and collateral based on direction
* Merge master + fixes
* Investigating issues with pnl and holdings
* Minor pnl fixes
* Fixes future position sizing, needs contract sizing
* Can render pnl results, focussing on funding statistics
* tracking candles for futures, but why not btc
* Improves funding statistics
* Colours and stats
* Fixes collateral and snapshot bugs
* Completes test
* Fixes totals bug
* Fix double buy, expand stats, fixes usd totals, introduce interface
* Begins report formatting and calculations
* Appends pnl to receiving curr. Fixes map[time]. accurate USD
* Improves report output rendering
* PNL stats in report. New tests for futures
* Fixes existing tests before adding new coverage
* Test coverage
* Completes portfolio coverage
* Increase coverage exchange, portfolio. fix size bug. NEW CHART
* WHAT IS GOING ON WITH PNL
* Fixes PNL calculation. Adds ability to skip om futures tracking
* minor commit before merge
* Adds basic liquidation to backtester
* Changes liquidation to order based
* Liquidationnnnnn
* Further fleshes out liquidations
* Completes liquidations in a honorable manner. Adds AppendReasonf
* Beginnings of spot futures gap chart. Needs to link currencies to render difference
* Removes fake liquidation. Adds cool new chart
* Fixes somet tests,allows for zero fee value v nil distinction,New tests
* Some annoying test fixes that took too long
* portfolio coverage
* holding coverage, privatisation funding
* Testwork
* boring tests
* engine coverage
* More backtesting coverage
* Funding, strategy, report test coverage
* Completes coverage of report package
* Documentation, fixes some assumptions on asset errors
* Changes before master merge
* Lint and Tests
* defaults to non-coloured rendering
* Chart rendering
* Fixes surprise non-local-lints
* Niterinos to the extremeos
* Fixes merge problems
* The linter splintered across the glinting plinths
* Many nits addressed. Now sells spot position on final candle
* Adds forgotten coverage
* Adds ability to size futures contracts to match spot positions.
* fixes order sell sizing
* Adds tests to sizing. Fixes charting issue
* clint splintered the linters with flint
* Improves stats, stat rendering
* minifix
* Fixes tests and fee bug
* Merge fixeroos
* Microfixes
* Updates orderPNL on first Correctly utilises fees. Adds committed funds
* New base funcs. New order summary
* Fun test updates
* Fix logo colouring
* Fixes niteroonies
* Fix report
* BAD COMMIT
* Fixes funding issues.Updates default fee rates.Combines cashcarry case
* doc regen
* Now returns err
* Fixes sizing bug issue introduced in PR
* Fixes fun fee/total US value bug
* Fix chart bug. Show log charts with disclaimer
* sellside fee
* fixes fee and slippage view
* Fixed slippage price issue
* Fixes calculation and removes rendering
* Fixes stats and some rendering
* Merge fix
* Fixes merge issues
* go mod tidy, lint updates
* New linter attempt
* Version bump in appveyor and makefile
* Regex filename, config fixes, template h2 fixes
* Removes bad stats.
* neatens config builder. Moves filename generator
* Fixes issue where linter wants to fix my spelling
* Fixes pointers and starts
* orders: deprecate SubmitResponse return and change to *order.Detail construct detail from order.Submit struct
* orders: add coverage, fix tests
* coinut: rm test for checking
* orders: revert change for return and change field ID to a more explicit name OrderID
* orders: Add method to see if the order was placed
* order: change field name in Cancel type to be more explicit
* orders: standardize field -> OrderID
* backtester: populate change
* orders: add test
* gctscript: fix field name
* linter: fix issues
* linter: more fixes
* linter: forever
* exchanges_tests: populate order.Submit field exchange name
* Update exchanges/order/order_types.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* Update exchanges/order/orders.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits
* glorious: nits
* thrasher: nits
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* orders: Add derive modify struct method to order.Detail and then subsequent method to derive and standardize response details
* exchanges: call modify method in wrappers
* linter: fixes
* engine/wsroutineman: remove print summary
* glorious: nits, removed modifyOrder functionality for Bithumb. There are not docs to support this.
* Update exchanges/order/orders.go
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* glorious: nits
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
* orders: add method to Limit to retrieve order execution limit snapshots
* currency/btcmarkets: add error and update field name to standard
* linter: fix
* limts: don't return pointer
* limit: Add notes
* glorious: nits
* linter: fix
* limit: reinstate nil check
* exchanges: change field names to be more consistent (@thrasher-) suggestion
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* exchange/wrapper: expose GetCredentials func to IBotInterface
* exchanges: split up GetAuthenticatedAPISupport into specific function calls, organize IBotExchange functionality getter functions
* interface: change name - RPCSercer: rm GetBase func call.
* glorious: nits (fix panic)
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* ordermanager: fix residual test issue from #917 and reduce some racey action
* glorious: nits; also removed functions that weren't being used and were unexported
* rm: pew
* linter: fix issues
* glourious: nits
* credentials: fix test issue with racey racey horse basey
* order: slight optimizations
* orders: add benchmarks, small optimize and change order side to uin8 for comparitive optimizations.
* orders: continue to convert string type -> uint
* orders/backtester: interim move type to orders package, later can expand or deprecate.
* orders: handle errors
* orders: optimize filters and remove error returns when its clearly not needed
* orders: remove log call
* backtester: zero value check
* orders/futures: zero value -> flag
* linter: fix
* linter: more fixes
* linters: rides again
* glorious: nits
* common: Add zero value unix check for time values; also addresses glorious nits
* glorious scott: nits
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* 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>
* implements futures functions and GRPC functions on new branch
* lint and test fixes
* Fix uneven split pnl. Adds collateral weight test. docs. New clear func
* Test protection if someone has zero collateral
* Uses string instead of double for accuracy
* Fixes old code panic
* context, match, docs
* Addresses Shazniterinos, var names, expanded tests
* Returns subaccount name, provides USD values when offlinecalc
* Fixes oopsie
* Fixes cool bug which allowed made up subaccount results
* Subaccount override on FTX, subaccount results for collateral
* Strenghten collateral account info checks. Improve FTX test
* English is my first language
* Fixes oopsies
* Fixes for unrealised PNL & collateral rendering
* Fixes lint and tests
* Shaznit fixes
* Secret Shaznit
* Updates account information across wrappers to include more fields
* Updates online collateral calculations. Updates RPC data
* Accurately calculates collateral offline and online minus testing
* Tests and lint chocolate
* Simplifies accountinfo results
* Fixes shaznits
* Adds new func
* Increases collateral accuracy again again again x 200
* Increases accuracy of collateral rendering
* Fixes minor merge/test issues
* Linterino
* Fixes ws test. Improves collateral calculations and rendering
* Make it prettier
* Removes the lock I put on 👀
* Adds `additional_collateral_used` field, renders orig currency
* Fixes unrelated test
* Fix test
* Correctly calculate spot margin borrow collateral
* Address fun lint surprise
See https://github.com/golangci/golangci-lint/issues/741#issuecomment-1017014331
* Strange lint fixing x2
* Continued lint journey
* Nolint the nolint to not lint the lint
* Adds two new fields to response
* More linting issues arising
* fIX3s_c4s|NG
* Fixes command flags' incorrect numbering
* FairMarket = Won
* backtester/request: trying to fix panic (WIP)
* request: fix race for transport layer
* request: linter issue fix
* request: more linter issues
* requester: Add function to remove the tracking of underlying http client and add to engine unload exchange.
* request: add more context to error return
* request: Fix after cherry pick issues
* request: fix niterinos
* exchanges: change return to package variable
* request: changed named
Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
* 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>
As per Huobi Futures documentation, client order id must be an
integer field in the request. For most other exchanges this is a string
field so to accomodate we keep the string representation and convert
to a number right before the request goes on the wire.
* log: fix bugs expand coverage and optimise
* log: fix linter issues
* log: fix linter issue and pack methods in same file
* log: drop defer
* logger: move global check inside getfields and remove unused test function
* logger: Increase note thanks @gloriouscode
* logger: wrap error with writer type
* logger: change variable name
* logger: change variable names and remove validsublogger func as it doesn't add functionality over a standard map call
* logs: error when unsupported output is applied on setup calls
* logs: add glorious suggestion
* logger: add protection to reduce olympic gold medal races
* logger: fix linter issues
* log: glorious niterinos
* cmd/tools/exchange: fix regression and implement reflection so as this can dynamically scale to our interface
* exchanges: add comment and fix whoopsie
* exchanges: fix linter issues
* wrapper_cov_tool: add actual full interface method count to get a better perceived deployment
* exchanges/tool: addr glorious nits
* kraken: remove string in test
* exchange_template_tool: fix tmpl issue
* exchanges/binance: proper arguments order when calling Binance.FuturesNewOrder
* exchanges/binance: adapt FuturesOrderPlaceData (+ unmarshaling) to latest coin/delivery futures API
* exchanges/binance: introduce futuresNewOrderRequest and use it to pass order parameters for coin margined futures
* exchanges/binance: test json unmarshaling of FuturesOrderPlaceData
* exchanges/binance: reorder fields as per docs, include missing fields (also in tests)
* exchanges/binance/coinm: use constants instead of hard coded strings (also fixes linting)
* exchanges/binance/coinm: pass futuresNewOrderRequest by reference
* exchanges/binance/coinm: expose FuturesNewOrderRequest
* exchanges/binance/coinm: do not explicitly assign default values fields of FuturesNewOrderRequest
* exchanges/binance/coinm: document FuturesNewOrderRequest
* exchanges/binance/coinm: expose all fields of FuturesNewOrderRequest
* exchanges/binance/coinm: expose fields of FuturesNewOrderRequest
* exchange/binance/coin: order submission: add support for priceProtect
Co-authored-by: Yordan Miladinov <jordanmiladinov@gmail.bg>
* Initial concept for creating price tracking pairs
* Completes coverage, even with a slow test
* I dont know what point to hook this stuff up
* Bit of a broken way of handling tracking pairs
* Correctly calculates USD rates against all currencies
* Removes dependency on GCT config
* Failed currency statistics redesign
* initial Update chart to use highcharts
* Minor changes to stats
* Creats funding stats to handle the stat calculations. Needs more work
* tracks USD snapshots and BREAKS THINGS FURTHER
* Fixed!
* Adds ratio calculations and such, but its WRONG. do it at totals level dummy
* End of day basic lint
* Remaining lints
* USD totals statistics
* Minor panic fixes
* Printing of funding stats, but its bad
* Properly calculates overall benchmark, moves funding stat output
* Adds some template charge, removes duplicate fields
* New charts!
* Darkcharts. funding protection when disabled
* Now works with usd tracking/funding disabled!
* Attempting to only show working stats based on settings.
* Spruces up the goose/reporting
* Completes report HTML rendering
* lint and test fixes
* funding statistics testing
* slightly more test coverage
* Test coverage
* Initial documentation
* Fixes tests
* Database testing and rendering improvements and breakages
* report and cmd rendering, linting. fix comma output. rm gct cfg
* PR mode 🎉 Path field, config builder support,testing,linting,docs
* minor calculation improvement
* Secret lint that did not show up locally
* Disable USD tracking for example configs
* ShazNitNoScope
* Forgotten errors
* ""
* literally Logarithmically logically renders the date 👀
* Fixes typos, fixes parallel test, fixes chart gui and exporting
* Expose trade feed websocket exchange data through data channel
Most relevant to applications that import GCT as a lib, this allows
them to (through configuration, disabled by default) receive trade data
through the data channel similarly to the orderbook feed.
* exchanges: allow exposure of trade websocket feed through data channel
* Expose fill feed websocket abstracted exchange data through data channel
* exchanges: allow exposure of fill websocket feed through data channel