I am in the process of writing an algo for stock scanning and auto trades. Need help to Get only the closed orders for a particular stock for Today, the logic is if I already traded a stock for a day and if the scanner comes up with the same stock at different time I would like to avoid the placing an order.
Example - At 9:45 AM EST the scanner came up with AAPL as a potential buy. The program places the trade to buy and sell automatically. The trade is completed either with Profit or Loss at 10:15 AM EST.
At 11 AM EST if the scanner comes up with AAPL, I would like to scan through the closed orders for the day since I already traded AAPL the program should not place a new order.
Please help with python codes to achieve the logic.