Tag Archives: dot NET

dot net framework array to r program code through the R CSharp package

Note: I really no longer support dot net framework array to r anymore. This means that I don’t support .NET nor Microsoft nor Windows anymore due to  back door security concerns I have with their product. I would strongly Python and other open source technologies over Microsoft product Also, this R posting is here as a courtesy due to R is still popular. Also remember this link recommended from my Academy section is from 2012 so it might no longer work.

Very Nice! My C# program calls R Code through the R.NET package. 

How to get R connect to NOSQL scalable database Redis with doRedis R package for parallelization

Whoa! I finally got this working with R.NET. I can get my C# appliction call directly R code which is very nice. There is a nasty bug on the search path of R so note at the beginning of the code as well. Get more info about R.Net package from http://rdotnet.codeplex.com/. Here is the C# code but don’t foret to add the.NET.DLL DLL reference in your Visual Studio:

Enjoy this C Sharp code

using System;
using System.Linq;
using RDotNet;

class Program
{
    static void Main(string[] args)
    {
        //code solution from http://stackoverflow.com/questions/7960738/importing-mgcv-fails-because-rlapack-dll-cannot-be-found
        string rhome = System.Environment.GetEnvironmentVariable(“R_HOME”);
        if (string.IsNullOrEmpty(rhome))
            rhome = @”C:Program FilesRR-2.15.0″;

        System.Environment.SetEnvironmentVariable(“R_HOME”, rhome);
        System.Environment.SetEnvironmentVariable(“PATH”, System.Environment.GetEnvironmentVariable(“PATH”) + “;” + rhome + @”bini386″);

        // Set the folder in which R.dll locates.
        //REngine.SetDllDirectory(@”C:Program FilesRR-2.12.0bini386″);
        REngine.SetDllDirectory(@”C:Program FilesRR-2.15.0bini386″);
        using (REngine engine = REngine.CreateInstance(“RDotNet”, new[] { “-q” }))  // quiet mode
        {
            foreach (string path in engine.EagerEvaluate(“.libPaths()”).AsCharacter())
            {
               Console.WriteLine(path);
            }
            //engine.EagerEvaluate(“.libPaths(“C:/Program Files/R/R-2.15.0/library”);

            // .NET Framework array to R vector.
            NumericVector group1 = engine.CreateNumericVector(new double[] { 30.02, 29.99, 30.11, 29.97, 30.01, 29.99 });
            engine.SetSymbol(“group1”, group1);
            // Direct parsing from R script.
            NumericVector group2 = engine.EagerEvaluate(“group2 <- c(29.89, 29.93, 29.72, 29.98, 30.02, 29.98)”).AsNumeric();

            // Test difference of mean and get the P-value.
            GenericVector testResult = engine.EagerEvaluate(“t.test(group1, group2)”).AsList();
            double p = testResult[“p.value”].AsNumeric().First();

            Console.WriteLine(“Group1: [{0}]”, string.Join(“, “, group1));
            Console.WriteLine(“Group2: [{0}]”, string.Join(“, “, group2));
            Console.WriteLine(“P-value = {0:0.000}”, p);
        }
    }
}

 

Here is an C# example:

using System;
using System.Linq;
using RDotNet;

