227 Commits

Author SHA1 Message Date
Adrian Gallagher
0b27096376 Periodic available pairs config update 2019-05-16 14:28:10 +10:00
Andrew
5bce701d43 Add httputil.DumpRequestOut & httputil.DumpResponse to SendPayload (#298)
* First pass adding DumpResponse

* WIP

* Added httpDebug flag to SendPayload

* anx -> coinbase converted

* HTTPDebug flag added to all exchanges

* Updated Alphapoint:

* reworded error message

* Corrected itbit and huobihadax sendpayload

* Removed setting of default value

* don't return body for response as we already get this in verbose mode

* body is now included based on verbose setting

* WIP

* Due to issues with DumpResponse and gzip decoding use raw response from exchange for body output Also adds gzip decoding back as bug fix for OK group exchange

* removed additional new line

* Added URL path to dumpbody display as well
2019-05-16 13:46:28 +10:00
Ryan O'Hara-Reid
35b94268e0 Update request.go to fix concurrency nonce issues (#285)
* Updates nonce generation to adhere to fifo channel buffer before request executes by routine

* removed unused variables, lns etc

* Fix requested changes and added in timer that disengages lock if out of scope error occurs

* Fixed woopsy daisy issue

* Add benchmark, reduce time in force to unlock before stack insertion, add nil check for edge case

* Remove unusued waitgroup field

* use return nonce.Value and method, rm redundant nonce code, fix tests.

* Fix linter issue: unnecessary conversion
2019-05-06 13:46:34 +10:00
Andrew
071f4f68a8 New NTP Client (#277)
* WIP

* Added check for time out of sync

* merged upstream/master

* added tests

* Increased configuration options for NTPclient and test coverage

* removed unneeded config save at end of ntp update

* Added test for empty response to confirm it will loop

* formatting correction

* converted to pointer to allow for default allowance settings to be checked

* added readme for NTP server

* corrected some formatting

* updated configtest negativedifference value

* gofmt config_test.go for correct import order

* corrected typo value in test

* bugfix for windows newline and changes based on PR feedback

* added minus sign to output

* fixed negative number input

* Fixed spelling mistakes and removed redundant test

* reverted back to a positive number in the config instead of negative for allowednegativedifference

* restructured code for cleaner output
2019-04-18 10:08:19 +10:00
Adam
400c1cc84d Improved test coverage and functions in common.go (#266)
Improved directory creation, including permissions and expanded test coverage
2019-04-17 17:33:40 +10:00
Scott
107cf76373 Kraken websocket support (#264)
* Initial commit. Adds ticker, candle and trade, subscription support

* Adds support for spread and orderbooks

* Adds new currency pair delimiter ("/"), Adds dedicated websocket Connected channel handler, Updates Kraken websocket capability definition, Refines websocket tests to connect and disconnect without freezing, separates WebsocketUnsubscribeEventRequest ChannelID into its own struct WebsocketUnsubscribeByChannelIDEventRequest to prevent bad json WS requests, Adds asset type to orderbook, Kraken WS handles connection better

* Removes duplicate type, reverts config value

* Addresses error returns and changes writeToWebsocket to use byte array. Removes deferred funcs in tests. Increases test listening limit for rare cases

* Fixes verbose log. Rearranges WS Connect async ordering. Fixes DATA RACE. Fixes random okex tests. Ensures Kraken WS tests only connect once
2019-04-04 10:21:44 +11:00
Ryan O'Hara-Reid
0990f9d118 Currency package update (#247)
* Initial currency overhaul before service system implementation

* Remove redundant currency string in orderbook.Base
Unexport lastupdated field in orderbook.Base as it was being instantiated multiple times
Add error handling for process orderbook

*  Remove redundant currency string in ticker.Price
 Unexport lastupdated field in ticker.Price
 Add error handling for process ticker function and fix tests

* Phase Two Update

* Update translations to use map type - thankyou to kempeng for spotting this

* Change pair method name from Display -> Format for better readability

* Fixes misspelling and tests

* Implement requested changes from GloriousCode

* Remove reduntant function and streamlined return in currency_translation.go

* Revert pair method naming conventions

* Change currency naming conventions

* Changed code type to exported Item type with underlying string to reduce complexity

* Added interim orderbook process method to orderbook.Base type

* Changed feebuilder struct field to currency.Pair

* Adds fall over system for backup fx providers

* deprecate function and children and fix linter issue with btcmarkets

* Fixed requested changes

* Fix bug and move mtx for rates

* Fixed after rebase oopsies

* Fix linter issues

* Fixes race conditions in testing functions

* Final phase coinmarketcap update

* fix linter issues

* Implement requested changes

* Adds configuration variables to increase/decrease time durations between updating currency file and fetching new currency rates

* Add a collection of tests to improve codecov

* After rebase oopsy fixes for btse

* Fix requested changes

* fix after rebase oopsies and add more efficient comparison checks within currency pair

* Fix linter issues
2019-03-19 11:49:05 +11:00
Andrew
58bd0a301b Added config option to enable pprof (#253)
* Added config option to enable pprof

* fixed typo in Makefile
2019-03-14 14:56:30 +11:00
Adrian Gallagher
6cb356cd7a configs: periodic update of available pairs
NOTE: Yobit and Bitflyer dynamic support is enabled in the engine branch
2019-03-13 11:45:42 +11:00
Adrian Gallagher
3ac8b7746f Add REST and websocket support for BTSE (#250)
* Add REST and websocket support for BTSE exchange

TO-DO: Finish wrappers and expand test coverage

* Fill out wrapper funcs and expand test coverage
2019-03-08 16:33:10 +11:00
Adrian Gallagher
3066f3d027 New forex provider ExchangeRatesAPI which is used by default (#248)
* Add new unauthenticated forex provider and use it by default

This is in response to currencyconverterapi requiring an API key for the free version

* Fix golinter complaint

* Added additional endpoints, tests and improve config forex logic
2019-02-20 17:17:27 +11:00
Adrian Gallagher
928a332220 Use official Slack join link instead of herokuapp 2019-02-12 13:45:43 +11:00
Adrian Gallagher
a02b736a5b Periodic pairs update 2019-02-08 14:10:59 +11:00
Adrian Gallagher
ef51b59c8b Remove OKCoin China exchange support 2019-02-08 14:03:28 +11:00
Adrian Gallagher
26d67f5228 Remove WEX exchange support 2019-02-08 13:52:53 +11:00
Adrian Gallagher
d7368c1a8d Remove Liqui exchange from GCT 2019-02-05 11:17:05 +11:00
Ryan O'Hara-Reid
82a622294c Coinmarketcap implementation (#243)
* Updates requester package to allow unpacking of zipped files and defaults to warn if no JSON is present

* Initial addition of coinmarketcap functionality

* fix requested changes

* Fix issue with displaying false positive in request.go && reorder plan list

* Rename CurrencyProvider -> CryptocurrencyProvider
Skip seeding currency data if not enabled
Rm line in main.go

* Update test procedures and relevant json files

* Fix const issue within config.go
2019-01-31 16:11:42 +11:00
Andrew
d01e7bad72 Implement Logger (#228)
* Added new base logger

* updated example and test configs

* updated exchange helpers restful router & server

* logPath is now passed to the logger to remove dependency on common package

* updated everything besides exchanges to use new logger

* alphapoint to bitmex done

* updated bitmex bitstamp bittrex btcc and also performance changes to logger

* btcmarkets coinbase coinut exmo gateio wrappers updated

* gateio and gemini logger updated

* hitbtc huobi itbit & kraken updated

* All exchanges updatd

* return correct error for disabled websocket

* don't disconnect client on invalid json

* updated router internal logging

* log.Fatal to t.Error for tests

* Changed from fatal to error failure to set maxprocs

* output ANSI codes for everything but windows for now due to lack of windows support

* added error handling to logger and unit tests

* clear wording on print -> log.print

* added benchmark test

* cleaned up import sections

* Updated logger based on PR requests (added default config options on failure/setting errors)

* ah this should fix travici enc config issue

* Load entire config and clear out logging to hopefully fix travisci issue

* wording & test error handling

* fixed formatting issues based on feedback

* fixed formatting issues based on feedback

* changed CheckDir to use mkdirall instead of mkdir and other changes based on feedback
2019-01-08 21:56:22 +11:00
Adrian Gallagher
dffa8eca99 Periodic pairsLastUpdated timestamp update
Fix other GoReportCard warnings
2018-12-27 15:32:59 +11:00
Scott
ff6a84f0f1 Cancel all orders wrapper implementation (#217)
* Changes method signature for cancelling all orders (experitmental). Implements cancelAllOrders wrapper for alphapoint, anx, binance

* Implements cancel all wrapper for bitfinex, bitmex, bitstamp, bittrex, btcmarkets, coinbasepro and hilariously coinut

* Changes method signature to only use one OrderCancellation type. Adds support for Exmo, gateio, gemini, itbit, lakebtc

* Adds/updates support for hitbtc, huobi, hadax, itbit and kraken

* Adds support for liqui, localbitcoins, okcoin, poloniex, wex and yobit. Splits up open order methods for poloniex

* Adds bithumb, okex and zb support. BTCC for another PR

* Updates bitflyer, bithumb, bitmex, coinut, okex and zb cancelAllOrders method to cancel via enabled currency pairs rather than a singular currency

* Adds tests to all exchanges to test wrapper function CancelAllOrders

* Fixes OKEX and huobi, btcmarkets, kraken, okCoin cancel order implementations

* Fixes coinut, hitbtc and okex api for authenticated requests

* Fixes comment and spacing

* Changes the CancelAllOrders signature to return orderids and errors along with a generic error.

* Fixes OKEX delimiter

* Removes spacing and test verbosity

* Removes more spacing

* Removes space

* Fixes okex rebasing issue. Also makes the maps instead of assuming they just work
2018-12-14 15:53:26 +11:00
Adrian Gallagher
27091ef442 Periodic pairs update; LocalBitcoins, OKCoin and OKEX are now auto 2018-11-26 16:38:56 +11:00
Ryan O'Hara-Reid
e104d29028 Fix code coverage issue (#204) 2018-11-02 16:20:16 +11:00
Ryan O'Hara-Reid
19f65df236 Exchange interface update (#202)
* Adds helper function to get available asset types to the exchange interface

* Adds test to function
2018-11-02 09:26:26 +11:00
Ryan O'Hara-Reid
5dd0fecc62 Adds go module support that came into effect in go version 1.11 (#201)
Adds go module support that came into effect in go version 1.11
2018-11-01 17:40:54 +11:00
Scott
e4c443b901 Calculating each exchange's fees (#188)
* Adds some constants for fee types
Adds some fee calculation in an attempt to be generic
Adds fee stuff to Bittrex
Adds fee stuff to bitstamp

* Fixes bitstamp fee calculation

* Tests
Tests all scenarios for GetFeeByType

* Adds method to wrapper
Adds err to response
Checks for err

* Adds support for Bittrex fees

* Adds maker/taker dynamic to fees
Updates tests
Adds bitmex fee support
Removes unused switch case scenarios to not waste space

* Adds bithumb support for fee calculation

* Adds Bitfinex fee support
Adds list of currencies as const strings
Sets up bitflyer

* Fixes arguments

* Greatly expands symbols
Adds Binance fee calculation support
Cleans up previous exchanges

* Fixes errors for fee calculations

* Adds ANX fee support

* Adds btcc fee support
Adds alphapoint fee wrapper support
Renames method to match "enum"
Uses symbols in tests, not inline strings

* Adds support for BTCMarkets fee calculation
Adds new method to retrieve fee amount from BTCMarkets
Adds new fee type struct: FeeBuilder
Updates ANX and BTCMarkets to use new FeeBuilder type struct
Standardises the tests to run when it comes to fee calculation

* Migrates all existing exchange fee to use new feebuilder type struct
Uses standard testing model

* Fixes unit tests

* Updates maker taker fees in test config

* Removes parallel from fee testing

* Removes more parallel from tests

* Adds coinbasepro fee support

* Adds Coinut fee support

* Adds Exmo fee support
Adds maker fee support to coinut
Introduces a type for fees and bank transfers to prevent random strings being used

* Adds partial bitflyer support
Moves bitflyer to feeBuilder struct

* Adds gateio fee support

* Adds Gemini fee support

* Adds hitbtc fee support

* Adds huobi fee support

* Adds HuobiHadax fee support

* Adds itbit fee support

* Adds partial kraken fee support with trading fees

* Finishes basic Kraken fee support

* Adds basic LakeBTC fee support

* Adds basic liqui fee support

* Adds localbitcoins fee support.......

* Adds basic okcoin fee support

* Adds simple OKEX fee support
Adds many new currency symbols
Fixes liqui's fees

* Adds poloniex fee support

* Adds fee support for Yobit

* Adds WEX fee support

* Adds ZB fee support

* Removes bad reference

* Improves accuracy of variable name

* trading fee method names are now consistent

(cherry picked from commit 21c82e8b90cae590cfd73d365d7be39e1a00e973)

* Fixes rebasing issues

* Fixes issues from rebase
Removes "IsTaker" as IsMaker bool can imply taker
Updates tests to actually work.

* Adds a zero to the test

* Fixes bitfinex api endpoints and fixes fee calculations

* Updates btcmarkets trading fee calculation

* Verifies tests with apis for all exchanges except coinbasepro, itbit and bitflyer
Removes taker fee test as taker is default

* Removes redundant all exchange wrapper error checks due to the error checks being redundant

* Addresses review comments:
- Renames variables
- Changes how functions return data
- Fixes typo
2018-10-29 12:32:46 +11:00
Ryan O'Hara-Reid
d3c2800fe0 Initial overhaul of websocket connection and feeds (#189)
* Initial overhaul of websocket connection and feeds
* Added proxy support
* Piped to routines.go

* Added new websocket file in exchanges
Refactored orderbook handling into exchange_websocket.go
Added better error responses for binance_websocket.go
General clean for binance_websocket.go

* General fixes - bitfinex_websocket.go
Refactored orderbook cache code - bitfinex_websocket.go
Removed fatal error with unhandled type - routines.go

* Added general improvements to bitmex_websocket.go
Refactored orderbook handling to exchange_websocket.go
Added variable in Item struct in orderbook.go for looking up orders by ID

* Fix issue when routines are blocked due to Data Handler not started
Updated traffic handler
General fixes for bitstamp_websocket.go

* General fixes for coinbasepro_websocket.go

* General fixes for coinut_websocket.go
Fixed error return in exchange_websocket.go

* Removed comments in coinut_wrapper.go
Refactor orderbook logic from hitbtc_websocket.go to exchange_websocket.go

* General fixes

* Removed comments
General fixes

* Updated routines.go

* After rebase fix

* Fixed update config pairs in okcoin.go

* fixed config currency issue in okcoin.go for okcoin China

* exchange_websocket.go
*Removed unused const dec
*Removed state change routine
*Improved trafficMonitor routine
*Increased verbosity for error returns
*Removed uneeded mutex locks

exchange_websocket_test.go
*Added new tests for websocket and orderbook updating

routines.go
*Removed string cased

* Fixed race conditions on sync.waitgroup in exchanges_websocket.go

* Changes variable name in config.go

* Removes unnecessary comment

* Removes indefinite lock on error return

* Removes unnecessary comment

* Adds support for BTCC websocket
Drops support for BTCC REST

* Rewords comment in exchange_websocket.go
Moves types to poloniex_types.go

* Moves types to coinut_types.go

* Removes uneeded range for accessing array variables for coinbase_websocket.go
Removes comments in coinut_types.go

* Adds verbosity flag to GCT
Suppresses verbose output from routines.go

* Fixes setting proxy for REST and Websocket per exchange
Upgrades error handling
Drops unused *url.Url variable in exchange type

* Adds test for setting proxy

* Fixes bug that closes connection due to incorrect timeout time through a proxy connection

* Clarify verbose flag message
2018-10-24 14:22:40 +11:00
Adrian Gallagher
be561dd077 Periodic available pairs update for manual exchanges 2018-10-11 15:47:12 +11:00
Adrian Gallagher
9b85b431ab BTCMarkets: Add automatic available pair updates 2018-10-11 12:25:58 +11:00
Adrian Gallagher
9dd0474c7c Huobi Hadax no longer supports BTC-USDT; update API endpoints and config available/enabled pairs 2018-10-03 17:17:23 +10:00
Adrian Gallagher
bdd1fa3cdf config consistency check to ensure an enabled pair is supported by the exchange 2018-09-21 16:25:27 +10:00
soxipy
fb4e2d1452 localbitcoins fixes (#177)
* General LocalBitcoin fixes

* Added override variables to config for exchange packages to allow different API URL's
2018-08-27 14:19:29 +10:00
Ryan O'Hara-Reid
ca0c22f422 Merge pull request #169 from ermalguni/master
OKEX websocket
resolves #158
2018-08-27 10:11:19 +10:00
Marco Franssen
cbbad60e78 Lowercased the remaining config values for the config/all endpoint 2018-08-10 16:05:20 +02:00
Ermal Guni
07ef1406ce fixed merge conflicts 2018-08-09 23:46:37 +02:00
Ryan O'Hara-Reid
06a0caec43 Bitmex exchange (#160)
* Added REST support for Bitmex

* Added Bitmex documentation updates

* Update config_example.json

* Added final REST functions for user account operations.

* Added initial websocket support

* Change function access
Added reconnection logic

* Added initial routine management
Updated wrapper functions

* General fixes
2018-08-09 16:31:29 +10:00
Adrian Gallagher
a0de1b78a7 Support configurable HTTP user agent per exchange 2018-08-07 13:05:13 +10:00
Marco Franssen
6c2f6df875 Lowercase json to be more compliant with javascript coding standards (#163) 2018-08-06 21:33:25 +10:00
Ermal Guni
a7baed25d6 okex pairs fixes 2018-08-05 17:46:44 +02:00
Adrian Gallagher
c63f1b0ff6 Port from idoall's codebase (#161)
* 修复火币Post REST API方法不正确的问题,同时增加火币海带丝交易所

* add vendor folder

* 修改命名空间依赖

* 第一次提交分支

* 增加取消订单功能

* 修复binance.GetAccount方法

* 更新readme.md

* 增加 Gateio 交易所的支持,支持获取K线、支持的交易对、交易市场参数

* 替换HuobiHadax的参数

* 买/卖订单、取消订单

* OKEX 币币交易:增加获取用户信息,下订单,取消订单

* 测试ok kline

* 修复 Bitfinex 的 GetAccountInfo 方法

* 做一些不必要的删减

* 修复binfinex不返回错误的bug

* 统一我修改交易所的Kline获取方式

* Bitfinex 增加获取最新价格

* update main.go

* 更新GetSymbol方法

* 修改火币和海带丝的Kline编号ID类型

* 修改海带丝的默认配置大小写

* okex增加获取最新价格

*   调整okex的参数判断

* 调整比特儿的参数名称

* 修改火币、火币Hadax的参数全名

* 更新海带丝的配置名称

* 修改bintfinex的GetAccountInfo方法

* 去掉一行注释

* 支持zb交易所的部分功能

* 修复获取K线时没有设置参数的错误

* 增加 Binance 取消订单的方法,获取订单状态,获取所有打开的状态以及所有订单

* 修改获取深度和历史订单的数据

* 修改币安获取深度的参数

* 修改火币获取市场深度的参数

* 修改okex获取市场深度的参数

* 修改币安、OKex获取历史订单的参数

* 修复币安提交参数错误的问题

* merge upstrem

* merge后,调整一部分命名空间

* 修改ZB时间参数的命名方式

* 继续替换命名空间

* 命名空间的替换

* 继续命名空间的替换

* 测试

* Port code from idoall's PR

* Drop errors dep

* Start amending PR

* Fix commented code
* Translate text from Chinese to English (except for ZB). The reasning behind this is that it's a Chinese exchange and the structs are self explanatory in English, but would for other developers in China

* Translate Chinese text, basic formatting changes

* Remove commented lines and address feedback on PR
2018-08-04 08:30:20 +10:00
Adrian Gallagher
4fadc6ff48 Adds support for new Huobi authorised requests and a tool for ecdsa keys
Fixes: https://github.com/thrasher-/gocryptotrader/issues/150
2018-07-13 15:54:31 +10:00
Ryan O'Hara-Reid
ed675bde30 Add bank details support 2018-07-12 12:25:07 +10:00
Adrian Gallagher
42d458d5ea Rename GDAX -> CoinbasePro 2018-07-11 10:42:37 +10:00
Adrian Gallagher
9b2ac9a6dc Bump last checked available currencies timestamp and expand automatic updating of available currencies for various exchanges 2018-06-15 15:56:01 +10:00
Ryan O'Hara-Reid
9d0616d8cf New communications package
Support for Slack, SMSGlobal, SMTP and Telegram

Supersedes: https://github.com/thrasher-/gocryptotrader/pull/126
2018-06-08 14:09:36 +10:00
Ryan O'Hara-Reid
58051b89c7 New package provider for foreign exchange rates.
Fixes issue: https://github.com/thrasher-/gocryptotrader/issues/131
Supersedes: https://github.com/thrasher-/gocryptotrader/pull/123
2018-06-06 21:05:17 +10:00
Ryan O'Hara-Reid
dc11f87b8b Updated README template files and regenerated documentation. (#125) 2018-05-14 10:03:17 +10:00
Adrian Gallagher
ac41a7cfad New features and bug fixes
- Modifications made to the request package. Planned improvements will be
sending requests on intervals, rate limiter back off support, dynamic tuning
and requests packaged into a request job group.
- Can modify each exchanges individual HTTP client (e.g timeout and
transport settings).
- Bot now uses an exchange config HTTP timeout value.
- Bot now uses a global HTTP timeout (configurable).
- Batched ticker request support for exchanges.
- Ticker and Orderbook fetching now are spanned accross multiple
go routines and regulated by a sync wait group.
- Fixes hack used to load exchanges, now uses a sync wait group.
- Ticker and Orderbook storage and fetching now uses mutex locks.
- New pair function for finding different pairs between two supplied
 pair arrays. This is used for currency pair updates for exchange which
support dynamic updating.
- Shows removal/additions of dynamic updates currencies.
2018-05-04 13:20:19 +10:00
Adrian Gallagher
52dfddbb18 Feature: Add support to check whether an exchange supports automatic currency pair updates and if they don't, show a warning if the last currency pair update is >= 30 days
Also fix race condition in config get/set functions
2018-03-27 12:53:46 +11:00
Ryan O'Hara-Reid
9514754960 New documents generated by documentation tool. 2018-02-28 09:55:11 +11:00
Ryan O'Hara-Reid
dd00eba27e Applied fix to documentation.go for contribution HTML_URL.
Added period to documentation templates sentences.
Added logic to documentation.go to fix broken links for godoc in sub-packages.
Fix coding style to conform to golang idiomatic practice.
Applied fix to access main godocs in tools and test data.
Generated new documents using tools.
2018-02-20 11:56:25 +11:00