Why was my Limit Order executed right after the placement?

The Limit Orders get executed at the best price, they help us buy at a lower price and sell at a higher price. Thus, if you place a Buy Limit Order and the Ask price is lower it will get executed immediately. The Sell Limit Order works the opposite way, it will get executed in case the Bid price equals a set price or higher.