# Arbitrage

I’m going to demonstrate a simple example using forward agreements for stocks of what we mean when we say there is no arbitrage.

First assume that there is a risk free investment that yields continuous interest at rate $r$, typically treasury bonds are used as the risk free investment. Now assume we have a stock $S$ that has price $S_0$ at time 0. Suppose you enter into a forward agreement to pay $F_{0,T}$ at time T for the stock $S$.

Now using the risk free investment we can say that $F_{0,T}$ is worth $F_{0,T}e^{-rT}$ at time 0 (this is because if we invested $F_{0,T}e^{-rT}$ in the risk free investment at time 0 we would have $F_{0,T}$ money at time T).

The assumption of no arbitrage means that $F_{0,T}e^{-rT} = S_0$ since by investing $F_{0,T}e^{-rT}$ in treasury bonds we will own the stock at time T and by buying the stock we also own it at time T.

Thus by assuming no arbitrage the forward price is $F_{0,T} = S_0e^{rT}.$

This is one example of using the assumption of no arbitrage. The Wikipedia article on arbitrage shows the other types of arbitrage.

# Configuring Mono and ASP.Net on Nginx

For work I need to setup one domain with multiple subdomains. The basic idea for the website is the same as Fog Bugz, in that it’s a web hosted app. And each customer has their own site e.g. johnny.quickpm.net would be johhny’s site.

For the technology side we use ASP.Net Web forums for the actual software, that is johnny.quickpm.net is running an instance of Asp.net WebForms on Mono.  But for the main site quickpm.net I want to run ASP.Net MVC since I like the MVC model and mono now (mostly) supports ASP.Net MVC in the current daily builds.

For the server software I’m using Nginx and the Mono FastCGI interface.  The important configuration bits are
nginx.conf

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
worker_connections  1024;
}

http {
include       mime.types;
default_type  application/octet-stream;

#log_format  main  '\$remote_addr - \$remote_user [\$time_local] \$request '
#                  '"\$status" \$body_bytes_sent "\$http_referer" '
#                  '"\$http_user_agent" "\$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

server {
listen       80;
server_name  localhost *.quickpm.net;
root /usr/local/nginx/html/\$host;
#charset koi8-r;

access_log  logs/access.log;
location / {
root /usr/local/nginx/html/\$host/;
index index.html index.htm index.aspx default.aspx Default.aspx;
fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/\$host\$fastcgi_script_name;
include ../conf/fastcgi_params;
}

#location / {
#    root   html;
#    index index.html index.html index.aspx default.aspx Default.aspx;
#}

#error_page  404              /404.html;

# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   html;
}

}
}

To run the mono fastcgi server use

fastcgi-mono-server2 /applications=cmd.quickpm.net:/:/usr/local/nginx/html/cmd.quickpm.net,quickpm.net:/:/usr/local/nginx/html/quickpm.net /socket=tcp:127.0.0.1:9000

Doing the above results in quickpm.net resolving to /usr/local/nginx/html/quickpm.net and cmd.quickpm.net resolving to /usr/local/nginx/html/cmd.quickpm.net also mono will serve the two directories as two separate ASP.Net Applications.