• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Python relevance

Personally, no! If you know C++ really well including DS and Algos, your game for it.
 
Is python really gaining with quant firms compared to C++, R, Matlab???

No idea to be honest. I don't even know yet whether Python is a fad.

What I _do_ notice is the rise of C#.
 
My personal advice would be to learn concepts using Python, since it is an OOP language, and then move on to C++. Learning design patterns and algorithms using Python is straightforward, translating to C++ after that is pretty easy. Matlab and R are dying technologies since the scientific toolkits in python have become so good. Don't waste your time investing in dead technologies.
 
My personal advice would be to learn concepts using Python, since it is an OOP language, and then move on to C++. Learning design patterns and algorithms using Python is straightforward, translating to C++ after that is pretty easy. Matlab and R are dying technologies since the scientific toolkits in python have become so good. Don't waste your time investing in dead technologies.
Could u suggest any good online course/websites/books for python
 
Python >> (Matlab, R) when it comes to software engineering tradition.

Can't speak in detail about Matlab, but R is a hodgepodge of packages that are rarely designed with inter-operability in mind. I still like it better for EDA because of the data.table package, but for any non ad-hoc data analysis, I prefer Python. The parts simply fit together much more nicely.

And yes, data analysis languages are highly relevant, because it's just such a pain to do quick analyses in C++. Things that would take minutes in Python/Matlab/R take hours or days instead.
 
Python >> (Matlab, R) when it comes to software engineering tradition.

Can't speak in detail about Matlab, but R is a hodgepodge of packages that are rarely designed with inter-operability in mind. I still like it better for EDA because of the data.table package, but for any non ad-hoc data analysis, I prefer Python. The parts simply fit together much more nicely.

And yes, data analysis languages are highly relevant, because it's just such a pain to do quick analyses in C++. Things that would take minutes in Python/Matlab/R take hours or days instead.

With regards to data.table, you've heard of pandas for python, right? A python replacement for R's data.table functionality.

http://pandas.pydata.org/
 
With regards to data.table, you've heard of pandas for python, right? A python replacement for R's data.table functionality.

http://pandas.pydata.org/
Yes, but it's still not as intuitive. data.table is VERY clean and always gives me what I expect. I can do very quick ad hoc data exploration with it. Part of it is that I haven't fully learned pandas, but that's also partially pandas' fault.

Data.table maps so well to SQL concepts: dt[where clause, select clause, group by clause], dt[, list()] when you want to return another data.table, leave off the list if you don't, and the semantics are less cumbersome (no need to constantly prefix with DF[DF.bid > 0] etc). Pandas feels very awkward and not at all straightforward for this type of thing. I can reel off a nice quick analysis that gets me exactly what I want in data.table in less than a minute, but pandas I have to dig through documentation for 30 minutes, then often I have to write extra glue code to achieve what I want.

I use pandas for when I need to do these types of operations 1000 times completely automated, I use R data.table for when I need to do them ~10 times with minor manual adjustments while trying to figure out what I exactly want.

Unfortunately, one big reason why data.table is so nice and consistent is because of the lazy semantics of R. The closest thing in pandas is "df.eval" which is totally jerry rigged compared to the way data.table is.
 
Last edited:
Here's a practical question: can you generate Python code from this spec?

C++:
<option name="ExpandOption">
<param type="double" descr="expansion scale">e</param>
<param type="double" descr="outlay">I</param>
<param type="double" descr="interest rate">r</param>
<var name="V" descr="project value">
<lower>e*V-exp(-r*(T-t))*I</lower>
</var>
<payoff>max(e*V-I)</payoff>
<american value="false"></american>
</option>
 
Here's a practical question: can you generate Python code from this spec?

C++:
<option name="ExpandOption">
<param type="double" descr="expansion scale">e</param>
<param type="double" descr="outlay">I</param>
<param type="double" descr="interest rate">r</param>
<var name="V" descr="project value">
<lower>e*V-exp(-r*(T-t))*I</lower>
</var>
<payoff>max(e*V-I)</payoff>
<american value="false"></american>
</option>
Umm, there's a library for practically every standard thing in Python, so yes. There is in fact an XML parsing library (several in fact). And with the right imports, it's also quite easy to parse the mathematical expressions.

