Slide 1

Slide 1 text

Open Source Finance: QuantLib, OpenGamma, and Bitcoin Ferdinando M. Ametrano [email protected] Banca IMI IntesaSanpaolo Milano-Bicocca University QuantLib Hayek Money Düsseldorf , 4th of December 2014, QuantLib User Meeting https://speakerdeck.com/nando1970/open-source-finance-quantlib-opengamma-bitcoin

Slide 2

Slide 2 text

Open Source Software software that can be freely • used, • changed, • and shared (in modified or unmodified form) • by anyone http://opensource.org/ 2/83

Slide 3

Slide 3 text

Free Software A software is free if its users have four essential freedoms: 1. The freedom to run the program as you wish, for any purpose 2. The freedom to study how the program works, and change it so it does your computing as you wish. 3. The freedom to redistribute copies. 4. The freedom to distribute copies of your modified versions to others. 3/83

Slide 4

Slide 4 text

Open Source / Free Finance • QuantLib • OpenGamma • Bitcoin 4/83

Slide 5

Slide 5 text

QuantLib • The announcement: 5/83

Slide 6

Slide 6 text

QuantLib • SourceForge project registered on 2000-10-11 • First release 2000-12-05 • http://quantlib.org 6/83

Slide 7

Slide 7 text

QuantLib (2) https://github.com/lballabio/quantlib • Commits: 17,078 • Contributors: 25 • Watch: 103 • Stars: 247 • Forks: 293 • Pull Requests: 173 since June 2013 7/83

Slide 8

Slide 8 text

QuantLib (3) 8/83

Slide 9

Slide 9 text

9/83

Slide 10

Slide 10 text

OpenGamma www.opengamma.com • Founded in 2009 • Raised a total of $23.35 million from Accel Partners, Firstmark Capital, ICAP and Euclid Opportunities • Headquartered in London with an office in New York City • 70% of employees in R&D 10/83

Slide 11

Slide 11 text

OpenGamma (2) • Open architecture platform for real-time market risk management • Strong Java analytics library (adjoint greeks) 11/83

Slide 12

Slide 12 text

OpenGamma (3) https://github.com/OpenGamma • Commits: 26,700 • Contributors: 33 • Watch: 32 • Stars: 184 • Forks: 123 • Pull Requests: 294 since November 2012 12/83

Slide 13

Slide 13 text

OpenGamma (4) 13/83

Slide 14

Slide 14 text

Bitcoin: The Announcement From: Satoshi Nakamoto vistomail.com> Subject: Bitcoin P2P e-cash paper Newsgroups: gmane.comp.encryption.general Date: 2008-10-31 18:10:00 GMT I've been working on a new electronic cash system that's fully peer-to-peer, with no trusted third party. The paper is available at: http://www.bitcoin.org/bitcoin.pdf The main properties: Double-spending is prevented with a peer-to-peer network. No mint or other trusted parties. Participants can be anonymous. New coins are made from Hashcash style proof-of-work. The proof-of-work for new coin generation also powers the network to prevent double-spending. Bitcoin: A Peer-to-Peer Electronic Cash System Abstract. A purely peer-to-peer version of electronic cash […] Satoshi Nakamoto --------------------------------------- The Cryptography Mailing List 14/83

Slide 15

Slide 15 text

Satoshi Nakamoto • Unknown identity: pseudonymous person or group? • Worked on Bitcoin since 2007, published the paper in 2008 • Released as open source free software in January 2009 • His involvement stops mid-2010 • Entrusted the Bitcoin SourceForge project and a copy of the alert key to Gavin Andresen, effectively his successor • Must own about 1M bitcoins, never spent Bitcoin: A peer-to-peer electronic cash system http://www.bitcoin.org/bitcoin.pdf http://mag.newsweek.com/2014/03/14/bitcoin-satoshi-nakamoto.html 15/83

Slide 16

Slide 16 text

