I want to post an limit order just below the last price, but check before if there is already an pending Order at the same price.
So i came up with this, but this one doesnt send an Order as well when there is none yet.
var depth = exchange.GetDepth(); var pricex = depth.Asks[0].Price var ordersx = exchange.GetOrders var ordersprice = ordersx.Price
exchange.SetDirection(“buy”)
if (ordersprice === pricex-0.5,20) {} else {exchange.Buy(pricex-0.5,20)}
Thanks for your help.