BTCMarkets: Fix order JSON unmarshal response (#314)

This commit is contained in:
Adrian Gallagher
2019-06-06 11:37:54 +10:00
committed by GitHub
parent d639f6e4a6
commit 92d798ef2a
2 changed files with 5 additions and 10 deletions

View File

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

View File

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