Aiden Byrne Podcasts

posted by ben on 09.03.22 at 16:15, null, food, London, Leave a comment Permalink

here and here

Council Tax

posted by ben on 09.03.22 at 15:53, null, London, Leave a comment Permalink

Here's where it goes. I'd assumed a lot more went to schools... not really thrilled about paying for the projects.

In Soviet England...

posted by ben on 09.03.22 at 15:51, null, London, Leave a comment Permalink

I tried to buy hangers at Argos today. You poke through a phone book sized catalog, pick numbers of items you want and then a clerk gets them for you. The conversation went something like this:

Ben: I don't see any hangers in your catalog, but you sell them right?

Clerk: Yes. Let's see... page 143. But, they usually sell out as soon as we get them in. I'll check if we have any. No. Let me see if any of the surrounding stores have any... No.

Ben: When will you get more in?

Clerk: I don't know.

Ben: Is there anywhere else I can get hangers around here?

Clerk: I don't know.

Ben: Thanks anyway.

Demand > Supply -> Order more hangers. Right? What's next, toilet paper shortages?

Big Brother on Brick Lane

posted by ben on 09.03.22 at 09:27, null, pictures, London, Leave a comment Permalink

Trade Lifecycle

posted by ben on 09.03.22 at 07:13, null, null, ben tries to beat Livermore, Leave a comment Permalink

I'm a fair way along writing the trade engine for arbit (what I call my statistical arbitrage program that's something like 2.5 years in the making (the name of which still makes me think of these)). I've started to realize that I'm writing a finite state machine, one which looks alarmingly like the one in TIBCO BusinessEvents (BE).

So, out of curiosity, I built up the state model using BE. I'm now thinking BE makes lot of sense for trade life cycle. I've pitched the idea before, but I think trying to write a trade engine from scratch has made it really obvious how valuable this is.

Now I just have to figure out how to do this in Python. I'm thinking for each trading day I create a new object and then progress it through with a bunch of flags. Yay for non scalable approaches!

I'm also starting to wonder if my one language to rule them all approach is a good idea. I use Python for most everything, with occasional calls into C for a couple libraries I need that don't exist in Python. Python interoperates natively with C, so this isn't a big deal. That said, it'd be nice to be able to call something mathy (Matlab, R, S+, even Mathematica), and there are about a billion things in Java that'd be nice to have.

I don't want to use Jython because I'm not convinced it has a future. The integration to the Ameritrade API is already as much code as my entire arbitrage program. Likewise, the cluster code is easily 3x the size of the arbitrage code. Then there's the market data scraper which is probably 5x the arbitrage code. Integration is hard... That said, I really like the idea of keeping it all in Python so this problem doesn't get worse.

I finally built a closet.

posted by ben on 09.03.21 at 12:19, null, London, 2 comments Permalink
Comment from: graham [Member] · http://nonplatonic.com/graham.php
So how did you end up building it? I'm a little disappointed that it's not 15 feet long.
Permalink 04/20/09 @ 11:15
Comment from: ben [Member] · http://ben.nonplatonic.com
I build everything. I'm awesome. Yay shit drills and 2x4s!
Permalink 04/20/09 @ 15:25

posted by ben on 09.03.20 at 18:30, null, null, books, Leave a comment Permalink

I've read the book. I love it. If there is some hint of how to find you in it, I've missed it. As GK Ashe probably isn't available, let's go get dinner some other ridiculous place!

?

posted by ben on 09.03.19 at 14:30, null, null, books, Leave a comment Permalink

The Road Home by Rose Tremain is to Strawberry Fields by Marina Lewycka
as
House of Meetings by Martin Amis is to Russian Debutante's Handbook by Gary Shteyngart

Pay attention to sex!

posted by ben on 09.03.18 at 13:53, null, null, Leave a comment Permalink
I wish I'd had the self control to not argue with PETA in the comments... to not immortalize myself with an improperly conjugated verb. Sigh.

BoingBoing: a directory of misleading facts

posted by ben on 09.03.15 at 15:26, null, null, Leave a comment Permalink

In related flawed reasoning, there are trillions in outstanding lottery tickets. Every time a person buys a lottery ticket, the state is potentially obligated to pay millions of dollars. It's only a matter of time before everyone wins the lottery at once and the state is required to pay out millions to each of millions of lottery players.

End the lottery! It may seem like a boon to public resources now, but soon the bubble will burst and this house of cards will come tumbling down!

--------------------

"2. Derivatives are unregulated, not traded on any public exchange, without universal standards, dealt with by private agreement, not transparent, have no open bid/ask market, are unguaranteed, have no central clearing house, and are just not really tangible."

Um, no. Anyone heard of CBOE?

Photo from Chamonix...

