Just Like Jesse

The Journal of a Trader WannaBe.

Scala on Fedora

without comments

I started learning Scala this weekend. While trying to run scala scripts, I recieved the following error message:

exception while trying to instantiate source reader “scala.tools.nsc.io.SourceReader”

I am running Fedora. After a quick Google search, I found Jay Patel’s blog entry Scala may be running atop GCC Java on Fedora. As he stated, scala was running atop GCC Java which was causing my problems. After installing open-jdk with

yum install java-1.6.0-openjdk; yum install java-1.6.0-openjdk-devel

and removing gcc-java the problem was not resolved. The final step I needed was removing scala via yum and then reinstalling it.

Problem Solved. Thanks Mr. Patel.

Written by jbn

April 11th, 2009 at 5:52 pm

Posted in Uncategorized

XKCD Romance Comics

without comments

It is my belief that the same mental processes are involved in trading and romance. Along those lines, here are some of my favorite XKCD comics dealing with romance.

Love

Love

Why Do You Love Me?

Why Do You Love Me?

Regrets

Regrets

A Way So Familiar

A Way So Familiar

Facebook

Facebook

Dating Pools

Dating Pools

Fixed Width

Fixed Width

Aeris Dies

Aeris Dies

Forgetting

Forgetting

Boyfriend

Boyfriend

Decline

Decline

Useless

Useless

(This is kinda a fluff post)

Written by jbn

April 8th, 2009 at 7:41 pm

Posted in Uncategorized

Tagged with

Warning: NVIDIA CUDA memset bug

without comments

Calling cudaMemset() on some platforms does nothing. It took me two hours to figure out why the result of my computation was so bizarre. My experience was similar to many people who posted on this informative thread. In emulator mode, the function performs as expected; When running on the device, the memory is not set.

Written by jbn

March 9th, 2009 at 11:06 am

Posted in Uncategorized

Tagged with

Black Swan Technical Pattern

without comments

A friend sent me this link today. Pretty funny stuff.

Scary chart pattern

P.S. I’m not sure this link will be permanent. If you’re reading this in 2010 and you see nothing…sorry.

Written by jbn

February 9th, 2009 at 4:26 pm

Posted in Uncategorized

Re: The Two Flaws Of Libertarian Economics

without comments

Zed Shaw wrote a blog post titled The Two Flaws of Libertarian Economics that made me angry (mostly because I like Zed Shaw). This is my rebuttal. It is completely off topic, but I had no other place to post it.

Zed:

I almost always respect your opinion; I especially enjoy it when you are being appropriately flippant (an ironic statement, yes). Therefore, I wanted to take a few minutes to disagree with your post: The Two Flaws of Libertarian Economics.

The problem with self-described libertarians is that they are often very smart but only talk to other very smart libertarians.  Their arguments become ridiculously path dependent until the point where they lose sight of the applications of their debates. Can a system of free-market local defense services exist and work better than the currently provided government ones? I don’t know; I doubt it; and I don’t really care.  It’s simply not relevant and is merely the product of incestuous ideas.

Any libertarian who states that large corporations are more efficient than large government bureaucracies is simply dogmatic. The problems that plague the executives in government bureaus are largely the same as those that plague executives in both for and non-profit corporations: They answer to a stakeholders; They must show good results; If they don’t show good results they get booted; Therefore, the rational course of action is to take the least risky path to ensure their own positions. Bureaucracy is bureaucracy.

However, the libertarian doctrine (or I suppose I should say the facet of libertarianism that I subscribe to) does not require, or even encourage, large for-profit corporations as a means of solving all problems both social and technological. It does make the assertion that any system that maximizes the diversity of investment is preferable to one that does not. Capitalist systems are not superior because the profit motive forces capitalist actors to work harder, better, faster, stronger; Capitalists systems are superior because they take on more risk and often enough it pays off well. Libertarians who fail to recognize this do their own cause a great disservice. They are the same libertarians who dogmatically oppose all and any regulatory efforts.

Now, while the willingness to take on risks is responsible for capitalisms excessive gains relative to state dominated economies, it is also potentially dangerous. To state that the current economic crisis proves the inefficiency of corporations, as you did, is very misleading — everything was distorted. Contrary to what you intimated, capitalism is an evolutionary system.  And, just like any evolutionary system, it is not necessarily the best that survive in the short-run; It is only those that were, by accident or merit, the best suited for exploiting the current environment that survive. Corporations that were long-term blind and took on insane risks to capture the high short-term returns offered by sub-prime lending got big and got big fast. They were the most fit for that particular environmental aberration – an aberration created by the political fetish of advocating that every American, regardless of credit worthiness, own a home.

Removing the government’s encouragement and creation of the sub-prime industry would likely have prevented the sub-prime crisis. I am not stating that the government causes all economic crises (it does not) but in this case it was the central mover.  I am also not saying that prevention of the sub-prime crisis would have prevented the current economic debacle. The appetite for risk was grotesque in recent years; If it wasn’t sub-prime, it would have been something else.

This leads me to my final point: A crisis is not necessarily a net-negative event. I realize this might be too controversial or offensive and I risk overshadowing my previous argument, but I believe it is an important point.  Times of crisis, regardless of cause, result in a general refocusing of all efforts and a rethinking of everything. Certain deficiencies come sharply into focus. Oil may have reached $150 per barrel for fundamental or speculative reasons, but it doesn’t matter. No one can debate the utility of an alternative energy system and nothing could have provided a greater impetus for one than $150 per barrel oil. We do not yet know what positive impact the economic crisis will yield, but I will state (blindly) that I will be substantial.

