Groovy Over Python?

After a few frustrating events where I had some Python code blow up because of dependencies, I started looking hard a using Groovy going forward. For some simple things, Groovy and Python are very easy. For example, if I wanted to read the latest sales from park.io and print them out, I could do the following in Python on my Mac.


import pandas as pd

df = pd.read_csv('https://park.io/orders/export.csv')

print (df)

(c) neuralmarkettrends.com

If I tried that on my old Raspberry Pi, I'd run into dependency issues w.r.t. to Numpy not compiling correctly.

With Groovy, it's roughly the same but no need to call a module, it's just built in.


String getResult = new URL('https://park.io/orders/export.csv').text

print getResult

(c) neuralmarkettrends.com

And that works on my Raspberry Pi. Granted, I don't need all the multithreading power of Java to run this simple program but the portability is nice.

If I wanted to read park.io's JSON endpoint, it's as simple as doing this:

import groovy.json.JsonSlurper

def slurped = new JsonSlurper().parse('https://park.io/domains/index/to.json'.toURL())

print slurped

Why Groovy?

The answer is simple, throughput and performance. Groovy runs wherever a JVM is and it's multithreaded. While I use Python every day for my work, it annoys the hell out of me. I don't know why, maybe it's my Engineering upbringing but I do love the simplicity of a good scripting language.

I love the ease of prototyping out programs in a scripting language but then compiling it for performance. I know there are some hacks for Python and that Python is eating the world are we desperately trying to cram a square programming peg into round hole?

On top of that, I've been thinking of building an MVP using Groovy and Grails. My strategy behind this is to build an enterprise-ready product from the ground up. I'm not looking to build trading bots, but rather build something that will provide end users with decision support services in the crazy world of trading and investing.

There will be no fancy deep learning (although there are Java libraries for it), instead, it will be a web application that will allow me to do some financial-related analysis.