The only thing I don't quite understand is why you persist in being skeptical/asking us, when Googling this particular task is much easier. You probably could have answered 70%+ of your questions by just Googling, as the documentation on Python is quite abundant.
 
You're a bit touchy today :) My question was serious. google, LOL.

So, what kinds of questions do you feel comfortable with?

there's a library for practically every standard thing in Python, so yes

No kidding.
 
What do you mean generate code? Like JAXB generate a class that can parse this code automatically in Python?

What you are looking for is probably here:

https://wiki.python.org/moin/PythonXml


Basically, user-level coding (in C# in this case)

1. Read in XML, create a class C (Reflection API) and put into a dll
2. Load the dll, find C and instantiate it
3. Use the instance in the application.

Simple example given

C++:
using System;
using System.Reflection;
using System.Reflection.Emit;
 
//djd
// Generate a generic class, add a method and store in a dll
 
class DemoAssemblyBuilder
{
    public static void Main()
    {
 
        AssemblyName assName = new AssemblyName("MeaningOfLife");
        AssemblyBuilder assBuilder =
            AppDomain.CurrentDomain.DefineDynamicAssembly(assName, AssemblyBuilderAccess.RunAndSave);
 
        ModuleBuilder mb = assBuilder.DefineDynamicModule(assName.Name, assName.Name + ".dll");
 
        TypeBuilder tb = mb.DefineType("GaudeamusIgitur", TypeAttributes.Public);
 
        GenericTypeParameterBuilder[] genericParams = tb.DefineGenericParameters("T1", "T2");
        tb.DefineField("key", genericParams[0], FieldAttributes.Public);
        tb.DefineField("value", genericParams[0], FieldAttributes.Public);
 
        MethodBuilder method = tb.DefineMethod("Salve", MethodAttributes.Public, typeof(void),Type.EmptyTypes);
 
        ILGenerator gen = method.GetILGenerator();
        gen.EmitWriteLine((string)"42");
        gen.Emit(OpCodes.Ret);
 
        Type t = tb.CreateType();
 
        assBuilder.Save(assName.Name + ".dll");
    }
}
 

using
System;

 

public
classClass1

 

{
 
publicstaticvoid Main()

 

{
 
GaudeamusIgitur<int, int> g = newGaudeamusIgitur<int, int>();

 

g.key = 1;
g.value = 42;
g.Salve();
}
}
 
You're a bit touchy today :) My question was serious. google, LOL.
Yes, maybe you've heard of it:
http://lmgtfy.com/?q=python+generate+code+from+xml

This isn't exactly a highly unusual problem, so your first expectation for Python really should be that it's solved already.

I can actually see where you're coming from though, there are many things I would expect to be standard in C++ that aren't for example path expansion. See for example: http://stackoverflow.com/questions/...that-have-environment-variables-in-their-path
 
Basically, user-level coding (in C# in this case)

1. Read in XML, create a class C (Reflection API) and put into a dll
2. Load the dll, find C and instantiate it
3. Use the instance in the application.
Dynamically creating a class is really standard (and eminently Google-able). The DLL part is usually not done, and kind of not the right mindset. You COULD compile it down to C dynamically and load that, depending on the type of code, see for example Numba.
 
Yes, maybe you've heard of it:
http://lmgtfy.com/?q=python generate code from xml

This isn't exactly a highly unusual problem, so your first expectation for Python really should be that it's solved already.

I can actually see where you're coming from though, there are many things I would expect to be standard in C++ that aren't for example path expansion. See for example: http://stackoverflow.com/questions/...that-have-environment-variables-in-their-path
Too general. Please see my C# example above to see what I mean.

The google link is cute but not very useful. And I don't have a clue about paths.
 
Back
Top