Bitcoin • SourceForge project registered on 2008-11-09 • First release 2009-01 • https://bitcoin.org 16/83

Slide 17

Slide 17 text

Bitcoin (2) https://github.com/bitcoin/bitcoin • Commits: 7,481 • Contributors: 262 • Watch: 798 • Stars: 6125 • Forks: 4452 • Pull Requests: 3500+ since December 2010 17/83

Slide 18

Slide 18 text

Bitcoin (3) 18/83

Slide 19

Slide 19 text

Open Source Finance • Finance is usually closed source • Academia has not adopted QuantLib and OpenGamma very much • Bitcoin is the most relevant open source finance project • Why so much relevant? 19/83

Slide 20

Slide 20 text

Favorable Opinions • Ben Bernanke: [the virtual currency] may hold long-term promise, particularly if the innovations promote a faster, more secure and more efficient payment system. • Jared Cohen: I think it’s very obvious to all of us that crypto-currencies are inevitable • Marc Andreessen: Bitcoin today is like Internet in 1994, weird and scary 20/83

Slide 21

Slide 21 text

Bitcoin Investments to Surpass Early Stage Internet Investments • f 21/83

Slide 22

Slide 22 text

Unfavorable Opinions • Nouriel Roubini: Bitcoin is not a currency as it is not a unit of account or a means of payments or store of value. It is a Ponzi game and a conduit for criminal/illegal activities • Alan Greenspan: It’s a bubble. It has to have intrinsic value: you have to really stretch your imagination to infer what the intrinsic value of Bitcoin is. I haven’t been able to do it. Maybe somebody else can. I do not understand where the backing of Bitcoin is coming from 22/83

Slide 23

Slide 23 text

What are bitcoins? https://bitcoin.org/en/ • decentralized digital currency • not backed by any government or organization • instantaneous peer-to-peer transactions • no need for trusted third party • cryptographic security • low-cost banking for everybody everywhere https://bitcoin.org/en/faq http://www.coindesk.com/information/ 23/83

Slide 24

Slide 24 text

Bitcoin Economy • Total number of BTC is about 13M • Market Cap: $7B BTC vs $1,200B USD 24/83

Slide 25

Slide 25 text

December 2013: China crackdown • People’s Bank of China crackdown: – prohibits financial institutions from trading, underwriting, or offering insurance in bitcoins or any other digital currency – Bitcoin is not to be considered a currency – owning bitcoins is not outlawed or prohibited • As of December 2013 BTC China was world's largest Bitcoin exchange by volume • Alibaba, China's top Internet retailer, stopped using bitcoins as of January 19 2014. 25/83

Slide 26

Slide 26 text

February 2014: Mt Gox bankruptcy • As of January 2014 Mt Gox was world's largest Bitcoin exchange by volume • In February 2014 it filed for bankruptcy protection from creditors • It announced that around 850,000 bitcoins belonging to customers and the company were missing and likely stolen, an amount valued at more than $450 million at the time • Fraud or theft? 26/83

Slide 27

Slide 27 text

Silk Road • online market, operated as a Tor hidden service • online users were able to buy illicit goodies using bitcoins, while browsing it anonymously and securely without potential traffic monitoring • launched in February 2011, shut down in October 2013 • Ross William Ulbricht, alleged to be the owner of Silk Road arrested in San Francisco • Many other black markets have filled in as successors 27/83

Slide 28

Slide 28 text

Bitcoin resilience Is there anything else in financial world: • Just 5 years old • Without government or corporation backing • That can lost its main (China) market and its main exchanges in 3 months • Subjected to fraud or theft perpetrated at its main reference exchange • With such a bad reputation That could be still alive and kicking? 28/83

Slide 29

Slide 29 text

Hard to regulate • Janet Yellen (November 2013 US Senate): – Bitcoin is a payment innovation that's taking place outside the banking industry – It's not so easy to regulate Bitcoin because there's no central issuer or network operator. This is a decentralized, global [entity] • ECB (October 2012 report): – governments and central banks would face serious difficulties if they tried to control or ban any virtual currency scheme – there is no server that could be shut down if the authorities deemed it necessary 29/83

