Getting only the today's orders

 
I need to get only today's orders (both open/closed). This function runs 5 times within every second (please don't ask why, I need it).
My problem is I only can do it by examine all orders of the given account.
It can be a big problem if the account's history has a huge number of orders.
Is it possible to shorten this process, ie. not running the whole cycle for all the orders of history?
 
linux80s:
I need to get only today's orders (both open/closed). This function runs 5 times within every second (please don't ask why, I need it).
My problem is I only can do it by examine all orders of the given account.
It can be a big problem if the account's history has a huge number of orders.
Is it possible to shorten this process, ie. not running the whole cycle for all the orders of history?

You really don't need it... looking up historical orders 5 times a second is a complete waste of resources they are not going to change from the first time you look them up.

So look them up once then manage the delta change as time goes by.

Not the answer you wanted but it is the sensible answer 

 
Agreed. Only if OrdersTotal has changed do you need to recompute the list.
 
William Roeder #:
Agreed. Only if OrdersTotal has changed do you need to recompute the list.

Yes, you are right. Thank you guys!

 
linux80s:
I need to get only today's orders (both open/closed). This function runs 5 times within every second (please don't ask why, I need it).
My problem is I only can do it by examine all orders of the given account.
It can be a big problem if the account's history has a huge number of orders.
Is it possible to shorten this process, ie. not running the whole cycle for all the orders ofyur

Your broker will ping you an email at the end of the day with all of that days orders, both open and closed. Much easier that coding something up. Let your broker earn their money for once! ;) 

Reason: