From 536ce4912d23efb4ae9c952c385beb0f86de4507 Mon Sep 17 00:00:00 2001 From: frankrap <2201441955@qq.com> Date: Tue, 20 Oct 2020 15:39:49 +0800 Subject: [PATCH] Update --- exchanges/exsim/exsim.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/exchanges/exsim/exsim.go b/exchanges/exsim/exsim.go index 2e2e027..cdb3bb3 100644 --- a/exchanges/exsim/exsim.go +++ b/exchanges/exsim/exsim.go @@ -246,7 +246,13 @@ func (b *ExSim) matchMarketOrder(order *Order) (changed bool, err error) { return } - ob := b.getOrderBook() + var ob *OrderBook + //ob := b.getOrderBook() + if order.Symbol != "" { + ob, _ = b.GetOrderBook(order.Symbol, 25) + } else { + ob = b.getOrderBook() + } // 判断开仓数量 margin := b.balance @@ -344,7 +350,13 @@ func (b *ExSim) matchLimitOrder(order *Order, immediate bool) (match bool, err e side := b.getOrderSide(order) - ob := b.getOrderBook() + var ob *OrderBook + //ob := b.getOrderBook() + if order.Symbol != "" { + ob, _ = b.GetOrderBook(order.Symbol, 25) + } else { + ob = b.getOrderBook() + } if order.Direction == Buy { // Bid order filledAmount, avgPrice := b.matchBid(order.Amount, ob.Asks...) //if order.Price < ob.AskPrice() {