Slide 30

Slide 30 text

Disruptive? • PayPal or Western Union did not received the attention of virtually every central bank • For a first evidence of bitcoin relevance look at the on-going debate about it 30/83

Slide 31

Slide 31 text

Bitcoin Price Growth & Adoption Coindesk, State of Bitcoin Q2 2014 http://www.coindesk.com/state-of-bitcoin-q2-2014-report-expanding-bitcoin-economy/ 31/83

Slide 32

Slide 32 text

Merchants & Payment Processors • PayPal accept bitcoin as of September 2014 • Sridhar Ramaswamy, head of Google Wallet We are working in the payments team to figure out how to incorporate bitcoin into our plans • Amazon: granted patent for the use of digital currencies as payment on cloud platforms (Amazon Web Services) 32/83

Slide 33

Slide 33 text

Where can you buy bitcoins? What can you buy with bitcoins? • Buy bitcoins using USD or EUR at one of many exchanges, e.g. Bitstamp, The Rock Trading, etc. • Use bitcoins to buy: – web services – software – hardware – gambling services – Narcotics, guns, credit card numbers, etc. – Topping the list, in terms of the number of transactions, is tipping and donations 33/83

Slide 34

Slide 34 text

Bitcoin: a currency and a protocol • Bitcoin: protocol, software, and community • bitcoins: units of the currency. bitcoins are sent using Bitcoin 34/83

Slide 35

Slide 35 text

Bitcoin the protocol Distributed public ledger of transactions: • allows to transfer a unique digital token • the token can be exchanged, but not duplicated • keeps records of each and every transaction forever • shared with peer-to-peer technology • everyone knows the transaction happened, nobody can challenge its legitimacy • the protocol is Bitcoin extra-legal tight regulation 35/83

Slide 36

Slide 36 text

bitcoin the currency • bitcoins are a digital property • created inside the Bitcoin protocol • the first powerful protocol application • authorities replaced: – central banks – financial intermediaries 36/83

Slide 37

Slide 37 text

bitcoins • Not to be found anywhere, they only exist as block chain documented transactions • A bitcoin wallet is a public address 1FEz167JCVgBvhJBahpzmrsTNewhiwgWVG • the public ledger certifies for everybody how many bitcoins are associated to the wallet http://blockexplorer.com/address/1FEz167JCVgBvhJBahpzmrsTNewhiwgWVG It is mine; you are REALLY encouraged to tip 37/83

Slide 38

Slide 38 text

Pseudonymity, Anonymity Bitcoin is really pseudonymous, not anonymous: • The public key does not provide direct information about the private key owner • All transactions are transparent to everybody’s inspection. • Perfect persistent public account history: the public ledger is forever • Tool little privacy for honest people, too much for criminals https://blockchain.info/ http://blockexplorer.com/ 38/83

Slide 39

Slide 39 text

Asymmetric Cryptography: Public/Private Key Pair mathematically linked, perform opposite functions: • private (secret) key produce a digital signature • public key used by anyone to verify the signature • The bitcoin wallet address is the public key • The private key allows spending from the wallet 39/83

Slide 40

Slide 40 text

Asymmetric Cryptography: Public/Private Key Pair Keys are not granted by the network: • No need to register the keys anywhere in advance • Only used when required for a transaction 40/83

Slide 41

Slide 41 text

A bitcoin transaction: from public key to public key • The sender’s private key signs the transaction: – transacted amount – receiver’s public key • Sender’s public key verifies that the transaction: – originated from sender’s private key – has not been modified – the amount is at sender’s public key disposal • The transaction is published to the public ledger • Everybody knows that the receiver’s public key has received the transacted amount 41/83

Slide 42

Slide 42 text

