Hedging your investments… explained

November 12th, 2008 by greentheo

When most think of hedge funds they think of big fat cats sitting around in some office with billions at their disposal rolling the dice on risky futures and derivatives.   While this might be true in some cases it doesn’t explain what a hedge, or a hedgefund does.  And let’s start by eliminating the obvious… a hedgefund does not invest in thick bushes that line driveways :-)

Any investment can be considered a hedge if it helps to reduce the risk of overall loss due to a seperate (usually larger) investment.

The best way to think about a hedge investment is with an example that we should all know very well, cars and car insurance.

When one purchases a vehicle there are two financial sums at risk… the vehicle itself and the damage caused to others or yourself in an accident.  It may happen that while I’m driving my $50k hummer down the highway I, oblivious to the rest of the world, crash into another Hummer (who is equally oblivious to the real world).  Since the accident is my fault I’m now on the hook for my hummer, the other hummer and all medical bills… let’s say $200k all together.  Luckily I hedged against catastrophic loss by taking out a comprehensive auto-insurance policy for $100 a month… they pay for everything.  I’m free to return to my irresponsible hummer driving ways!

Notice that for $100 a month, my hedge has the ability to pay out $200k when a predefined event occurs, this is called leverage: the ability for a small sum of money to control a large sum.

Hedging is not limited to insurance though.  In the stock market one can easily hedge against significant loss via Put and Call options.  If I sell a Put option to some other investor, we’ve agreed that I can “put” my stock on him (sell it to him) for an agreed upon price.  In exchange for the risk that the Put option buyer takes on, I agree to pay him a small fee…say 5% of my stock’s value.  When my stock shoots up 10% the put option gives me no advantage and I keep my stock.   But perhaps it loses 20%… I then shovel off the stock to the purchaser of the put contract for its agreed upon value.  Now instead of losing 20%, I’ve only lost 5%.

Notice:  5% of the stock’s original value creates a contract to control 100% of it’s value.  Again, we see leverage here.

A Call option works the other way, it is an agreement between me and a holder of some stock such that I can “call” him up and purchase the stock for an agreed upon price.  In this case I pay the owner 5% to buy the stock at a certain price.  When the price of the stock shoots up and above our agreed upon price by 20% I excercise my option to buy and purchase the stock for a 20% discount.  If the stock fails to increase in value the owner of the stock makes a 5% profit and I lose the nominal value of the call option.

Again, for 5% I can gain control of 100%.

The essential feature here is that I can take on another’s risk or dish out some of my risk for profit.  No problems here with massive default.

However, what if I don’t have stock to sell options on or the money to purchase the asset indicated in the contract?  I can go naked! wooohooo!!

No not that kind of naked.  Going naked means that you sell someone the option to “put” stock on you without having the money to pay for that stock (which would cause a default on your side).  Likewise you can also sell the right for someone to “call” you on your stock.  In both cases you collect the 5% fee, but you’d better hope that the conditions don’t force you to to have to purchase the requisite amount of stock in order to fulfill the contract[1].

Selling naked options is not hedging, it’s highly leveraged speculation and is ill-advised.

Hedging is not limited to what has been shown above.  Almost any investment can be a hedge as long as it protects against loss from another investment … the possibilities are almost limitless, for example: biodiesel hedges against rising oil, hay bails against rising drywall costs, Japanese steel against American Steel, Apple vs. Microsoft etc.

Perhaps one of the most common hedges in the average person’s life (besides car insurance) is the common resume and occasional job application.  That’s right, hedge against income and job loss by keeping one foot in the door of another company… it only takes a little bit of your time.

  1. this is called securities fraud and => jail []

When computers control all essential societal functionsw

November 3rd, 2008 by greentheo

It is apparent to a researcher in Machine learning and Artificial intelligence that soon enough machines will be controlling many of the essential resources of our society.  The webs that will be woven by the interdependent parts of our cities and countries  will be held together by increasingly powerful and complex networks of computers.

