blog.sojoodi.com

November 23, 2007

Exchange Rate Arbiterage Detection

Filed under: Uncategorized — Sahand @ 7:21 pm

Here’s a little brainteaser to think about while commuting to work on the Greyhound bus! (that’s another story maybe for another post).

If you go to x-rates.com or Yahoo Currency Converter you can obtain a table of exchange rates for world’s major currencies. Here’s a sample:


USD U.K. £ CAD Euro AU $
USD 1.00000 2.05639 1.01142 1.48250 0.87440
U.K. £ 0.48629 1.00000 0.49184 0.72092 0.42521
CAD 0.98870 2.03316 1.00000 1.46574 0.86452
Euro 0.67454 1.38711 0.68225 1.00000 0.58981
AU $ 1.14364 2.35177 1.15671 1.69544 1.00000

* (USD to CAD element was changed from 0.98870 to 1.0 in the example below)

The data is essentially a matrix as follows (with a bit of rearranging and reducing the number of currencies):

FX table

C for Canadian Dollar
U for US Dollar
E for Euro
CU: price of 1 Canadian dollar in US dollars as reported in the table
UC: price of 1 US dollar in Canadian dollars as reported in the table

FX-table multiplied by itself

This matrix, in an efficient, arbitrage-free market, should simplify to:

Ideally The Result should simplify to this.

Therefore, the test is to form the Foreign Exchange Matrix, and then calculate the following expression in Matlab, Excel, etc:

Test formula , where n is the number of rows in the FX table. (3 in the above example)

If the resulting matrix has non-zero elements, it is theoretically possible that arbitrage can happen. Note that “non-zero” is relative as it is unlikely that you get all zeros because of round off errors. But, dividing (the absolute value of) the biggest element by n gives you a good idea about the potential amount of arbitrage. For example, applying the formula to the sample data at the beginning of the text shows that the inconsistency in the table of rates is, more or less, about 0.678%. (Again, the sample table was tampered with for the sake of the example. Using the original data, the arbitrage potential was 0.00068%.)

I recommend that this formula be used for a quick test as opposed to a full diagnostic review of your FX table. There are definitely better and more elaborate ways of arbitrage detection and pinpointing what algorithm can make you the most amount of money. This post is only meant to show how a little bit of Linear Algebra can be used as a quick test of online data.

Also, the chances of making money this way is very low. That is because markets are quite efficient these days. Also, all FX trading accounts have a trading spread which is basically charging you a small premium every time you do a trade. This small amount is large enough to cover the arbitrage opportunity as detected above. If you know of a trading account that isn’t like that, I would love to know about them ;)

Let me know what you thought of this post. Do I have what it takes to be a Quant!? If you’re interested in the spreadsheet that does the calculations, let me know.

November 21, 2007

Coupon Codes!

Filed under: Marketing — Sahand @ 5:07 pm

Last week, I spent a bit of time on sales coupons for Giftify. Since I have no formal marketing education, I had to rely on common-sense and intuition. Please, feel free to give me feedback on this. I’m really interested to know what other people think of it.

The objective is to be able to sell at a discounted price to select individuals, groups of individuals, or everyone who carries a valid coupon code issued by the vendor. Sounds simple enough.

I thought of a couple of aspects of coupons:

Discount Logic

  • Percentage coupon; e.g. 10% off the gift price
  • Absolute amount coupon; e.g. $15 off the gift price
  • Combinable with other promotions

Authorized User

This is who the coupon is meant for

  • a specific user; e.g. A frequent customer, reviewer
  • a group of people; this is similar to the individual user, but a little different in the database model
  • general public; in this case you want to let anyone with a promosional coupon code to be able to benefit from the discount. e.g. GoDaddy promo codes.

Discounted Merchandise

This is more an implementation issue again.

  • Authorize use of coupon on select gifts in the catalog
  • Coupon is valid on every item in the catalog

Profit Safety Net

Is the objective of the coupon (promotion, appreciation, etc) worth losing money on certain orders from users with the coupons. For example, a person has a 15% discount coupon, but she wants to use it on a gift with a margin of 10%.

  • Coupon allowed to override minimum gift price
  • Coupon has a limit

As for implementation, I will give you a brief overview of my design. If there’s interest in seeing more details, please let me know and I will try to make a post. In summary, I used a Single Table Inheritance approach to model coupons in our database. That is, all various types of coupons (Percent/ Absolute/ Limitless/ Limited) are stored in a single table. I store coupon details, as well as the type in the table. In the controller code, when retrieving a coupon from the database, I look at the type first and use the correct code based on that.

That’s all. Please, let me know what you think of this post. Was it useful to you? Do you know of a better resource online which captures the information in this post and more?

btw, here’s a coupon code for Giftify to show my appreciation for reading this blog ;) SOJOODIBLOG

© 2007 Sahand Sojoodi
Powered by WordPress