- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll make a trading app that trades up to 5 assets concurrently. The trading server is accessed through websockets. So each concurrent work/task should open/close a websocket connection every minute (1min trading).
Tasking is the way to go?
Thank you!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Eduardo,
I do not know all details of your algorithm; however, the Intel TBB tasks approach is not suitable for IO operations (files, sockets and so on). Usually, Intel TBB tasks are used for computational (not blocking) activities. You may want to read the section about Intel TBB Task Scheduler in documentation.
Regards,
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Eduardo,
I concur with Alex. You might find it sufficient enough to use OpenMP
const double PollingInterval = 60.0; double lastRunTime = -PollingInterval; bool Done = false; for(double now = omp_get_wtime(); !Done; now = omp_get_wtime()) { if(now - lastRunTime > PollingInterval) { lastRunTime += 60.0; // do not use = now #pragma omp parallel for schedule(dynamic) for(int i=0; i < nAssets; ++i) Assets.tradeCheck(); } Sleep(10); // sleep for 10ms }
Keep in mind that if you have more Assets than you have worker threads that some assets will trade somewhat later than others.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you guys! I appreciate it.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page