Bitcoin wallet security • bitcoins are effectively owned by whoever can spend them • Securing a wallet: private key safe storage • PC client: Bitcoin Core, Armory, Electrum • Web client: blockchain.info, greenaddress.it • Cold storage: never exposed to Internet, stored away 42/83

Slide 43

Slide 43 text

Bitcoin’s public ledger: the block chain • Transactions are bundled in blocks, sequentially chained, about one block every 10 minutes • The block chain is a history of transactions resilient to network attackers • The cryptographic link between blocks requires large amount of computing power, so the block chain cannot be altered without huge resources • Computing power is measured in hash/s, hash being the basic operation needed for validation 43/83

Slide 44

Slide 44 text

Network hash rate • More powerful than the combined top 500 supercomputers (but less flexibility…) • charts 44/83

Slide 45

Slide 45 text

Mining • Miners are the nodes of the network • They provide the computing power for: – processing and validating transactions (avoiding double spending) – securing the network – synchronizing the nodes 45/83

Slide 46

Slide 46 text

Mining (2) • Miners compete to process a new block of transactions. • The winner provides a proof-of-work and is rewarded with the issue of new bitcoins. • Seigniorage revenues subsidize the network, making transaction almost free 46/83

Slide 47

Slide 47 text

Bitcoin Monetary Rule • 2009: 50BTC every 10 minutes – halving every 4Y • This is the only way new bitcoins are released • It is called mining because of its similarity with the progressive scarcity of gold extraction • digital cash supply free of discretionary intervention 47/83

Slide 48

Slide 48 text

Inelastic Money Supply Decreasing rate fixed supply 48/83

Slide 49

Slide 49 text

Bitcoin the protocol • stroke of genius, major disruptive invention replace any processing central authority with decentralized peer-to-peer cryptographically secure equivalent • This really is Web 3.0 49/83

Slide 50

Slide 50 text

Smart Properties and Contracts • Smart properties are digital token that can be programmatically exchanged using smart contracts • Smart contracts are math (not legal) based contracts that do not need human interpretation or intervention to complete: the settlement is done by software. • Autonomous agents are software programs created for specific tasks: with Bitcoin they can now make and receive payments • Decentralized Autonomous Organizations 50/83

Slide 51

Slide 51 text

No central authorities: examples digital tokens for: • Car ownership (car sharing) • Voting rights (liquid democracy) Distributed Autonomous Organizations: • Gambling online (no fees, no taxes) • Health insurance (without company costs) 51/83

Slide 52

Slide 52 text

Proof of Existence • Block chain as time stamp authority • Put a hash value in the «comment» section of a (monetarily negligible) transaction • Hash being a fixed length string that uniquely identify an arbitrary length digital object (e.g. a txt or pdf file) • Existence of that digital object at the transaction time is proved on the block chain www.proofofexistence.com 52/83

Slide 53

Slide 53 text

Bitcoin 2.0 • Bitcoin-like block chains as public ownership database for digital assets • Meta-protocols: Namecoin, Mastercoin, Counterparty, ColoredCoins • Ethereum: next-generation smart contract and decentralized application platform 53/83

Slide 54

Slide 54 text

Money as social relation instrument • Human beings are born into a gift economy • Enlarged relationship circle requires exchange economy • barter economy, coincidence of wants • trade economy, money as medium of exchange 54/83

Slide 55

Slide 55 text

Information Economy • Mobile communication, Internet, and social networks • Cryptocurrency: money for the information economy 55/83

Slide 56

Slide 56 text

Money Comparison Medium of Exchange Store of Value Unit of Account Live cattle Diamonds Gold Fiat coins and notes Cryptocurrency • swappable • fungible • portable • divisible • recognizable • resistant to counterfeiting • reliably saved, stored, and retrieved • retain usefulness over time • non-perishable or with low preservation cost • relative worth unit of measure • stable value for stable price comparison • supply must be limited in some way 56/83

Slide 57

Slide 57 text

