Skip to content

Commit

Permalink
Merge pull request ethereum#513 from dinhln89/tmx_fix_order
Browse files Browse the repository at this point in the history
Fixed bug remove order from DB not update orderList.
  • Loading branch information
ngtuna authored May 13, 2019
2 parents bd4ff66 + ec745a5 commit 5133d30
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tomox/orderbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type OrderBookItemRecordBSON struct {

// OrderBook : list of orders
type OrderBook struct {
db OrderDao // this is for orderBook
db OrderDao // this is for orderBook
Bids *OrderTree `json:"bids"`
Asks *OrderTree `json:"asks"`
Item *OrderBookItem
Expand Down Expand Up @@ -312,18 +312,22 @@ func (orderBook *OrderBook) processOrderList(side string, orderList *OrderList,
} else if IsEqual(quantityToTrade, headOrder.Item.Quantity) {
tradedQuantity = CloneBigInt(quantityToTrade)
if side == Bid {
orderBook.Bids.RemoveOrder(headOrder)
orderList.orderTree.RemoveOrderFromOrderList(headOrder, orderList)
//orderBook.Bids.RemoveOrder(headOrder)
} else {
orderBook.Asks.RemoveOrder(headOrder)
orderList.orderTree.RemoveOrderFromOrderList(headOrder, orderList)
//orderBook.Asks.RemoveOrder(headOrder)
}
quantityToTrade = Zero()

} else {
tradedQuantity = CloneBigInt(headOrder.Item.Quantity)
if side == Bid {
orderBook.Bids.RemoveOrder(headOrder)
orderList.orderTree.RemoveOrderFromOrderList(headOrder, orderList)
//orderBook.Bids.RemoveOrder(headOrder)
} else {
orderBook.Asks.RemoveOrderFromOrderList(headOrder, orderList)
orderList.orderTree.RemoveOrderFromOrderList(headOrder, orderList)
//orderBook.Asks.RemoveOrderFromOrderList(headOrder, orderList)
}
}

Expand Down

0 comments on commit 5133d30

Please sign in to comment.