I'm working on a stock trading app that utilizes the broker's dll file and commands to makes requests through the API. The biggest challenge (to me at least) has been figuring out how to give the API the various data types it requires for input. Right now I'm working on some test code that will buy 1 share of a stock. Many of the necessary conversions I've been able to figure out but enum continues to elude me.
InsertOrderRequest insertOrderRequest = new InsertOrderRequest();
insertOrderRequest.m_accountNumber = "00000001";
insertOrderRequest.m_symbolId = Convert.ToUInt64(1900028);
insertOrderRequest.m_quantity = Convert.ToDouble(1);
insertOrderRequest.m_orderType = "Market"; //Needs to be enum
insertOrderRequest.m_timeInForce = "Day"; //Needs to be enum
insertOrderRequest.m_action = "Buy"; //Needs to be enum
insertOrderRequest.m_primaryRoute = "AUTO";
You can see the 3 lines that I've marked "Needs to be enum". Now I've gone into the object browser and determined that "Market", "Day", and "Buy" are the appropriate responses but they aren't the right data type. Is there a line of code similar to "Convert.ToDouble()" that will convert these from string to enum? Thanks.