private int tickOptionComputationField; // 10=Bid, 11=Ask, 12=Last, 13=Model public OSWrapper2(DataHandler2 parentClass) { parentDataHandler2 = parentClass; tickPriceFieldSTK = 66; // priceField; //This to set the kind of data you want: 1=Bid, 2=Ask, 4=Last, 9=Closed, Delayed data 66 Bid, 67 Ask, 68 Last, 72 Highest, 73 Lowest tickPriceFieldOPT = 1; tickOptionComputationField = 13; // optionField;// 10=Bid, 11=Ask, 12=Last, 13=Model, Delayed 80 Bid, 81 Ask, 82 Last, 83 Model Console.WriteLine("Wrapper: Tick Field - " + tickPriceFieldSTK + "Tick Option STK - " + tickPriceFieldOPT + "Tick Option OPT - " + tickOptionComputationField); }
// DATAHANDLER Methods //****************************************************************************************// // Here we create a DataHandler, it will give us back, somehow, the data about the Ticker private void btConnect_Click(object sender, EventArgs e) { // Storing the requested right requestedRight = cbxRight.Text; // Setting how many tickers we are expecting back tickerCount = lsbTickers.Items.Count; // Getting the tickers displayed in the listbox into 8 different arrays (8 is the max number of clients we can connect at the same time) // Finding the arrays dimensions int bigArraysDimension = (int)Math.Floor((double)lsbTickers.Items.Count / numberOfClients); // First seven arrays dimention int lastArrayDimension = lsbTickers.Items.Count - (bigArraysDimension * (numberOfClients - 1)); // This shoud give the odd array dimension, 0 if it has the same dimension as the others // If bigArrayDimension is 0 it means that there is a list of fewer tickets than numberOfClients, so skip the big arrays and jump to the last one if (bigArraysDimension > 0) { for (int i = 1; i < numberOfClients; i++)// Creating 7 arrays of bigArrayDimension dimension { // Creating 7 mini arrays with different tickers lists and feading them to 7 DataHandlers string[] miniTickerList = CreateMiniTickerList(i, bigArraysDimension); // Deciding wether to create a DataHandler for serial computing, or a DataHandler2 for parallel computing if (chbxParallelComputing.Checked) { dataHandler2 = new DataHandler2(i, this, dtpExirationDate.Value.Date, cbxRight.Text, miniTickerList); } else { dataHandler = new DataHandler(i, this, dtpExirationDate.Value.Date, cbxRight.Text, miniTickerList); } } } if (lastArrayDimension == 0)//If there is no last array means the 8th array has the same dimentions of the first 7 { lastArrayDimension = bigArraysDimension; } // We create the last array and dataHandler string[] lastArray = CreateMiniTickerList(numberOfClients, lastArrayDimension, bigArraysDimension); // Deciding wether to create a DataHandler for serial computing, or a DataHandler2 for parallel computing // This is the second time, not very elegant if (chbxParallelComputing.Checked) { dataHandler2 = new DataHandler2(numberOfClients, this, dtpExirationDate.Value.Date, cbxRight.Text, lastArray); } else { dataHandler = new DataHandler(numberOfClients, this, dtpExirationDate.Value.Date, cbxRight.Text, lastArray); } }