Finance

Keith A. Lewis

April 25, 2024

Abstract
Atoms of finance and their interaction.

What does it mean to say “Ford is trading at 8?”

The first approximation is “Ford stock is trading at 8 dollars per share.”

This means you can pay 8 dollars to obtain 1 share of Ford stock. You can also get 8 dollars to take on the obligation of buying back one share of F at some future date. More generally, you can pay 8a dollars to obtain a shares of Ford stock, where a can be positive or negative.

Exchange

In order to do this you will need to set up an account with an exchange that has legal agreements with _broker_s licensed to trade F, the stock symbol for Ford. Step one is to lay down some money for a margin account with the exchange to fund your trading activity. They will provide you with software that will show you the “price” of F. When their screen shows a price of 8 and you buy one share of F you might be surprised to find out they debited your account for 8.01 dollars. This is slippage is due to the exchange mechanics.

Order Book

Liquidity providers submit limit orders to the exchange order book. They agree to buy or sell some amount of an underlying at a specific level. Exchange customers can also submit limit orders. When a market order is recieved by the exchange to buy or sell some amount of an instrument it is matched with existing limit orders.

The limit order to sell having the lowest level is the ask. The limit order to buy having the highest level is the bid. A limit order that has not yet executed may be cancelled. Typically the bid is less than the ask. The depth of the book at each level is the sum of the amounts of limit orders at that level. A market order to buy is matched with limit orders to sell. If the amount of the market order is greater than the depth at the ask level then it will be matched with sell limit orders at the next higher level. This continues until the full amount of the market order is matched. Market orders to sell are likewise matched with limit orders to buy.

This mechanism makes the “price” uncertain. E.g., another market order might hit the book or additional limit orders may arrive during the settlment proces. Market orders execute almost instantaneously, but the price is uncertain. Limit orders always execute at the specified level, but when they execute is uncertain.

Some exchanges offer stop orders. When a specified market level is reached then a market order for a specified amount is executed.

Price

If a buyer acquires amount a of instrument i for amount a' of instrument i' from a seller, the price if the transaction is X = a'/a. Typically i' is dollars or the native currency.

Trading

Let X_t be the price of an instrument at time t and consider the trading strategy of purchasing 1 share at time u and selling 1 share at time v. The profit and loss of the trade is X_v - X_u after it has closed out at time v. At time s, where u < s < v, the P&L is X_s - X_u where X_s is the price at time s. This is also the definition of stochastic integration.

Blotter

