10 May 2011

Pajas!

I’ve now uploaded a project to github that I came up with early this year. We had a list where we kept track of the buffoonery or just silly things that some of us did. Stuff that made all of us, even the person in question, laugh. It was perfectly harmless and also a way to show that we aren’t perfect. Pajas means clown in Swedish.

Early this year I was looking for a project where I could make a social application. Something that needed interaction between people. And in my mind came the idea to make a web application of this list. I thought that this could be something that friends could be use amongst themselves.

My first idea was to use OpenId to make sure that most users on the web could access the site. I wanted a way to host the site and I went with making it a Google Appengine application. While researching for good info on how to use OpenId and appengine I happened to find a tutorial on making a facebook app. It seemed easy and to be honest, if you are going to make a social application today you will probably in some way rely or use facebook. My initial idea was to have some facebook integration(like buttons, posting etc..) anyway so why not go all the way?

I based the app on the tutorial on Run with Friends which was pretty good. There is some tricky handling that is needed to authenticate with Facebook that Run with Friends fixed. The initial contact with facebook will be a post whose data is encrypted using your apps API secret.

Check out the repo and if you have a facebook account you can check out Pajas! at facebook. Enjoy!

View Comments
01 May 2011

Solving Big Problems

I’ve started working on a new solution for the Stocks application. I will make the following concepts:

  • A stock quote fetcher that will fetch quotes from different sources depending on the availability.
  • An alarm manager that will keep track of when to update the quotes.
  • A new application for the presentation of the stock data. This will be a yaws application. The presentation will be stateless. I aim for using several yaws instances that could be used for load balancing.
  • A new database handling that will use riak
  • A new logging application that will log to file. Very simple logging to start with. I want this working as fast as possible as I will need it when trouble shooting.

Now I know that this is a lot and most is really unnecessary, I mean I won’t have any traffic to load balance. Why not go simple and use mysql? Well I’m doing this mostly to educate myself. I really boils down to making an application that is really fault tolerant, distributed, efficient and nice to use. It’s also a great way to learn about distribution in erlang and nice tools like riak and yaws. I want to make an application that I can feel really proud of.

But it is still a heck of a lot to do. Right now I’m a bit stuck where to start. But I want to get something working quickly or I will get bored. I’ve chosen the I feel is best for me. I will start with the problem top down. Trying to get the functions closest to me as an administrator to work and then try to implement the functionality that I have invented in the lower layers. Basically I’m writing the top function and inventing functions there on the spot for small problems that I don’t want to think about right now. It’s always a lot easier to solve those problems later when you don’t have to think about the higher up stuff.

The top down method also means that I have to be careful what I name the functions to because I will most likely be stuck with those names and the methodology they imply. I’m to lazy to change them afterwards.

View Comments
29 Apr 2011

Get That Stone of My Chest

So for this first post I will give a small introduction of who I am and why I am writing a blog. I am an engineer by day working with telecom software and a “hacker” by night. And by hacker I don’t mean hacker as in Hackers but as in a dude who’s having fun trying to implement the ideas in his head. I’m not really methodical and I can’t say that I solve my problems in an engineering kinda way. I try to solve problems best I can.

I like programming and I see programming languages as tools. But some tools are better than others, I especially like erlang for it’s simplicity and the fact that it is a functional language. It has great concurrency and it is very easy to prototype stuff with. I have also dabbled around with Python(especially Django) and Java a bit.

My main focus seems to be developing web applications. I guess I am driven to make stuff that many people can use, and web applications is one of the best ways to reach out the people. I’m also driven by a the simple urge to earn money(which I will elaborate on some other time). I want to score a great idea and be able to live off that. If I in the process of getting there can learn a thing or two, then I think I have achieved quite a lot.

One of the first big solo projects that I started on was Stocks. After graduating from the university I developed an interest in stocks and thought that with my newly learned theory and programming skills I could rock the stock market.

My first experiment was programming a simple stock simulator and trying to find the perfect moments to buy and sell according to some slope on the stock quote curve. I used a genetic algorithm to optimize this – which really is pretty ineffective, you get a result but could get an equal result in a much quicker time with another algorithm – and got some promising results. But I only tested this on one stock. I did not at that time have access to any other data.

For some reason I put the project on hold(probably has something to do with the fact that I got my first child). About a year ago I decided to start again and this time I was dead set on getting some data. I looked around and found two sources for data on the internet, text-tv and NASDAQ OMX. From NASDAQ OMX I could get historical prices and therefore I developed a crawler that could fetch all data for the stocks I wanted.

With all this new data I wondered what to do next. After a failed neural network experiment I started reading up on Technical Analysis and decided to implement a bunch of those indicators. Back then technical analysis sounded right to me, because I wanted a way to predict the stock market without any knowledge of the company behind the stock itself. After having experimented with the indicators I am pretty convinced that you wont get far with just technical analysis, you will need a lot of Fundamental Analysis too. That means checking into financial statements, balance sheets and those kinds of documents. Which I wont do, yet at least.

I then started where I first left off. Maybe I could try to find some optimal trading strategy based on the slope of the stock curve? I now had more data to experiment on and got to work. I implemented two optimizing algorithm which I could use beside genetic algorithms, simple hill climbing and simulated annealing which both are global optimization algorithm that can be used to search a large search space. When I tested this I got some pretty encouraging results on some stocks, under 10 years I could get a 200% increase for example. But then I tested that against just buying the stock and holding on to it under the same time. I got about the same results… I felt so fucking stupid at that point.

But I have learned something from this. I could probably go on and refine my algorithms and try other strategies but I have to realize the fact that this is useless. There are probably hundreds(maybe thousands?) of engineers throughout the world that have gone into the same pitfall and think they can solve this. Graduate students are doing research on many universities, why would I do better? I think I can put my energy on other stuff where I can be more successful.

That being said I will still continue my work on stocks, but from another angle. I will put my energy on using the data I have and try to create a web application for a community instead. Mostly because I want to make an application that uses the benefits and strengths of erlang, and to learn HTML 5 for the future. I will make the web application distributable and will utilize websockets for a nice user experience. But I will talk more about this some other time.

A tip for the stock market… Buy a stock of a big company that is unlikely to die and hold on to that, you will most likely get rich(in the end) by doing that.

View Comments