Note that there are some explanatory texts on larger screens.

plurals
  1. POC# code and SQL Server 2008 stored procedure performance comparison
    primarykey
    data
    text
    <p>I am developing a high frequency trading application using C#, .NET 3.5 framework and SQL Server 2008 R2. I am subscribing to 70 instruments, for each instrument I am storing 1 minute bars. Each bar for each instrument consists of <code>Open Price</code>, <code>High Price</code>, <code>Low Price</code>, <code>Close Price</code>, <code>Volume</code>. </p> <p>I am pushing all the one minute bars for each instrument in one common table where the primary key is <code>StockID</code>.</p> <p>Now, for some calculation. I will need to construct 5 min bars, 10 mins bars, 15 mins bars etc. from the 1 min Bars. Example: I will loop though last 5 rows of 1 min bars and construct 1st bar with bar size = 5 min. And within that 5 min bar I will need to find <code>Open Price</code>, <code>High Price</code>, <code>Low Price</code>, <code>Close Price</code>, <code>Volume</code>. Similarly, I will need 180, 5 min bars. So, I will need 180 * 5 = 900 rows of 1 min bars. (From 900, I will construct 180 rows each of 5 mins)</p> <ol> <li><p>If I do a simple Select statement from C# code to get all 900 one min data and then loop and create 180 data with 5 min bar in my C# code and in each 5 min bar get open price, high price, close price, volume.</p></li> <li><p>Or, I write a SQL stored procedure to do the same above and return open price, high price, low price, close price, volumes for all 180 data of 5 min bars to C# code.</p></li> </ol> <p>My question is, which will be much faster 1) or 2) and which will be more robust 1) or 2)</p> <p>Hope, I have framed my question and scenario in detail for experts to guide me.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload