.NET Conditional Callback on a type.
Posted
by
Mahesh
on Stack Overflow
See other posts from Stack Overflow
or by Mahesh
Published on 2011-02-14T15:21:20Z
Indexed on
2011/02/14
15:25 UTC
Read the original article
Hit count: 254
I have a stock price which changes by nature all the time. And, there will be many users who wants to buy that stock.
Let's say that the stock price is started at 10 and let's say, 30 people bid for 10.98, 20 people bid for 7.45, 100 people bid for 8.99.
During the day, the stock price can touch any of these values, and if that happens, I want to execute all the orders for users who quoted that price.
Technically, I am storing in a List. Whenever the price changes, I am checking against all the values in the list and executing those that satisfy the quoted price.
Class Bids
{
string stockname;
double quote;
}
Is there any better alternative way to callback the satisfied items in the list rather than checking all the items whenever there is a change??
If storing in a list is not right way of doing it, let me know the best way.
© Stack Overflow or respective owner