posted by ben on 09.03.08 at 08:01, null, pictures, places, Leave a comment Permalink

Seems strangely familiar.

python: xml to dict, bow to my recursive genius

import xml.dom.minidom
def xmltodict(xmlstring):
	doc = xml.dom.minidom.parseString(xmlstring)
	return elementtodict(doc.documentElement)
def elementtodict(parent):
	child = parent.firstChild
	if (child.nodeType == xml.dom.minidom.Node.TEXT_NODE):
		return child.nodeValue
	d={}
	while child is not None:
		if (child.nodeType == xml.dom.minidom.Node.ELEMENT_NODE):
			try:
				d[child.tagName]
			except KeyError:
				d[child.tagName]=[]
			d[child.tagName].append(elementtodict(child))
		child = child.nextSibling
	return d

Updated: Fixed a bug that didn't like null nodes and another about whitespace, though I stole some code from an O'Reilly book for that.

import xml.dom.minidom
def xmltodict(xmlstring):
	doc = xml.dom.minidom.parseString(xmlstring)
	remove_whilespace_nodes(doc.documentElement)
	return elementtodict(doc.documentElement)
def elementtodict(parent):
	child = parent.firstChild
	if (not child):
		return None
	elif (child.nodeType == xml.dom.minidom.Node.TEXT_NODE):
		return child.nodeValue
	d={}
	while child is not None:
		if (child.nodeType == xml.dom.minidom.Node.ELEMENT_NODE):
			try:
				d[child.tagName]
			except KeyError:
				d[child.tagName]=[]
			d[child.tagName].append(elementtodict(child))
		child = child.nextSibling
	return d
def remove_whilespace_nodes(node, unlink=True):
	remove_list = []
	for child in node.childNodes:
		if child.nodeType == xml.dom.Node.TEXT_NODE and not child.data.strip():
			remove_list.append(child)
		elif child.hasChildNodes():
			remove_whilespace_nodes(child, unlink)
	for node in remove_list:
		node.parentNode.removeChild(node)
		if unlink:
			node.unlink()

Update 2: Someone already did this in the 2nd edition of the Python Cookbook. There's another one here too: http://code.activestate.com/recipes/116539/. So much for there only being one way to do something in Python...

Comment from: qkiss [Visitor]
Hi,

Thanks for the simple solution, just what I was looking for.

I changed it a bit and removed the remove_whilespace_nodes function. Hope it will also help someone.

from xml.dom.minidom import parse, Node

def xmltodict(filename):
doc = parse(filename)
return elementtodict(doc.documentElement)

def elementtodict(parent):
child = parent.firstChild
if not child:
return None
while child.nodeType == Node.TEXT_NODE and not child.data.strip():
child = child.nextSibling
if child.nodeType == Node.TEXT_NODE:
return child.nodeValue

d={}
while child is not None:
if (child.nodeType == Node.ELEMENT_NODE):
try:
d[child.tagName]
except KeyError:
d[child.tagName]=[]
d[child.tagName].append(elementtodict(child))
if len(d[child.tagName]) == 1:
d[child.tagName] = d[child.tagName][0]
child = child.nextSibling
return d

qkiss
Permalink 01/11/10 @ 12:58
Comment from: qkiss [Visitor]
Sorry for the code... I hope this one will be better.


from xml.dom.minidom import parse, Node

def xmltodict(filename):
doc = parse(filename)
return elementtodict(doc.documentElement)

def elementtodict(parent):
child = parent.firstChild
if not child:
return None
while child.nodeType == Node.TEXT_NODE and not child.data.strip():
child = child.nextSibling
if child.nodeType == Node.TEXT_NODE:
return child.nodeValue

d={}
while child is not None:
if (child.nodeType == Node.ELEMENT_NODE):
try:
d[child.tagName]
except KeyError:
d[child.tagName]=[]
d[child.tagName].append(elementtodict(child))
if len(d[child.tagName]) == 1:
d[child.tagName] = d[child.tagName][0]
child = child.nextSibling
return d
Permalink 01/11/10 @ 12:59
Comment from: Nan [Visitor]
I adapted elementtodict to use numeric values instead of strings for actual numeric values, as well as base types instead of lists when there is only one element with a given name:

def elementtodict(parent):
child = parent.firstChild
if (not child):
return None
elif (child.nodeType == xml.dom.minidom.Node.TEXT_NODE):
val = child.nodeValue
try:
if '.' in val:
val = float(val)
else:
val = int(val)
except ValueError:
pass
return val

