446,147 Members | 1,483 Online
Need help? Post your question and get tips & solutions from a community of 446,147 IT Pros & Developers. It's quick & easy.

# seeking better solution for resetting ID

 P: n/a I use the following code to reset an ID when an order has been filled by more than one trade. For example, order= buy 9 corn, order ID = 101. If the order is filled with three separate trades of, say, 3 each, I need three order IDs (i.e. 101.1, 101.2, 101.3). My simple solution was to use a "char" set to '0' then increment the char for each multiple ID. This works fine if there are only 10 "multi ID trades", but after that the ascii symbols get weird. Any recommendations for a better solution? if(numTrades>1) //setting order ID for mult fills for single order { int dex=y; char id='0'; for(int a=1; a<=numTrades; a++) { string s_id="."; id+=1; s_id+=id; string multiTradeId=orderID+s_id; vTrades[dex++].resetOrderId(multiTradeId); } } Jun 2 '07 #1
2 Replies

 P: n/a I use the following code to reset an ID when an order has been filled by more than one trade. For example, order= buy 9 corn, order ID = 101. If the order is filled with three separate trades of, say, 3 each, I need three order IDs (i.e. 101.1, 101.2, 101.3). My simple solution was to use a "char" set to '0' then increment the char for each multiple ID. This works fine if there are only 10 "multi ID trades", but after that the ascii symbols get weird. Any recommendations for a better solution? if(numTrades>1) //setting order ID for mult fills for single order { int dex=y; char id='0'; for(int a=1; a<=numTrades; a++) { string s_id="."; id+=1; s_id+=id; string multiTradeId=orderID+s_id; vTrades[dex++].resetOrderId(multiTradeId); } } It depends, what do you want to happen after 9 fullfillments? Do you want it to become 101.10 or 101.a or 101.A or soemthing else? And if you use 101.a what do you want to happen after 36 fullfillments? In other words, what comes after 101.z? Jun 3 '07 #3

### This discussion thread is closed

Replies have been disabled for this discussion.

### Similar topics

Browse more C / C++ Questions on Bytes