Skip to content

Commit

Permalink
Merge branch 'master' into engine
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasher- committed Aug 23, 2019
1 parent 94a784d commit 2dc813b
Show file tree
Hide file tree
Showing 97 changed files with 111,511 additions and 1,222 deletions.
7 changes: 6 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ test_script:
# test back-end
- go get github.com/golangci/golangci-lint/cmd/[email protected]
- '%GOPATH%\bin\golangci-lint.exe run --verbose'
- go test -race ./...
- ps: >-
if($env:APPVEYOR_SCHEDULED_BUILD -eq 'true') {
go test -race ./... -tags=mock_test_off
}else {
go test -race ./...
}
# test front-end
- node --version
Expand Down
6 changes: 5 additions & 1 deletion CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ CodeLingoBot | https://github.com/CodeLingoBot
CodeLingoTeam | https://github.com/CodeLingoTeam
Daanikus | https://github.com/Daanikus
daniel-cohen | https://github.com/daniel-cohen
DirectX | https://github.com/DirectX
frankzougc | https://github.com/frankzougc
starit | https://github.com/starit
Jimexist | https://github.com/Jimexist
lookfirst | https://github.com/lookfirst
mattkanwisher | https://github.com/mattkanwisher
mKurrels | https://github.com/mKurrels
m1kola | https://github.com/m1kola
cavapoo2 | https://github.com/cavapoo2
zeldrinn | https://github.com/zeldrinn

5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ LINTPKG = github.com/golangci/golangci-lint/cmd/[email protected]
LINTBIN = $(GOPATH)/bin/golangci-lint
GCTLISTENPORT=9050
GCTPROFILERLISTENPORT=8085
CRON = $(TRAVIS_EVENT_TYPE)

get:
GO111MODULE=on go get $(GCTPKG)
Expand All @@ -16,7 +17,11 @@ linter:
check: linter test

test:
ifeq ($(CRON), cron)
go test -race -tags=mock_test_off -coverprofile=coverage.txt -covermode=atomic ./...
else
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
endif

build:
GO111MODULE=on go build $(LDFLAGS)
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
| Huobi.Hadax | Yes | Yes | NA |
| ItBit | Yes | NA | No |
| Kraken | Yes | Yes | NA |
| LakeBTC | Yes | Yes | NA |
| Lbank | Yes | No | NA |
| LakeBTC | Yes | No | NA |
| LocalBitcoins | Yes | NA | NA |
| OKCoin International | Yes | Yes | No |
| OKEX | Yes | Yes | No |
Expand Down Expand Up @@ -129,10 +130,11 @@ Binaries will be published once the codebase reaches a stable condition.
### A very special thank you to all who have contributed to this program:

|User|Github|Contribution Amount|
|--|--|--|| thrasher- | https://github.com/thrasher- | 540 |
| shazbert | https://github.com/shazbert | 173 |
| gloriousCode | https://github.com/gloriousCode | 150 |
| xtda | https://github.com/xtda | 17 |
|--|--|--|
| thrasher- | https://github.com/thrasher- | 543 |
| shazbert | https://github.com/shazbert | 174 |
| gloriousCode | https://github.com/gloriousCode | 154 |
| xtda | https://github.com/xtda | 18 |
| ermalguni | https://github.com/ermalguni | 14 |
| vadimzhukck | https://github.com/vadimzhukck | 10 |
| 140am | https://github.com/140am | 8 |
Expand All @@ -154,10 +156,13 @@ Binaries will be published once the codebase reaches a stable condition.
| CodeLingoTeam | https://github.com/CodeLingoTeam | 1 |
| Daanikus | https://github.com/Daanikus | 1 |
| daniel-cohen | https://github.com/daniel-cohen | 1 |
| DirectX | https://github.com/DirectX | 1 |
| frankzougc | https://github.com/frankzougc | 1 |
| starit | https://github.com/starit | 1 |
| Jimexist | https://github.com/Jimexist | 1 |
| lookfirst | https://github.com/lookfirst | 1 |
| mattkanwisher | https://github.com/mattkanwisher | 1 |
| mKurrels | https://github.com/mKurrels | 1 |
| m1kola | https://github.com/m1kola | 1 |
| cavapoo2 | https://github.com/cavapoo2 | 1 |
| zeldrinn | https://github.com/zeldrinn | 1 |


98 changes: 98 additions & 0 deletions cmd/documentation/exchanges_templates/lbank.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{{define "exchanges lbank" -}}
{{template "header" .}}
## Lbank Exchange

### Current Features

+ REST Support

### How to enable

