Skip to content

Commit

Permalink
BTCMarkets: Fix order JSON unmarshal response (thrasher-corp#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasher- authored Jun 6, 2019
1 parent d639f6e commit 92d798e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion exchanges/btcmarkets/btcmarkets_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
13 changes: 4 additions & 9 deletions exchanges/btcmarkets/btcmarkets_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 92d798e

Please sign in to comment.