Money as value yardstick • Unit against which the value of every other good is measured • A good in itself: its value is governed by supply and demand • The price system measures the value of goods relative to the value of money • Good money should provide stable prices to best perform its role as unit of account 57/83

Slide 58

Slide 58 text

Inflation and Deflation • reduction in the purchasing power per unit of money: money value decrease, price level increase • deflation hinders money’s unit of account role and encourages its hoarding. This can lead to perverse economic crisis. 58/83

Slide 59

Slide 59 text

Monetary policy • delegated to central banks or equivalent monetary authorities • institutionally designed to be independents • central bank’s main objective is to safeguard the value of the national currency • low and stable rate of inflation is the implicit or explicit goal 59/83

Slide 60

Slide 60 text

Statement of the Problem • The Bitcoin protocol has been successful at get rid of any centralized monetary authority • The bitcoin currency has inadvertently thrown away the flexibility of a fully automatic non-discretionary monetary policy allowing for elastic supply of money 60/83

Slide 61

Slide 61 text

Transactions • Transactions/minute: 40-60 vs 200,000 VISA 61/83

Slide 62

Slide 62 text

Friedrich Hayek Denationalisation of Money • history of coinage is an almost uninterrupted story of debasements; history is largely a history of inflation engineered by governments for their gain • why government monopoly of the provision of money is regarded as indispensable? It deprived public of the opportunity to discover and use a better reliable money A Free-Market Monetary System Lecture delivered at the Gold and Monetary Conference, New Orleans, Nov. 1977 https://mises.org/daily/3204 Denationalisation of Money-The Argument Refined, Third Edition The Institute of Economics Affairs 1990 http://mises.org/books/denationalisation.pdf 62/83

Slide 63

Slide 63 text

Analysis of the Theory and Practice of Concurrent Currencies • Commercial banks issue their own money: – Keep the purchasing power constant – Competition between currencies Blessed will be the day when it will no longer be from the benevolence of the government that we expect good money but from the regard of the banks for their own interest 63/83

Slide 64

Slide 64 text

Fixed USD Exchange Rate • USD/BTC: 15-Apr-11 1.0, 29-Mar-14 500.0 • x500 increase for BTC demand relative to USD • 29-March-14: 12.5M bitcoins in circulation • Inflate their number 500 times to 6250M • On 29-Mar-14 it would have been equivalent – to own 1BTC worth 500USD – or 500BTC each worth 1USD 64/83

Slide 65

Slide 65 text

Rebasing Process Reaction Lag Daily rebasing 65/83

Slide 66

Slide 66 text

Inflation adjusted USD • Adopting the USD Consumer Price Index • 6% inflation in the period March 2011-2014 1.06 66/83

Slide 67

Slide 67 text

Brent-Wheat Commodity Price Index 67/83

Slide 68

Slide 68 text

Brent-Wheat Commodity Price Index 68/83

Slide 69

Slide 69 text

Brent-Wheat Commodity Price Index 69/83

Slide 70

Slide 70 text

Brent-Wheat Commodity Price Index 70/83

Slide 71

Slide 71 text

Gold Commodity Price Index 71/83

Slide 72

Slide 72 text

Gold Commodity Price Index 72/83

Slide 73

Slide 73 text

Hayek Money The cryptocurrency monetary standard of elastic fully automatic non-discretionary supply regulated to achieve stable prices with respect to a (commodity) price index 73/83

Slide 74

Slide 74 text

Seigniorage Shares • The perceived potential of a cryptocurrency as investment asset leads to hoarding and limited transaction volume • Shield coin holders from the direct effects of monetary phases, restraining monetary policy’s costs and benefits to holders of seigniorage shares • Seigniorage shares are a participation in a distributed central bank: owners are entitled to seigniorage revenues in exchange for being subjected to the losses associated to coin price stability defence, obliged to validation task duties, and in charge of price index observation • Free coins from any speculative value, thus favoring money velocity and increasing the number of transactions 74/83

