Commit Graph

33 Commits

Author SHA1 Message Date
Scott
b1e6534e7c Withdraw Crypto wrapper mapping (#226)
* Initial commit

* Updates signature for all withdrawal methods to use new withdrawRequest struct type

* Implements crypto withdraw features & tests for Alphapoint, ANX, Binance, Bitfinex, Bitflyer, Bithumb, Bitmex, Bitstamp, Bittrex, BTCC, BTCmarkets, CoinbasePro, Coinut. Updates WithdrawRequest type with more members. Breaking change to update real order testing for increased code coverage

* Updates all realOrder tests to run when no API key is present. Updates exchange functions to handle errors better

* Implements crypto withdrawals for Exmo, GateIO, Gemini, HitBTC, Huobi, HuobiHadax, Kraken, LakeBTC, Liqui, Localbitcoins, OKCoin, OKEX, Poloniex, Wex, Yobit and ZB. Updates real order test formatting for all real order tests

* Update alphapoint. Fixes anx typos. Adds function WithdrawFiatFundsToInternationalBank to exchange wrapper interface. Adds WithdrawFiatFundsToInternationalBank to alphapoint, bitmex, coinbasepro. Updates Kraken to use TradePassword property

* Reverts alphapoint to use ErrNotYetImplemented

* Fixes line spacing and removes unnecessary line
2019-01-03 13:15:07 +11:00
Adrian Gallagher
046e15a67e Periodic GoReportCard fixes 2018-12-27 15:10:41 +11:00
Ryan O'Hara-Reid
7c3134f35b Wrapper update modify order (#222)
* Changed IBotExchange interface ModifyOrder function paramater and return value to exchange type for easier addition or retraction of variables.

* Function ModifyOrder for Binance not supported via API

* Change to unsupported function for exchange ZB

* Change to unsupported function for exchange Yobit

* Add modify order support for Poloniex

*  Change to unsupported function for exchange Okex

* Change to unsupported function for exchange Localbitcoins

* Change to unsupported function for exchange Liqui

* Change to unsupported function for exchange LakeBTC

* Change to unsupported function for exchange Kraken

* Change to unsupported function for exchange Itbit

* Change to unsupported function for exchange HuobiHadax

* Change to unsupported function for exchange Huobi

* Change to unsupported function for exchange HitBTC

* Change to unsupported function for exchange Gemini

* Change to unsupported function for exchange GateIO

* Change to unsupported function for exchange Exmo

* Change to unsupported function for exchange Coinut

* Change to unsupported function for exchange Coinbase

* Change to unsupported function for exchange BTCMarkets

* Change to unsupported function for exchange Bittrex

* Change to unsupported function for exchange Bitstamp

* Add modify order support for Bitmex

* Add verbose header information in request package

* Add modify order support for Bithumb exchange

* Change to unsupported function for exchange Bitflyer

* Change to unsupported function for exchange Bitfinex

*  Change to unsupported function for exchange ANX

* Change interface function signature

* Rm redundant code for authenticated requests in Bithumb

* Add error check if decimal values supplied for create or modifying an order on Bitmex

* Added test functions across the exchanges

* Rm comment for modify order on Alphapoint exchange

* Update tmpl file for exchange wrapper
2018-12-20 16:31:17 +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
098350739f Update WEX API endpoints again ¬_¬ 2018-12-06 15:52:37 +11:00
Adrian Gallagher
c580276ba8 Update WEX API endpoints (again) ¯\_(ツ)_/¯ 2018-12-03 12:15:18 +11:00
Scott
458aab301e Cancel order wrapper wrapup (#214)
* Reimplements order cancellation for alphapoint, anx, binance, bitfinex, bithumb, bitmex, bitstamp, bittrex,  btcmarkets, coinbasepro, coinut, exmo, gateio, gemini, gitbtc, huobi, hadax, itbit, kraken, lakebtc, liqui, okcoin, okex, poloniex, wex, yobit and zb wrappers. Adds new order cancellation struct type. Updates old tests that pointed to the wrong unrenamed methods

* Sets up tests for all supported exchanges. request.DoRequest errors when response status is not 200

* Updates alphapoint, coinut, hitbtc, lakebtc cancel order implementations. Finishes testing

* Adds localbitcoin cancel order wrapper support

* Fixes tests and build issues. Adds WexIssue flag for tests

* Changes CancelOrder signature to only return error. Allows exchange to format currency pairs with delimiters
2018-11-30 16:20:34 +11:00
Ryan O'Hara-Reid
92534249bf Remove unwanted wrapper name stuttering and standardise common error returns (#213) 2018-11-23 12:55:00 +11:00
Scott
c41f611d96 Map exchange wrapper function "SubmitExchangeOrder" to exchange implementations (#211)
* Sets up Alphapoint and ANX wrappers to use exchange implementations of submit orders
Creates const types for orderType and orderSides

* Changes wrapper func SubmitExchangeOrder return type to string to account for GUID order ID responses

* Adds binance and bitfinex new order wrapper support. Fixes alphapoint order wrapper.

* Adds bitflyer type for exchange order. Adds bithumb and bitmex wrapper support for SubmitExchangeOrder

* Fixes bitmex typo. Adds bitstamp, bittrex, coinbasePro, coinut SubmitExchangeOrder wrapper support

* Maps exchange wrapper function 'SubmitExchangeOrder' to exchange methods for exmo, gateio, gemini, hitbtc, huobi, huobihadax and itbit

* Maps exchange wrapper function 'SubmitExchangeOrder' to exchange methods for kraken, lakebtc, liqui, okcoin, okex, poloniex, wex, yobit and zb

* Updates interface, fixes wrapper type mismatch and fixes tests from changed parameters

* Adds generic support for SubmitExchangeOrder for localbitcoins_wrapper

* Updates wrappers tests and submit order implementations for anx, binance, bitfinex, bitflyer (cannot test), bitmex, bitstamp

* Fixes bitstamp tests

* Adds tests for submitting orders with bittrex, btcmarkets, coinbasepro and coinut

* Adds tests for exmo, gatio, gemini and hitbtc
Makes adjustments where necessary

* Adds tests and updates order implementations for huobi, huobiHadax, itbit, kraken, lakebtc, liqui, okcoin, okex, poloniex, wex, yobit and zb. Not all have been verified due to exchange issues

* Fixes variable names and symbol usages

* Fixes HitBTC order API implementation

* Removes formatting code. Adds error handling for unsupported order types. Fixes typo

* Fixes missed replace for new ToString function. Removes unused functions

* Changes report of unknown withdrawal type with bitshift approximation.
Improved code cov

* Updates wrapper SubmitExchangeOrder return to use a fancy new SubmitOrderResponse struct type to clarify if an order submission is successful or not
2018-11-22 17:28:29 +11:00
Adrian Gallagher
a78f3c21a5 Update WEX API endpoints and re-enable tests 2018-11-22 09:27:45 +11:00
Adrian Gallagher
da36c654b3 Skip WEX tests temporarily 2018-11-21 15:35:38 +11:00
Scott
baffb46300 Exchange withdraw capabilities (#199)
* Initial broken commit for updating exchanges to store data on whether withdrawals can be handled completely by the API

* Changes to use base exchange method to determine withdrawal permissions using bitshifting

* Adds withdrawal capabilities for alphapoint, anx, binance, bitfinex, bitflyer, bithumb, bitmex, bitstamp, bittrex exchanges

* Adds withdraw capabilities for btcmarkets, coinbasepro, coinut, exmo, gateio, gemini, hitbtc, huobi, hadax

* Adds withdraw capabilities for itbit, kraken, lakebtc, liqui, localbitcoins, okcoin, okex, poloniex, wex, yobit, zb

* Titillating tests & Wonderful wrappers

* Fixes typo, double checks all apis and corrects permissions

* Fixes gemini test

* Fixes incorrect log placement. Removes breaks

* Addresses PR comments. Changes readable function to: FormatWithdrawPermissions, adds new function 'GetWithdrawPermissions' and 'SupportsWithdrawPermissions'. Adds three functions to interface

* Removes unnecessary config_example.json additions

* Fixes bitwise comparisons. Adds more tests to highlight expected outcomes
2018-11-05 10:35:03 +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
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
Adrian Gallagher
a0de1b78a7 Support configurable HTTP user agent per exchange 2018-08-07 13:05:13 +10:00
Ryan O'Hara-Reid
3b8591bcc8 Updated documentation tool (#155)
* Updated documentation tool
Added templates
Updated documentation using tool

* Fixed incorrect version in web README

* Added new templates to tool.
Updated documents in templates across the code base.
Used tool to regenerate documentation.
2018-07-19 16:02:24 +10:00
Marco Franssen
0f209165d5 Improved code quality (#154)
* Removed package-lock.json form gitignore as it ensures specific package versions

* Updated all @angular web dependencies

* Resolved tslint errors using autofix option

* Resolved some more tslint issues

* Added lint scripts to package.json to easy lint the ts files

* Updated codelyzer and tslint

* Run web on travis using node 10 and run the lint task

* Resolved some more tslint issues after upgrading tslint and codelyzer

* Resolved golint issues with regards to exchange comments

* Resolved spelling errors shown by goreportcard.com

* Resolved gofmt warnings using goreportcard.com

* Resolved golint issue by removing unrequired else statement

* Refactored slack.go to reduce cyclomatic complexity

* Fixed govet issue where Slack was passed as value instead of reference
2018-07-18 15:46:47 +10:00
Ryan O'Hara-Reid
ed675bde30 Add bank details support 2018-07-12 12:25:07 +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
02dbab03ce Added new initial functions for bot/exchange interface. (#120) 2018-05-30 13:49:58 +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
Ryan O'Hara-Reid
7fc9d20fd7 Introduce request package and integrate with exchanges 2018-03-27 14:22:52 +11: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
10d5abacb3 Initial implementation of interface function for getting exchange history. 2018-02-26 10:01:42 +11:00
Adrian Gallagher
2e1b5afd94 Fix err check 2018-01-29 17:13:26 +11:00
Adrian Gallagher
ce908ee939 Use config.json by default if config file isn't encrypted
Fixes issue: https://github.com/thrasher-/gocryptotrader/issues/48
Allows for auto syntax highlighing in text editors/IDEs
2017-11-14 14:15:01 +11:00
Ryan O'Hara-Reid
7333c16dc4 Added test module for WEX exchange, added wex to testdata & fixed exchange test. 2017-10-03 12:31:44 +11:00
Ryan O'Hara-Reid
6975f411d4 Fixed merge issues, fixed race condition in gemini package. 2017-10-03 12:31:44 +11:00
Adrian Gallagher
05b2bc0d56 Fix WEX linter issues 2017-09-16 13:18:28 +10:00
Adrian Gallagher
542828e957 Rename BTC-e to WEX and reinstate exchange 2017-09-16 13:03:00 +10:00