* 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
* bitmex: normalize account info currencies
Bitmex has an interesting way of returning BTC balances, it returns them
as XBt and denominated in Satoshis instead. Normalize that still in the
bitmex wrapper by performing the conversion and returning the normal use
BTC currency.
* Change NW contract to NQ
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* FTX: Add missing fields for FutureData type NOTE: Use f.GetFutures(context.Background()) to test.
* ftx: Add missing field for FillsData
* ftx: Add UnderlyingDescription field to Futures Data type
* huobi futures: GetSwapAccountInfo argument is optional
* huobi futures: fetch main account data as well
* huobi futures: shut linter up
Old warnings not introduced in this scope.
* Remove settled from Coinbase Pro order history status
* Get Coinbase Pro order history without restricting currency pair and include price
* Add empty and nil pairs scenario for TestGetOrderHistory
* Include fee and fee asset in Coinbase Pro history order
* Better designed backtester funding concept
* Fleshes out funding concepts further to allow two funding types
* Adds types, finishes adding to portfolio and adds to exchange
* Fixes a bug to reveal another
* Fixes issues with purchasing
* A partial conversion to using decimal.decimal for the backtester
* Further decimal rollout. Can compile and output report
* More cleanup
* Fix rendering and initial funds issue.
* Adds new concept for trading using the exchange level funding to see what happens
* Fixes a bug in funding not being found
* New strat config to test RSI and discover issues
* Can run with pairs that contain 0 funding
* Finally fixes the arrangement to share funds
* Adds testing and funding transfer
* end of day
* More comments, more tests!
* Improves item comparisons and completes testing
* Initial attempt at new strategy which utilisies shared funding and transfers
* end of day broken
* Chronological output. Fixes output bug where multi currency.
* End of day commit
* Fixes bug where events were being overwritten in a simultaneous context
* Begins transitioning from portfolio holdings to funding holdings. Am I doing the right thing
* End of day run around
* Likely fix for holding calculations
* Improvement to template. Improvement to holdings
* DARK MODE. Report upgrades. Even handling with funds. Fix output
* Output funding to cmd
* Add new trasnferred funds "side"
* Fixing test run 1
* Test updates
* Test updating
* More test fixing
* Fixes portfolio tests
* More test fixes
* Fixes remaining tests and lints
* Fixes currencystatistics tests. Adds decimal math implementations
* Fixes hilarious bug where there could only be on holding
* Adds funding support for config. Minor fixes
* Adds documentation
* Finishes config builder support for funding
* Logs inexact conversions, updates tests. adds config validation
* The quest to understand a new funding bug begins. New strategy
* Fixes bug where wrong funding was retrieved. Expands t2b2 strat
* End of the day commit. Gotta revert the nulldecimal stuff
* Fixes tests, adds extra funding transfer feature
* Fixes initial total values, tries to add a grand total value
* Rebase fixes, documentation updates, tests for strategy
* Swaps the err statement for tests. Regenerates tests. Math warnings
* Attempts to solve Live data problems. Fixes volume
* Fixes live data missing
* can trade at any interval. skip volume sizing. volume colours.
* config regen. display fixes
* test fixes, lint fixes
* Anti-funky errors
* docs
* Rmbad
* docs
* docs update
* Simplifies err handling. Updates readmes. Data type checks
* docs. new field initial-base-funds. comment errs. config test coverage
* minMaxing
* testfix
* Fixes fee calculation, re-bans minMax being equal
* Crazy concepts to attempt to solve totals. Addresses nits
* Adds in totals calculation for exchange level funding.Uses external API
In future, this will be replaced by proper pricing supplied by the same
exchange that is requested. This is an unknown price
* rm dollar signs in cmd and report. rm bad error. fix chart decimal. padding
* re-run docs post merge
* Fixes oopsie for fee parsing
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Initial REST managed order updating
* Apply gloriousCode's changes.go patch
* Update internal order ID handling
* Check error
* Replace string with string pointer
* Avoid nil pointers in upsert
* Update test for UpdateOrderFromDetail()
* Add tests for orders.go
* Remove unnecessary newline
* Address comments
* Add missing nil check
* Add tests for new functions in order_manager.go
* Remove empty line
* Change log level for updates from Info to Debug (keep added orders at Info)
* Initialize orders before running the timer
* [TEMP] Add verbosity for debugging
* Nil checking on exchangeManager in GetExchanges()
- exchangeManager.GetExchanges() and iExchangeManager.GetExchanges() return an error on nil
- bot.GetExchanges() wraps exchangeManager.GetExchanges() and returns an empty slice
* Revert b5afe1a46b
* Do not start the order manager runner thread
Instead, mark the order manager as running
* Remove redundant error.Is() and remove print wrapper on msg
* Add atomic blocker and waitgroup on processOrders()
* Disable unnecessary orderManager runner thread for rpcserver_test
* Remove redundant err from orderStore.getActiveOrders()
* [FIX] Populate requiresProcessing using UpsertResponse data instead of REST return data
.. because the data returned by the REST calls do not include the internal user ID's
* [TEST] Verify that processOrders() actually processes queried order data
* Remove leftover warning and add nil check on wg.Done()
* Apply suggestions from code review
Log category changes - as suggested
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* Return when no exchanges available
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
* 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
* add account.Balance.Available() method that returns the amount of an asset not locked/held
* account: comment Balance.Available()
* account: test Balance.Available()
* websocket: select case error if no receiver, add in functionality to reset to initial sync for books on a new websocket connection
* websocket: fix tests
* websocket: log error instead of losing it
* websocket: fix whoopsie
* exchanges: fix test
* websocket: force requirement of specific functionality
* exchanges: fix tests
* exchanges/websocket: move waitgroup add before scheduling across exchanges
* gateio: add feature subscribe
* bithumb/bittrex: include connection state reset, fix reconnection bug for Bithumb
* huobi: Add listen to shutdown to routine so it actually returns and stops being a naughty boy.
* huobi: add missing waitgroup add.
* exchanges: bleed comms channels
* binance: fix reconnection bug with buffer
* bithumb: fix reconnection bug with ws orderbook when websocket is diabled/enabled
* bithumb/bittrex: add bleeders for ws orderbook jobs
* linter: fix
* kraken: reduce code block from double assertion
* This bug ruined my day.
* glorious: error checking
* zb: add correct path for websocket connection
* exchange: Add verbosity when config conflicts and overwrites default values
* zb: add https to path
* exchanges: glorious nits
* stream: Add checkAndSetMonitoring to reduce potential routine bundling, increase timeout and check state in tests
* stream: remove check that is not needed.
* glorious: nits addr.
* lint: test
* golangci: Enable err checking linter to expose unchecked errors.
* gct: handle errors across the board
* gct: handle errors NOTE: Found bug in FTX (WIP)
* linter: fix issues
* ftx/exchanges: fix bug where error was being returned when setting pair management variables to an already enabled state
* bitmex: fix bug where a dangly supported asset in config danglied up the place.
* linter: fix more linter issues
* linter: fix my terrible spelling.
* currency: fix test
* exchanges: fix tests
* logger: fix test
* exchanges: fix tests
* glorious: nits
* vm: revert rm variable and instigate test
* exchanges: add an UpdateTickers method to the main exchange interface
This method will fetch all currency pair tickers of a given asset type
and update them internally, does nothing for now.
* exchanges: refactor UpdateTicker on all exchanges
Keep the exact previous behaviour but implement the UpdateTickers
method and refactor UpdateTicker by using it where applicable.
* sync_manager: update all tickers when batching is enabled
* binance: UpdateTicker to fetch single ticker symbol
* ftx: UpdateTicker to fetch single ticker symbol
* Fix Bitstamp pair handling
* Fix spelling
* Populate namerinos
* Address nitterinos
* Revert trade currency code, introduces races between engine / this and rely on OB test instead
* One liner
* gctcli: remove all exchange name client-side validation
Since now exchange names can be user-assigned we can no longer have
client-side validation, all exchange name validation must now occur
on the server (it was already doing that).
* engine: add server side exchange name check on some RPCs
* docs: initially commit WS_TRADE_UPDATES.md
* docs/WS_TRADE_UPDATES: shorter text
* docs: rename WS_TRADE_UPDATES to WS_ORDER_EVENTS as that is more descriptive of what it documents
* docs/ADD_NEW_EXCHANGE: reference the newly added WS_ORDER_EVENTS file
* WS_ORDER_EVENTS: common terminology
* WS_ORDER_EVENTS: turn the code segment into a markdown table
* WS_ORDER_EVENTS: AverageExecutedPrice is now not mandatory
* exchanges/README: link to WS_ORDER_EVENTS
* exchange/binance/websocket:
1. resolve order type by reading the dedicated executionReport field (X)
2. populate average price (computed as advised in docs: Z/z)
3. fee taken is now assigned to order.Detail.Fee (not to order.Detail.Cost)
4. proper order.Detail.Cost and order.Detail.CostAsset
* order.Detail: add a new field: FeeAsset
* exchange/binance/websocket: wsOrderUpdate: assign FeeAsset
* exchange/binance/websocket: wsOrderUpdate: use TransactionTime instead of EventTime (more precise) and populate order.Detail.TargetAmount
* exchange/binance/websocket: wsOrderUpdate: use full name for variables (isn't obvious otherwise), do not mix var and :=, order temporary variable by their order in order.Detail
* exchange/binance/websocket: order fields of WsOrderUpdateData by the documented/received-over-the-websocket order of fields
* exchange/binance/websocket: add explicitly "M" as WsOrderUpdateData.Ignored2, which would otherwise override small "m"
* exchange/binance/websocket: check for zero when computing averagePrice
* exchange/binance/test: update TestExecutionTypeToOrderStatus and TestWsOrderExecutionReport
* exchange/binance/websocket: wsOrderUpdate now reports cost thus far, not the total order cost as that cannot be predicted in the case of partially filled orders
* exchange/ftx/websocket: WsOrderDataStore now reports cost thus far, not the total order cost as that cannot be predicted in the case of partially filled orders
* exchange/binance/websocket: executionReport now does not set TargetAmount as it is not applicable
* exchanges: binance/websocket and ftx/websocket now properly set Date and LastUpdated time fields when reporting a trade
* exchange/binance/websocket: check if WsOrderUpdateData.CommissionAsset is populated when assigning feeAsset
* exchange/binance/test: fix TestWsOrderExecutionReport
* [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>
* * Binance websocket: set commission of order Detail
* * Binance websocket: set commissionAsset of order.Detail
* * Binance websocket: change CostAsset to type currency.Code
* * Binance websocket: call NewCode after checking CommissionAsset is not empty. This guarantees that NULL CommissionAsset is mapped to an empty order.Detail.CostAsset. Otherwise, reflect.DeepEqual will fail on test. Update TestWsOrderExecutionReport json message to BTC commission.
* * Binance websocket: binance websocket "ExecutionReport" only provides "trade" status (partially filled), so check that executed amount == total amount before change status to filled
* engine: Setup exchange manager earlier
So it's available for applications before starting.
* engine: Add a custom exchange builder interface
Allows applications that import GCT as a lib to build new
custom exchanges without further modifications.
* exchanges/ftx: add support for ReduceOnly, ImmediateOrCancel and PostOnly orders
* exchanges/ftx: adapt tests to ReduceOnly/ImmediateOrCancel/PostOnly boolean flags
* exchanges/ftx: wrong json key of WsFillsDataStore.FillsData was causing json.Unmarshal() to yield an empty struct
* exchanges/ftx: update WsFills to latest API
* exchanges/ftx: add TestFTX_wsHandleData_wsFills
* exchanges/ftx: WsOrders.FilledSize was never parsed properly because of a key error (was spelled `filedSize` -- with one L); enrich data structure to support latest API fields
* exchanges/ftx: when order is closed, set status to closed, not canceled
* exchanges/ftx: compatibleOrderVars: compare floats for almost-equality
* order.Detail: add field: AverageExecutedPrice float64
* exchanges/ftx: FTX.wsHandleData() now populates all order.Detail fields properly on update/orders websocket message
* exchanges/ftx: implement TestFTX_wsHandleData_Details()
* exchanges/ftx: make golangci-lint happy
* exchanges/ftx: make golangci-lint happy
* exchanges/ftx/test: delete redundant commented code
* exchanges/ftx: move websocket tests from ftx_test.go to ftx_websocket_test.go
* exchanges/ftx: remove redundant line
* exchange/ftx: greatly simplify TestFTX_wsHandleData (thanks to @shazbert)
* exchanges/ftx: make golangci-lint/whitespace happy
* exchanges/ftx: requested review change: delete a redundant line
* exchanges/ftx/test: use predefined currency constants
* rate limits: Make context aware
* binance: rate limit allow for cancellation of reservation when deadline is exceeded
* request: add context.done() before initiating any bulk work.
* binance: update error return for rate limiting
* request: updated dealine check to remove after time.Now procedure as this will obfuscate a deadline which will be limited by the context check on every attempt, so no need to sleep with delay.
* requester: defer execution of request.Item generation in closure.
* bithumb: fix issue
* coinut/itbit: fix linter issues
* binance: fix bug on recvWindow setting
* requester: standardize sendpayload + add readme update
* nonce: remove inc() function
* request: defer unlockiflocked
* binance: revert changes for open orders
* btcmarkets: defer auth generation functionality, rm context deadline as this will be created just before sending HTTP request.
* binance: move const to top
* exmo: remove debug output as its generated in the requester function
* ftx: defer auth functionality
* requester: move error to top
* bittrex: defer auth functionality
* bitmex: defer auth functionality and remove deadline as generation occurs after rate limiting.
* btse: defer auth functionality
* coinbasepro: defer auth functionality and removed context deadline as this is generated after rate limiting
* coinbene: defer auth functionality and remove context deadline as this is generated after rate limiting
* huobi: defer auth functionality and remove context deadline as this is generated after rate limiting
* huobi-futures: defer auth functionality and remove context deadline as this is generated after rate limiting
* kraken: defer auth functionality and remove context deadline as this is generated after rate limiting
* kraken: remove deadline protection for timestamp generation
* okgroup: defer auth functionality and remove context deadline as this is generated after rate limiting
* poloniex: defer auth functionality
* zb: defer auth functionality and remove context deadline as this is generated after rate limiting
* exchanges: clean up log output which are done and inspected in the requester package
* binance: fix path bug on every retry, rm timeout context as this is not needed
* coinbene: fix path bug on retry
* binance: consolidate functionality
* coinbene: fix linter issues
* poloniex: linter fix
* kraken: change add -> set
* bitstamp: fix path bug for retry
* BTSE: fix retry path bug
* coinbene: fix path bug whoopsie by me
* gateio: fix bug where on retry it does not reset reader
* localbitcoins: fix path bug on retry
* zb: change domain to land
* exchanges: make sure io.Reader is generated every request
* exchanges: move reader generation into function scope
* wrapper_issues: setup exchange manager
* engine: expand withdraw manager test
* engine: dont look for environment
* bitstamp: fix pathing bug (@thrasher-)
* engine/withdraw_manager: purge tests as this is covered in repository withdraw