Skip to content

Talking to C# API (Any reference to learn the same)

5 messages · Kunal Shah, Mark Knecht, Joshua Ulrich +1 more

#
Hello,

I have 250 R scripts.

*Input*
Each of them needs a real time data feed from a C# interface. The real time
datafeed updates at a speed of approx 3 times a second. Also the data array
size is increasing every minute. (1 minute time frame)

*Output*
I want to output say 4 variables from each of the R codes back to C#
execution engine

I wish to know the complete process. Can I get some references for the same?

Since R cannot be multi threaded, can this be done easily? What is the best
possible way?


Regards
#
On Sat, Oct 11, 2014 at 8:13 AM, Kunal Shah <kunalshah305 at gmail.com> wrote:
I think you want to look at the Rcpp package. I've not used it myself
but it seems to address your interface issue.

As for 'multi-threading' I think in a very specific way you might look
at the foreach package and then the multi-processing packages like
doMC and doParallel. I'm using doMC & doParallel on Linux and have as
many as 12 identical processes (parameter exploration ala the
quantstratIII demo) running at the same time. If you need more than
the number of cores on your machine then I think you want ReDis but
I've never used it. There's web pages out there talking about it
though.

HTH,
Mark
#
On Sat, Oct 11, 2014 at 12:04 PM, Mark Knecht <markknecht at gmail.com> wrote:
While you may be working on a financial application, your question has
nothing to do with finance, and is therefore off-topic for this list.
No, it doesn't.  C++ != C# (they're not even close; C# is closer to Java).
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
#
<SNIP>
<SNIP>
How right you are! That's what I get for trying to help in an area I
know less than zero about.

Sorry.

- Mark
1 day later
#
Kunal -

Your basic problem is around options for high performance inter-process communications. Since you mention C#, I'm going to assume your target applications are all running on Windows.

So you have several options under Windows including shared memory, pipes, queues, DMA etc.
Start with figuring out how to make DLL calls within R. Then configure your R programs as Named Pipe clients i.e. get them to make those calls. 


Named Pipes (Windows)

  
          
Named Pipes (Windows)
A named pipe is a named, one-way or duplex pipe for communication between the pipe server and one or more pipe clients.   
View on msdn.microsoft.com Preview by Yahoo  
  
 
Hope this helps.

Cheers
Suresh