d={}
while child is not None:
if (child.nodeType == xml.dom.minidom.Node.ELEMENT_NODE):
try:
d[child.tagName]
except KeyError:
d[child.tagName]=[]
d[child.tagName].append(elementtodict(child))
child = child.nextSibling
for key, val in d.items():
if type(val) is list and len(val) == 1:
d[key] = val[0]
return d
Permalink 08/12/10 @ 15:54
Comment from: Francisco [Visitor]
I added some changes to the child loop (in elementtodict(parent)) in order to avoid the list excess in the result:
while child is not None:
if child.nodeType == Node.ELEMENT_NODE:
try:
d[child.tagName]
except KeyError:
d[child.tagName] = elementtodict(child)
else: #first time that I use the try's else
if type(d[child.tagName]) != list:
d[child.tagName] = [d[child.tagName]]
d[child.tagName].append(elementtodict(child))
child = child.nextSibling
Permalink 07/16/11 @ 17:18

Crumpets Royale

posted by ben on 09.02.01 at 16:33, null, null, food, pictures, Leave a comment Permalink

Program Trading

posted by ben on 09.02.01 at 14:29, null, null, ben tries to beat Livermore, 1 comment Permalink

It turns out there are more reasonable options between professional brokers and scraping yahoo, google, and Ameritrade pages:

http://www.interactivebrokers.com/ibg/main.php
http://www.tdameritrade.com/tradingtools/partnertools/api_dev.html

Comment from: JOHNNY JOHNNY [Visitor]
used to use IB.. they are not bad
Permalink 06/12/09 @ 04:28

Learning to Program - A letter to a post

If you want to make GUIs (Graphical User Interfaces), I think .NET is the best choice. Of course it restricts you to PCs. Java is a close second, and will work on a Mac.

For .NET, you'd want a copy of Visual Studio. The free express edition is available here: http://www.microsoft.com/Express/
For Java, go with Eclipse: http://www.eclipse.org/

If you want to make lots of little graphs and such, then I think you would be best off with Matlab, though Mathematica and R are close seconds. R is free, the other two are not. http://www.r-project.org/

Finally, if you just want to crunch numbers, manipulate things and generally understand how to program, I think Python is the answer. Python is going to be the easiest of all these to get started with. So you could try it and then switch to something else if you run into a wall. http://wiki.python.org/moin/BeginnersGuide/NonProgrammers

-----begin diatribe --------

You will see lots of this sort of thing in the programming community...

I'd avoid C, C++, JavaScript, Visual Basic, Excel, Objective C, Lisp, Scheme, Haskell, Ruby, any type of assembly, machine code, PHP, Perl, Pascal, and the people who will try to push them on you for a whole bunch of other ones for various reasons.

All that said, if you want to jump into Linux land for some reason, you are going to be forced to learn C. In fact, if you have a Mac you are already trapped in UNIX land, which is pretty similar to Linux land. If that's the case, maybe start with Python then and move over to C once you notice the limitations. This book is the best way to learn C.

Stay away from anything written by Bruce Eckel. His books will be confusing until well after you've learned to program.

last photo

posted by ben on 09.01.08 at 10:40, null, null, pictures, Leave a comment Permalink

I was going to document my crappy little studio in encruciating detail. However, my camera died after the first picture. It now takes very blue pictures:

Adjusting the contrast (in Photoshop) makes it look kind of neat (Why yes, I am bored. Thanks for asking.):

This blog seems to be all about navel gazing. I really don't like that phrase... or the sound of that sentence. Here's the post from the night I got the camera. If I remember correctly, I was staying at Austin's. Changes.

My poor camera was a Canon Elph SD110. 3.2 megapixels! It was a big step up from the junk Fuji I had before. I think that was 1.something. It didn't have a zoom, so you could turn it on very quickly and snap photos. I liked that.

From the file names, I know I took 1108 pictures with the Elph. Assuming it cost something like $200, that's about $0.18 per picture, or $6.50 for 36.

I also feel compelled to point out that I'm a little odd in the way I use digital cameras. I don't tend to take photos indiscriminently. The Elph has an intentionally tiny memory card, which forced me to use my precious 10 photos carefully. I like that, somehow.

When I try to load the camera application on my BlackBerry Curve I get an out of memory error. So, these are probably the last photos for a while.

my place

posted by ben on 09.01.08 at 10:33, null, pictures, London, 1 comment Permalink
Comment from: graham [Member] · http://nonplatonic.com/graham.php
Hey... that looks a lot better than what you've described to me.
Permalink 01/16/09 @ 10:13

Fish and Chips

posted by ben on 09.01.07 at 14:10, null, London, Leave a comment Permalink

The best I've had have been at The Princess, Fish! and The Narrow. Though, I've had a couple bad Princess experiences recently.

I've been told to try:
Two Brothers - Finchley
Seashell - North of Marleybone Road
Some place in Muswell Hill

Ben wants a closet.

posted by ben on 09.01.07 at 13:43, null, null, London, 1 comment Permalink