Since computers can store far more information in their immediate memory and can play out 1,000’s of scenarios per second they are the clear choice for such jobs as: air traffic control, airplane scheduler, train engineer, traffic and road designer, stop light designer, telephone switch operator, and any number of jobs that require such comlex decision making.

I don’t think machines will ever “take over” like they do in the matrix, but the question will soon arise, what happens if we unplug one machine?  What about 20?  Furthermore, what if the machines make apparently sub-optimal decisions… how will we be able to tell if they really were sub-optimal?

I think the most likely worst-case-scenario will begin to be not that the machines take over the world and force us into slavery, but rather that our dependence on them becomes so great that we are afraid to do anything without their consent… even if it means doing something that is right, but crosses logical boundaries.

Problem with ‘Table Full’ for MyISAM DB?

November 3rd, 2008 by greentheo

If you need to expand your MyISAM table size for your MySQL DB becuase you simply have too much data then this is a nice quick tutorial on accomplishing your goal.

http://jeremy.zawodny.com/blog/archives/000796.html

Basically do the following

mysql> alter table your_table max_rows = 200000000000 avg_row_length = 50;

And that will increase it to its maximum size.

				

mxmlc segfault Ubuntu 8.04

October 24th, 2008 by greentheo

I got a segfualt error when running mxmlc on a new flex swf that I was trying to build.

Turns out the problem is that if you have recently updated your Ubuntu installation, it might have reverted to a previous java runtime environment.

To check your environment:

java -version

It should output:

greentheo@kingsnood3:~/Flex_Builder$ java -version
java version “1.6.0_07″
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)

If you get a different version you’ll want to switch it to the latest SUN sdk.

try: sudo apt-get sun-java6-jre

Once, it’s installed, change the default java jre to the sun jre with:

sudo update-alternatives –config java