class Program
{
    static void Main(string[] args)
    {
        //code solution from http://stackoverflow.com/questions/7960738/importing-mgcv-fails-because-rlapack-dll-cannot-be-found
        string rhome = System.Environment.GetEnvironmentVariable(“R_HOME”);
        if (string.IsNullOrEmpty(rhome))
            rhome = @”C:Program FilesRR-2.15.0″;

        System.Environment.SetEnvironmentVariable(“R_HOME”, rhome);
        System.Environment.SetEnvironmentVariable(“PATH”, System.Environment.GetEnvironmentVariable(“PATH”) + “;” + rhome + @”bini386″);

        // Set the folder in which R.dll locates.
        //REngine.SetDllDirectory(@”C:Program FilesRR-2.12.0bini386″);
        REngine.SetDllDirectory(@”C:Program FilesRR-2.15.0bini386″);
        using (REngine engine = REngine.CreateInstance(“RDotNet”, new[] { “-q” }))  // quiet mode
        {
            foreach (string path in engine.EagerEvaluate(“.libPaths()”).AsCharacter())
            {
               Console.WriteLine(path);
            }
            engine.EagerEvaluate(“.libPaths(“C:/Program Files/R/R-2.15.0/library”);

            // .NET Framework array to R vector.
            //NumericVector group1 = engine.CreateNumericVector(new double[] { 30.02, 29.99, 30.11, 29.97, 30.01, 29.99 });
            //engine.SetSymbol(“group1”, group1);
            //// Direct parsing from R script.
            //NumericVector group2 = engine.EagerEvaluate(“group2 <- c(29.89, 29.93, 29.72, 29.98, 30.02, 29.98)”).AsNumeric();

            //// Test difference of mean and get the P-value.
            //GenericVector testResult = engine.EagerEvaluate(“t.test(group1, group2)”).AsList();
            //double p = testResult[“p.value”].AsNumeric().First();

            //Console.WriteLine(“Group1: [{0}]”, string.Join(“, “, group1));
            //Console.WriteLine(“Group2: [{0}]”, string.Join(“, “, group2));
            //Console.WriteLine(“P-value = {0:0.000}”, p);

            //example to call complete R script from http://rdotnet.codeplex.com/discussions/262426
            //REngine R = REngine.GetInstanceFromID(“RDotNet”);
            //R.EagerEvaluate(“source(“MyRscript.r”)”);
            engine.EagerEvaluate(“source(“test.r”)”);
            Console.ReadLine();
        }
    }
}

Here is R script test.r which resides in the same Release directory as the C# program.

G<-c(1,2,3)
G
cat(‘hello from r’, G)

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Preparing Matlab pair trading code for Dot NET CSharp calling with Builder NE toolbox

Preparing Matlab pair trading code for Dot NET CSharp calling with Builder NE toolbox

Watch this to understand it,  my Quant Elite members will get this

I refer to this

https://quantlabs.net/blog/2014/02/highlighted-matlab-source-code-walk-through-of-pair-trading-code-with-automated-trading-system-in-mind/

Join my FREE newsletter  on the announcement when this is complete

 

 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

I don’t know if this guy likes this video on how to export Java JAR files to Windows EXE using IKVM for Dot Net Apps

I don’t know if this guy likes this video on how to export Java JAR files to Windows  EXE using IKVM for Dot Net Apps

Haaah!! Liked within first 15 seconds specifically because of-
“I’ll explain the reasons I’m running this video… in another video”
Glorious 😀 But nice vid 🙂

This was a comment in the video below

Figure out if we use Java in our trading environment with our FREE newsletter

 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

How to get free MSN Money with new data source with Morningstar newsfeed through XLQ and Excel for dot Net

How to get free MSN Money with new data source with Morningstar newsfeed through XLQ and Excel for dot Net

This is kind of exciting! More reasons on using XLQ. A message from the vendor:

SN rolled out a new version of their website yesterday (http://money.msn.com/common/now-on-msn-money-new-quote-data-pages), now supporting data from Morningstar.

 

This has not impacted historic data, but has broken the interface for day data. I am still working on the different changes and will announce a new release of xlq as soon as it is ready. There will also be other changes with the data, as symbols for currencies and options and some indexes are different.

Learn more how use MSN Money as your data source from my FREE newsletter

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

My 3 FREE open source projects with Matlab coder to Dot Net C#, C, C++, open source R Hadoop for big data analysis

My FREE open source projects with Matlab coder to Dot Net C#, C, C++, open source R Hadoop for big data analysis

Here are my completely FREE open source project I provide at SourceForge.net:

Interested in learning more as I release them?

Matlab coder to C++ or C
MATLAB Coder converting Hello World M script to C or C++
R Hadoop for Big Data

Download Free Associated R open source script files for big data analyis
matlab-test-to-csharp
Open Source Code Simple Test of Microsoft .NET C# using MATLAB NE Builder
http://sourceforge.net/directory/os:windows/freshness:recently-updated/?q=quantlabs

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Youtube video on How to learn Microsoft dot net programming c# and Head First book

Youtube video on How to learn Microsoft dot net programming c# and Head First book

Learn more what I do with C# for HFT in my FREE newsletter

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Youtube video Demo of Visual C++ CLR DLL with Microsoft dot Net C sharp client

Youtube video Demo of Visual C++ CLR DLL with Microsoft dot Net C sharp client

Not the most earth shattering for most, but very useful for newbie at all this!

I HAVE POSTED SOURCE FOR MY MEMBERS SO GET ACCESS NOW

Join my free newsletter to see what else I post

Or join now to get access this type the source code once revealed 

C++ CLI code

Some ther helpful tips:

http://stackoverflow.com/questions/14704016/how-to-call-class-ref-object-in-c-unmanaged-dll-from-c-sharp

http://stackoverflow.com/questions/2375622/performance-of-calling-unmanaged-dll-from-c-sharp –> http://msdn.microsoft.com/en-us/library/ms998551.aspx

 

http://stackoverflow.com/questions/4465639/call-c-sharp-dll-from-unmanaged-c-app-without-com

Solution: Reverse P/Invoke http://tigerang.blogspot.ca/2008/09/reverse-pinvoke.html

http://stackoverflow.com/questions/14462049/create-dll-from-unmanaged-c

http://msdn.microsoft.com/en-us/magazine/cc302048.aspx

http://www.codeguru.com/cpp/cpp/cpp_managed/components/article.php/c15683/C-CLR-Compilation.htm

 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

how to export Java class into JAR then convert EXE using IKVM for Dot Net C# Apps

how to export Java class into JAR then convert EXE using IKVM for Dot Net C# Apps

Learn more what I do with this here.

www.sourceforge.net/projects/ikvm/files/ikvm/

www.ikvm.net/index.html

 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Does Microsoft Dot NET and C# make you more productive in your high frequency trading HFT quant development? How does this compare to Linux and Unix?

Does Microsoft Dot NET and C# make you more productive in your high frequency trading HFT quant development? How does this compare to Linux and Unix?

From a user:

There are many good features of  dotnet which make our work productive or professional. The  visual studio, c# are the two type of dotnet.l.

 

Twitter Weekly Updates for 2012-03-25

 

I would liek to see your opinion so comment below. Thanks

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Youtube video demo Using ICE Demo to have Java talk to Microsoft dot NET C Sharp applications easily and quickly

Youtube video demo Using ICE Demo to have Java talk to Microsoft dot NET C Sharp applications easily and quickly

http://quantlabs.net/membership.htm
Get more info on what I am doing by joining

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!