Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Find aggregated volume based on price.

$
0
0
for( int i=0; i<bids.Count && i<count; i++ )
            {
                WriteLine("{0,15}\t{1}\t{2}\t{3}\t{4}\t\t{5,15}\t{6}\t{7}\t{8}\t{9}",
                    disp(bids[i].MktMkrId),
                    disp(bids[i].MktMkrBid),
                    disp(bids[i].MktMkrBidsize),
                    disp(bids[i].MktMkrBidTime),
                    disp(bids[i].MktMkrStatus),
                    disp(asks[i].MktMkrId),
                    disp(asks[i].MktMkrAsk),
                    disp(asks[i].MktMkrAsksize),
                    disp(asks[i].MktMkrAskTime),
                    disp(asks[i].MktMkrStatus)
                    );

                

            }
Hi guys,

I have the code above which gives me line by lines each values.

I am looking for a way to make the aggregated Bid volume and aggregated Ask volume based on price.

So right now, the console gives me 20 writelines:

For example: 

Writeline("Bid Size: 200 Bid Price: 5.12  Ask Price 5.17 Ask Size: 300"); //5.12 & 5.17
Writeline("Bid Size: 100 Bid Price: 5.12  Ask Price 5.17 Ask Size: 100"); //5.12 & 5.17
Writeline("Bid Size: 400 Bid Price: 5.12  Ask Price 5.17 Ask Size: 900"); //5.12 & 5.17
Writeline("Bid Size: 800 Bid Price: 5.11  Ask Price 5.18 Ask Size: 400"); //5.11 & 5.18
Writeline("Bid Size: 100 Bid Price: 5.11  Ask Price 5.18 Ask Size: 100"); //5.11 & 5.18
Writeline("Bid Size: 200 Bid Price: 5.10  Ask Price 5.19 Ask Size: 2000"); //5.10 & 5.19



How can i achieve the goal that the console gives me the aggregated volume based on price only?

Desired output:

Writeline("Bid Size: 700 Bid Price: 5.12 Ask Price 5.17 Ask Size: 1300"); // Aggregated 
Writeline("Bid Size: 900 Bid Price: 5.11 Ask Price 5.18 Ask Size: 500"); // Aggregated
Writeline("Bid Size: 100 Bid Price: 5.10 Ask Price 5.19 Ask Size: 2000"); // Aggregated

Can anyone help or guide me please?


Please do not forget to click “Vote as Helpful” if the reply helps/directs you toward your solution and or "Mark as Answer" if it solves your question. This will help to contribute to the forum.


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>