Tag Archives: embedding

Extending or Embedding Python into C++

Extending or Embedding Python into C++

Here are some links to consider when embedding Python scripts into a C++ application. This could be your dynamically loaded Python trading script. Old ones I know but this is what came up with Google search:

https://www6.software.ibm.com/developerworks/education/l-pythonscript/l-pythonscript-ltr.pdf

http://stackoverflow.com/questions/9746586/speed-embedding-python-in-c-or-extending-python-with-c

http://members.gamedev.net/sicrane/articles/EmbeddingPythonPart1.html

http://m.linuxjournal.com/node/8497/print

http://code.activestate.com/lists/python-list/213810/

Join my FREE newsletter to see if I implement this into my automated trading

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!

Anyone ever try embedding Python program in a C/C++ code? Could be very useful

Anyone ever try embedding Python program in a C/C++ code? Could be very useful

 

I have tried this in so many numerous ways:

Embedding Python program in a C/C++ code

http://www.codeproject.com/Articles/820116/Embedding-Python-program-in-a-C-Cplusplus-code

I wonder if someone could try and report back by commenting beloew or posting more feedback at my forum:

http://quantlabs.net/academy/forum/technical-forum/anyone-ever-try-embedding-python-program-in-a-cc-code/#p640

NOTE: One of the CodeProjects commented on Boost Python. Hmmmmm…..

join my FREE newsletter to see if anyone comes up with anything

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!

Is embedding the Python interpreter into a C program as great way for quant trading models with HFT potential?

Is embedding the Python interpreter into a C program as great way for quant trading models with HFT potential?

A couple of thoughts:

This is interesting to embed the Python interpreter into a C program for run a lot of Python scripts. This is cool but do remember you still have a lot of unnecessary code from the Python interpreter. I prefer simple and stripped down code in a final EXE or BIN file if done in C++ or C. This presenter basically accesses the entry point into the Python interpreter directly which is nice. Doing it brings convenience but it is not making the final C code compact. It is also a real pain to do but also a dangerous path to go down. I would just stuck with basic algos written in basic C no different this C sytles coding found in the video at

I am still trying to figure out this Python speedup thing with C++ or C integration using Cython

 

Do check out the last coding segment the link’s video above. It sped up the basic Python script by 100+ times. That is impressive but do realize there is a lot low level (also known as whacking in the weeds) coding style with malloc, POP, etc. This is basically saying one step above Assembler or the operating system specifically Linux.This not for the faint of heart or newbie to all this. Doing it wrong will be a disaster with memory going haywire which is not fun to deal with. So take that as a warning but it is the best way to handle the fastest code possible. This is also the same path to true ultra lowest latency coding for HFT (high frequency trading).

 

Join my FREE newsletter for my thoughts on this style of coding in C or C++

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!

For HFT: Just like Matlab or Coder toolbox,, embedding Octave M script code C++ is ugly, stick with R, RCpp, RInside

For HFT: Just like Matlab or Coder toolbox,, embedding Octave M script code  C++ is ugly, stick with R, RCpp, RInside

I tried investigating this as a hopeful extra bonus. This can be done but be aware that it is ugly as if you did it with Matlab. With the extra expense of Matlab core, the .NET or JABuilder toolboxes, it would be a real pain and expensive to do. The added costs of $6k for the Matlab Coder might not be worth it!! As GCC or G++ with R is all free! Yipeee! But too bad about Octave as it just does not have athe advancement of a community like R. It would have been nice to spend time on this but not worth it at this point.

http://octave.sourceforge.net/doxygen/html/

Learn more what I do with this potential HFT platform by joining 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!