+ [Enable via configuration](https://githul.com/thrasher-corp/gocryptotrader/tree/master/config#enable-exchange-via-config-example)

+ Individual package example below:

```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```

### How to do REST public/private calls

+ If enabled via "configuration".json file the exchange will be added to the
IBotExchange array in the ```go var bot Bot``` and you will only be able to use
the wrapper interface functions for accessing exchange data. View routines.go
for an example of integration usage with GoCryptoTrader. Rudimentary example
below:

main.go
```go
var l exchange.IBotExchange

for i := range bot.exchanges {
if bot.exchanges[i].GetName() == "Lbank" {
l = bot.exchanges[i]
}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := l.GetTickerPrice()
if err != nil {
// Handle error
}

// Fetches current orderbook information
ob, err := l.GetOrderbookEx()
if err != nil {
// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := l.GetAccountInfo()
if err != nil {
// Handle error
}
```

+ If enabled via individually importing package, rudimentary example below:

```go
// Public calls

// Fetches current ticker information
ticker, err := l.GetTicker()
if err != nil {
// Handle error
}

// Fetches current orderbook information
ob, err := l.GetOrderBook()
if err != nil {
// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := l.GetUserInfo(...)
if err != nil {
// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := l.Trade(...)
if err != nil {
// Handle error
}
```

### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations"}}
{{end}}
3 changes: 2 additions & 1 deletion cmd/documentation/root_templates/root_readme.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
| Huobi.Hadax | Yes | Yes | NA |
| ItBit | Yes | NA | No |
| Kraken | Yes | Yes | NA |
| LakeBTC | Yes | Yes | NA |
| Lbank | Yes | No | NA |
| LakeBTC | Yes | No | NA |
| LocalBitcoins | Yes | NA | NA |
| OKCoin International | Yes | Yes | No |
| OKEX | Yes | Yes | No |
Expand Down
1 change: 0 additions & 1 deletion config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ have multiple deposit accounts for different FIAT deposit currencies.
"websocketResponseCheckTimeout": 30000000,
"websocketResponseMaxLimit": 7000000000,
"httpTimeout": 15000000000,
"AuthenticatedAPISupport": false,
"APIKey": "Key",
"APISecret": "Secret",
"AvailablePairs": "ATENC_GBP,ATENC_NZD,BTC_AUD,BTC_SGD,LTC_BTC,START_GBP,...",
Expand Down
4 changes: 2 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
const (
// Default number of enabled exchanges. Modify this whenever an exchange is
// added or removed
defaultEnabledExchanges = 27
defaultEnabledExchanges = 28
)

func TestGetCurrencyConfig(t *testing.T) {
Expand Down Expand Up @@ -465,7 +465,7 @@ func TestCountEnabledExchanges(t *testing.T) {
}
enabledExch := GetConfigEnabledExchanges.CountEnabledExchanges()
if enabledExch != defaultEnabledExchanges {
t.Error("Test failed. GetConfigEnabledExchanges is wrong")
t.Errorf("Test failed. Expected %v, Received %v", defaultEnabledExchanges, enabledExch)
}
}

Expand Down
42 changes: 42 additions & 0 deletions config_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,48 @@
}
]
},
{
"name": "LBank",
"enabled": true,
"verbose": false,
"websocket": false,
"useSandbox": false,
"restPollingDelay": 10,
"httpTimeout": 15000000000,
"httpUserAgent": "",
"httpDebugging": false,
"authenticatedApiSupport": false,
"apiKey": "Key",
"apiSecret": "Secret",
"apiUrl": "NON_DEFAULT_HTTP_LINK_TO_EXCHANGE_API",
"apiUrlSecondary": "NON_DEFAULT_HTTP_LINK_TO_EXCHANGE_API",
"proxyAddress": "",
"websocketUrl": "NON_DEFAULT_HTTP_LINK_TO_WEBSOCKET_EXCHANGE_API",
"availablePairs": "fbc_usdt,hds_usdt,galt_usdt,dxn_usdt,iog_usdt,ioex_usdt,vollar_usdt,oath_usdt,bloc_usdt,btc_lbcn,eth_lbcn,usdt_lbcn,btc_usdt,eth_usdt,eth_btc,abbc_btc,bzky_eth,onot_eth,kisc_eth,bxa_usdt,atp_usdt,mat_usdt,sky_btc,sky_lbcn,rnt_usdt,vena_usdt,grin_usdt,ida_usdt,pnt_usdt,bsv_btc,bsv_usdt,opx_usdt,tena_eth,seer_lbcn,vet_lbcn,vtho_btc,vnx_lbcn,vnx_btc,amo_eth,ubex_btc,eos_btc,ubex_usdt,tns_lbcn,tns_btc,ali_eth,sdc_eth,sait_eth,artcn_usdt,dax_btc,dax_eth,dali_usdt,vet_usdt,ten_usdt,bch_usdt,neo_usdt,qtum_usdt,zec_usdt,vet_btc,pai_btc,pnt_btc,bch_btc,ltc_btc,neo_btc,dash_btc,etc_btc,qtum_btc,zec_btc,sc_btc,bts_btc,cpx_btc,xwc_btc,fil6_btc,fil12_btc,fil36_btc,eos_usdt,ut_eth,ela_eth,vet_eth,vtho_eth,pai_eth,bfdt_eth,her_eth,ptt_eth,tac_eth,idhub_eth,ssc_eth,skm_eth,iic_eth,ply_eth,ext_eth,eos_eth,yoyow_eth,trx_eth,qtum_eth,zec_eth,bts_eth,btm_eth,mith_eth,nas_eth,man_eth,dbc_eth,bto_eth,ddd_eth,cpx_eth,cs_eth,iht_eth,tky_eth,ocn_eth,dct_eth,zpt_eth,eko_eth,mda_eth,pst_eth,xwc_eth,put_eth,pnt_eth,aac_eth,fil6_eth,fil12_eth,fil36_eth,uip_eth,seer_eth,bsb_eth,cdc_eth,grams_eth,ddmx_eth,eai_eth,inc_eth,bnb_usdt,ht_usdt,bot_eth,kbc_btc,kbc_usdt,mai_usdt,phv_usdt,hnb_usdt,gt_usdt,b91_usdt,voken_usdt,cye_usdt,brc_usdt,btc_ausd",
"enabledPairs": "btc_usdt",
"baseCurrencies": "USD",
"assetTypes": "SPOT",
"supportsAutoPairUpdates": true,
"configCurrencyPairFormat": {
"uppercase": false,
"delimiter": "_"
},
"requestCurrencyPairFormat": {
"uppercase": false,
"delimiter": "_"
},
"bankAccounts": [
{
"bankName": "",
"bankAddress": "",
"accountName": "",
"accountNumber": "",
"swiftCode": "",
"iban": "",
"supportedCurrencies": ""
}
]
},
{
"name": "LocalBitcoins",
"enabled": true,
Expand Down
1 change: 1 addition & 0 deletions currency/coinmarketcap/coinmarketcap.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ func (c *Coinmarketcap) SendHTTPRequest(method, endpoint string, v url.Values, r
false,
false,
c.Verbose,
false,
false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func (c *CurrencyConverter) SendHTTPRequest(endPoint string, values url.Values,
auth,
false,
c.Verbose,
false,
false)
if err != nil {
return fmt.Errorf("currency converter API SendHTTPRequest error %s with path %s",
Expand Down
1 change: 1 addition & 0 deletions currency/forexprovider/currencylayer/currencylayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,5 +243,6 @@ func (c *CurrencyLayer) SendHTTPRequest(endPoint string, values url.Values, resu
auth,
false,
c.Verbose,
false,
false)
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ func (e *ExchangeRates) SendHTTPRequest(endPoint string, values url.Values, resu
false,
false,
e.Verbose,
false,
false)
if err != nil {
return fmt.Errorf("exchangeRatesAPI SendHTTPRequest error %s with path %s",
Expand Down
1 change: 1 addition & 0 deletions currency/forexprovider/fixer.io/fixer.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,6 @@ func (f *Fixer) SendOpenHTTPRequest(endpoint string, v url.Values, result interf
auth,
false,
f.Verbose,
false,
false)
}
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,6 @@ func (o *OXR) SendHTTPRequest(endpoint string, values url.Values, result interfa
false,
false,
o.Verbose,
false,
false)
}
3 changes: 3 additions & 0 deletions engine/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/thrasher-corp/gocryptotrader/exchanges/itbit"
"github.com/thrasher-corp/gocryptotrader/exchanges/kraken"
"github.com/thrasher-corp/gocryptotrader/exchanges/lakebtc"
"github.com/thrasher-corp/gocryptotrader/exchanges/lbank"
"github.com/thrasher-corp/gocryptotrader/exchanges/localbitcoins"
"github.com/thrasher-corp/gocryptotrader/exchanges/okcoin"
"github.com/thrasher-corp/gocryptotrader/exchanges/okex"
Expand Down Expand Up @@ -174,6 +175,8 @@ func LoadExchange(name string, useWG bool, wg *sync.WaitGroup) error {
exch = new(kraken.Kraken)
case "lakebtc":
exch = new(lakebtc.LakeBTC)
case "lbank":
exch = new(lbank.Lbank)
case "localbitcoins":
exch = new(localbitcoins.LocalBitcoins)
case "okcoin international":
Expand Down
22 changes: 20 additions & 2 deletions exchanges/alphapoint/alphapoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,16 @@ func (a *Alphapoint) SendHTTPRequest(method, path string, data map[string]interf
return errors.New("unable to JSON request")
}

return a.SendPayload(method, path, headers, bytes.NewBuffer(PayloadJSON), result, false, false, a.Verbose, a.HTTPDebugging)
return a.SendPayload(method,
path,
headers,
bytes.NewBuffer(PayloadJSON),
result,
false,
false,
a.Verbose,
a.HTTPDebugging,
a.HTTPRecording)
}

// SendAuthenticatedHTTPRequest sends an authenticated request
Expand All @@ -543,5 +552,14 @@ func (a *Alphapoint) SendAuthenticatedHTTPRequest(method, path string, data map[
return errors.New("unable to JSON request")
}

return a.SendPayload(method, path, headers, bytes.NewBuffer(PayloadJSON), result, true, true, a.Verbose, a.HTTPDebugging)
return a.SendPayload(method,
path,
headers,
bytes.NewBuffer(PayloadJSON),
result,
true,
true,
a.Verbose,
a.HTTPDebugging,
a.HTTPRecording)
}
Loading

0 comments on commit 2dc813b

Please sign in to comment.