The blotter is a collection \{(t;a,i,e;a',i',e')\}. We assume all t are distinct.

Use as foreign key to attach additional transaction data.

A transaction is (t'',(t,a,i,e),(t',a',i',e')).

This adds the following to the blotter.

(t'', (t'', (t'',-a,i,e), (t'', -a', i', e'))

(t'', (t'', (t'',a',i',e), (t'', a, i, e'))

Broker

bid/ask spread

a = 8a’ <-> a’

(a, i, e) <-> (a’, i’, e’) has price X = a’/a

Entity

Let E be a set of entities. An entitiy e\in E can own intruments and is subject to laws and regulations of the country they are governed by.

Instrument

Let I be a set of instruments. An instrument i\in I is a tradeable asset that can be owned by an entity.

Amount

An amount A measures the quantity of an instrument. Each instrument has a smallest unit of exchange so A is an integer.

Atom

The atoms of finance are positions: \pi = (a, i, e)\in A\times I\times E. Entity e owns amount a of instrument i. Given a postion \pi = (a, i, e) we write \pi_a, \pi_i, and \pi_e for a, e, and i.

Portfolio

A portfolio is a set of positions \Pi \subseteq A\times I\times E. It is convenient to aggregate portfolios into net amounts. Define A_\Pi\colon I\times E\to A by A_\Pi(i, e) = \sum_{\pi\in\Pi} \{\pi_a\mid \pi_i = i, \pi_e = e\}

The net portfolio of \Pi is N_\Pi = \{(A_\Pi(i, e), i, e)\mid i\in I, e\in E\}. Note N_\Pi\subseteq A^{I\times E}.

Define \alpha_\Pi\colon \Pi\to I\times E by \alpha_\Pi(a, i, e) = (i, e)

Exercise. Show A_\Pi(i,e) = +^*\alpha_\Pi(i,e).

Hint. \alpha_\Pi(i,e) is the right coset and +^*S = \sum\{s\in S\}.

Transaction

A transaction is an exchange of positions at a time t, \chi = (t, \pi, \pi'). The buyer holding \pi trades that with a seller holding \pi' at time t. After a transaction the buyer holds (a',i',e) and the seller holds (a, i, e'). The price of the transaction is X = \pi'_a/\pi_a.

Define \delta_{i,e}(i',e') = 1 if i = i' and e = e', otherwise 0. A transaction can be represented by a vector X(\chi) = a(\delta_{i,e'} - \delta_{i,e}) + a'(\delta_{i',e} - \delta_{i',e'}). Amount a of of instrument i is credited to entity e' and debited from e. Amount a' of of instrument i' is credited to entity e and debited from e'.

If the net portfolio is N at time t the result of the transaction is N + X(\chi) when it settles.

Mark to Market

Given i'\in I and a set of prices X_{i,i'} we can mark a portfolio to i' by assuming the transactions (t; a'X_{i,i'}, i; a', i'), a\in\mathbf{R} are available to any entities.

A single entity e computes \sum

If the USD/JPY exchange rate is 123 then one dollar can be exchanged for 123 yen at the time it is quoted by the seller. It is almost true that the buyer can exchange a dollars for 123a yen with the seller. In reality it depends on the sign and size of a. If a is positive then the seller will quote the ask price. If a is negative then the seller will quote the bid price. The spread is the difference between the ask and bid is typically a positive number. As the magnitude of the amount the buyer wants to transact increases, the spread gets larger.

Notes

We assemble some basic facts about sets and relations.

Product

The cartesian product of sets A and B is the set of ordered pairs A\times B = \{(a, b)\mid a\in A, b\in B\}. Define projections \pi_A\colon A\times B\to A by \pi_A(a, b) = a and \pi_B\colon A\times B\to B by \pi_B(a, b) = b.

Exercise. If \alpha\colon C\to A and \beta\colon C\to B are functions, show there is a unique function \gamma\colon C\to A\times B with \alpha(c) = \pi_A(\gamma(c)) and \beta(c) = \pi_B(\gamma(c)), c\in C.

Hint. Show \gamma(c) = (\alpha(c), \beta(c)) is the only such function.

The cartesian product can be generalized to any collection of sets (A_i)_{i\in I}. Define \Pi_{i\in I} A_i by \pi_j\colon\Pi_{i\in I} A_i\to A_j, j\in I where given \alpha_j\colon C\to A_j, j\in I there exists a unique function \gamma\colon C\to\Pi_{i\in I} A_i with \pi_j(\gamma(c)) = \alpha_j(c), j\in I, c\in C.

Exercise. If A_i = A for all i\in I then \Pi_{i\in I} A = A^I = \{\alpha\colon I\to A\}.

Hint. Let \pi_j(a) = a(j) for a\in A^I.

Relation

A relation is a subset of the cartesian product of sets. If A and B are sets and R\subseteq A\times B we write aRb for (a,b)\in R. Define aR = \{b\in B\mid aRb\} and Rb = \{a\in A\mid aRb\} to be the left and right coset, respectively.

The domain of a relation is \operatorname{dom}R = \{a\in A\mid aRb\text{ for some }b\in B\} and the codomain is \operatorname{cod}R = \{b\in B\mid aRb\text{ for some }a\in A\}.

Exercise. Show \operatorname{dom}R = \cup_{b\in B} Rb and \operatorname{cod}R = \cup_{a\in A} aR.

A function is a relation when aR is a singleton for every a\in A. We write R(a) = b where b is the unique element of the left coset. If the left coset is either a singleton or empty then R is a partial function.

Given a function f\colon X\to Y define \operatorname{ker}f = \{fb\mid b\in B\} where fb is the right coset of b for f. The kernel of a function is a partition of its domain.

Exercise. Show \cup\operatorname{ker}f = \cup_{b\in B} fb = A and if fb = fb' then either fb = fb' or fb\cap fb' = \emptyset.

Hint. For a\in A we have a\in fb where b = f(a). If a\in fb\cap fb' then f(a) = b and f(a) = b' so b = b' and fb = fb'.

Monoid

A monoid is an associative binary operation m\colon M\times M\to M with an identity element e\in M. Associative means m(a, m(b, c)) = m(m(a, b), c) for a,b,c\in M. The identity satisfies m(a,e) = a = m(e, a) for a\in M. When the binary operation is understood we write ab for m(a,b).

Exercise. Show the identity element is unique.

Hint: If e' is another identity then e = ee' = e'.

Exercise If m is an associative binary operation on M and define ae = a = ea, a\in M, then M\cup\{e\} is a monoid.

We can extend the binary operation to all finite ordered sequences of elements from M. Let M^* = \cup_{n\ge 0} M^n. Define m^*\colon M^0 by m^0(\emptyset) = e. Given m^n\colon M^n\to M define m^{n+1}\colon M^{n+1} = M^n\times M\to M by m^{n+1}(a,b) = m(m^n(a), b).

Partition

f\colon A\to M