Imandra Formal Verification of Financial Algorithms, Progress and Prospects Grant Olney Passmore ACL2-2017, Austin Joint work with Denis Ignatovich and our incredible team at AI AESTHETIC DESIGNED INTEGRATION WITH CARE BY
Video (see it on http:/ /imandra.ai) The Logic of Financial Risk™ / 2
Problem Financial markets have become notoriously unstable. The Logic of Financial Risk™ / 3
Problem Financial markets have become notoriously unstable. Flash Crashes : systemic events characterised by non-trivial co- dependence of trading algorithms (e.g., May 2010, drop of $1tr) The Logic of Financial Risk™ / 4
Problem Financial markets have become notoriously unstable. Flash Crashes : systemic events characterised by non-trivial co- dependence of trading algorithms (e.g., May 2010, drop of $1tr) Lack of Transparency : issues of misrepresentation (e.g., misleading marketing materials or regulatory fi lings) of trading algorithm behaviour (e.g., BATS/Direct Edge $14M settlement with the SEC) The Logic of Financial Risk™ / 5
Problem Financial markets have become notoriously unstable. Flash Crashes : systemic events characterised by non-trivial co- dependence of trading algorithms (e.g., May 2010, drop of $1tr) Lack of Transparency : issues of misrepresentation (e.g. misleading marketing materials or regulatory fi lings) of trading algorithm behaviour (e.g., BATS/Direct Edge $14M settlement with the SEC) Glitches : trading system errors in design or implementation, o fu en causing signi fi cant losses (e.g., Knight Capital’s loss of $400M) The Logic of Financial Risk™ / 6
Goals for this talk • Concepts : venue, exchange, dark pool, order book, order type (market, limit, pegged), matching logic, market microstructure, smart order router 7
Goals for this talk • Concepts : venue, exchange, dark pool, order book, order type (market, limit, pegged), matching logic, market microstructure, smart order router • Regulations : Transparency, safety and fairness (Reg ATS-N), best execution (Reg NMS)
Goals for this talk • Concepts : venue, exchange, dark pool, order book, order type (market, limit, pegged), matching logic, market microstructure, smart order router • Regulations : Transparency, safety and fairness (Reg ATS-N), best execution (Reg NMS) • Practice : Be able to write a spec and analyse basic regulatory properties of a trading venue’s matching logic
Goals for this talk • Intuitions : • “Venue matching logics” = “ISA of the market” • Pressing need for: • venues to be bullet-proof w.r.t. safety and fairness regulations • matching logics to be formally described to regulators and market participants • matching logics to be formally analysed w.r.t. precise encodings of regulatory directives • financial mathematics (stochastic calculus) that takes precise discrete behaviour of matching logics into account
The Stack of Financial Algorithms The Logic of Financial Risk™ / 11
The Stack of Financial Algorithms Venues The Logic of Financial Risk™ / 12
The Stack of Financial Algorithms Smart Order Routers Venues The Logic of Financial Risk™ / 13
The Stack of Financial Algorithms Trading Algos Smart Order Routers Venues The Logic of Financial Risk™ / 14
The Stack of Financial Algorithms Algo Containers Trading Algos Smart Order Routers Venues The Logic of Financial Risk™ / 15
The Stack of Financial Algorithms Inventory Management Algo Containers Trading Algos Smart Order Routers Venues The Logic of Financial Risk™ / 16
The Stack of Financial Algorithms Collateral Trading Inventory Management Algo Containers Trading Algos Smart Order Routers Venues The Logic of Financial Risk™ / 17
The Stack of Financial Algorithms Collateral Trading Inventory Management Algo Containers Trading Algos Smart Order Routers Venues The Logic of Financial Risk™ / 18
The Stack of Financial Algorithms Collateral Trading low freq Inventory Management Algo Containers Trading Algos Smart Order Routers high freq Venues The Logic of Financial Risk™ / 19
The Stack of Financial Algorithms Collateral Trading low freq Inventory Management Algo Containers Trading Algos Smart Order Routers discrete, high freq Venues nonlinear The Logic of Financial Risk™ / 20
The Stack of Financial Algorithms Collateral Trading low freq Inventory Management Algo Containers continuous, Trading Algos nonlinear Smart Order Routers discrete, high freq Venues nonlinear The Logic of Financial Risk™ / 21
What is a venue? The Logic of Financial Risk™ / 22
What is a venue? The Logic of Financial Risk™ / 23
What is a venue? The Logic of Financial Risk™ / 24
What is a venue? LIT LIQUIDITY DARK LIQUIDITY The Logic of Financial Risk™ / 25
Running Example: UBS ATS First place winner! 620 companies 52 countries The Logic of Financial Risk T M
Running Example: UBS ATS First place winner! 620 companies 52 countries Jan, 2015: UBS fined $14M by the SEC for issues of unfairness in their dark pool design We analysed it, found more issues The Logic of Financial Risk T M
Running Example: UBS ATS The Logic of Financial Risk T M
Running Example: UBS ATS Let’s examine an actual regulatory disclosure (esp. Sec 4.1) The Logic of Financial Risk T M
What is Imandra? • Programming language • Mathematical logic • Reasoning engine The Logic of Financial Risk T M
What is Imandra? Automated Reasoning + • Programming language • Mathematical logic • Reasoning engine • First-class counterexamples • Nonlinear + SE decomposition • Proof automation for various financial regulations • Test suite generation • Documentation generation The Logic of Financial Risk T M
What does a venue do? • maintain an order book • process incoming orders • match orders (‘trade’!) • send ` fills ’ • route orders away (`best-ex’) • report on market activity …all according to a (precisely?) defined ‘spec’ …while obeying many complex regulations The Logic of Financial Risk™ / 32
What is an order book? The Logic of Financial Risk™ / 33
What is an order book? The Logic of Financial Risk™ / 34
What is an order book? at each discrete time-step, the book is sorted. The Logic of Financial Risk™ / 35
What is an order book? how is it sorted? The Logic of Financial Risk™ / 36
What is an order book? how is it sorted? VERY COMPLEX ANSWER! The Logic of Financial Risk™ / 37
What is an order book? how is it sorted? INTUITION: Price/Time Priority The Logic of Financial Risk™ / 38
What is an order book? how is it sorted? INTUITION: Price/Time Priority REALITY: Let’s see! The Logic of Financial Risk™ / 39
What is an order? an instruction to • buy or sell a given security • in a specified manner , • subject to market constraints , and • order parameters . The Logic of Financial Risk™ / 40
What is an order? an instruction to • buy or sell a given security • in a specified manner , • subject to market constraints , and • order parameters . “buy 100 shares of MSFT, with price at most $50” The Logic of Financial Risk™ / 41
What is an order? an instruction to • buy or sell a given security • in a specified manner , • subject to market constraints , and • order parameters . “buy 100 shares of MSFT, with price at most $50” “buy 100 shares of MSFT” The Logic of Financial Risk™ / 42
What is an order? The Logic of Financial Risk™ / 43
What is an order type? MARKET ORDER The Logic of Financial Risk™ / 44
What is an order type? MARKET ORDER LIMIT ORDER The Logic of Financial Risk™ / 45
What is an order type? MARKET ORDER LIMIT ORDER ICEBERG ORDER The Logic of Financial Risk™ / 46
What is an order type? MARKET ORDER LIMIT ORDER ICEBERG ORDER STOP LOSS ORDER The Logic of Financial Risk™ / 47
What is an order type? The Logic of Financial Risk™ / 48
What is an order type? The Logic of Financial Risk™ / 49
What is an order type? The Logic of Financial Risk™ / 50
Is your venue fair? Difficult questions: Is your venue fair ? - Can you prove it? - If it’s not fair, how can you fix it? - Can your collection of order-types ever - violate regulatory directives? Does your high-performance - implementation conform to your high- level design specification? Does your documentation of your order- - types truly match your implementation? How can you automate both testing and - compliance ? What is the strongest possible evidence - you can give to regulators? The Logic of Financial Risk™ / 51
Formal analysis of trading venues • Analysis of safety and fairness properties of trading venues (dark pools, exchanges, etc.) • In use at top global investment banks • Principled way to manage growing order-type proliferation • Exciting developments in regulatory space (more soon…!) The Logic of Financial Risk™ / 52
Running Example: UBS ATS Demo: Transitivity of order ranking The Logic of Financial Risk™ / 53
Example: SIX Swiss Exchange The Logic of Financial Risk™ / 54
Recommend
More recommend