Ding Zhou

an engineer wearing a scientist hat

Web/ LinkedIn/ Facebook

(0) ¶ set up remote desktop in ubuntu 

1. first install the package via apt-get

sudo apt-get install vnc4server

2. add two lines in ~/.vnc/xstartup

 unset SESSION_MANAGER
 sh /etc/X11/xinit/xinitrc

3. set up the password required to go to the desktop

vncpasswd

4. launch the remote desktop server:

vncserver :1

This will start a new desktop in the background ready for a remote user to connect to. Note the :1 above tells the server to bind port 5901 for vncserver.

5. You can also make sure you start a vncserver upon restarting. In /etc/rc.local add a line (can assign a port for each user you want remote desktop access):

6. now if you want to connect from a windows machine, download the free VNC client here:

7. Sometimes, you want to set up ssh for security. What you do is to set up a port forwarding so you’d only have to maintain a ssh tunnel to the server. Try this when you ssh:

 ssh -fNC -L9999:localhost:5909 myvncserver.com
Share on Facebook
2009
Dec
26
21:07

(0) ¶ invest in the investors; not the MF 

The world is becoming more open and transparent, as evident by more private content and info being shared on the Web or through social networks every day. People know more about each other and understand more about the world’s information at an amazing speed. However, there is one place in the U.S. that has been a forbidden city full of mysteries; there is one thing in the world that is a carefully guarded secret — do we really know how those Wall Street firms invest *our* money?

In this interesting country, people care a lot about how the government spend their mandatory tax money so they get together every four years and burn hundreds of millions of dollars to listen to a few candidate proposals. This way, they feel secured as they understand how 1/3 of their gross income would be spent. However, when it comes to dealing with their life-long savings, most of them surprisingly know very little about how the retirement fund or mutual funds or hedge fund works. For most of them, when deciding on their investment, all they take as input is the name of the financial firm and the sector of mutual fund (MF). Very few of them look at who the fund manager is. And I’ve never hear of anyone switching to a new MF only because the previous star manager left. However, it’s really the fund manager who drives the fund and they jump around all the time — why do you still buy the season ticket now that Michael Jordan has left Bulls? Few people understand this or with limited options choose to neglect this. They buy and hold through ups and downs, letting go most of profits made *their money* into the Wall street’s pocket. The root cause of this is the market inefficiency set forth by people’s limited options and lack of transparency from Wall street. I thought about this a few years ago — there has to be a better and more transparent way to invest my money! And here is one:

http://www.techcrunch.com/2009/12/15/kaching-funding/

It’s the people that matters. Why should we pay so much to the firms that hire them? A small amount of insurance premium to hedge against risks is fine but we have obviously been paying to fly their jets as well…

Share on Facebook
2009
Dec
16
07:17

(0) ¶ create your calculator with awk 

in your bash, do the following

calc(){ awk "BEGIN{ print $* }" ; }

and then do the following:

calc 2*1 - 12

and

calc '2*(1 - 12)'

you can put this in your ~/.bash_profile too…

Share on Facebook
2009
Nov
5
08:11

(0) ¶ Good stocks? bad stocks? 

So one of the many challenges an algorithmic trader faces is to come up with a good watch list. Why? — A trading strategy is almost always conditioned on a watch list. And the total performance is the product of the quality of the watchlist and that of the trading strategy. In the past, I’ve read a lot of good articles proposing various watchlist generation ideas. Despite the rosy pictures they paint, I believe in data. So I wrote a small program to provide another data point.

This is what I did. I write a wrapper around one trading strategy of mine. Randomly sample n stocks from a grand watch list. Pair each of the sample with a few index ETF and run my trading over x years of history data until a few years ago. Then based on the performances of each sample stock, I divide them into two buckets, and run the same trading strategy from that point onward until now, on two new watch lists respectively. Here are my observations:

1. Overall, over a long period of time, there is no positive correlation between a stock’s past performance with a stock’s future performance, conditioned on the same trading strategy

2. For large cap, there is in fact a negative correlation between past and future performance. In many cases, the future gain between the top and bottom half of the stocks by past performance, can differ by 2x or more.

3. For small cap, there is a weak positive correlation between past and future performance. The future performances differ even more dramatically between *good* and *bad* stocks than the past performances.

Of course, i can’t tell you on what time period i’ve drawn the above conclusion. :) But in one word, I observe that, in the market, there are trends and there’re waves.

Takeaways? There’re a few. Some specific to traders are: 1) past successful strategies will very likely fail in the future, at least on the same set of stocks (so develop new strategies or at least update your watchlists, if you don’t want to be another prey of the wall street); 2) do not get too excited with your backtest results, history does not repeat, again, at least on the same set of stocks.

An even more profound lesson here applies to not only the stock market. Note how very unlikely a successful company (a large cap is a built on top of its past success I assume) can remain successful over a long time? It’s much easier for a great company to remain good when it is small. But is much much harder for it to repeat its success, at least according to the statistics. :)

Share on Facebook
2009
Oct
10
21:35

(0) ¶ To plug in Dell S2409W for old laptops (e.g. IBM X60s) 

