<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Economy &#8211; The Financial Hacker</title>
	<atom:link href="https://financial-hacker.com/tag/economy/feed/" rel="self" type="application/rss+xml" />
	<link>https://financial-hacker.com</link>
	<description>A new view on algorithmic trading</description>
	<lastBuildDate>Wed, 27 Apr 2022 12:44:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://financial-hacker.com/wp-content/uploads/2017/07/cropped-mask-32x32.jpg</url>
	<title>Economy &#8211; The Financial Hacker</title>
	<link>https://financial-hacker.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>The Scholz Brake: Fixing Germany&#8217;s New 1000% Trader Tax</title>
		<link>https://financial-hacker.com/the-scholz-brake-fixing-germanys-new-1000-trader-tax/</link>
					<comments>https://financial-hacker.com/the-scholz-brake-fixing-germanys-new-1000-trader-tax/#comments</comments>
		
		<dc:creator><![CDATA[jcl]]></dc:creator>
		<pubDate>Sun, 19 Jan 2020 10:44:05 +0000</pubDate>
				<category><![CDATA[No Math]]></category>
		<category><![CDATA[System Evaluation]]></category>
		<category><![CDATA[Economy]]></category>
		<category><![CDATA[Tax]]></category>
		<guid isPermaLink="false">https://financial-hacker.com/?p=3197</guid>

					<description><![CDATA[Would you like to read &#8211; from begin to end &#8211; a 18 page pounderous law draft titled &#8220;Law for introducing a duty to report cross-border tax structuring&#8221;? The members of the German Bundestag apparently didn&#8217;t. After all, nothing seemed wrong with a duty to report cum-ex schemes. So the new law, proposed by finance &#8230; <a href="https://financial-hacker.com/the-scholz-brake-fixing-germanys-new-1000-trader-tax/" class="more-link">Continue reading<span class="screen-reader-text"> "The Scholz Brake: Fixing Germany&#8217;s New 1000% Trader Tax"</span></a>]]></description>
										<content:encoded><![CDATA[<p>Would you like to read &#8211; from begin to end &#8211; a 18 page pounderous law draft titled <em>&#8220;Law for introducing a duty to report cross-border tax structuring&#8221;</em>? The members of the German Bundestag apparently didn&#8217;t. After all, nothing seemed wrong with a duty to report cum-ex schemes. So the new law, proposed by finance minister Olaf Scholz, passed legislation on December 12, 2019 without much discussion. Only afterwards its real content, hidden on page 15, became public. It caused incredulity and turmoil among traders and investors. This article deals with the new bizarre German &#8216;trader tax&#8217;, and with ways to step around it.<span id="more-3197"></span></p>
<p>News about a &#8220;1000% tax for traders&#8221; and even a &#8220;tax on losses&#8221; spread quickly in January 2020. Hopefully, fake news? This is the relevant section of the new law (Art. 5 § 20 sentence 6 number 4):</p>
<p><em>&#8220;The Income Tax Act as published on October 8, 2009 (Federal Law Gazette I p. 3366, 3862), last amended by Article 1 of the Law of August 4, 2019 (Federal Law Gazette I p. 1122), is changed as follows. The following sentences are inserted after § 20 paragraph 6 sentence 4: Losses from financial assets within the meaning of paragraph 2 sentence 1 number 3 may only be offset in the amount of 10,000 euros with profits within the meaning of paragraph 2 sentence 1 number 3 and with income within the meaning of § 20 paragraph 1 number 11; sentences 2 and 3 apply mutatis mutandis with the proviso that losses that have not been offset each year may only be offset against profits up to the amount of 10,000 euros with profits within the meaning of paragraph 2 sentence 1 number 3 and with income within the meaning of § 20 paragraph 1 number 11. &#8220;</em></p>
<p>Translation: For the income tax, trading losses cannot anymore be offset against trading profits in excess of EUR 10,000 per year.</p>
<p>Bad enough. But surely they mean that an annual loss can only be offset in 10,000 EUR portions against annual profits in subsequent years? That was at least my interpretation. It made a sort of sense, and appeared harmless if you anyway do not plan to have an annual trading loss. But rumors said that they mean to tax not the annual net profit, but the profit of every single trade. Some said it&#8217;s even a tax on every favourable price tick of any open position, since this already constitutes a profit. In any case, this would quickly sum up to an insane tax amount &#8211; no matter if you win or lose. It&#8217;s in fact not a tax on income, but a tax on volatility, portfolio diversification, and hedging. And it was not even clear for which sorts of assets that tax is due. The relevant <em>§ 2 sentence 1 number 3</em> can be applied to options, futures, and bonds, but possibly also to all leveraged assets such as forex, CFDs, ETFs, and stocks. Only the risky and ecologically damaging speculation with cryptocurrencies seems exempt.</p>
<h6>The win/loss offset mystery</h6>
<p>For getting clarification, I wrote a letter:</p>
<p><em>Dear Federal Ministry of Finance,</em></p>
<p><em>on my blog I would like to inform readers about the current &#8220;Law for introducing a duty to report cross-border tax structuring&#8221;, in particular about Art 5 § 20 sentence 6 number 4. </em><em style="font-size: inherit;">However, I am not sure that I fully understood the new law. Therefore I kindly ask you to briefly answer my subsequent questions.</em></p>
<p><em>1) Which of the following financial products fall under the referred &#8220;financial assets&#8221;: stocks, currencies (&#8216;Forex&#8217;), options, futures, CFDs, savings contracts with a limited term, German treasury bonds?</em></p>
<p><em>2)  Which tax is due in this scenario: Bob owns EUR 20,000 that he invests in options trading. He buys about 200 options per year. In one winning year, 101 of the transactions ended with a profit of EUR 1000 each, 99 transactions with a loss of EUR 1000 each. The annual result is <strong>EUR 2000</strong>. The taxable profit is <strong>EUR 101,000</strong>, for which Bob has to pay a tax of EUR 91,000 x 25% = <strong>EUR 22,750</strong> after deducting EUR 10,000 loss. The tax rate in relation to the EUR 2000 profit is <strong>1137.5%</strong>.  Is the tax calculation correct?</em></p>
<p><em>3) Same scenario, but a losing year. 101 transactions ended with a loss of EUR 1000, 99 transactions with a profit of EUR 1000. The annual loss is <strong>EUR 2000</strong>. The taxable profit is EUR 99,000. After subtracting EUR 10,000, Bob has for his loss a tax liability of EUR 89,000 x 25% = <strong>EUR 22,250</strong>.</em></p>
<p><em>4) Same scenario, but Bob now tries to outwit the new trader tax. He buys a single long-term position for EUR 20,000 at the begin of the year. Due to leverage, the total value of the position has risen by EUR 100,000 by the middle of the year, then dropped again by EUR 100,000 by the end of the year. Bob sells at the end of the year at purchase price. The year ends profit-neutral and Bob intends to pay no tax. <br />   But the finance ministry is not as easily fooled. Since the tax also applies to the value increase in the middle of the year, the taxable profit minus loss deduction is <strong>EUR 90,000</strong>. Bob gets a tax bill of EUR 90,000 x 25% = <strong>EUR 22,500</strong>.</em></p>
<p><em>5) Same scenario as 2), but for stepping around the new trader tax, Bob now avoids closing positions. Instead he exercises all options, no matter of in the money or not, shortly before expiration. The paid premium is then not a loss, but a purchase fee. Since the broker offsets simultaneous long and short positions automatically, the finance ministry can do nothing about that. <br />   At the end of the year remains a single long position in the underlying with a value of <strong>EUR 2,000</strong>, which is then sold. The taxable profit amount is EUR 2,000 x 25% = <strong>EUR 500</strong>.</em></p>
<p><em>6) Same scenario as 2), but for stepping around the new trader tax, the broker has now offered a new structured product. Instead of closing positions, they are converted directly into another asset of the client&#8217;s choice that does not fall under § 20 sentence 6 number 4 (for instance, a nonleveraged stock). The premium for selling options is also not paid in cash, but in a position of that asset. At the end of the year, a position with a value of <strong>EUR 2,000</strong> remains in Bob&#8217;s account, which is then sold. The taxable profit amount is EUR 2,000 x 25% = <strong>EUR 500</strong>.</em></p>
<p><em>I would be pleased if you could briefly tell me which of the tax calculations in the 5 scenarios are appropriate. I would also be interested in a brief explanation of the purpose and motivation behind the new law. And I would be very interested in an explanation how Bob in scenarios 2-4 is supposed to pay his taxes, since  they exceed all his capital.</em></p>
<p><em>Sincerely yours</em></p>
<p><em>Johann Christian Lotter</em></p>
<p>I was obviously not the only one who asked the ministry about the new law. I got a long formal response with little information content. It did not answer any of my questions, but confirmed that the 1137% tax and the tax on losses in scenarios 2 and 3 is for real. They did not comment on the tick tax of scenario 4.</p>
<p>Even the experts in Scholz&#8217; finance ministry seem mystified about the implementation, motivation, or objective of this new law. It does not stand alone, but is part of a bundle of similar (although slightly less absurd) laws against retail traders and small investors. Their purpose is a mystery. They seem not motivated by populism. Except for the upcoming transaction tax, few know about them. Some say that they were originally intended against tax scams and large-scale speculation, and only designed in a wrong way.  But that is of course impossible, since it would imply a remarkable intellectual incapacity of our lawmakers. Maybe Scholz just intended to show a leftist position for his election to party chairman (which failed nevertheless). Or he&#8217;s really convinced that people who live from trading are all speculators and capitalist pigs, and must be hit whenever possible. Who knows. A personal confession at this point: I, also, am responsible for the new tax. I have always voted for Olaf Scholz&#8217; party in the past. Often just out of tradition. This was apparently not always a wise decision.</p>
<h6>Four ways to fix the tax</h6>
<p>The trader tax will be in effect from 2021. It will then be unique in the world. No other country has a tax on volatility or diversification. I think it will not last long: Traders financially ruined by it, like Bob in some of the above examples, will challenge it in court. The Federal Supreme Court might eventually annul it due to unlawful overtaxation or its blatant absurdity. But until that happens, we&#8217;ll have to live with it.</p>
<p>Large-scale tax scammers, speculators, and hedge funds can laugh at Scholz&#8217; tax constructs. They just incorporate, preferably offshore, and are exempt. That&#8217;s no solution for small private investors. Scenarios 5 and 6 are two possible ways to avoid the trader tax. A third, relatively simple method would be a trading account in a cryptocurrency. As long as the tax is not applied on open positions, converting one financial asset into another should be tax-neutral, since it does not realize any profit. The problem: You never know what bitcoin, or another account base that brokers might offer for outwitting the tax, will be worth next year. And the ministry was unable to precisely describe how the tax will be applied and which assets are affected. So there&#8217;s no guarantee that these workarounds do really work. The safe way is staying below the loss limit.  </p>
<p>I know that the <a href="https://zorro-project.com" target="_blank" rel="noopener noreferrer">Zorro platform</a>, on demand of several German users, will get a new indicator, the <strong>Scholz Brake</strong>. This indicator will be implemented in the next Zorro release. It can be set up at the session start and at the begin of any year, like this:</p>
<pre class="prettyprint">if(is(INITRUN) || year(0) != year(1)) // any new year<br />  ScholzBrake = 10000; // activate the Scholz Brake</pre>
<p>Once set, the <strong>ScholzBrake </strong>variable will be counted down by all trading losses of all Zorro instances that run on the same PC and have activated it. So the script can always check the distance to the critical EUR 10,000 total loss limit, and decide what to do. If the variable reaches zero, trading is automatically suspended until the end of the year.</p>
<p>This prevents you (mostly) from the effects of the new law. Of course at the price of not trading for the rest of the year. If you live from trading and have hit the Scholz limit early in the year, you got enough time to look for a new job. Maybe as an expert in the finance ministry.</p>
<h6>References</h6>
<p>1. <a href="https://www.bundesrat.de/SharedDocs/drucksachen/2019/0601-0700/649-19.pdf;jsessionid=994163D05E496D3D58EED7A2ECCCA424.1_cid365?__blob=publicationFile&amp;v=1" target="_blank" rel="noopener noreferrer">Gesetz zur Einführung einer Pflicht zur Mitteilung</a><br /><a href="https://www.bundesrat.de/SharedDocs/drucksachen/2019/0601-0700/649-19.pdf;jsessionid=994163D05E496D3D58EED7A2ECCCA424.1_cid365?__blob=publicationFile&amp;v=1">grenzüberschreitender Steuergestaltungen</a></p>
<p>2. <a href="https://boerse.ard.de/anlagestrategie/steuern/verlustverrechnung-fuer-termingeschaefte-wird-erschwert100.html" target="_blank" rel="noopener noreferrer">ARD Börsenmagazin</a></p>
<p>3. <a href="https://manual.zorro-project.com/lots.htm#scholz" target="_blank" rel="noopener noreferrer">ScholzBrake</a></p>
<p>4. <a href="http://chng.it/xYTnxrqxJ5" target="_blank" rel="noopener noreferrer">Petition</a></p>

]]></content:encoded>
					
					<wfw:commentRss>https://financial-hacker.com/the-scholz-brake-fixing-germanys-new-1000-trader-tax/feed/</wfw:commentRss>
			<slash:comments>33</slash:comments>
		
		
			</item>
		<item>
		<title>Deep Learning Systems for Bitcoin 1</title>
		<link>https://financial-hacker.com/deep-learning-systems-for-bitcoins-part-1/</link>
					<comments>https://financial-hacker.com/deep-learning-systems-for-bitcoins-part-1/#comments</comments>
		
		<dc:creator><![CDATA[jcl]]></dc:creator>
		<pubDate>Wed, 27 Dec 2017 10:51:27 +0000</pubDate>
				<category><![CDATA[Machine Learning]]></category>
		<category><![CDATA[No Math]]></category>
		<category><![CDATA[System Development]]></category>
		<category><![CDATA[Autoencoder]]></category>
		<category><![CDATA[Bitcoin]]></category>
		<category><![CDATA[Blockchain]]></category>
		<category><![CDATA[Boltzmann machine]]></category>
		<category><![CDATA[Cryptocurrency]]></category>
		<category><![CDATA[Deepnet]]></category>
		<category><![CDATA[Economy]]></category>
		<category><![CDATA[H2O]]></category>
		<category><![CDATA[Keras]]></category>
		<category><![CDATA[Money]]></category>
		<category><![CDATA[MxNet]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Tensorflow]]></category>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=2899</guid>

					<description><![CDATA[Since December 2017, bitcoins can not only be traded at more or less dubious exchanges, but also as futures at the CME and CBOE. And already several trading systems popped up for bitcoin and other cryptocurrencies. None of them can claim big success, with one exception. There is a very simple strategy that easily surpasses &#8230; <a href="https://financial-hacker.com/deep-learning-systems-for-bitcoins-part-1/" class="more-link">Continue reading<span class="screen-reader-text"> "Deep Learning Systems for Bitcoin 1"</span></a>]]></description>
										<content:encoded><![CDATA[<p>Since December 2017, bitcoins can not only be traded at more or less dubious exchanges, but also as futures at the CME and CBOE. And already several trading systems popped up for bitcoin and other cryptocurrencies. None of them can claim big success, with one exception. There is a very simple strategy that easily surpasses all other bitcoin systems and probably also all known historical trading systems. Its name: <strong>Buy and Hold</strong>. In the light of the extreme success of that particular bitcoin strategy, do we really need any other trading system for cryptos?<span id="more-2899"></span></p>
<h3>Bitcoin &#8211; hodl??</h3>
<p>A buy and hold strategy works extremely well when a price bubble grows, and extremely bad when it bursts. And indeed, apparently all finance and economy gurus (well, all but <a href="https://www.rt.com/news/411379-john-mcafee-bitcoin-prediction/" target="_blank" rel="noopener noreferrer">John McAfee</a>) tell you that the cryptocurrency market, and especially bitcoin, is a bubble, even a &#8220;scam with no substantial worth&#8221;, and will soon experience a crash &#8220;worse than the 17th century tulip mania&#8221; or the &#8220;18th century South Sea Company fraud&#8221;.</p>
<p><figure id="attachment_2917" aria-describedby="caption-attachment-2917" style="width: 681px" class="wp-caption alignnone"><a href="http://www.financial-hacker.com/wp-content/uploads/2017/12/bitcoin.png"><img fetchpriority="high" decoding="async" class="wp-image-2917 size-full" src="http://www.financial-hacker.com/wp-content/uploads/2017/12/bitcoin.png" alt="" width="681" height="321" srcset="https://financial-hacker.com/wp-content/uploads/2017/12/bitcoin.png 681w, https://financial-hacker.com/wp-content/uploads/2017/12/bitcoin-300x141.png 300w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px" /></a><figcaption id="caption-attachment-2917" class="wp-caption-text">Bubble or not?</figcaption></figure></p>
<p>By definition, a bubble is a price largely above the &#8216;real value&#8217; or &#8216;fair value&#8217; of an asset, and it bursts when people realize that. So what is the fair value of a bitcoin? Obviously not zero, since blockchain based currencies have (aside from their disadvantages) several advantages over traditional currencies, on the economy level as well as on the private level. Such as:</p>
<ul style="list-style-type: square;">
<li>They break the <a href="http://www.financial-hacker.com/money-and-how-to-get-it/" target="_blank" rel="noopener noreferrer">link of money and debt</a>. Cryptocurrencies don&#8217;t require the bank credit mechanism for money creation.</li>
<li>They can be used where normal money would be impractical, such as fee transfers between machines or trading in multiplayer games.</li>
<li>They allow low-cost and anonymous money transactions. At least in theory.</li>
<li>They replace banks for storing and mattresses for stashing money.</li>
</ul>
<p>I&#8217;m ready to believe that blockchain is the future of money transfer and storage. But that does not mean an ever-rising bitcoin price. Hundreds of cryptocurrencies came out in the last two years, any single of them with a better blockchain technology than bitcoin, and any good programmer can add a new coin anytime. Few will survive. Countries or big companies might sooner or later issue their own crypto tokens, as Venezuela already is attempting. The release of an official blockchain Dollar, Yuan, or Euro would leave the old bitcoin with its energy hungry transaction algorithm in thin air. Thus, when investing in bitcoin, we should not hope for a rosy future, but look for its present &#8216;real value&#8217;.</p>
<p>Due to its extreme volatility, bitcoin can not replace bank tresors. But it is already used in some situations for reducing money transfer costs, since the miners get any transaction rewarded in bitcoin. And above all, anonymity can be a substantial motive to own it. When you need a hacker to delete your drunk driving record, pay her in bitcoin. But how big is the online market for illegal hacker jobs, kill contracts, money laundering, drugs, weapons, or pro-Trump facebook advertisements? No one knows, but when we compare it with cash, another form of anonymous payment, we get interesting results.</p>
<p>The current cash in circulation in the US is approximately $1.5 trillion dollars. And the current bitcoin supply, about 17 million bitcoins, represents a total value of about $250 billion. Which means that you can already replace 15% of all US cash with bitcoin! Not to mention all the other cryptos. I fear that this supply already exceeds the demand of anonymous online payment for today and also the next future.</p>
<p>For those reasons, a bitcoin &#8220;hodl&#8221; system, despite its extreme historical performance, is high risk. We don&#8217;t know when and how the bubble will burst &#8211; maybe bitcoin will go up to $100,000 before &#8211; but we have some reason to suspect that at some point sooner or later the bitcoin price might drop like a stone down to its &#8216;real value&#8217;. Which is unknown, but for practical purposes is probably not in the $15,000 area, but more like $15.</p>
<p>So we need some other method to tackle the cryptocurrency trading problem. The first question: Has the crypto market already developed price curve inefficiencies that can be exploited in a trading system? In <strong>(1)</strong> we see some tests with basic bitcoin strategies. Our own tests came to the same results. Momentum based strategies can work, and <a href="http://www.financial-hacker.com/get-rich-slowly/" target="_blank" rel="noopener noreferrer">mean-variance optimizing</a>&nbsp;portfolio systems can achieve even extreme returns with crytrocurrencies &#8211; up to 10 times higher than &#8220;hodl&#8221;. But that&#8217;s not really surprising due to the high momentums and volatilities of crypto coins. The problem is that all crypto portfolios are exposed to high risk. Other conventional model-based strategies don&#8217;t work well anyway with cryptos.</p>
<p>When we concentrate on bitcoin, our proposed system must be a fast trading, trend-agnostic strategy. That means it holds positions only a few minutes, and is not exposed to the bubble risk. I can already tell that short-term mean reversion &#8211; even with a more sophisticated system as in <strong>(1)</strong> &#8211; produces no good result with cryptos. So only a few possibilities remain. One of them is exploiting short-term price patterns. This is the strategy that we will develop. And I can already tell that it works. But for this we&#8217;ll need a deep machine learning system for detecting the patterns and determining their rules.</p>
<h3>Selecting a machine learning library</h3>
<p>The basic structure of such a machine learning system is described <a href="http://www.financial-hacker.com/build-better-strategies-part-5-developing-a-machine-learning-system/" target="_blank" rel="noopener noreferrer">here</a>. Due to the low signal-to-noise ratio and to ever-changing market conditions, analyzing price series is one of the most ambitious tasks for machine learning. Compared with other AI algorithms, deep learning systems have the highest success rate. Since we can connect any <a href="http://www.financial-hacker.com/hackers-tools-zorro-and-r/" target="_blank" rel="noopener noreferrer">Zorro</a> based trading script to the data analysis software R, we&#8217;ll use a R based deep learning package. There are meanwhile many available. Here&#8217;s the choice:</p>
<ul style="list-style-type: square;">
<li><strong>Deepnet</strong>, a lightweight and straightforward neural net library with a stacked autoencoder and a Boltzmann machine. Produces good results when the feature set is not too complex. The basic train and predict functions for using a deepnet autoencoder in a Zorro strategy:<!--?prettify linenums=true?-->
<pre class="prettyprint">library('deepnet') 

neural.train = function(model,XY) 
{
  XY &lt;- as.matrix(XY)
  X &lt;- XY[,-ncol(XY)]
  Y &lt;- XY[,ncol(XY)]
  Y &lt;- ifelse(Y &gt; 0,1,0)
  Models[[model]] &lt;&lt;- sae.dnn.train(X,Y,
      hidden = c(30), 
      learningrate = 0.5, 
      momentum = 0.5, 
      learningrate_scale = 1.0, 
      output = "sigm", 
      sae_output = "linear", 
      numepochs = 100, 
      batchsize = 100)
}

neural.predict = function(model,X) 
{
  if(is.vector(X)) X &lt;- t(X)
  return(nn.predict(Models[[model]],X))
}
</pre>
</li>
<li><strong>H2O</strong>, an open-source software package with the ability to run on distributed computer systems. Coded in Java, so the latest version of the JDK is required. Aside from deep autoencoders, many other machine learning algorithms are supported, such as random forests. Features can be preselected, and ensembles can be created. Disadvantage: While batch training is fast, predicting a single sample, as usually needed in a trading strategy, is relatively slow due to the server/client concept. The basic <strong>H2O</strong> train and predict functions for Zorro:<!--?prettify linenums=true?-->
<pre class="prettyprint">library('h2o') 
# also install the Java JDK

neural.train = function(model,XY) 
{
  XY &lt;- as.h2o(XY)
  Models[[model]] &lt;&lt;- h2o.deeplearning(
    -ncol(XY),ncol(XY),XY,
    hidden = c(30),  seed = 365)
}

neural.predict = function(model,X) 
{
  if(is.vector(X)) X &lt;- as.h2o(as.data.frame(t(X)))
  else X &lt;- as.h2o(X)
  Y &lt;- h2o.predict(Models[[model]],X)
  return(as.vector(Y))
}</pre>
</li>
<li><strong>Tensorflow</strong> in its <strong>Keras</strong> incarnation, a neural network kit by Google. Supports CPU and GPU and comes with all needed modules for tensor arithmetics, activation and loss functions, covolution kernels, and backpropagation algorithms. So you can build your own neural net structure. <strong>Keras</strong> offers a simple interface for that.
<p>Keras is available as a R library, but installing it requires also a Python environment. First install Anaconda from <a href="https://www.anaconda.com">www.anaconda.com</a>. Open the Anaconda Navigator and install the RStudio application (installing Keras outside an Anaconda environment fails on some PCs with an error message). Then open Rstudio inside the Navigator, install the Keras package, then finally execute library(&#8216;keras&#8217;) and install_keras(). These steps usually succeed.</p>
<p>The <strong>Keras</strong> train and predict functions for Zorro:<!--?prettify linenums=true?--></p>
<pre class="prettyprint">library('keras')
#needs Python 3.6 and Anaconda
#call install_keras() after installing the package

neural.train = function(model,XY) 
{
  X &lt;- data.matrix(XY[,-ncol(XY)])
  Y &lt;- XY[,ncol(XY)]
  Y &lt;- ifelse(Y &gt; 0,1,0)
  Model &lt;- keras_model_sequential() 
  Model %&gt;% 
    layer_dense(units=30,activation='relu',input_shape = c(ncol(X))) %&gt;% 
    layer_dropout(rate = 0.2) %&gt;% 
    layer_dense(units = 1, activation = 'sigmoid')
  
  Model %&gt;% compile(
    loss = 'binary_crossentropy',
    optimizer = optimizer_rmsprop(),
    metrics = c('accuracy'))
  
  Model %&gt;% fit(X, Y, 
    epochs = 20, batch_size = 20, 
    validation_split = 0, shuffle = FALSE)
  
  Models[[model]] &lt;&lt;- Model
}

neural.predict = function(model,X) 
{
  if(is.vector(X)) X &lt;- t(X)
  X &lt;- as.matrix(X)
  Y &lt;- Models[[model]] %&gt;% predict_proba(X)
  return(ifelse(Y &gt; 0.5,1,0))
}
</pre>
</li>
<li><strong>MxNet</strong>, Amazon&#8217;s answer on Google&#8217;s Tensorflow. Offers also tensor arithmetics and neural net building blocks on CPU and GPU, as well as high level network functions similar to Keras (the next Keras version will also support MxNet). Just as with Tensorflow, CUDA is supported, but not (yet) OpenCL, so you&#8217;ll need a Nvidia graphics card to enjoy GPU support. In direct comparison <strong>(2)</strong>, MxNet was reported to be less resource hungry and a bit faster than Tensorflow, but so far I could not confirm this. The standard train and predict functions:<!--?prettify linenums=true?-->
<pre class="prettyprint"># how to install the CPU version:
#cran &lt;- getOption("repos")
#cran["dmlc"] &lt;- "https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/"
#options(repos = cran)
#install.packages('mxnet')
library('mxnet')

neural.train = function(model,XY) 
{
  X &lt;- data.matrix(XY[,-ncol(XY)])
  Y &lt;- XY[,ncol(XY)]
  Y &lt;- ifelse(Y &gt; 0,1,0)
  Models[[model]] &lt;&lt;- mx.mlp(X,Y,
       hidden_node = c(30), 
       out_node = 2, 
       activation = "sigmoid",
       out_activation = "softmax",
       num.round = 20,
       array.batch.size = 20,
       learning.rate = 0.05,
       momentum = 0.9,
       eval.metric = mx.metric.accuracy)
}

neural.predict = function(model,X) 
{
  if(is.vector(X)) X &lt;- t(X)
  X &lt;- data.matrix(X)
  Y &lt;- predict(Models[[model]],X)
  return(ifelse(Y[1,] &gt; Y[2,],0,1))
}
</pre>
</li>
</ul>
<p>By replacing the <strong>neural.train</strong> and <strong>neural.predict</strong> functions, and other functions for saving and loading models that are not listed here, you can run the same strategy with different deep learning packages and compare. We&#8217;re currently using Keras for most machine learning strategies, and I&#8217;ll also use it for the short-term bitcoin trading system presented in the upcoming 2nd part of this article. There is no bitcoin futures data available yet, so tick based price data from several bitcoin exchanges will have to do for the backtest.</p>
<p>I&#8217;ve uploaded the interface scripts for Deepnet, H2O, Tensorflow/Keras, and MxNet to the 2018 script repository, so you can run your own deep learning experiments and compare the packages. Here&#8217;s a Zorro script for downloading bitcoin prices from Quandl &#8211; EOD only, though, since the exchanges demand dear payment for their tick data.</p>
<pre class="prettyprint">void main()
{
  assetHistory("BITFINEX/BTCUSD",FROM_QUANDL);
}</pre>
<p>You can also get Bitcoin M1 data from Kaggle in CSV format. Here&#8217;s a Zorro script for converting it to a Zorro T6 dataset:</p>
<pre class="prettyprint">void main()
{
	string InName = "History\\bitstampUSD_1-min_data_2012-01-01_to_2019-03-13.csv";
	string Format = "+%t,f3,f1,f2,f4,f6";
	dataParse(1,Format,InName); 
	dataSave(1,"History\\BTCUSD.t6");
}</pre>
<h3>Further reading</h3>
<p>(1) Nicolas Rabener, <a href="https://www.factorresearch.com/research-quant-strategies-in-the-cryptocurrency-space" target="_blank" rel="noopener noreferrer">Quant Strategies in the Cryptocurrency Space</a></p>
<p>(2) Julien Simon, <a href="https://medium.com/@julsimon/keras-shoot-out-tensorflow-vs-mxnet-51ae2b30a9c0" target="_blank" rel="noopener noreferrer">Tensorflow vs MxNet</a></p>
<p>(3) Zachary Lipton et al, <a href="https://github.com/zackchase/mxnet-the-straight-dope" target="_blank" rel="noopener noreferrer">MxNet &#8211; The Straight Dope</a><br />
(Good introduction in deep learning with MxNet / Gluon examples)</p>
<p>(4) F.Chollet/J.J.Allaire, Deep Learning with R<br />
(Excellent introduction in Keras)</p>
]]></content:encoded>
					
					<wfw:commentRss>https://financial-hacker.com/deep-learning-systems-for-bitcoins-part-1/feed/</wfw:commentRss>
			<slash:comments>42</slash:comments>
		
		
			</item>
		<item>
		<title>Build Better Strategies!</title>
		<link>https://financial-hacker.com/build-better-strategies/</link>
					<comments>https://financial-hacker.com/build-better-strategies/#comments</comments>
		
		<dc:creator><![CDATA[jcl]]></dc:creator>
		<pubDate>Mon, 09 Nov 2015 10:27:03 +0000</pubDate>
				<category><![CDATA[Introductory]]></category>
		<category><![CDATA[No Math]]></category>
		<category><![CDATA[System Development]]></category>
		<category><![CDATA[CHF]]></category>
		<category><![CDATA[Economy]]></category>
		<category><![CDATA[Grid trading]]></category>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=799</guid>

					<description><![CDATA[Enough blog posts, papers, and books deal with how to properly optimize and test trading systems. But there is little information about how to get to such a system in the first place. The described strategies often seem to have appeared out of thin air. Does a trading system require some sort of epiphany? Or is &#8230; <a href="https://financial-hacker.com/build-better-strategies/" class="more-link">Continue reading<span class="screen-reader-text"> "Build Better Strategies!"</span></a>]]></description>
										<content:encoded><![CDATA[<p>Enough blog posts, papers, and books deal with how to properly optimize and test trading systems. But there is little information about how to get to such a system in the first place. The described strategies often seem to have appeared out of thin air. Does a trading system require some sort of epiphany? Or is there a systematic approach to developing it?<br />   This post is the first of a small series in which I&#8217;ll attempt a methodical way to build trading strategies. The first part deals with the two main methods of strategy development, with market hypotheses and with a Swiss Franc case study.<span id="more-799"></span></p>
<h3>Strategies come in two flavors</h3>
<p>You can use mainly two methods to develop trading systems: <strong>model-based</strong> and <strong>data-mining</strong>. A model-based system starts with a model of a <strong>market inefficiency</strong> &#8211; based on trader psychology, economy, market microstructure, or any other price affecting force. The inefficiency produces a price curve anomaly or pattern that deviates from the random walk and can &#8211; when predictive &#8211; be used for a trade algorithm. Examples of model based trading methods are trend following, mean reversion, price cycles, price clusters, statistical arbitrage, and seasonality.</p>
<p>The problem: A model is not the reality. It is a simplified image of it. It can not be proven and can often not even be falsified. Its validity can only be determined by its effects on the price curve. The usefulness of this method thus depends on the significance and long-term stability of its price curve anomalies. For judging this you need good test algorithms. </p>
<p>The <strong>pure data mining method</strong> works the other way around. It just looks for price curve patterns and attempts to fit an algorithm to them. By which market forces the patterns are caused is of no interest; only assumption is that patterns of the past will repeat in the future. This allows the generation of trade systems, often, but not always with machine learning software. The most popular methods in this approach are trial-and-error TA, candle patterns, regression, autocorrelation, k-means clustering, neural networks, support vector machines, and decision trees.</p>
<p>The advantage of data mining is that you do not need to care about market hypotheses. The disadvantage: those methods usually find a vast amount of random patterns and thus generate a vast amount of worthless strategies. Since mere data mining is a blind approach, distinguishing real patterns &#8211; caused by real market inefficiencies &#8211; from random patterns is a challenging task. Even sophisticated <a href="http://www.financial-hacker.com/whites-reality-check/">reality checks</a> can normally not eliminate all data mining bias. Not many successful trading systems generated by data mining methods are known today.</p>
<h3>Are you cleverer than the market?</h3>
<p>Obviously, no trading system would work when market inefficiencies do not exist. And it would not work either when they exist, but can not be exploited since better equipped players are doing that already. In this first part of the mini-series I look into the possibility of <strong>trading better than the majority</strong> of market participants, a prerequisite of a successful strategy. </p>
<p>The three hypotheses of market efficiency that you&#8217;ll hear from time to time are as follows: </p>
<ul style="list-style-type: square;">
<li><strong>Hypothesis A: The markets are efficient.</strong> Prices follow real events, such as the publication of company results, and reflect the real value of the asset. All traders are &#8216;informed&#8217;, decide rationally and act immediately. Price curves are mostly random-walk curves with no information for predicting future prices. Technical trading systems can not work, or if they do, it&#8217;s just luck.<br />  </li>
<li><strong>Hypothesis B: The markets are not efficient, but their inefficiencies are of no value</strong> for private traders. Only large trading firms and hedge funds can exploit them successfully, since they have lots of capital, very fast computers, very experienced analysts and very clever quants &#8211; much more intelligent than you. Beware of entering their terrain, or else you&#8217;ll become their prey.<br />  </li>
<li><strong>Hypothesis C: Enough market inefficiencies are free for you to exploit.</strong> Large trading firms and hedge funds are too slow and cumbersome to tackle them effectively. Their capital and their fast computers give them no real advantage in the game that you&#8217;re going to play. Neither do their clueless analysts, overpaid traders, and overestimated quants.</li>
</ul>
<p>Not many today do still believe in hypothesis A. It can be easily shown that most price curves do not follow a random walk (a fellow blogger recently posted a great article about <a href="http://www.turingfinance.com/hacking-the-random-walk-hypothesis/" target="_blank">Hacking the Random Walk Hypothesis</a>). And the markets are anything but rational or effective. Counter-examples are plenty. Jack Schwager, in his book &#8216;Market Sense and Nonsense&#8217;, listed cases of <strong>blatant market dumbness and grotesque analyst failures</strong>. More often than not, asset prices are far, far away from their true value. Although all this is anecdotical evidence, a pattern is visible. The markets react fast and firm when rumors or news give them a clear direction. But when the information is a little more subtle and requires a minimum of interpretation, they react slow or not at all. Here&#8217;s the story of a typical example.</p>
<h3>The Swiss Franc case</h3>
<p>In September 2011 the Swiss National Bank established a price cap to the Swiss Franc. Purpose was protecting the tourism and export industries against an overvalued currency. The limit was set to an EUR/CHF price of 1.20, and the SNB vowed to defend it against all enemies.</p>
<p>A price cap is a <strong>rare and striking market inefficiency</strong>. It can immediately be translated into a highly profitable, almost risk-free trading system (how this works is explained below). So you would normally expect a strong market reaction after the EUR/CHF price move to 1.20. But the reaction was a long time in the coming.</p>
<p>No doubt, Switzerland is an obscure European country and for the major US trading firms probably known for cheese, if at all. They did either not notice the price cap, or they had just forgotten to equip their European offices with modern communication gear. So it took the mounted messenger from Europe three months riding over hill and dale, sailing over the Atlantic Ocean, maybe fighting off brigands, pirates, and indians on his way, to reach New York City and shout: &#8220;The Swiss have a price cap!&#8221;.</p>
<p>But what the heck can you do with a price cap? By January 2012, large market participants had finally come up with an idea. Not something as subtle as a trading system. Instead, they began to buy mad amounts of Francs for bringing pressure on the EUR/CHF price: </p>
<p><figure style="width: 879px" class="wp-caption alignnone"><img decoding="async" class="alignnone wp-image-869 size-full" src="http://www.financial-hacker.com/wp-content/uploads/2015/11/chf1.png" alt="" width="879" height="321" /><figcaption class="wp-caption-text">EUR/CHF price curve, September 2011 &#8211; August 2012</figcaption></figure></p>
<p>The obvious idea was that when there is a price boundary, there must be some profit in breaking it. A lot of effort, patience and money was put in that game. From May 2012 on the EUR/CHF price was nailed shut to its 1.20 limit. But alas, the price cap collapse did not happen. You do not mess with the SNB. During 2012 the Swiss erected a <strong>wall of 200 billion dollars</strong> for defending the price cap. The attackers never had a chance. The first gave up in September 2012, and by the end of January 2013 all had retreated with their tails between their legs (and probably painful losses):</p>
<p><figure id="attachment_869" aria-describedby="caption-attachment-869" style="width: 879px" class="wp-caption alignnone"><a href="http://www.financial-hacker.com/wp-content/uploads/2015/11/chf2.png"><img decoding="async" class="wp-image-869 size-full" src="http://www.financial-hacker.com/wp-content/uploads/2015/11/chf2.png" alt="" width="879" height="321" srcset="https://financial-hacker.com/wp-content/uploads/2015/11/chf2.png 879w, https://financial-hacker.com/wp-content/uploads/2015/11/chf2-300x110.png 300w" sizes="(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></a><figcaption id="caption-attachment-869" class="wp-caption-text">EUR/CHF price curve, September 2012 &#8211; May 2013</figcaption></figure></p>
<p>Now the way was free for algorithmic systems. During the 2012 CHF battle they were forced to inactivity, since private traders and hackers lack the capital to participate in a market manipulation game. In January 2013 the first hackers started to exploit the market inefficiency with a specific method, a <strong>Grid Trader</strong>.<a id="gridtrader"></a> This turned out a money-printing machine.</p>
<h3>The money press algorithm</h3>
<p>A grid trader is a very simple system. It places pending long and short trades at a fixed grid above and below the current price, with profit targets of the same grid distance. So trades are opened and closed whenever the price crosses a grid line in any direction. Such a system has a hypothetical 100% win rate, since trades close either in profit or not at all. But grid traders normally use a <strong>virtual hedging mechanism</strong> that closes an open position instead of opening a new one in opposite direction. This improves the total profit by reducing trade costs and margin. But it allows trades to be closed with a loss. So the real win rate of a grid trader is in the 60% area.</p>
<p>This is the Zorro script of such a grid trader:</p>
<pre class="prettyprint">// helper function to check if the grid line has no trade
bool isFree(var Price,var Grid,bool IsShort)
{
  bool result = true;
  for(open_trades) {
    if(TradeIsShort == IsShort
      &amp;&amp; between(TradeEntryLimit,Price-Grid/2,Price+Grid/2))
        result = false;
  }
  return result;
}

// EUR/CHF grid trader main function
int run() 
{
  BarPeriod = 60;
  Hedge = 5; // activate virtual hedging

  var Grid = 20*PIP; // set grid distance to 20 pips
  var Close = priceClose();
 
// place pending trades at 5 grid lines above and below the Close
  int i;
  for(i = Close/Grid - 5; i &lt; Close/Grid + 5; i++)
  {
    var Price = i*Grid;
// place short trades with profit target below the current price
    if(Price &lt; Close &amp;&amp; isFree(Price,Grid,true))
      enterShort(1,Price,0,Grid); 
// place long trades with profit target above the current price
    else if(Price &gt; Close &amp;&amp; isFree(Price,Grid,false))
      enterLong(1,Price,0,Grid);
  }
}</pre>
<p>A grid trader is a typical <strong>model-based system</strong>. It assumes that some market force keeps the price inside a channel. This is the case here: The cap prevents the EUR/CHF from falling below 1.20, but it also prevents it from rising too high, since the SNB must eventually buy back all the Francs they have sold for defending the cap. The mathematical model of this would be a random walk with a 1.20 boundary and some drift term that pulls the price down. Such a constraint is a prerequisite for a grid trader; without it grid trading would be just high-risk gambling and is consequently listed in the <a href="http://www.financial-hacker.com/seventeen-popular-trade-strategies-that-i-dont-really-understand/">irrational trade methods</a> collection.</p>
<p>This is the P&amp;L-curve (blue) of the above script applied to the EUR/CHF in 2013:</p>
<p><figure id="attachment_894" aria-describedby="caption-attachment-894" style="width: 879px" class="wp-caption alignnone"><a href="http://www.financial-hacker.com/wp-content/uploads/2015/11/chf3.png"><img loading="lazy" decoding="async" class="wp-image-894 size-full" src="http://www.financial-hacker.com/wp-content/uploads/2015/11/chf3.png" alt="" width="879" height="401" srcset="https://financial-hacker.com/wp-content/uploads/2015/11/chf3.png 879w, https://financial-hacker.com/wp-content/uploads/2015/11/chf3-300x137.png 300w" sizes="auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></a><figcaption id="caption-attachment-894" class="wp-caption-text">EUR/CHF grid trading P&amp;L curve 2013</figcaption></figure></p>
<p>We can see that large price fluctuations, as in January and May, cause large drawdowns (the red underwater peaks in the chart). But since the fluctuations have a limit, we can estimate the maximum loss and just keep enough capital on the account. This way the above script produces an annual return of 130% and a Sharpe Ratio of 1.7 &#8211; with virtually no risk ( as long as the price cap stays in place).</p>
<p>The news of such a trading strategy slowly spread in 2013. More and more private traders and financial hackers, and also more and more large market participants jumped on the bandwagon. Three years after installation of the price cap, thousands of such systems sat on the EUR/CHF price curve like leeches and sucked off money. The result was a continuously falling price volatility:</p>
<p><figure id="attachment_902" aria-describedby="caption-attachment-902" style="width: 879px" class="wp-caption alignnone"><a href="http://www.financial-hacker.com/wp-content/uploads/2015/11/chf4.png"><img loading="lazy" decoding="async" class="wp-image-902 size-full" src="http://www.financial-hacker.com/wp-content/uploads/2015/11/chf4.png" alt="" width="879" height="438" srcset="https://financial-hacker.com/wp-content/uploads/2015/11/chf4.png 879w, https://financial-hacker.com/wp-content/uploads/2015/11/chf4-300x149.png 300w" sizes="auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></a><figcaption id="caption-attachment-902" class="wp-caption-text">EUR/CHF price and volatility, July 2013 &#8211; Dec 2014</figcaption></figure></p>
<p>Lower volatility means lower profits to a grid trader. More capital must be invested and the grid must be tightened for compensating. But there is a natural limit. You can not have a grid size smaller than the trading costs. By autumn 2014 the volatility was close to zero. And this was accompanied by an ominous price downwards drift, as if some large market participant (possibly the SNB itself) would continously sell EUR and buy CHF in anticipation of some future event. That would have been high time for private traders to retreat from the game. Of course, thickheads like me didn&#8217;t. It is well known what then happened to the Swiss Franc:</p>
<p><figure id="attachment_917" aria-describedby="caption-attachment-917" style="width: 879px" class="wp-caption alignnone"><a href="http://www.financial-hacker.com/wp-content/uploads/2015/11/chf5.png"><img loading="lazy" decoding="async" class="wp-image-917 size-full" src="http://www.financial-hacker.com/wp-content/uploads/2015/11/chf5.png" alt="" width="879" height="321" srcset="https://financial-hacker.com/wp-content/uploads/2015/11/chf5.png 879w, https://financial-hacker.com/wp-content/uploads/2015/11/chf5-300x110.png 300w" sizes="auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px" /></a><figcaption id="caption-attachment-917" class="wp-caption-text">EUR/CHF price, January 2015</figcaption></figure></p>
<p>In the morning of 15 January 2015, the SNB gave a press conference and announced the cancellation of the price cap. The EUR/CHF fell in minutes like a stone from the 1.20 limit to below parity. Obviously a fast and extreme market reaction &#8211; very different to the introduction of the price cap 4 years before. The price drop killed many accounts and even a few brokers. By the way, the &#8216;real value&#8217; of the EUR/CHF, based on the relative buying power of the two currencies, was in the 1.50 area all the time. </p>
<p>What can we learn from this and from similar examples?</p>
<h3>Conclusions</h3>
<ul>
<li>The financial markets react immediately and often hysterically on news with a clear price upwards/downwards direction.</li>
<li>The markets react slow or not at all on more subtle information. It can take years until they become aware of new inefficiencies or trading methods.</li>
<li>The markets prefer brute-force methods. Complex strategies are normally only used by a small part of market participants.</li>
<li>Simple systems based on very obvious inefficiencies can be extremely profitable, but have a limited lifetime. </li>
</ul>
<p>The next parts of the <strong>Build Better Strategies</strong> series will deal with model-based systems, with known market inefficiencies and with a methodical approach of exploiting them. </p>
<p style="text-align: right;"><strong>⇒ <a href="http://www.financial-hacker.com/build-better-strategies-part-2-model-based-systems/">Build Better Strategies &#8211; Part 2</a></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://financial-hacker.com/build-better-strategies/feed/</wfw:commentRss>
			<slash:comments>17</slash:comments>
		
		
			</item>
		<item>
		<title>Money and How to Get It</title>
		<link>https://financial-hacker.com/money-and-how-to-get-it/</link>
					<comments>https://financial-hacker.com/money-and-how-to-get-it/#comments</comments>
		
		<dc:creator><![CDATA[jcl]]></dc:creator>
		<pubDate>Wed, 02 Sep 2015 10:45:51 +0000</pubDate>
				<category><![CDATA[Introductory]]></category>
		<category><![CDATA[No Math]]></category>
		<category><![CDATA[Economy]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Money]]></category>
		<guid isPermaLink="false">http://www.financial-hacker.com/?p=62</guid>

					<description><![CDATA[Contrary to popular belief, money is no material good. It is created out of nothing by banks lending it. Therefore, for each newly created lot of money there&#8217;s the same amount of debt. You&#8217;re destroying the money by repaying your credits. Since this requires a higher sum due to interest and compound interest, and since &#8230; <a href="https://financial-hacker.com/money-and-how-to-get-it/" class="more-link">Continue reading<span class="screen-reader-text"> "Money and How to Get It"</span></a>]]></description>
										<content:encoded><![CDATA[<p>Contrary to popular belief, <strong>money</strong> is no material good. It is created out of nothing by banks lending it. Therefore, for each newly created lot of money there&#8217;s the same amount of <strong>debt</strong>. You&#8217;re destroying the money by repaying your credits. Since this requires a higher sum due to interest and compound interest, and since money is also permanently withdrawn from circulation by hoarding, the entire money supply must constantly grow. It must never shrink. If it still does, as in the 1930 economic crisis, loan defaults, bank crashes and bankruptcies are the result. The monetary system is therefore a classic <strong>Ponzi scheme</strong>.<span id="more-62"></span></p>
<p>Because the money amount always corresponds to the same amount of private and public debt, this debt amount also must inevitably grow, in spite of all the political lamentoes. Reducing public debt would either destroy money or increase private debt proportionately. This happened in fact in the United States around the turn of the millennium, when then-President <strong>Bill Clinton</strong> managed to get by without borrowing, and even achieved a budget surplus. Which caused interests to drop and banks to look elsewhere for distributing their money. The indirect result of Clinton&#8217;s good deed was a massive increase in private debt that eventually led to the mortgage crash of 2007.</p>
<h3>How to acquire it in large amounts</h3>
<p>Money is considered a good thing in almost all cultures. After all, it allows you to do the things you want, and &#8211; even more important &#8211; not to do things you don&#8217;t want to do. It thus represents freedom. You can get to it with different methods. The most obvious is taking away other people&#8217;s money. Here&#8217;s the Top Ten fortunes by known villains, according to Forbes (in US $):</p>
<ol>
<li>Hugo Drax &#8211; <strong>7.6 billion</strong></li>
<li>Auric Goldfinger &#8211; <strong>6.5 billion</strong></li>
<li>Max Zorin &#8211; <strong>5.3 billion</strong></li>
<li>Lex Luthor &#8211; <strong>4.7 billion</strong></li>
<li>Franz Sanchez &#8211; <strong>1 billion</strong></li>
<li>Ernst Stavro Blofeld &#8211; <strong>640 million</strong></li>
<li>Karl Stromberg &#8211; <strong>640 million</strong></li>
<li>Elektra King &#8211; <strong>420 million</strong></li>
<li>Francisco Scaramanga &#8211; <strong>115 million</strong></li>
<li>Dr. Julius No &#8211; <strong>110 million</strong></li>
</ol>
<p>But the most successful in money taking are not, as you might think, drug cartel bosses or leaders of criminal underground organizations, but <strong>presidents and other heads of state</strong>. They can take their share of money with no risk, since they need not fear the law. Here&#8217;s the Top Ten of the acquired fortunes by this way (in US $):</p>
<ol>
<li>Muammar Gaddafi, Libya &#8211; <strong>55 billion</strong></li>
<li>Hosni Mubarak, Egypt &#8211; <strong>50 billion</strong></li>
<li>Mohamed Suharto, Indonesia &#8211; <strong>25 billion</strong></li>
<li>Alexander Lukashenko, Belarus &#8211; <strong>12 billion</strong></li>
<li>Mobutu Sese Seko, Congo &#8211; <strong>7 billion</strong></li>
<li>Ben Ali, Tunisia &#8211; <strong>4 billion</strong></li>
<li>Gnassingbé Eyadéma, Togo &#8211; <strong>4 billion</strong></li>
<li>Obiang Nguema, Equatorial Guinea &#8211; <strong>3 billion</strong></li>
<li>Slobodan Milosevic, Serbia &#8211; <strong>1 billion</strong></li>
<li>&#8216;Baby Doc&#8217; Duvalier, Haiti &#8211; <strong>600 million</strong></li>
</ol>
<p>This list does naturally not include assets of monarchs such as the Sultan of Brunei, who have no need of pilfering because the country belongs to them by law anyway. Or of dictators like Wladimir Putin, whose estimated 125 billion booty (plus a 17,000 sqft palace) officially does not belong to them, but is kept for them by friendly oligarchs. The listed sums must also be considered in relation to the economy of the country. To bag 600 million in grinding poor Haiti is a much more impressive performance than the lousy one billion that Milosevic could siphon off in industrialized Serbia. But as long as you&#8217;re neither a supervillain, nor a head of state, nor both at the same time, you have no choice but to use other means to acquire money. There&#8217;s also the method of buying something cheap and selling it dear. Not as profitable as being a head of state, but it still can produce some handsome gains (annual income in US $):</p>
<ol>
<li>Jim Simons, Renaissance &#8211; <strong>1.7 billion</strong></li>
<li>Ken Griffin, Citadel &#8211; <strong>1.7 billion</strong></li>
<li>Raymond Dalio, Bridgewater &#8211; <strong>1.4 billion</strong></li>
<li>David Tepper, Apaloosa &#8211; <strong>1.4 billion</strong></li>
<li>Izzy Englander, Millenium &#8211; <strong>1.1 billion</strong></li>
<li>David Shaw, Shaw Group &#8211; <strong>750 million</strong></li>
<li>John Overdeck, Two Sigma &#8211; <strong>500 million</strong></li>
<li>David Siegel, Two Sigma &#8211; <strong>500 million</strong></li>
<li>Andreas Halvorsen, Viking &#8211; <strong>370 million</strong></li>
<li>Joseph Edelman, Perceptive &#8211; <strong>300 million</strong></li>
</ol>
<p>All in this list acquired their wealth with <a href="https://zorro-project.com/algotrading.php" target="_blank" rel="noopener">algorithmic trading</a>. Which is the topic of most of the rest of this blog. It does not produce any goods. But on the other hand, it does not steal from anyone. On the contrary, private, small-scale financial trading can boost demand and soften economic inequality. It can redistribute money from the rich to the poor. So it should be rewarded by the government, for instance by a tax exemption. Well, one can dream, at least&#8230;<a id="why"></a></p>
<h3>Why financial hacking?</h3>
<p>Part of my job is developing financial tools and trading systems for clients. So far we coded hundreds of trading strategies with all sorts of algorithms for all sorts of financial instruments. Some worked and fulfilled the client&#8217;s expectations. Some failed miserably. And some worked in the backtest, but not in live trading. Coming from a background of theoretical physics and computer game programming, I wondered why trading seems not to be an exact science at all. What is the difference between a successful and a doomed strategy? And how can you determine that before actually trading it?</p>
<p>On this blog I&#8217;ll attempt a <strong>hacking approach to algorithmic trading</strong>. Hacking is nothing illegal, it&#8217;s just a pragmatic way to solve problems. Hackers prefer experiment over theory. They don&#8217;t give a damn about the wisdom of gurus or authorities. So I&#8217;ll start with considering all praised trade systems worthless and all &#8220;trader&#8217;s wisdom&#8221; irrational and nonsense until proven otherwise. I will try to evaluate <strong>by systematic experimenting </strong>whether, why, when, and how algorithmic trading does work. My goal is to find out how it can be a reliable income source for a private trader. This might require complex statistical or machine learning algorithms &#8211; but that&#8217;s no big deal with today&#8217;s software tools. All scripts and software to the articles will be put up for download, so anyone interested can reproduce all the results and use the strategies. After all, successful private trading is for the common good.</p>
<p>As this blog is about algorithmic trading, I&#8217;m going to post here a lot of algorithms and source code. Naturally not any trader is able to read code. On the other hand, some basic code and math understanding is required for making sense of the articles. To go from zero to a full understanding of the articles on this blog, here&#8217;s a <a href="http://manual.zorro-project.com/links.htm" target="_blank" rel="noopener noreferrer">list of Useful Books</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://financial-hacker.com/money-and-how-to-get-it/feed/</wfw:commentRss>
			<slash:comments>24</slash:comments>
		
		
			</item>
	</channel>
</rss>
