Tag Archives: classes

Matlab session calls Java classes

Matlab session calls Java classes

Can you call Java classesor JARs from your Matlab session? Sure just look at the link below. Can you do this with R or Python at all?

http://www.mathworks.com/help/matlab/matlab_external/bringing-java-classes-and-methods-into-matlab-workspace.html

Join my FREE newsletter to learn more about uses with Matlab

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!

What are good suggestions for math classes to take to support algorithmic trading and quant analytics?

What are good suggestions for math classes to take to support algorithmic trading and quant analytics?

I have a Bachelor’s in Math, but wish to expand my knowledge. I’ve been told Stochastic Calculus would be one choice, as well as Applied Math.

 

==
QuantLib http://quantlib.org/index.shtml a great Quantitative library in C++.
Encog http://www.heatonresearch.com/encog for machine learning algorithms and Neural Nets in Java and .Net, well documented, and provide GUI for training neural nets, and GA
DnAnalytics: http://dnanalytics.codeplex.com/
AlgLib: http://www.alglib.net/ (the best in my point of view, very complete and well documented)
Lapack: http://www.netlib.org/lapack/
F# for Numerics: http://www.ffconsultancy.com/products/fsharp_for_numerics/?so
DotNumerics: http://www.dotnumerics.com/
DewResearch: http://www.dewresearch.com/index.html (Not free)

Hope it help

 

==