Slide 75

Slide 75 text

Two Monetary Digital Tokens • Two species of digital tokens: coins and shares. Block chain technology tracks ownership and transactions for both. • Coins are divisible, shares are not. Both can be used for transactions even if not fungible • Coins are minted as share dividends and distributed to shareholders • The right to validate transactions is reserved to shareholders, so here miner is a synonym of shareholder. • Miners are rewarded with the issuance of new shares. 75/83

Slide 76

Slide 76 text

The Distributed Central Bank • Seigniorage shares are a participation in a distributed central bank • Owners are entitled to seigniorage revenues in exchange for being: – subjected to the losses associated to coin price stability defense – obliged to validation task duties – In charge of price index observation – network security, node synchronization, etc. • Shares are cryptographically identifiable, so those involved in double spending attempts are invalidated and “burned” away 76/83

Slide 77

Slide 77 text

The Coin and Share Prices • The coin is actively pegged to a price index in order to make its value essentially constant at parity • Share price instead is free to float: expectations about expansionary monetary phases increment it, while contractionary phases depress it. 77/83

Slide 78

Slide 78 text

Monetary Base • shares and coins in circulation, with prices and respectively, ≅ 1 • The share market cap and the coin market cap add up to the overall outstanding monetary base: = ∙ + ∙ • Share market cap is the estimation of future coin issuance: assuming zero interest rate ∙ is the expected number of coins to be issued in the future • The monetary base coin equivalent is: = ∙ + = ∙ 78/83

Slide 79

Slide 79 text

Burning Coins for Shares • New shares can be issued at every block in exchange for a minimum auction price of burned coins • If no shares are bought in a block, in the next one the share auction price will be lowered. If shares are bought in a block, then the share auction price will be increased • The auction is not really depriving shareholders of value: assuming constant in an equilibrium state, the reduction of coin monetary base will just shift value in the share monetary base. • Only the coin price must be obtained exogenously to the network, relying on shareholders for its observation 79/83

Slide 80

Slide 80 text

Price Index Deflation • > 1, fresh new coins are minted and paid as share dividends. • This limits the appreciation potential of , as for a given coin market cap value ∙ , the number of coins increases depressing . • As long as > 1 the share price is obviously non-negative > 0, as coins are expected to be paid as dividend. 80/83

Slide 81

Slide 81 text

Price Index Inflation • < 1, no dividends are expected on short-term: shares lose value • is always incorporating the expectation of future coins “stored” into the market share price, so as soon as decreases then less future coins are expected and will experience a pull to parity proportional to the share market cap loss. • the share defensive help is exhausted when approaches zero. • < 1 and > 0: price stability might be still defended if the market will consider further share devaluation enough to restore parity; • ≅ 0 and > 0: this is the realization of the bitcoin case, with shares being equivalent to bitcoins • < 1 and ≅ 0: price stability cannot be preserved unless coins are burned; • ≅ 0 and ≅ 0: the cryptomoney is dead 81/83

Slide 82

Slide 82 text

Bibliography • Hayek, F. A. (third edition 1990, first edition 1977), Denationalisation of Money - The Argument Refined, The Institute of Economic Affairs, mises.org/books/denationalisation.pdf • Dowd, K. (2014), New Private Monies: A Bit- Part Player?, http://www.iea.org.uk/publications/research/ new-private-monies-a-bit-part-player 82/83

Slide 83

Slide 83 text

Bibliography • Ametrano, Ferdinando M. (2014), Hayek Money: the Cryptocurrency Price Stability Solution, http://ssrn.com/abstract=2425270 • Ametrano, Ferdinando M. (2014), Price Stability Using Cryptocurrency Seigniorage Shares, http://ssrn.com/abstract=2508296 • Sams, Robert (2014), A Note on Cryptocurrency Stabilisation: Seigniorage Shares, https://github.com/rmsams/stablecoins/blob/ma ster/00-main.pdf 83/83