Right now efforts are still focused on sorting out the economic crisis and the field is very murky.  Your contribution was to state that policies that are libertarian in nature were fully or partly to blame. A libertarian who says zero-regulation is the only acceptable policy is completely wrong but, luckily, has no influence on policy anyway.  However, the most valued elements of the libertarian doctrine – choice and personal responsibility – are, almost inarguably, worth defending.  This is the true core of libertarianism.

Sincerely, John Nelson

Written by jbn

January 8th, 2009 at 11:32 am

Posted in Uncategorized

Tagged with

Using CUDA for Financial Modeling

without comments

Kudos to NVidia for CUDA; It’s fast — really fast.

CUDA allows you to harness the parrellel power of a CUDA capable GPU for (semi-) general computation. The result? Hundreds of cores running your binomial option pricing models, Monte-Carlo simulations, or Black-Scholes computations.

I started learning CUDA yesterday; I wrote my first simple CUDA program today. The library does have a non-negligible learning curve, but it is not steep. It largely is a matter of learning the most efficient ways to work with CUDA (e.g. shared, local, or constant memory). Happily, this is an incremental process; You can learn to write bad yet working CUDA applications while slowly learn to write them better; And, as a bonus, even your bad code is likely to run laps around your CPU (for finance apps anyway).

I am currently writing a Poker hand simulator (to compare to the OpenHoldem’s speed) but, once I am comfortable with the library, I will be porting my c++ option pricing algorithm. With CUDA, my algorithm will now be (closer to) real-time!

P.S. I bought the GForce 9600GSO which was only $99 at Best Buy; This low-end NVidia card achieved the following results for the binomialOptions.exe sample included in the SDK:

Using single precision...
Using device 0: GeForce 9600 GSO
Generating input data...
Running GPU binomial tree...
Options count            : 512
Time steps               : 2048
binomialOptionsGPU() time: 92.526009 msec
Options per second       : 5533.579236
Running CPU binomial tree...
Comparing the results...
GPU binomial vs. Black-Scholes
L1 norm: 1.484960E-004
CPU binomial vs. Black-Scholes
L1 norm: 1.045247E-004
CPU binomial vs. GPU binomial
L1 norm: 4.464579E-005
TEST PASSED
Shutting down...

Not bad, Eh?

Written by jbn

December 30th, 2008 at 8:08 pm

Posted in Experiments

Tagged with

Long SPY Jan 85 Puts

without comments

I just bought SPY JAN 85 put options at $2.66 based on the valuation given by my market analysis program. SPY is currently trading at $91.40. I took a small position on this play.

Written by jbn

December 18th, 2008 at 10:38 am

Posted in Speculation

Tagged with

The Oral Hygiene of Economic Pundits

without comments

I had a dentist appointment today. Like most people who do not suffer from OCD, I do not floss regularly and the dental hygienist is quick notice. Therefore, I brush my teeth a few minutes before, hoping to lessen the likelihood of the (possibly inevitable) boring lecture. Apparently, this is a common behavior.

While I was sitting in the chair listening to hygienist explain how to properly floss and brush my teeth (even after I explained that I skip flossing out of indifference not ignorance), it dawned on me that this experience is very similar to that of economic pundits who make occasional media appearances.

When using historical data, confirmation and survival biases are the biggest dangers; You can be easily fooled into drawing VERY invalid inferences. When economic pundits make an appearance, they do something far worse – they willfully fool the viewers. When looking at historical data you might make the mistake of believing one strategy to be highly profitable and, because you have not tried all the available strategies, you believe that it is very significant; When a pundit is presenting his recent “trades”, he is likely only to present those that ended up being both profitable and justifiable through narration.

One could argue that this is simply confirmation bias (or data snooping) restated, but I think it is something more damaging – it is triple distilled information (econoporn) and feigned authority. They take trades; They clean out (finally I can justify the tooth brushing analogy) those that are unsuccessful; They cite the cleaned set of trades as evidence of their authority; They make predictions that are listened to based on this faux-authority.

This is all very comical except it has the affect of diluting (relatively) the authority of those who actually DID get everything right AHEAD of time. It is an oft-repeating pattern and it frustrates me to no end.

To be fair, most things frustrate me.

Written by jbn

December 11th, 2008 at 2:36 pm

Posted in Introspection

To Iterate is Human, to Recurse, Divine

without comments

Escher Hands

I have a fancy for functional programming languages; I find recursion intuitively elegant. However, in my mental processes, recursion seems to be a dangerous flaw.

This trade may return 5% if event A occurs-> This trade could return 10% if event A & B occur -> This trade could return 20% if event A & B & C occur -> Well, this trade has returned 20% and now people are going to pile one and it could return 30% -> … -> This trade could return 1,000,000%.

My mind selectively traverses the path on the recursive tree that is most favorable while ignoring the (huge) selection of paths that do not lead to the favorable end-node. Even worse, I forget the necessary conditions that lead to the selected outcome! A favorable outcome is pleasurable and I am a pleasure-seeking animal; It seems that this also applies abstractions.

Furthermore, the recursive thought seems to lack a terminal condition. Instead of building a balanced tree of possibilities, the favorable path gets many more steps, leading to a gross asymmetry. My mind stops traveling only after it has exhausted mental resources.

Mental recursion is dangerous without continuous checks.

* Note to the non-programmer: The title of this entry is actually an oft-repeated L. Peter Deutsch quote.

Written by jbn

November 30th, 2008 at 2:01 pm

Posted in Introspection

My First Perfect Trade

without comments

By perfect trade I mean executed well and taken for the valid reasons. In yesterdays post, Liquidity Black Holes, I stated that I bought NOV SPY 83 Puts for $2.20. I sold them at the end of the today for $6.46. This was a lot of fun.

Written by jbn

November 20th, 2008 at 5:28 pm

Posted in Speculation

Tagged with