mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-20 23:16:49 +00:00
Merge branch 'master' into engine
This commit is contained in:
@@ -28,7 +28,7 @@ before_test:
|
||||
|
||||
test_script:
|
||||
# test back-end
|
||||
- go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.16.0
|
||||
- go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.18.0
|
||||
- '%GOPATH%\bin\golangci-lint.exe run --verbose'
|
||||
- ps: >-
|
||||
if($env:APPVEYOR_SCHEDULED_BUILD -eq 'true') {
|
||||
|
||||
@@ -4,7 +4,7 @@ run:
|
||||
tests: true
|
||||
skip-dirs:
|
||||
- vendor
|
||||
- web
|
||||
- web/
|
||||
- testdata
|
||||
|
||||
linters:
|
||||
@@ -21,14 +21,13 @@ linters:
|
||||
- ineffassign
|
||||
# - deadcode
|
||||
- typecheck
|
||||
- goimports
|
||||
- govet
|
||||
|
||||
# disabled by default linters
|
||||
# - bodyclose
|
||||
- golint
|
||||
- stylecheck
|
||||
- gosec
|
||||
# - interfacer
|
||||
# - interfacer
|
||||
- unconvert
|
||||
# - dupl
|
||||
- goconst
|
||||
@@ -46,6 +45,7 @@ linters:
|
||||
- gocritic
|
||||
# - gochecknoinits
|
||||
# - gochecknoglobals
|
||||
# - funlen
|
||||
|
||||
linters-settings:
|
||||
govet:
|
||||
@@ -67,6 +67,7 @@ linters-settings:
|
||||
- wrapperFunc
|
||||
- importShadow
|
||||
- methodExprCall
|
||||
- evalOrder
|
||||
|
||||
issues:
|
||||
max-issues-per-linter: 0
|
||||
|
||||
@@ -18,7 +18,7 @@ matrix:
|
||||
dist: xenial
|
||||
name: 'GoCryptoTrader [back-end] [linux]'
|
||||
go:
|
||||
- 1.12.x
|
||||
- 1.13.x
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
install: true
|
||||
@@ -35,7 +35,7 @@ matrix:
|
||||
os: osx
|
||||
name: 'GoCryptoTrader [back-end] [darwin]'
|
||||
go:
|
||||
- 1.12.x
|
||||
- 1.13.x
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
install: true
|
||||
|
||||
2
Makefile
2
Makefile
@@ -1,6 +1,6 @@
|
||||
LDFLAGS = -ldflags "-w -s"
|
||||
GCTPKG = github.com/thrasher-corp/gocryptotrader
|
||||
LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.16.0
|
||||
LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.18.0
|
||||
LINTBIN = $(GOPATH)/bin/golangci-lint
|
||||
GCTLISTENPORT=9050
|
||||
GCTPROFILERLISTENPORT=8085
|
||||
|
||||
@@ -1374,33 +1374,37 @@ func (c *Config) DisableNTPCheck(input io.Reader) (string, error) {
|
||||
defer m.Unlock()
|
||||
|
||||
reader := bufio.NewReader(input)
|
||||
log.Warnln(log.ConfigMgr, "Your system time is out of sync, this may cause issues with trading.")
|
||||
log.Warnln(log.ConfigMgr, "How would you like to show future notifications? (a)lert / (w)arn / (d)isable.")
|
||||
log.Warnln(log.ConfigMgr, "Your system time is out of sync, this may cause issues with trading")
|
||||
log.Warnln(log.ConfigMgr, "How would you like to show future notifications? (a)lert / (w)arn / (d)isable")
|
||||
|
||||
var answered = false
|
||||
for ok := true; ok; ok = (!answered) {
|
||||
var resp string
|
||||
answered := false
|
||||
for !answered {
|
||||
answer, err := reader.ReadString('\n')
|
||||
if err != nil {
|
||||
return "", err
|
||||
return resp, err
|
||||
}
|
||||
|
||||
answer = strings.TrimRight(answer, "\r\n")
|
||||
switch answer {
|
||||
case "a":
|
||||
c.NTPClient.Level = 0
|
||||
resp = "Time sync has been set to alert"
|
||||
answered = true
|
||||
return "Time sync has been set to alert", nil
|
||||
case "w":
|
||||
c.NTPClient.Level = 1
|
||||
resp = "Time sync has been set to warn only"
|
||||
answered = true
|
||||
return "Time sync has been set to warn only", nil
|
||||
case "d":
|
||||
c.NTPClient.Level = -1
|
||||
resp = "Future notifications for out of time sync has been disabled"
|
||||
answered = true
|
||||
return "Future notications for out time sync have been disabled", nil
|
||||
default:
|
||||
log.Warnln(log.ConfigMgr,
|
||||
"Invalid option selected, please try again (a)lert / (w)arn / (d)isable")
|
||||
}
|
||||
}
|
||||
return "", errors.New("something went wrong, NTPCheck should never make it this far")
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// CheckConnectionMonitorConfig checks and if zero value assigns default values
|
||||
|
||||
@@ -1647,8 +1647,8 @@ func TestDisableNTPCheck(t *testing.T) {
|
||||
}
|
||||
|
||||
disable, _ := c.DisableNTPCheck(strings.NewReader("d\n"))
|
||||
if disable != "Future notications for out time sync have been disabled" {
|
||||
t.Errorf("failed expected %v got %v", "Future notications for out time sync have been disabled", disable)
|
||||
if disable != "Future notifications for out of time sync has been disabled" {
|
||||
t.Errorf("failed expected %v got %v", "Future notifications for out of time sync has been disabled", disable)
|
||||
}
|
||||
|
||||
_, err = c.DisableNTPCheck(strings.NewReader(" "))
|
||||
|
||||
@@ -547,7 +547,7 @@ var (
|
||||
BAT = NewCode("BAT")
|
||||
ETP = NewCode("ETP")
|
||||
HOT = NewCode("HOT")
|
||||
STRAT = NewCode("STRAT")
|
||||
STRAT = NewCode("STRAT") // nolint: misspell
|
||||
GNT = NewCode("GNT")
|
||||
REP = NewCode("REP")
|
||||
SNT = NewCode("SNT")
|
||||
|
||||
@@ -155,28 +155,28 @@ func (c *Coinmarketcap) GetCryptocurrencyIDMap() ([]CryptoCurrencyMap, error) {
|
||||
// GetCryptocurrencyHistoricalListings returns a paginated list of all
|
||||
// cryptocurrencies with market data for a given historical time.
|
||||
func (c *Coinmarketcap) GetCryptocurrencyHistoricalListings() ([]CryptocurrencyHistoricalListings, error) {
|
||||
return nil, errors.New("this endpoint is not yet available")
|
||||
return nil, common.ErrNotYetImplemented
|
||||
// NOTE unreachable code but will be utilised at a later date
|
||||
// resp := struct {
|
||||
// Data []CryptocurrencyHistoricalListings `json:"data"`
|
||||
// Status Status `json:"status"`
|
||||
// }{}
|
||||
|
||||
// err := c.CheckAccountPlan(0)
|
||||
// nolint: gocritic err := c.CheckAccountPlan(0)
|
||||
// if err != nil {
|
||||
// return resp.Data, err
|
||||
// }
|
||||
|
||||
// err = c.SendHTTPRequest(http.MethodGet, endpointCryptocurrencyHistoricalListings, nil, &resp)
|
||||
// nolint: gocritic err = c.SendHTTPRequest(http.MethodGet, endpointCryptocurrencyHistoricalListings, nil, &resp)
|
||||
// if err != nil {
|
||||
// return resp.Data, err
|
||||
// }
|
||||
|
||||
//nolint:gocritic if resp.Status.ErrorCode != 0 {
|
||||
// nolint: gocritic nolint:gocritic if resp.Status.ErrorCode != 0 {
|
||||
// return resp.Data, errors.New(resp.Status.ErrorMessage)
|
||||
// }
|
||||
|
||||
//nolint:gocritic return resp.Data, nil
|
||||
// nolint: gocritic nolint:gocritic return resp.Data, nil
|
||||
}
|
||||
|
||||
// GetCryptocurrencyLatestListing returns a paginated list of all
|
||||
|
||||
@@ -323,7 +323,7 @@ func (b *Bitflyer) SendHTTPRequest(path string, result interface{}) error {
|
||||
// if you have access and update the authenticated requests
|
||||
// TODO: Fill out this function once API access is obtained
|
||||
func (b *Bitflyer) SendAuthHTTPRequest() {
|
||||
// headers := make(map[string]string)
|
||||
// nolint: gocritic headers := make(map[string]string)
|
||||
// headers["ACCESS-KEY"] = b.API.Credentials.Key
|
||||
// headers["ACCESS-TIMESTAMP"] = strconv.FormatInt(time.Now().UnixNano(), 10)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package bitflyer
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -248,26 +247,13 @@ func (b *Bitflyer) UpdateOrderbook(p currency.Pair, assetType asset.Item) (order
|
||||
// GetAccountInfo retrieves balances for all enabled currencies on the
|
||||
// Bitflyer exchange
|
||||
func (b *Bitflyer) GetAccountInfo() (exchange.AccountInfo, error) {
|
||||
var response exchange.AccountInfo
|
||||
response.Exchange = b.GetName()
|
||||
// accountBalance, err := b.GetAccountBalance()
|
||||
// if err != nil {
|
||||
// return response, err
|
||||
// }
|
||||
if !b.Enabled {
|
||||
return response, errors.New("exchange not enabled")
|
||||
}
|
||||
|
||||
// implement once authenticated requests are introduced
|
||||
|
||||
return response, nil
|
||||
return exchange.AccountInfo{}, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetFundingHistory returns funding history, deposits and
|
||||
// withdrawals
|
||||
func (b *Bitflyer) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
var fundHistory []exchange.FundHistory
|
||||
return fundHistory, common.ErrFunctionNotSupported
|
||||
return nil, common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
// GetExchangeHistory returns historic trade data since exchange opening.
|
||||
|
||||
@@ -533,13 +533,10 @@ func (l *Lbank) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]
|
||||
var finalResp []exchange.OrderDetail
|
||||
var resp exchange.OrderDetail
|
||||
var tempCurr currency.Pairs
|
||||
var x int
|
||||
if len(getOrdersRequest.Currencies) == 0 {
|
||||
tempCurr = l.GetEnabledPairs(asset.Spot)
|
||||
} else {
|
||||
for x < len(getOrdersRequest.Currencies) {
|
||||
tempCurr = getOrdersRequest.Currencies
|
||||
}
|
||||
tempCurr = getOrdersRequest.Currencies
|
||||
}
|
||||
for a := range tempCurr {
|
||||
p := l.FormatExchangeCurrency(tempCurr[a], asset.Spot).String()
|
||||
|
||||
@@ -577,6 +577,6 @@ func TestSetup(t *testing.T) {
|
||||
w := WebsocketOrderbookLocal{}
|
||||
w.Setup(1, true, true, true, true, "hi")
|
||||
if w.obBufferLimit != 1 || !w.bufferEnabled || !w.sortBuffer || !w.sortBufferByUpdateIDs || !w.updateEntriesByID || w.exchangeName != "hi" {
|
||||
t.Errorf("Setup incorrectly loaded %v", w)
|
||||
t.Errorf("Setup incorrectly loaded %s", w.exchangeName)
|
||||
}
|
||||
}
|
||||
|
||||
2
go.mod
2
go.mod
@@ -20,7 +20,7 @@ require (
|
||||
github.com/toorop/go-pusher v0.0.0-20180521062818-4521e2eb39fb
|
||||
github.com/urfave/cli v1.20.0
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5
|
||||
golang.org/x/net v0.0.0-20190606173856-1492cefac77f // indirect
|
||||
golang.org/x/net v0.0.0-20190606173856-1492cefac77f
|
||||
google.golang.org/genproto v0.0.0-20190605220351-eb0b1bdb6ae6
|
||||
google.golang.org/grpc v1.21.1
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user