views:

411

answers:

9

I'm working on a personal project doing some finance analysis. It's a totally new field for me, and I'm really having fun with it so far, plus working in the high-level language arena is a great break from my embedded systems daytime work.

I have a MySQL backend on a non-local server with a pile of stock data. My task now is to do some analysis of the stocks and produce something approximating a useful result. There are a couple technical difficulties.

(1) I have a lot of records. To be precise, I believe I'm near 100K records right now, and this number grows by 6.1K each weekday. I need to create a way to rummage through these fields and do data analysis - based on a given computation, go look at this other set. Fine and dandy, nothing too outre. But this means I could really use a straightforward API for talking to MySQL.

(2) Ideally, it runs on OS X 10.4.11. No Windows/Linux machine at home.

(3) I can use PHP, C++, Perl, etc. I even have an R installation. I'm pretty flexible with stuff, so long as it runs on OS X. (Lots of options here, pick water, H20, or dihydrogen monoxide ;-) )

(4)Lack of hassle. While I like clever and fun ways of doing things, I'm trying to get some analysis done, not spend ten hours doing installation work and scratching my head figuring out a theoretical syntax question needed to spout out "hello world".

What's the question?

I'd like to dig into something different than my usual PHP/C++/C toolset. I'm looking for recommendations for languages/technologies that will assist me and meet the above requirements.

In particular, I've heard a lot of buzz about F# and Python on SO. I've used CLISP for small problems before, and kinda liked it. I'm seeking opinions about those in particular.

edit:since I rent the DB server and have a limited amount of CPU time online, I'm trying to do the analysis on a local machine.

+1  A: 

How about going with something completely different, free, and interesting? WebObjects, included with Xcode on your Mac. There's an Eclipse plug-in to provide an IDE for WebObjects development, or you can use Xcode/Textmate/etc.

It'll also simplify some of your development tasks, as you mention in your question. From the Wikipedia article: "Given a data model, WebObjects can automatically create a customizable Web application without writing a single line of code."

Robert S.
That looks remarkably heavyweight. I'll look into it, it might be a very useful stack to get some knowledge of.
Paul Nathan
It generates pure Java code, so no runtime is needed, but I guess 'heavyweight' can mean a lot of things. :)
Robert S.
+3  A: 

What about Ruby, Haskell or Erlang?

jonnii
Paul Nathan
I love writing in ruby, it's a great language, and for web stuff you have merb and rails. Two great web frameworks.
jonnii
A: 

I would suggest Python, although in a few months (after some percolation time) F# might be a better choice.

EBGreen
Why do you say that, EBGreen?
Paul Nathan
Well, I say Python is good because it has a proven track record with large scale data manipulation (see google's use of python). It would also let you easily go very low level and easily integrate C code if you needed too.
EBGreen
Why would you say F# might be a better choice in a few months?
Paul Nathan
As for potentially waiting on F#, it is just a matter of waiting for their to be more adopters to just provide examples. Although now that I look at your requirements, the running on a Mac may preclude F#. I don't know where it stands in the Mono environment.
EBGreen
F# provides very robust multi-threading abilities, so if your data analysis would lend itself to it, that is where I would see the advantage that F# might give you.
EBGreen
what does data analysis have to do with multithreading? i'd use several processes to do multitasking (less coupling); but with any non-toy language, the bottleneck is the DB, so you'd want the least amount of threads processing it.
Javier
also, F# might run on Mono, but it's not its preferred platform, so it might lag behind specs. and Mono might run on MacOS, but it's not its preferred platform, so it might lag behind specs.
Javier
"but with any non-toy language, the bottleneck is the DB" This is true. So I should have said 'If your analysis' lends itself to it. So if the need is for heavy analysis of chunks of data held in memory.
EBGreen
"also, F# might run on Mono, but it's not its preferred platform" hence my comment "the running on a Mac may preclude F#"
EBGreen
+1  A: 

I'd stick with CLISP, frankly. If you don't know it well yet, then learn that. You may end up writing "PHP in Lisp", but that's not so bad, and CLISP has any language feature you can possibly want, being that it's Common Lisp from which all known language features seem to have derived from at some point or another :-).

Play with CLISP, play with your project, learn some macros. You'll have a good time.

Will Hartung
+6  A: 

The easiest would be Python. it's already installed on mac, and has more than reasonably performance for anything SQL related.

if you liked LISP, there's PLT Scheme for mac; but i don't know how well it interfaces to MySQL. Another interesting LISP is arc, i'm still checking it myself, hope to get it to 'practical' uses.

another not so mainstream option is Lua, which does have a SQL libraries, is by far the fastest scripting language, has a very neat and clean syntax, and stays close to language design principles, almost like Scheme.

Javier
I would also second that Lua would not be a terrible option.
EBGreen
Lua is fab, it's next on my hit list of languages to learn.
jonnii
A: 

Many developers in small shops, or that move between startups a lot, end up learning a handful of different types of languages, some are unavoidable (javascript, java, C#), some are fun, some are special purpose and very powerful. i alluded to that here:

http://stackoverflow.com/questions/196792/next-step-for-system-administrator#225652

You could look at python and ruby with C extensions, scala, clojure, F#, ocaml, haskell, erlang, all the languages that the wide finder submissions are in

http://eigenclass.org/hiki/widefinder2-conclusions

Gene T
A: 

If you're looking into Haskell (and I can't promise that you won't bump into some "theoretical syntax questions"), check out this paper:

Composing contracts: an adventure in financial engineering
http://research.microsoft.com/~simonpj/papers/papers.html

ja
A: 

I would recommend to use R for that. It can handle data matrices well (SQL is not suitable for that). I don't have personal experience with it, but I had a colleague who was also dabbling in financial analysis and was very happy with R. But I believe that with other (more general) languages, you would soon run into some library problems, but with R you have everything you need for statistics and large datasets handling. As a next choice, I would use Python, but it's a personal preference and not necessarily better than the others.

J S
A: 

Rebol is great for Finance, it's a multi-paradigm (Functional and OOP) language like F# so learning Rebol first could help you tackle F# afterwards.

You can find here a few financial examples:

Derivatives Option Pricer (based on Black & Scholes Formula): http://reboltutorial.com/blog/derivative-options-pricer/

As for data, you can use the free MySQL Driver or even a pure text data file format which can cope with millions of rows: http://reboltutorial.com/blog/mysql/ or http://reboltutorial.com/blog/rebol-sqllinq-like-text-database-engine-blaze-through-millions-of-rows-a-second/

Rebol is also especially great at parsing data see for example parsing google finance csv file http://reboltutorial.com/blog/parse-csv/

Rebol Tutorial