mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
* deribit implementation * add ws impll * cleanup * Update deribit_wrapper.go * Add missing endpoints * Fix config file * asset type update * Update code structure * Update authenticated private endpoints unit tests * Updating websocket * Updating websocket connection and subscription handling * Finishing up adding subscription push data * Adding websocket public endpoint * Adding WS endpoints * Adding websocket unit tests * Minor clean-up * Integrating websocket endpoints into the wrapper funcs * Updating exchange documentations * Fixing test issues * Code cleaning-up * fix test issues * Updating validations and logic errors * Updating wrapper issues * fix test issues * Slight test update * Unit test and code structure update * Update websocket tempos * Slight update on code structure * Minor update on unit tests * Update depending on review comments * Minor code fix and doc re-generating * Update on Candlestick wrapper functions * Minor updates * minor unit test updates * Minor updates on weboscket and unit tests * minor linter fix * codespell and rate limiter issues * single linter issue fix * adding rate limiter * Add ratelimiter to websocket conn and overall code update * fix websocket push data issue * Implementing missing wrapper function * Websocket fix * Minor update on missing endpoint and other * fixing websocket issues and cleaningup * Minor tempo fix * Minor linter issues * unit test update * Indexing error fix * Websocket connection fix * string formatting fix * Small fix on unit tests * fix minor json conversion issue * websocket and documentation update * websocket, wrapper and unit test updates * Documentation and unit tests update * Fix unit tests * wrapper fix for new change * Unit test fix * timestamp conversion and unit tests update * Minor instrument ID conversion fix * instrument formats and unit test update * formatting and unit test fix * config update * Updating websocket and adding the Spot support * Add small unit test fix * unit test and websocket handlers update * Linter issues fix * minor documentation and code update * Minor fix * added a wrapper func GetLatestFundingRates * Types, wrapper update, and unit tests * Minor config update * fix wrapper unit tests * Resolve all panic and wrapper test issues * minor unit test fix * fix issues and adding newly added endpoints * updates and added remaining endpoints with unit tests * Update unit tests using assert * Added missing endpoints and unit tests * Minor updates and clean-ups * Resolve tradable pair fetching panic * Mutex fix * Added Options assets test and minor fixes * subscription mothod updated * Remove misadded code lines * resolve websocket * Updating tests, types, endpoint methods and others * Added GetFuturesContractDetails and minor fix * fix linter issue * revert change on candlestic time * Added filters to candles * minor unit test and wrapper fix * Minor unit tests update * cahnge param key for GetOrderMarginByID * updating unit tests and resolve issues * Update websocket unit tests * Minor fix based on review * Revert unit test change * fix pair config issue * Added missing wrapper functions * Fix missing review changes * Fix options request pair formatting * fix AllExchangeWrappers test issue * Changes with unit test and wrapper based on the review * Fix to options reg-exp * wrapper functions fix * Update MaximumFundingRateHistory filter and minor fixes * Fix besed on review comment * Fix issues on review comment * linter fix * fix minor unit test issue * Fix unit test issues * Update trade order cancellation responses * fix config files issue * lint update config files * Update unit tests * Update return values and response handling * added missing endpoint and fixes based on review comment * toggle useTestNet back * Update cancel by label and other fix * fix forgotten cancel all response type * update CancelResp type * Fix unmarshaling error * updated websocket orderbook load issue * fix websocket lock and groups * Change Items to Tranche and fix linter issues * Fix orderbook issue * Update unit tests offline error handling, and endpoints argument and error handling * Contributors documentation update and change error return type * Updated unit tests based on review comment * Update unit tests and removed password change endpoint * Fix race condition * Update on tests, test pairs, and wrapper config * Update test tradable pairs loading * Update unit tests, fix linter issues, and update wrapper functions * remove credentials * Update test and fix authentication method and few authenticated endpoints * fix codespell issue * group the repeated currency code check to a func * added unit test for repeated pair check func * Added a base coin and related updates --------- Co-authored-by: E Sequeira <earncef@earncef.com>
5.1 KiB
5.1 KiB
GoCryptoTrader package Trade
This trade package is part of the GoCryptoTrader codebase.
This is still in active development
You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.
Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack
Current Features for trade
- The trade package contains a processor for both REST and websocket trade history processing
- Its primary purpose is to collect trade data from multiple sources and save it to the database's trade table
- If you do not have database enabled, then trades will not be processed
Requirements to save a trade to the database
- Database has to be enabled
- Under
config.json, under your selected exchange, enable the fieldsaveTradeData- This will enable trade processing to occur for that specific exchange
- This can also be done via gRPC under the
SetExchangeTradeProcessingcommand
Usage
- To send trade data to be processed, use the following example:
err := trade.AddTradesToBuffer(b.Name, trade.Data{
Exchange: b.Name,
TID: strconv.FormatInt(tradeData[i].TID, 10),
CurrencyPair: p,
AssetType: assetType,
Side: side,
Price: tradeData[i].Price,
Amount: tradeData[i].Amount,
Timestamp: tradeTS,
})
b in this context is an IBotExchange implemented struct
Rules
- If the trade processor has not started, it will automatically start upon being sent trade data.
- The processor will add all received trades to a buffer
- After 15 seconds, the trade processor will parse and save all trades on the buffer to the trade table
- This is to save on constant writing to the database. Trade data, especially when received via websocket would cause massive issues on the round trip of saving data for every trade
- If the processor has not received any trades in that 15 second timeframe, it will shut down.
- Sending trade data to it later will automatically start it up again
Exchange Support Table
| Exchange | Recent Trades via REST | Live trade updates via Websocket | Trade history via REST |
|---|---|---|---|
| Alphapoint | No | No | No |
| Binance.US | Yes | Yes | NA |
| Binance | Yes | Yes | Yes |
| Bitfinex | Yes | Yes | Yes |
| Bitflyer | Yes | No | No |
| Bithumb | Yes | Yes | No |
| BitMEX | Yes | Yes | Yes |
| Bitstamp | Yes | Yes | No |
| BTCMarkets | Yes | Yes | No |
| BTSE | Yes | Yes | No |
| Bybit | Yes | Yes | Yes |
| CoinbasePro | Yes | Yes | No |
| COINUT | Yes | Yes | No |
| Deribit | Yes | Yes | Yes |
| Exmo | Yes | NA | No |
| GateIO | Yes | Yes | No |
| Gemini | Yes | Yes | Yes |
| HitBTC | Yes | Yes | Yes |
| Huobi.Pro | Yes | Yes | No |
| Kraken | Yes | Yes | No |
| Kucoin | Yes | No | Yes |
| Lbank | Yes | No | Yes |
| Okcoin | Yes | Yes | Yes |
| Okx | Yes | Yes | Yes |
| Poloniex | Yes | Yes | Yes |
| Yobit | Yes | NA | No |
Please click GoDocs chevron above to view current GoDoc information for this package
Contribution
Please feel free to submit any pull requests or suggest any desired features to be added.
When submitting a PR, please abide by our coding guidelines:
- Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
- Code must be documented adhering to the official Go commentary guidelines.
- Code must adhere to our coding style.
- Pull requests need to be based on and opened against the
masterbranch.
Donations
If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc