Sunday, February 13, 2011

My simple stock trading emulator, a work in progress

Working post and subject to change, and will be updated. I am putting the R codes in a page to the right

Implementing a trading model as a  finite entropy encoder in an optimum Shannon channel.

My trading model consist of a finite network of traders operating a graph algebra , which is the dual nework of the tracking the actual performance of companies on the market.  Traders use this graph algabra  in the manner of a Hidalgo-Hausmann dual network, or a Huffman encoder. The variables tracked are the price/earning ratios, and the exogenous changes come from dividend and net present value of liquid asset held within the company; call this liquidity measure.  The measured output of the system are price/earnings ratio as represented in the generalized yield curve of the trading network.

The goal of the trading network is Huffman encoding restricted by the graph algebra vs Huffman encoding without such a restriction.  When the two are out of balance, the trader network will drop the rank of the trading network, or increase the rank of the trading network. Portfolio shifts attempt to maintain the proper Fibonacci sequence as seen as transaction rates along the X axis of the yield curve.  The Y axis should be PE values. The research goal is to change the liquidity measure, the exogenous shocks and watch the two yield curves diverge.

Parameters:
The window length of the Huffman encoder defines the bandwidth of the trading network, which normally adjusts to twice the trading rate of the shortest term trading group. The exogenous input are the liquidity shocks coming from companies, which are determined from the real world. The research compares actual PE variations to imputed PE variations.

I use R Project codes consisting of a simple Huffman coder, a set of Graph algebra operations on the traders network, my generalized yield curve, and a small set of trading strategies within the limited graph algabra. I am trying to replicate the LeBaron research using the entropy norm.

Update 1:

We do not need tha actual Huffman codes inthe procedure, weneed the Huffman tree, and from that can determine information content, log(Wi), in the sample from Wiki Huffman description, becomes signal power. Since Pi log(Pi) is entropy, we make the quantum equivalance between transaction rate (Pi) and signal strength Wi with computed entropy Wi log(Wi)

Tha is,under Shannon  C = B log(1 + SNR).  We break the Shannon channel into components, each component has equal SNR. exp(Pi/B) = 1 + log(Pi)/V(i) The right term is constant, the Pi become the rate for the ith trader. The V(i) is the yield, the value of the Y acists on the yield curve.  We have broken up a Shannon channel into components based on bit length of an equivalent Hufman encoding tree, the rank of the supply chain.

The rates along the X axis should be the Fibonacci numbers, as Log(Pi) is uniformly distributed modulo 1, meaning all SNR values down the network are constant within an integer. This is the trick, and should be made more explicit.

2 comments:

2Stocktrading said...

Thanks for your post. I want to know more about graph algabra. Can you tell me axactly how it works?

2stocktrading said...

Thanks for your post. I want to know more about graph algabra. Can you tell me axactly how it works?