There are 3 alternatives which provide `java’.

Selection    Alternative
———————————————–
1    /usr/lib/jvm/java-6-sun/jre/bin/java
*+      2    /usr/lib/jvm/java-gcj/jre/bin/java
3    /usr/bin/gij-4.2
And choose the option with the Sun Java jre.

Now get back to work on your Flex application!

Adaptive UI

October 9th, 2008 by greentheo

Designing a website, or a User Interface for a program is hard work.  One has to study people and their often hard to predict and difficult to quantity decision making processes.

For instance, google.com shows a clear knowledge that user’s get distracted by anything other than the task at hand if presented with multiple options.  Thus their site has one main focus… a search bar.  They, are are after all, a search company.

google.jpg yahoo-screenshot-2.jpg

But what if User Interface designers, and website designers started to pay attention to the actual math behind user interactions?  Like living organisms, what if the website or user interface adapted to the user?  For instance, if the website knew that people browsing on cloudy days liked a more cheerful design why wouldn’t it brighten up the background?

Or perhaps in Yahoo’s case why not reorder the sidebar links in order of most clicked on?  What about Yahoo’s search bar?  Might that feature become larger and more prominent?

Why aren’t websites and Program designers doing this already?  They may be, but the sheer volume and dynamism of large user bases makes it a very difficult and ever changing job.

I suggest that website and User Interface designers move to a design framework which includes the ability for the site or program to collect user statistics, and then reorganize itself according to some preset rules.  Flex, Flash, php, python and a host of other programming languages could all support these features really easily.  And if you can’t think of a better optimization algorithm, simply allow the user interactions with the site to be a sort of genetic algorithm.

Local Search Optimization

October 2nd, 2008 by greentheo

What do you do to find the optimal solution to a problem that has an overwhelmingly large amount of equally appealing solutions?  Well, it turns out that mathematicians and computer scientists haven’t even really been able to answer the problem either.

In the book Combinatorial Optimization, Christos H. Papadimitriou admits that for most complex problems there is no easy way to find an optimal solution given a finite amount of computation time.  He recommends Local Search as a good starting point.

Local Search is actually a very simple algorithm which humans have been using for years. It goes as follows:

  1. Start off with your best guess, if you have no best guess then start off with a set of random solutions
  2. Modify your initial solution set slightly.  I.e. move about a small neighborhood of your initial solution set.
  3. If solution get’s better, keep on pursuing the direction you moved in, else try another neighboring solution.
  4. Keep proceding until a sufficiently optimal solution is found

Imagine the problem in this way, your friend told you he was going hiking next week, but didn’t tell you a day, time or location.  1 full week from now you’ve not heard from him, and are getting worried.  You call in the search and rescue team but where to start?  Colorado has thousands of trails.

Well, the best place to start is probably his house, then the 5 most frequently hiked or mentioned trails by your friend.  After that, go with the most popular, then the most available to hike.  If you haven’t found him at the initial places, then look at the trails closest to the ones just searched.

Good ol’ combinatorial optimization!

Quantastic!

September 26th, 2008 by greentheo

I am very proud to announce that my years (3) of research into the stock market have paid off.

I will now be working with Northfield Trading LP here in Denver to develop automated trading algorithms for futures markets.

Should be alot of fun, growth and learning.

A good analogy for Operations Research

September 25th, 2008 by greentheo

The other day I was trying to explain the concept of constrained optimization to an artist.  As I was fumbling around a bit, my friend (who was also a Math nerd) said:

Constrained optimization is like fishing… you have a limited amount of bait, you don’t know what the fish want, how many fish are out there, or what type/proportion they are but the goal is to catch as many as possible in a few hours.

While it’s not a perfect analogy… it’s pretty good.  What’s your favorite analogy for constrained optimization?

Fun with Heliostats Part II

September 20th, 2008 by greentheo

This week expanded my first heliostat by adding another 8 sq. ft of mirrors (bringing the total to 24 sq. ft) and have also added a second heliostat.  The second sun collector uses 12 1 sq. ft mirrors (mirror tile from Home Depot or Lowes, $10).

Circular heliostat

I tried to take temperature readings of the second colletor, but ended up frying my thermometer.  Regardless the temperature on the brick gets well over 150 degrees and is unbearably hot (can’t but my hand on it for more than about 1 second).

Overall, the heliostat project is a success and I have determined that the second more circular collector will make a good space heater for the office.  The plan is to put the bricks inside the office window and the mirrors outside.  As the day progresses the brick will heat up and heat up my office.  By the time the sun goes down I’ll be done with work and wont need any more heat.

Circular heliostat closeup

As for the water heater collector, there will be too many drags on heating efficiency and transfer too and from the house.  I’ve decided that it will likely be better to build a flat panel with small pipes to collect the heat and to move the panel much closer to the house.

Water Heater heliostat

Water Heater closeup

Overall, this project has been fun and has really shown me that for a really low cost (<$40 for the second circular collector) one can build a solar powered heater.

In the future I’d like to test what the effect of concentrating the sun on a real PV panel would be.  I’d like to set up two panels  relatively close to each other and test how much more efficient one can make the panel by concentration.  I exepect that a factor of 1.5-2X power will be acheived by focusing 2X the solar area. Perhaps with a third row of mirrors to the circular collector it might be possible to push the efficieny up to 2.5-3X. If this turns out to be the case it will enable the average person to go Solar, bringing down the cost of solar by about half.

Ode to Linux (and Open Source)

September 16th, 2008 by greentheo

The trusty ol’ T43 got sick this weekend with the “Windows Anti-Virus 2008″ virus.  Try as I might, I could not get it off of Windows XP.  I tried everything and every software to no avail.  Luckily I didn’t decide to the buy the “anti-virus” software they were pitching to solve the “virsuses” they had detected on my computer (this particular virus is actually mal-ware which tries to convince you that you have viruses and to buy their software to fix it).

I read tales of woe of those who “bought” the software only to have their accounts drained.

But as I was giving up and cursing windows for making such an insecure Operating System (really? Windows, you couldn’t have prevented such an attack?), I remebered that ntaylor0909 had just given me a copy of Ubuntu Server 8.04….

So I wiped ‘er clean and am now up on Ubuntu Linux.

I have to say so far I’m quite impressed.  It’s free… it works… all the programs for it are free… and they work too… and I hear that it’s even quite secure.

Thank you Linux!