What is the best way to prepare bar data for real-time auto-trading under IB API? I need to trigger the code to do calculation and send order at specific time every day, say every 15 minutes, like 9:45 AM. I am thinking to (1) use reqHistoricalData() method to retrieve data immediately after 9:45 AM; or (2)use reqMketData() to continously get the price then store in a SQL Server and right after 9:45 do a SQL query to get the bar data.
The advantage of (1) is the bar data is neat and I do not need to process, but I need to convert the price data to the bar data under (2). However, under (1), the immediate availability of historical data is under question and any delay in return historial data will mess up the whole trading. But under (2), at least I can control most of the data, but the SQL thing may take some time to process and since I collected data myself, the data quality may not be as neat as that returned from (1).
Also, what is the best way to implement a trigger action that can fire off at the specific time? I think about timer, but is there a better way? I am using C#.
Thanks for your time and input.
The advantage of (1) is the bar data is neat and I do not need to process, but I need to convert the price data to the bar data under (2). However, under (1), the immediate availability of historical data is under question and any delay in return historial data will mess up the whole trading. But under (2), at least I can control most of the data, but the SQL thing may take some time to process and since I collected data myself, the data quality may not be as neat as that returned from (1).
Also, what is the best way to implement a trigger action that can fire off at the specific time? I think about timer, but is there a better way? I am using C#.
Thanks for your time and input.