I have a bunch on clothes that I'd like to stuff in the huge open space in my bathroom. If I can get them out of my main living space, I'll have more room for books (on actual shelves) and my abode will look less like a college student's, and I will grow to love my dark hole of a home. I will also be able to buy wing chairs.

Problem is, I've been buying clothing that likes to be hung up. So, I really need to racks, each about 30" long. What's the best way to accomplish this?

One thought would be to buy some pipe, T, and L joints, kind of like I had in Seattle holding the floor up. Question is, how would I attach these to brick, tile, drywall, and a partly tiled over door without doing too much damage? Could I use one of those telescoping structural supports they use to hold up ceilings? What are those even called? Ideas?

Alternatively I could build a wall and then use traditional clothes hanging type bars. It would probably look better, but it'd be a lot of work and probably piss my landlord off (and he has something like £1500 of mine, so I'd rather do this in some easily reversible way). Anyway, wall like so:

My drawings are excellent!

What would it take to get two unsupported posts pointing perpendicular out of the wall, each with 100lbs of clothes? Maybe that's the way to go?

Or just a ceiling support in the drywall? That might be more reasonable. I would still need to attach pipe to brick in some fairly reliable manner.

Arg! Is this place temporary? Should I spend £100 on this, then more on furniture? Will I be here for 6 months, 1 year? That seems long. 6 months is a good upper limit. Then I move... somewhere. So, maybe I shouldn't bother... anyone have any easy suggestions?

Comment from: collin [Member] · http://nonplatonic.com/collin.php
You're drawings are very crappy.

Those telescoping supports are called house jacks (I think). And you don't need them since they're made for 5-20 tons. I would just use steel pipe and fittings, but those can get expensive surprisingly quickly.

Do you remember the thing I have for my skis?
-2 3/4"x2' pipe
-2 end caps
-2 flanges
-2 pieces 1/4" cable
-2 turnbuckles
-2 eye bolts
-some u-bolts and drywall screws

I think it was about $50. I've got ~6 pairs of skis and 2 paddles on it right now.

If I were you I'd put the flanges on the brick not the tile, drilling into the brick not the mortar and use expansion bolts. You could just have a vertical cable like I did, with an eybolt in a joist. Or have a vertical pipe with a flange resting on the floor. I don't think you'd need to attach it to the floor, maybe stick a piece of rubber on the bottom.

Then the only thing you'd need to patch are some holes in the brick.
Permalink 01/12/09 @ 17:27

um, no.

posted by ben on 09.01.07 at 12:47, null, books, ben tries to beat Livermore, Leave a comment Permalink

I’ve been reading When Genius Failed, and it seems to misrepresent a lot of the theory it summarizes. The most egregious is the notion of equilibrium:

"An efficient market is a less volatile one (it has no Black Mondays) and, from day to day a less risky one. "

-Roger Lowenstein, When Genius Failed, pg 76

Black initially thought noise and information traders played a balancing act. In 1986, Black wrote:

"People who trade on noise are willing to trade even though from an objective point of view they would be better off not trading. Perhaps they think the noise they are trading on is information. Or perhaps they just like to trade.

With a lot of noise traders in the markets, it now pays for those with information to trade….

The information traders will not take large enough positions to eliminate the noise…

The noise that noise traders put into stock prices will be cumulative, in the same sense that a drunk tends to wander farther and farther from his starting point. Offsetting this, though, will be the research and actions taken by information traders. The farther the price of a stock gets from its value, the more aggressive the information traders will become. More of them will come in, and they will take larger positions. "

-Fischer Black, Business Cycles and Equilibrium, Noise, pg 155.

According to Mehrling’s biography of Black, his position continued to evolve, eventually to the position that noise is an integral part of equilibrium markets:

"…people were adopting trading strategies that increased price volatility by increasing buying pressure when prices rose and increasing selling pressure when prices fell…. Essentially given the increased demand, the ‘cost’ of portfolio insurance had to rise in order to equilibrate markets, and that meant that equilibrium mean reversion of asset prices had to rise… but mean reversion is not something that investors can readily observe, so for a while their behavior continued to reflect the historical lower rate of mean reversion. The result was that, as prices rose, investors miscalculated the degree to which expected return was falling. By October 19, enough investors had become aware of the state of affairs to calculate correctly, and prices fell until expected return was high enough that investors were willing to hold the existing quantities of stock."

-Perry Mehrling, Fischer Black and the Revolutionary Idea of Finance, pg 273-274

The key point of this being that despite what numerous crap macro economics books might say, equilibrium and efficient markets can incorporate noise, and that noise can build in such a way to cause all manners of crashes. Given that Scholes and Merton were both at LTCM, I suspect this idea was well incorporated into their thought.

I like Black.