Category: Uncategorized

  • trading agents

    I always considered finance and accounting as the most boring things you can do with a computer. And while you can earn big bucks, working for a Swiss bank, I have always preferred topics with a more physical background.

    But BitCoin got me interested in how some aspects of the established financial systems work. Looking at the bitcoin price fluctuations, I long suspected that it should be possible to write a trading agent to exploit the volatility. It could follow some fix pre-programmed rules, or find the rules by itself using machine learning. All the data it would need to work on, is easily available.

    Last summer started btcrobot, a service that promised just that. They have a subscription model, and I’m sure, if it doesn’t work out, they still gain and the users loose. I didn’t really want to pay hundreds of dollars just to find out if it works. And to be honest, the whole site smelled like a scam.

    So I completed the Coursera class “Computational Investing 1“. It was more about portfolio management and algorithmic trading of stocks. But a lot of the material can be applied to currency trading and in special to bitcoin as well. In the homeworks we built a small trading agent and portfolio optimizer. The main metric we used was the Bollinger Bands technical indicator.

    So I started implementing a bitcoin trading agent that would use bollinger bands. I didn’t want to start completely from scratch, so I skimmed through github and sourceforge for a starting point. I selected funny-bot, and started extending it. But soon, my interest switched to other projects. Remember, finance is not my primary interest. In the last months I had an eye on the exchange rates, trying to see how such an agent might perform. And I think it would be very difficult to tune, at least without experience in that field.

    Last week I found out again that I suck at trading. The bitcoin price started rising like cracy. I thought if it goes up so fast, it must come down again. In a rush, I sold some of my bitcoins. I wanted to buy again after the price would crash. But the price kept rising, and I would have gotten a lot more if I sold them just two days later. Apparently I was not alone with my false prediction.

  • Mining BitCoins

    Today I read an article called “Why you should care about BitCoin” with a quote that I want to repeat here:

     “Hackers are the animals that can detect a storm coming or an earthquake. They just know, even though they don’t know why, and there are two big things hackers are excited about now and can’t articulate why – Bitcoin and 3D printing”
    – Paul Graham

    In late June I ordered a KncMiner Saturn BitCoin mining machine. I knew that it would be delivered in October. What I didn’t know was how the difficulty for mining would develop. It was rising fast, exponentially fast. Nevertheless it was tempting to see, that if I received the miner when I ordered it, return on investment would have been reached in 9 days. In the months since I ordered the device, the network difficulty went through the roof. So at the moment it’s not even sure if I will reach a break even point for the investment. It was a substantial investment for me. But I won’t complain, it was less than what I gained just by holding onto some BitCoins, that I earned with paragliding tandem flights. The mining business appears even riskier than just investing in BitCoin. But in late spring it looked as if the BitCoin price would stabilize, which would be a good thing for BitCoin adoption. Thus mining seemed to be a good strategy to gain something. And on top of that, everybody heard the stories of the people who made a fortune through mining BitCoins.

    Last wednesday, I received an eMail from DHL, that they picked up a packet for me in Sweden and that it is on it’s way to me. With the tracking number I could see where it was. The first part of the voyage was quite impressive, but then they couldn’t locate my home, which shouldn’t be that hard. So I had it delivered to the office a day later:

    October 16, 2013 14:13 Vasteras - Sweden     Shipment picked up
    October 16, 2013 19:35 Vasteras - Sweden     Processed at Vasteras - Sweden
    October 16, 2013 20:57 Vasteras - Sweden     Departed from DHL facility in Vasteras - Sweden
    October 16, 2013 22:40 Copenhagen - Denmark  Transferred through Copenhagen - Denmark
    October 16, 2013 22:42 Copenhagen - Denmark  Departed from DHL facility in Copenhagen - Denmark
    October 17, 2013 00:52 Leipzig - Germany     Arrived at DHL facility in Leipzig - Germany
    October 17, 2013 01:08 Leipzig - Germany     Processed at Leipzig - Germany
    October 17, 2013 04:40 Leipzig - Germany     Departed from DHL facility in Leipzig - Germany
    October 17, 2013 06:35 Basel - Switzerland   Arrived at DHL facility in Basel - Switzerland
    October 17, 2013 06:43 Basel - Switzerland   Processed for clearance at Basel - Switzerland
    October 17, 2013 06:44 Basel - Switzerland   Clearance processing complete at Basel - Switzerland
    October 17, 2013 06:46 Basel - Switzerland   Processed at Basel - Switzerland
    October 17, 2013 07:58 Basel - Switzerland   Departed from DHL facility in Basel - Switzerland
    October 17, 2013 09:06 Basel - Switzerland   Arrived at DHL facility
    October 17, 2013 09:19 Basel - Switzerland   With delivery courier
    October 17, 2013 16:46 Basel - Switzerland   Address information needed; contact DHL
    October 18, 2013 09:36 Basel - Switzerland   With delivery courier
    October 18, 2013 15:03 Basel - Switzerland   Shipment delivered

    Usually when I look at the tracking,  the steps that take minutes or hours for DHL, would take days or weeks for stuff that comes from China with economy shipping.

    When I opened the package, I noticed that something shakes inside the case. When I opened it, I saw that the fans had fallen off the big heat-sinks. So I re-mounted them before starting the device. The software came fully configured, so this part was plug n play. Over the first few hours it was hashing at approx 240 GH/s. When I ordered it, 200+ GH/s was promised, but they stated that 275 GH/s would be normal after the first prototypes. For comparison: a high-end graphics card hashes at about 0.3 GH/s. So I upgraded the firmware to get some more diagnostics. One core was always at 57°C while the other was always at 44°C. So I guessed there should be a way to make the one with the lower temperature work faster.

    On the KncMiner forum, I found a firmware mod called BertMod that should offer more detailed diagnostic. It didn’t work with the newest firmware though. Fortunately I could de-compose it, and run the perl script in an ssh session to get the diagnostics. It showed that on the second chip there were about 40 cores disabled.

    The next thing I found was the official EnableCores patch. As the name suggests, it enables all the cores in case they were disabled erroneously. Shortly after applying it, the hashrate went up to 260GH/s, but not for long. It stabilized at 250GH/s. And now, I get lots of messages like this:

    KnC: core 4-xx was disabled due to 10 HW errors in a row

    The technical support told me they are working on a new firmware to improve the performance.

    Since solo mining is too risky for my taste at the moment, I am participating in pooled mining. My device should statistically find about 1.3 Blocks in it’s lifetime. But if I were unlucky, it could find nothing at all. When experimenting with GPU mining a while back, I used the 50btc pool. Thus, it was my first choice for the Saturn as well. But after a day or two, they were attacked by a DDoS and later also their billing server was hacked. Mining still worked, but the situation seemed a bit risky, so I looked for alternatives. At the moment I configured slush, bitminter, eligius and solo mining as failover alternatives. They have problems of their own, but these can be worked around:

    • slush wouldn’t send confirmation emails to my regular account. So I had to use gmail.
    • bitminter uses OpenId for logging in, which is great. But the first two OpenId’s that I tried, didn’t work with their site. They would provide additional security as they are self hosted or backed by a client certificate. So I had to use my launchpad.net OpenId, which is only secured with a password.
    • eligius is based in the US

  • VW Bus Treffen Schwarzsee

    Last saturday we went to the vw bus gathering at the Schwarzsee. There were more than 460 VW Busses present from all different types. I had the impression, to see less vehicles than last time, but comparing the pictures from 2009, I’m not so sure anymore. It’s amazing in how good a shape some of the vintage hippie mobiles still are.

    By accident we discovered a DVD of “The Bus” movie on the bugbus booth. It was apparently crowd-funded by a kickstarter campain.

    Of course I went for a short flight, to see the event from the top, while Mirella and the kids listened to a “Guggämusig”.

    The drive there was a good opportunity to test the SPOT Connect that I got for my birthday. [map link] Contrary to my previous understanding, It doesn’t provide internet connectivity, but allows to send custom messages to pre-defined phone numbers and eMail addresses. As the simpler SPOT devices, it contains a transmit only unit for the GlobalStar satellite network. The very bad thing about it, is that it was hard to perform the required firmware upgrade. They provide the upgrade program only for Windows and Mac. But communication afterwards seems to be better, as lined out by this blog post.

    Enough blabbing, pictures tell more than words:

  • sniffing i2c with the BusPirate

    I received my BusPirate v4 a while ago, but didn’t really use it so far. That’s a cool analysis/debug tool for serial buses such as uart, spi, i2c and the like. For me i2c is the most interesting. From time to time, the communication doesn’t work as it should, and so far, I worked it out with trial and error. I hope the BusPirate can be of help in such situations in the future. So, here is my first test run.

    The BusPirate is controlled through an uart textual interface:

    minicom -D /dev/ttyACM1 -b 115200

    When you connect to it, it performs a self test, and then you can choose the mode by entering m. In my case, that’s 4 for i2c. Next I get to choose between hardware and software. I don’t know the implications yet, but what I see is that hardware offers higher speeds, and locks up more often. Then I get to choose the bus speed. 100KHz is the standard. With ? you can always get a list of possible commands. (0) shows a list of available macros. (1) scans all possible addresses for connected devices, just like i2cdetect would do it on the computer. (2) finally is what I was after, that’s the i2c sniffer.

    I was actually hoping it could find out why I’m having problems reading back a simple value from an AtMega8 to a RaspberyPi. The AtMega8 is at address 0x11 and the command to read the value is 0xA1. I verified with a serial connection to the AtMega8 that it has a proper value, but on the RaspberryPi I always get a 0. At least the command was received on the AVR as I could verify with the UART, but writing the value back is the problem. So here is what the sniffer outputs for the attempted read:

    [[[][]][[[0x01+][0x04-[][[0x20+][[[[[][0x20-[][0x4C+][0x04-[][0x24+][0x20-][]]]

    Let’s decipher those numbers. Plus means ACK and minus means NACK. Opening square bracked means start bit, and closing square bracket means stop bit. The expected sequence would be 0x22 (the address for sending to the AVR) 0xA1 (send back which value) 0x23 (the address for receiving from the AVR) 0x08 (or whatever value was stored on the AVR). But the above output doesn’t look like this at all. So, lets try to communicate from the BusPirate to the AVR directly. Here we go: (more…)

  • The crapware platform

    I complained many times that there is no standard package manager on Windows, and that installations and especially upgrading software on that platform is an unholy mess. On my office computer there are probably close to ten different mechanisms present to keep different software packages up to date. Some lurk in the system tray, and most of them constantly waste resources. The update mechanism of our software is a little bit better than most in that respect. It doesn’t waste resources while it’s not in use, but it’s still a separate proprietary solution. And the worst part is, that most of the software on usual Windows Systems don’t even get updated at all.

    I looked for a solution as simple, elegant and powerful as apt-get many times. The best I found so far was Npackd. It’s still a decade short of the debian system, but better than anything else I found. The repository has grown significantly in the years I have used it. But even if Npackd implements dependency management, the packages rarely make use of it. It’s just not the way Windows packages are made. Rather than managing the dependencies, they keep inventing new versions of dll hell.

    I don’t know what is the reason that upgrades in Npackd frequently fail. It’s usually that the uninstall of the old version fails, and thus the update stops. What I usually did in the past, was installing the new version in parallel. I think there is not much Npackd could do about WindowsInstaller packages failing to uninstall. Having crafted WindowsInstaller packages myself, I know how brittle and error prone this technology can be.

    Today I upgraded some packages that Npackd flagged as upgradeable. You select the ones you want to bring up to date, and click update. It’s not like “sudo apt-get upgrade” and done, but it still makes Windows a lot more bearable. And for a long time the quality of the packages was good, at least for Windows standards. It started out with mostly open source projects and a few big name packages. The crapware that is so stereotypical for the Microsoft platform had to stay out.

    That impression changed today. One of the packages that I upgraded was IZArc, a compression package with nice Windows Explorer integration. Already during the upgrade process I had a strange feeling, when I saw the ads in the installer window. And when it was done, I was certain something fishy had happened. Some windows popped up wanting to install browser toolbars, changing the default search engine and scan the computer for possible improvements. Holly shit I thought is this some scareware? I would expect this from some random shareware downloaded from a shady page, but not from Npackd.

    And that’s my main point. When you install software on your computer, you trust the issuer not to hijack your system. And if you install software through a software repository, you trust the repository even more. On Windows, you’re pretty much dependant on lots of individuals and companies involved in the creation of all the packages you install. There is a Microsoft certification process, and I don’t know what it checks and entails. There is also the possibility to sign your packages with a key signed by Microsoft. But that merely protects from tampering between the issuer and you. With OpenSource software however, you can examine the sourcecode yourself, and rely on the fact that other people checked it as well. Then most distributions have build hosts that compile and sign the binary packages. To be included in the repository, a maintainer has to take responsibility for the package, and upload a signed source package. The source package can be verified by everyone. So, the only thing you have to trust is the build host. But even that you could verify by building the package yourself, and compare the result. So the whole thing is fully transparent. Hence, if one individual decided he wanted to earn some bucks from advertising and bundling crapware, he wouldn’t get very far. As a nice add on, apt (or synaptic for that matter), can tell you exactly what files get installed to what location for every package in the system.

    Just as a side note, crapware is the unwanted software that is pre-installed when you buy a new computer, or that is sneaked onto your computer when you install oracle’s java. When I bought my netbook, I booted Windows exactly once to see how much crapware they bundled, before wiping the disk and installing ubuntu. Needless to say no such problems exist on the Linux side.

    So I checked the “Programme und Funktionen” in the system settings. That’s one of the configuration items that changes its name and appearance with every version of Windows. I found about 7 unwanted packages with today’s installation date. I removed them immediately, and I can only hope that they didn’t install additional malware.

  • The most beautiful car ever built

    I usually don’t write about books I read, or even reviews. So, this is a rare occasion, but it’s also a type of book that I only rarely read. Usually I just give ratings on goodreads. This book is about the Jaguar XJ13.  Now, beauty is a matter of taste, so you’re free to disagree, but I for myself have never seen a more beautiful car than the Jaguar XJ13. It was designed by Malcolm Sayer who also designed the iconic E-Type, the successful racing C- and D-Types as well as (my) XJS.

    The XJ13 was designed to win the 24 hours race in Le Mans, to carry on with the victories Jaguar had in the fifties. As Jaguar were too hesitant at the time of development and as a consequence of a change in the rules for the Le Mans race, the car never took part in an actual race. Nevertheless it held a lap record for the MIRA test track for 30 years. Only ever one was built and it had a horrible crash while filming for an advertisement. The car was later rebuilt to it’s full beauty. It now belongs to the Jaguar heritage trust, and not even an arab sheikh bidding seven million british pounds could buy it.

    As I was never involved in the design or engineering process of neither a car nor an engine, it was totally exciting and interesting to learn how all these processes work. Or should I say worked fifty years ago? No point in listing all the details here, but the book has full coverage of the engine design and testing as well of the body design as well as the testing of the car itself on the test track as well as the race track.

    The stuff is especially interesting, as the engine that was developed for XJ13 was Jaguar’s first V12, and a predecessor of the engine that powers my XJS.

    At the end of the book there is a short discussion of the die cast models available. By chance I found out that the same model, I own is now on ebay for four times of what I payed ten years ago. Now, I’m still looking for a 1:18 model of the C-X75.

    The most memorable quote from the book is when Malcolm Sayer describes how he designed the car to not being negatively influenced by the airflow. No lift, no pushing down and no effects from wind from the side. The wings at the tail of some other cars were unacceptable for him. He described them as a kludge to fix design mistakes. Noone at Jaguar understood how he calculated the shapes. Instead or or in addition to drawings he also calculated books full of numbers. From the descriptions given, it’s hard to tell if his proceedings would today be described as parametric surfaces. So, in a way he performed CAD without a computer.

  • Chiemsee Holiday

    Like for most people around here, summer holidays for us usually means going south. And that is what we usually did in the past. This year, we wanted something new. The countries north of Switzerland were unexplored territory for us in regards of holiday destinations. We had ideas to go to the netherlands, Belgium or the Provence. The Nordic countries, we wanted to save for later, for a bigger trip when the boys grow older. After some brainstorming and discussing, we settled on the north sea cost of Germany. It would be a long drive, but manageable wit the current age of our boys. Then we found out that Levin is still allergic to fish. So we figured, that going to the sea might be not such a great idea. At least a lake we needed so that we could do some kayaking. Thus, the next best thing was the Bavarian sea: the Chiemsee.
    We both didn’t know the area. The closest I was before, was Berchtesgaden, where I was competing in the 2005 German paragliding championship. Lots of people told us that it is a very nice area. So we looked forward to it.
    The day we drove there was full of postponings. We left only in the middle of the afternoon, and so we didn’t make it in time to check into the camping. Consequently, we had to sleep the first night parking in the driveway, with all the luggage still in the camper.

    Our first canoe excursion was not so pleasant, as Noah didn’t sleep enough, and so he complained all the time. The area was nice indeed with lots of activities for the kids. Definitely the highlight was the fairy tale theme park in Ruhpolding. It is a paradise for kids, full of ingenious playgrounds and stuff to explore. Neither the flyer nor the homepage can describe how good it is. If you’re in the area with children, you have to go there!

    The Chiemsee is on the flat land but very close to the mountains. As it’s on the flat, the underground is all mud. I had heard of two nearby flying sites before: Hochfelln and Hochries. One day we wanted to go to the Hochries, but the easterly wind was not suited for flying there, and the one person chairlift was a no-go for Mirella anyway. So we went to Kössen just after the Austrian border. I was very positively surprised of the flying area. It was well protected from the prevailing wind, and had enough room for many paragliders on takeoff and in the air. It reminded me a lot of Gstaad. After about an hour flying in the gentle thermals above takeoff, I decided it’s time to look after my family. Then I found out that landing next to the cablecar was the trickiest part of the flight. There were lots of small thermals close to the landing area.

    One day we took the boat across the lake to have a ride with an old steam train. The boys were totally excited by the ancient technology. Next, we visited the castle on the main island. It was built for the fairy tail king Ludwig the second, who also built castle Neuschwanenstein. The castle on the Chiemsee island is a copy of the french Versailles palace, and although not finished, full of excessive splendour.

    On the way home, we stopped in Munich to visit the BMW world with our two car fanatics. From every model sold in the BMW group, there was a piece in the exhibition. The kids could sit into all but the Rolls Royce. We had a hard time to get them out again.

  • Computational neuroscience class

    This year didn’t start out so great for my online classes. I signed up and started a bunch, but quit all but one so far. Some were not as interesting as I thought, some didn’t contain enough new stuff or the material covered was too different from what I expected. I just couldn’t motivate myself to invest the time and effort to complete them. Maybe it’s not as exciting as it was for the first few classes or maybe these teachers are just trying out a new channel and are not as determined and enthusiastic about this new form of education. For me personally, the first MOOC that I completed, the introduction to AI is still the best.

    Finally I found a class that I was keen enough to complete. That was about computational neuroscience. I read some books about neurology before, and was familiar with the basic structure of neurons and synapses as well as with some neuro transmitters such as GABA. But the details about ion channels and their detailed behaviour was new to me. The calculations with the spike voltages and spike triggered averages were very interesting. They highlighted to me just how simplified the common perceptron neural network models are. The second part of the class that was more about the application of the insight from the biological neuroscience into artificial intelligence and machine learning was more familiar and partly repetition.

  • AtTiny Advent Wreath

    An advent wreath in late spring, you ask? Yes, the timing is a bit off, and that’s not just because the coldest spring in ages has not finished yet. While browsing for the topic of my last post, I discovered a nice little one-evening-project: Geeky advent from tinkerlog.
    I had all the required parts here, so I just gave it a try. The adaptation from the AtTiny13 to an AtTiny45 was straight forward. But finding the right threshold value for the ambient light sensor was a bit trickier. Especially, as the ADC didn’t work at first. That was probably a difference between the two AtTiny’s. But once I configured the ADC properly for the AtTiny45, I flashed it a couple of times with different values, and turned the room light on an off, until I had a good threshold value.
    It’s interesting how the flickering is done with the random values and the manual PWM. And especially, how one of the LED’s is used to sense the ambient light was intriguing. To save battery power during the day, it goes to sleep and waits for the watchdog timer to wake it up. It then senses the ambient light. If it is bright, it goes straight back to sleep. If it’s dark, it lights up the LED’s. Going through the four modes for the four weeks of advent is done by resetting, or just quickly disconnecting the power from the battery.

    But now I look forward for the summer to come, before we can put the mini advent wreath to use…

    As my modified code is so similar to the original, it’s not really worth to create a project on github. So, I just pasted the code below.

    (more…)

  • AtMega breadboard header

    A while ago, I ordered some AtTiny breadboard headers from tinkerlog.com. Unfortunately, they didn’t have any boards for AtMega’s left. The ones for the AtTiny’s are very handy, and I used them whenever prototyping something with an AtTiny. In fact, I used it almost whenever flashing an AtTiny. Many times I wished I had one of these tiny boards for the AtMega’s and at some point I even forgot that they existed. Often times I just included in ICSP header on the stripboard.

    Last week I thought I must have such a board for the AtMega’s as well, and created one with a bit of stripboard. The wiring is not pretty, but the device works well, and is a real help when prototyping.

    Fritzing layout on github