My IBM X60s is so old that it has to upgrade its bios in order for the right resolution (1920 x 1080) to show up. I’m on an XP OS. Here are the step-by-steps that’ll hopefully save you sometime:

1. right click My Computer on Desktop and choose System Properties. Go to the Device Manager Tab and Choose Device Manager. There you’ll find out what your Display Adapter’s Chipset is. I have a X60s and my Video Adapter is Mobile Intel(R) 945 Express Chipset Family.

2. Go to intel.com or google to search for an upgrade of your chipset. Here’s the download link for Intel 945GM Chipset . Now install the new chipset driver. You can also use the Intel driver tool to detect whether your video driver needs upgrading.

3. Go to Dell to download the config file for the monitor. I have a S2409W so my config file is downloaded from the Dell’s driver support page. Extract files from the downloaded zip archive and remember the location.

4. Go to the Device Manager and choose the Monitor from the list. Right click and choose Update Driver. Then choose to manually upgrade driver using files as extracted in the previous step.

5. Now upgrade your Laptop’s bios so it knows that there’re  a monitor model called S2409W. Usually your laptop vendor’s web page has upgrade file. I have a IBM X60s and I downloaded the file from here.

6. Unzip the downloaded bios upgrade file and double click to run the WINUPTP.EXE.

7. now you can restart your machine for the first time.

8. Right click on desktop and click on Properties. Go to setting and you should be able to use the new resolution of  (1920 x 1080)

Share on Facebook
2009
Sep
21
08:51

(0) ¶ Lee Kaifu leaving Google China 

Wikipedia has updated Kai-Fu’s page almost right after the official announcement by Google China.

While many are celebrating Kai-Fu’s achievement today, let’s take a look at his previous jobs:

  • Corporate Vice President, Natural Interactive Services Division (NISD), Microsoft Corp. 2000 – July, 2005 [3]
  • Founder, Microsoft Research Asia, China, 1998-2000
  • President, Cosmo Software
  • President, Multimedia Software Business Unit, Silicon Graphics Inc. (SGI)
  • Vice President & General Manager, Web Products, Silicon Graphics Inc. (SGI)
  • Vice President, Interactive Media Group, Apple Computer, 1990-1996
  • Assistant Professor, Carnegie Mellon University, 1988-1990

It’s rather a long professional history of 20 years before he decides to do something of his own. On the other hand, 20 years, being spent to reach where he is now, is indeed an amazing journey. I’m holding my breath for KaiFu’s ventures in China. I thought we’ve passed the golden age of Internet? KaiFu could prove me wrong on China.

Share on Facebook
2009
Sep
4
19:15

(0) ¶ so you think you can trade with algorithms? 

interesting read — performance really depends on your selection of initial watchlist. on SP100, in my implementation, the performance has been 10%-20% year over year for the past 10 years. the portfolio shrinks to 40% in worst times…

“Algorithms for Portfolio Management based on the Newton Method”

Share on Facebook
2009
Aug
26
05:33

(0) ¶ Emacs: Change function color 

An emacs tip to share:

M-x customize-face
// twice to view all kinds for things to cutomize
// font-lock-* are the things you can attach color
Customize face> font-lock-function-name-face RET
// Then you can edit the color options in a nice form

Enjoy coding on servers…

Share on Facebook
2009
Aug
20
23:27

(0) ¶ reinstall python2.5 on ubuntu 

if you happen to be as dumb as me to remove the /usr/bin/python and thought python2.6 would be 100% compatible with your ubuntu system, this is how to get you out of trouble:

wget http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tgz
gunzip < Python-2.5.4.tgz | tar xvf -
./configure --enable-unicode --enable-shared --enable-profiling --enable-ipv6 --enable-unicode=ucs4 --prefix=/usr/
make clean
make
sudo make install

remember to include the option "--enable-unicode=ucs4" if you have AMD64bit as I do. I can almost hear screamings if you don't do that and you want to install numpy or rpy later.

Finally, you might want to change your default ubuntu python setting:

/usr/share/python/debian_defaults

Share on Facebook
2009
Aug
16
19:31

(0) ¶ how to install upgraded R 2.9 on Ubuntu 

Standard ubuntu distribution install R 2.7 as of Aug 2009. If you want a newer version, do the following:

1. add below to the ubuntu’s source list in /etc/apt/sources.list

deb http://cran.stat.ucla.edu/bin/linux/ubuntu intrepid/

replace the intrepid/ with your ubuntu version name.

2. now try to update your code

$ su
$ apt-get update

unless you’ve added the above source before, you’ll see the following error msg

W: GPG error: http://cran.stat.ucla.edu/ unstable
Release: The following signatures couldn't be verified
because the public key is not available: NO_PUBKEY [KEY]

3. now you should tell your system that the new source list is ok by:

$ su
$ gpg --keyserver wwwkeys.eu.pgp.net --recv-keys [KEY]

here wwwkeys.eu.pgp.net is a key server for debian-like systems. and then do:

$ gpg --armor --export | apt-key add -

4. now you should be able to update your source list safely:

$ apt-get update

5. and install r-base as usual

$ su
$ apt-get install r-base

6. smile

Share on Facebook
2009
Aug
16
00:27