These are not maths classes, they are maths class libraries. -:(

 

==

They were still helpful. Anything to add on to the two classes I referenced in my original post would be great. I’ve also heard Multivariate Statistics as well as anything having to do with Brownian Motion.

 

==

if I’m not wrong, I think you need Brownian motion for Black Scoles model and Pricing models, If so, you’ll find Quant-Lib very helpfull since it include almost all pricing methods already implemented. the BS model too, there is also a C# version of QuantLib QLNet if you’re more familiar with C# than C++.
I’ve forgotten to include Ta-Lib http://ta-lib.org/ the free library for technical trading indicators in the previous collection. sorry for that.

 

=

Yes, although it wasn’t an answer to the question, the above links are very helpful, thanks!

 

=

Thanks for the great links, if trying out in C++, I would suggest to check out boost math classes as well: http://www.boost.org/doc/libs/1_48_0/libs/libraries.htm#Math

especially statistical distributions:http://www.boost.org/doc/libs/1_48_0/libs/math/doc/sf_and_dist/html/index.html

 

==

This is very useful input. I just met up with somebody for algorithmic trading who was to charge me for writing a code.

==

 

this is extremely useful. Just met up with somebody few days back, who was to charge me for writing a code for algorithams. Thanks a ton Patrick !

 

==

glad that boost link helps, it has useful collection that can be used for pricing and all, for e.g. cdf(cumulative distribution function) for Black-Scholes pricing etc., I am still exploring it though,
there are few links that has overview and examples that may help:
http://www.quantnet.com/cplusplus-statistical-distributions-boost/http://quantlib.org/slides/dima-boost-intro.pdf

 

==

thanks for the very usefull links, Boost seems to be very fast in execution. The continuous probability distributions in the first link are complete and well defined, I’m looking at a good way to use it. thanks.

 

==

You probably need undergrad Physics, Maths or Engineering. Once you got that then for a good grounding in random variable theory and stochastic processes you can look at the book by Papoulis. Probability Random Variables and Stochastic Processes. There is also an easier intro in Probability and Random Variables by Peebles. Once you get that then the standard text is John C Hull Options Futures and Other Derivatives. Its really all about one equation (the BS equation 🙂 ) but you need to know stochastic processes and calculus in order to apply it. I would also look at Bayesian techniques.

 

If you look at the algorithmic trading as a branch of the quantitative analysis, you could consider an answer to the following question found in the book by Paul Wilmott: “What are the Different Types of Mathematics Found in Quantitative Finance?” Please note that “For some strange reason the advocates of different branches of mathematics get quite emotional when discussing the merits and demerits of their methodologies…” (“FAQ in Quantitative Finance” Wilmott, 2007)

 

 

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!

Why does Google kill GWT's potential with this junky anonymous callback classes?

Why does Google kill GWT’s potential with this junky anonymous callback classes?

This becomes debugging hell.

Sadly, I had to resort to GWT’s Label widget to overcome this in Google Translate libray. Final string s don’t work for some reason.

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!

Simplest builder pattern code sample in C++ for job interview questions using an abstract base class with derived concrete classes

Simplest builder pattern code sample in C++ for job interview questions using an abstract base class with derived concrete classes.

This example builds ‘distributed work packages’
This seems to the best build pattern code on the net. This basically builds an object step by step. In a nutshell, this example, distributed work packages are abstracted to be persistant and platform independent. This includes files, queues, pathway, etc. A reader or parser retrieves the archives specs through DistrWorkPackage. It will then delegate each build step to the builder object that was registered by the client. At the end, the client will retrieve the end result from the builder

//from http://sourcemaking.com/design_patterns/builder/cpp/1#

#include
#include
#include

enum PersistenceType
{
File, Queue, Pathway
};

struct PersistenceAttribute
{
PersistenceType type;
char value[30];
};

class DistrWorkPackage
{
public:
DistrWorkPackage(char *type)
{
sprintf(_desc, “Distributed Work Package for: %s”, type);
}
void setFile(char *f, char *v)
{
sprintf(_temp, “\n File(%s): %s”, f, v);
strcat(_desc, _temp);
}
void setQueue(char *q, char *v)
{
sprintf(_temp, “\n Queue(%s): %s”, q, v);
strcat(_desc, _temp);
}
void setPathway(char *p, char *v)
{
sprintf(_temp, “\n Pathway(%s): %s”, p, v);
strcat(_desc, _temp);
}
const char *getState()
{
return _desc;
}
private:
char _desc[200], _temp[80];
};

class Builder
{
public:
virtual void configureFile(char*) = 0;
virtual void configureQueue(char*) = 0;
virtual void configurePathway(char*) = 0;
DistrWorkPackage *getResult()
{
return _result;
}
protected:
DistrWorkPackage *_result;
};

class UnixBuilder: public Builder
{
public:
UnixBuilder()
{
_result = new DistrWorkPackage(“Unix”);
}
void configureFile(char *name)
{
_result->setFile(“flatFile”, name);
}
void configureQueue(char *queue)
{
_result->setQueue(“FIFO”, queue);
}
void configurePathway(char *type)
{
_result->setPathway(“thread”, type);
}
};

class VmsBuilder: public Builder
{
public:
VmsBuilder()
{
_result = new DistrWorkPackage(“Vms”);
}
void configureFile(char *name)
{
_result->setFile(“ISAM”, name);
}
void configureQueue(char *queue)
{
_result->setQueue(“priority”, queue);
}
void configurePathway(char *type)
{
_result->setPathway(“LWP”, type);
}
};

class Reader
{
public:
void setBuilder(Builder *b)
{
_builder = b;
}
void construct(PersistenceAttribute[], int);
private:
Builder *_builder;
};

void Reader::construct(PersistenceAttribute list[], int num)
{
for (int i = 0; i < num; i++) if (list[i].type == File) _builder->configureFile(list[i].value);
else if (list[i].type == Queue)
_builder->configureQueue(list[i].value);
else if (list[i].type == Pathway)
_builder->configurePathway(list[i].value);
}

const int NUM_ENTRIES = 6;
PersistenceAttribute input[NUM_ENTRIES] =
{
{
File, “state.dat”
}
,
{
File, “config.sys”
}
,
{
Queue, “compute”
}
,
{
Queue, “log”
}
,
{
Pathway, “authentication”
}
,
{
Pathway, “error processing”
}
};

int main()
{
UnixBuilder unixBuilder;
VmsBuilder vmsBuilder;
Reader reader;

reader.setBuilder(&unixBuilder);
reader.construct(input, NUM_ENTRIES);
cout << unixBuilder.getResult()->getState() << endl; reader.setBuilder(&vmsBuilder); reader.construct(input, NUM_ENTRIES); cout << vmsBuilder.getResult()->getState() << endl; } This will output: Distributed Work Package for: Unix File(flatFile): state.dat File(flatFile): config.sys Queue(FIFO): compute Queue(FIFO): log Pathway(thread): authentication Pathway(thread): error processing Distributed Work Package for: Vms File(ISAM): state.dat File(ISAM): config.sys Queue(priority): compute Queue(priority): log Pathway(LWP): authentication Pathway(LWP): error processing

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!

C++ Storage classes and qualifiers like auto, extern, register, volatile, const, mutable

C++ Storage classes and qualifiers like auto, extern, register, volatile, const, mutable

C++ storage classes include:
Auto: This is the default where variables are automatically created when they are defined and are destroyed at the end of a block containing their definition. They are also not visible outside of their defined block.
Register: This is similar to auto variable but suggests to the compiler to use a CPU register for performance.
Extern: A static variable that is whose definition and placement is determined when object and library modules are combined (also known as linking) to form the executable code file. It can also be visible outside of where it is defined as well. Both C and C++ require that symbols are only defined in a single translation unit (file.c|file.cpp). The extern keyword tells the compiler that a symbol is only a declaration – it is defined somewhere else. If you only ever include a header in a single .c-file, you can get away without the extern. However, if you include it in more than one, the linker will see the same symbol defined in more than one translation unit (one for each .c[pp] file including the header) and rightly flag it as an error.
Storage qualifiers:
Const keyword indicates that memory once initialized cannot be altered by the program.
Volatile keyword indicates that the value at a particular memory location can be altered event though in the program modifies its content. Volatile is to improve the compiler optimization. The volatile keyword is a type qualifier used to declare that an object can be modified in the program by something (external resources) such as the operating system, the hardware, or a concurrently executing thread. For example,
Mutable keyword indicate particular data member of a structure or class can be altered even if a particular variable is defined in a class member function as being const.
structure variable, class, or class member function is constant.
struct data
{
char name[80];
mutable double salary;
}
const data MyStruct = { “Satish Shetty”, 1000 }; //initlized by complier
strcpy ( MyStruct.name, “Shilpa Shetty”); // compiler error
MyStruct.salaray = 2000 ; // complier is happy allowed

?
int volatile nVint;

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!