You are currently browsing the category archive for the ‘trading’ category.

For experimenting with some ideas on improving blockchain scaling :

https://github.com/justgord/blksimjs

Currently simulates the growth of a crypto-currency blockchain ( similar to Bitcoin ), loops thru a cycle of :

  • spend – pick addresses at random and spend to another address
  • mine – put waiting transactions into the block, mine the cryptographic hash, add to chain

Features / Limitations :

  • uses single sha256 bit hash for ids
  • uses an easy Proof-of-work [ 256 tries on average to get a block hashs with ’00’ leading bytes ]
  • uses node.js byte buffers for transactions and blocks
  • runs around 7000 tps on i5 laptop

Motivation

I wanted to simulate the growth of a blockchain with unspent transactions spread somewhat sparsely at the early older parts of the blockchain, and more dense at the top of the blockchain [as more recent transactions havent had time to be spent yet ].

The reason for this is to test the feasibility of reducing the size of the data needed to bootstrap a new node. eg. in Bitcoin the whole dataset is :

  • around 150GB of transactions [ 250Mn txns ]
  • utxo of around 2GB [ ~50Mn txns ]
  • so unspent ‘utxo’ set is around 20% of transactions

Bring UTXO set forward

We can use much less data [5x smaller ] when spinning up a new node, by bringing utxo set forward to nearer the front of the chain. The sim gathers old utxos and injects them into the blockchain in baches of ids, so they are stamped into the block at block creation.

These ‘utxo catchup sections’ are read when starting a new processing node – ie. it only needs a provable list of utxos, not the complete history of all spent transactions.

skip links [ todo ]

Using block extension areas, we can also include skip links to blocks much earlier in the chain – the process of walking back thru the links of transactions inputs and outputs all the way back to the initial ‘genesis’ block is like walking a DAG tree, as un-needed areas of the blockchain are skipped over.  These skip links are validated at block creation time by other nodes.

This is useful for clients which want to traverse the chain to make better proof of validity that SPV, and for nodes that use utxo bring forward above, so they can trace PoW to an arbitrary level back to the genesis block.

Just watched a really interesting documentary on the Flash Crash of 2010 :

Money & Speed: Inside the Black Box

Some stand-out points :
> CFTC / SEC attribute the root cause as Waddell & Reed ‘dumping’ $4.1bn shares
> Eric Hunsader @ Nanex looks at the W&R trades [ see video at 34m18s ]
> W&R trades don’t look like dumping, they maximize sell price during local up runs
> there are other trades that do look like aggressive dumping, ie. rapid sequential bursts down

The Nanex explanation of the Flash Crash : FlashCrashAnalysis

Price manipulation ?

This raises an interesting Question :

Is it possible for a black box algorithm to use a rational probabilistic strategy to drive down stock price in bursts like this, in order to later buy the stock at a very low artificially deflated price ?  You’d need a lot of stock to do this : is there a threshold of stock volume, say 5% of all stock, under which its impossible to create this effect ?

Price Delay Arbitrage ?

Another aspect of this, is the possibility to do ‘Diffusion Arbitrage’ for want of a better name :

If you can drive the market so quickly that derived instruments take seconds to reprice ( due to the storm of new data), then you have that window to trade ahead of the market in options or indexes based on the underlying you have manipulated.

In this case the delay was a whopping 5 to 35 seconds : see for example Nanex’s FlashCrashSummary , showing the delayed drop and recovery of the Dow.