Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Level 2 Book Example Syntax Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Level 2 Book Example Syntax Question

    This should be an easy one.... I am going through the Level 2 book example code, and I can reverse engineer it to a point. But what I need to be able to do is convert each row in the list into a column. So instead of having 1 column with 10 rows in this output, I could run several different filters on it and then 10 columns. Code example:

    Print("Ask Book " + GetCurrentAsk());
    for (int idx = 0; idx < askRows.Count; idx++)
    Print("Ask Price=" + askRows[idx].Price + " Volume=" + askRows[idx].Volume + "Prior Volume" + askRows[idx].PriorVolume +" Position=" + idx);

    So I suppose what I am looking for is a way to say when row is in position 0 or position 3 or position 6 then do..... And for each of these I will just take the output and make a new column. Is there any simple way to move through this list by filtering on row position?

    Thanks in advance!

    Ian

    #2
    Hello iantg,

    Thank you for the post.

    Regarding the position, if you have used the code from the sample we provide, the e.Position is used to insert items into the correct position of the lists. With that being inserted in that way, you should be able to just use index-based access if you wanted to know the 3rd position for example that would just be index 2 of the list.

    Can you confirm, are you asking how to use the askRows and then say I wan the position 0 or 3 data?

    I look forward to being of further assistance.

    Comment


      #3
      Hi Jesse, Yes this is correct. And we are on the same page with the concept. I just need the syntax. I have tried a few things but haven't quite got it working. So what we have from the example code is this:

      Print("Ask Book " + GetCurrentAsk());
      for (int idx = 0; idx < askRows.Count; idx++)
      Print("Ask Price=" + askRows[idx].Price + " Volume=" + askRows[idx].Volume + "Prior Volume" + askRows[idx].PriorVolume +" Position=" + idx);

      And ultimately what I need is something like this:

      Header Columns:

      AskPrice1 AskVolume1 AskPrice2 AskVolume2 AskPrice3 AskVolume3, etc.

      Any syntax notes would save me some headache.

      I appreciate it.

      Ian

      Comment


        #4
        Hello iantg,

        If you are just trying to use the position, you could use a direct index instead of a loop is this what you are asking to do?

        Code:
        Print("Ask Price=" + askRows[0].Price + " Volume=" + askRows[0].Volume + "Prior Volume" + askRows[0].PriorVolume +" Position=" + 0);
        This would be the first row or index 0.


        I look forward to being of further assistance.

        Comment


          #5
          Thanks Jesse, I will take a stab at it with the approach you suggested and circle back if I hit any snags.
          Thanks!

          Ian

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          20 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          119 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          63 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          41 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          45 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X