Exposing it's innards? (Scripting question)

S. Dale Morrey sdalemorrey at gmail.com
Thu Jun 20 03:53:50 MDT 2013

I am currently suffering from analysis paralysis on something and was
hoping that perhaps the group has some insight into this topic.

Unrelated to the other work I've been doing, I decided to create an open
source OTC trading front end, mostly because I have some down time and this
has given me WAY too much time on my hands for a bit.

The application is written in Java and I would like to build in a
programmable algorithmic trader to complete the project.

Here is how it works just so you can see where I'm coming from.
The system is comprised of an event driven, modular architecture.  The
primary module connects to an exchange and basically just sits there
listening for data.  When data comes in (called a tick), the tick is stored
in the DB and various other modules are notified about the tick.  These
modules analyze the current tick in light of the previously stored data and
apply their own algorithms.

We call these "Signal and State" modules or just Signals for short.  For
our purpose a state is the current value and a signal is defined as a
change to state over time and contains pluralform deltas, amount and
intensity.  Example Cisco trading at $25 at the moment is a state, whereas
the price increasing to $26 would produce a signal of

Each time a signal changes it fires an onSignalChanged event and anything
that subscribes to that particular signal is notified.

I have written a couple of trading modules in Java that subscribe to
various signals and algorithmic trades according to signal changes.  In
trading parlance these are called Strategies.  These modules accept
parameters via config files, but I want to take it a step further.

I want to give users the ability to custom code their own strategies in an
interpreted scripting language.  I do not want to write my own language for
doing this.  There are too many hazards in creating an entirely new
language and the learning curve would be steep, plus I'm not sure I really
have anything to contribute to language development here.  In short, I
really just want to expose the signals and the trading api i.e. the
applications innards, via an interpreter of some sort.

I have been looking at the Java "scripting" API
it seems perfect for the job.

It defaults to Javascript which I do consider as a potential candidate for
this, but I'm curious to know what other languages have been implemented on
top of JSR-223 that would be adequate for the job.  The link to the other
languages provided on that page is dead.

So the questions I have are as follows.

Is it wise to force one language over another or should I leave this a
configurable option?
If you were trying to give this kind of power to an end user, what language
would you pick assuming the restriction that it must have a JSR-223

Thanks in advance!

More information about the PLUG mailing list