Merge branch 'master' into engine

This commit is contained in:
Adrian Gallagher
2019-05-29 11:15:50 +10:00
9 changed files with 25 additions and 24 deletions

View File

@@ -2,10 +2,17 @@ build: off
clone_folder: c:\gopath\src\github.com\thrasher-\gocryptotrader
cache:
- '%APPDATA%\npm-cache'
- '%GOPATH%\pkg\mod'
- '%LOCALAPPDATA%\go-build'
- c:\gopath\src\github.com\thrasher-\gocryptotrader\web\node_modules
environment:
GOPATH: c:\gopath
GO111MODULE: on
NODEJS_VER: 10.15.3
APPVEYOR_SAVE_CACHE_ON_ERROR: true
stack: go 1.12.3
@@ -21,7 +28,7 @@ before_test:
test_script:
# test back-end
- go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.15.0
- go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.16.0
- '%GOPATH%\bin\golangci-lint.exe run --verbose'
- go test -race ./...

View File

@@ -78,4 +78,4 @@ issues:
- gosec
service:
golangci-lint-version: 1.15.x
golangci-lint-version: 1.16.x

View File

@@ -1,6 +1,6 @@
LDFLAGS = -ldflags "-w -s"
GCTPKG = github.com/thrasher-/gocryptotrader
LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.15.0
LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.16.0
LINTBIN = $(GOPATH)/bin/golangci-lint
GCTLISTENPORT=9050
GCTPROFILERLISTENPORT=8085

View File

@@ -751,7 +751,7 @@ func TestReadConfig(t *testing.T) {
err = readConfig.ReadConfig("bla")
if err == nil {
t.Error("Test failed. TestReadConfig " + err.Error())
t.Error("Test failed. TestReadConfig error cannot be nil")
}
err = readConfig.ReadConfig("")

View File

@@ -78,7 +78,7 @@ type OrderToGo struct {
// Order holds order information
type Order struct {
ID int64 `json:"id"`
ID string `json:"id"`
Currency string `json:"currency"`
Instrument string `json:"instrument"`
OrderSide string `json:"orderSide"`

View File

@@ -323,7 +323,12 @@ func (b *BTCMarkets) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.Ca
var orderList []int64
for i := range openOrders {
orderList = append(orderList, openOrders[i].ID)
orderIDInt, err := strconv.ParseInt(openOrders[i].ID, 10, 64)
if err != nil {
cancelAllOrdersResponse.OrderStatus[openOrders[i].ID] = err.Error()
continue
}
orderList = append(orderList, orderIDInt)
}
if len(orderList) > 0 {
@@ -333,8 +338,8 @@ func (b *BTCMarkets) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.Ca
}
for i := range orders {
if err != nil {
cancelAllOrdersResponse.OrderStatus[strconv.FormatInt(orders[i].ID, 10)] = err.Error()
if !orders[i].Success {
cancelAllOrdersResponse.OrderStatus[strconv.FormatInt(orders[i].ID, 10)] = orders[i].ErrorMessage
}
}
}
@@ -376,7 +381,7 @@ func (b *BTCMarkets) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
OrderDetail.Amount = orders[i].Volume
OrderDetail.OrderDate = orderDate
OrderDetail.Exchange = b.GetName()
OrderDetail.ID = strconv.FormatInt(orders[i].ID, 10)
OrderDetail.ID = orders[i].ID
OrderDetail.RemainingAmount = orders[i].OpenVolume
OrderDetail.OrderSide = side
OrderDetail.OrderType = orderType
@@ -448,7 +453,7 @@ func (b *BTCMarkets) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest
orderType := exchange.OrderType(strings.ToUpper(resp[i].OrderType))
openOrder := exchange.OrderDetail{
ID: strconv.FormatInt(resp[i].ID, 10),
ID: resp[i].ID,
Amount: resp[i].Volume,
Exchange: b.Name,
RemainingAmount: resp[i].OpenVolume,
@@ -517,7 +522,7 @@ func (b *BTCMarkets) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest
orderType := exchange.OrderType(strings.ToUpper(respOrders[i].OrderType))
openOrder := exchange.OrderDetail{
ID: strconv.FormatInt(respOrders[i].ID, 10),
ID: respOrders[i].ID,
Amount: respOrders[i].Volume,
Exchange: b.Name,
RemainingAmount: respOrders[i].OpenVolume,

View File

@@ -49,10 +49,6 @@ func (b *BTSE) WsConnect() error {
b.Name, err)
}
if err != nil {
return err
}
go b.WsHandleData()
b.GenerateDefaultSubscriptions()

View File

@@ -152,12 +152,6 @@ func (h *HUOBI) Run() {
}
exchCfg.BaseCurrencies = currency.Currencies{currency.USD}
h.BaseCurrencies = currency.Currencies{currency.USD}
err = cfg.UpdateExchangeConfig(exchCfg)
if err != nil {
log.Errorf("%s failed to update config. %s\n", h.Name, err)
return
}
}
if forceUpdate {

View File

@@ -284,9 +284,8 @@ func (l *LocalBitcoins) SubmitOrder(p currency.Pair, side exchange.OrderSide, _
if err != nil {
return submitOrderResponse, err
}
if err == nil {
submitOrderResponse.IsOrderPlaced = true
}
submitOrderResponse.IsOrderPlaced = true
// Now to figure out what ad we just submitted
// The only details we have are the params above