hockey stick – asymptote

(See also post on fwd price ^ PnL/MTM of a fwd position.)

Assume K = 100. As we get very very close to maturity, the “now-if” graph descends very very close to the linear hockey stick, i.e. the “range of (terminal) possibilities” graph.

10 years before maturity, the “range of (terminal) possibilities” graph is still the same hockey stick turning at 100, but the now-if graph is quite a bit higher than the hockey stick. The real asymptote at this time is the (off-market) fwd contract’s now-if graph. This is a straight line crossing X-axis at K * exp(-rT). See

In other words, at time 0, call value >= S – K*exp(-rT)

As maturity nears, not only the now-if smooth curve but also the asymptote both descend to the kinked “terminal” hockey stick.

investment bank as IRS mkt-maker

See also – Trac Consultancy course handout includes many practical applications of IRS.

A) A lot of (non-financial) corporations (eg. AQQ) have floating interest cost from short term bank _loans_. (I did the same with Citibank SG. Every time I rolls the loan, the interest is based on some floating index.) For risk control and long term planning, they prefer a fixed borrowing cost. They would seek IRS dealers who gives a quote in terms of the swap rate — dealer to charged fixed interest and “Sell floating interest” i.e. “Sell the swap” or “Sell Libor”.

A muni IRS dealer would determine her swap rate using 70% Libor as the floating rate. For each tenor (3 months to 2 years) the ratio is slightly different from 70%.

B) On the other side of the river, a lot of bond issuers (eg IBM) have a fixed interest cost, but to lower it they want floating cost (pay floating). So they find IRS dealers who quote them a swap rate — dealer to PAY fixed and Buy floating interest Income, i.e. dealer Buy the swap.

It's important to get the above 2 scenarios right.


Q: Is it possible for Company A to directly trade with Company B without a dealer? It's improbable to find such a trading partner at the right time. Even if there is, transaction cost is probably too high.

The same dealer could give quotes to both clients. The 2 swap rates quoted are like the bid/ask “published” by the dealer. Dealer might want to pay 500bps for Libor; and simultaneously want to charge (receive) 530bps for Libor.

Dealer doesn't really publish the 2 swap rates because each IRS contract is bespoke. If a dealer happens to have both client A and B then dealer is lucky. He can earn the difference between the 2 swap rates. Usually there's not a perfect match on tenor and amount etc. In such a (normal) case, dealer has outstanding exposure to be hedged. They hedge by buying (selling also?) Eurodollar futures or trading gov bonds with repo.

In summary

AQQ's Motivation to pay fixed – predictable cost

IBM's Motivation to pay floating – lower cost

IRS motivations – a few tips

See also – Trac Consultancy course handout includes many practical applications of IRS.
see also — There’s a better summary and scenarios in the blog on IRS dealers

I feel IR swap is flexible and “joker card” in a suite — with transformation power.

Company B (Borrower aka Issuer) wants to borrow. Traditional solution is a bond issue or unfortunately …. a bank loan (most expensive of all), either fixed or floating rate. A relatively new Alternative is an IRS.

Note bank loan is the most expensive alternative (in terms of capital charge, balance sheet impact …), so if possible you avoid it. Mostly small companies with no choice take bank loans.

Motivation 1  relative funding advantage
Motivation 2 for company B – reduce cost of borrowing fixed
Motivation 3 for Company B – betting on Libor.
* If B bets on Libor to _rise, B would “buy” the Libor income stream of {12 semi-annual payments}, at a fixed (par) swap rate (like 3.5%) agreed now, which is seen as a dirt cheap price. Next month, the par swap rate may rise (to 3.52%) for the same income stream, so B is lucky to have bought it at 3.5%.
* If B bets on Libor to _drop, B would “sell” (paying) the Libor income stream

Motivation 4 to cater to different borrowing preferences. Say Company C is paying a fixed 5% interest, but believes Libor will fall. C wants to pay floating. C can swap with company A so as to pay libor. C will end up paying floating interest to A and receive 5.2% from A to offset the original 5% cost.

Why would A want to do this? I guess A could be a bank.

eq-forward – basic questions to internalize

See also post on equity forward. Better become very very comfortable answering these questions. They should be in your blood:)

Q: daily mark to market of an existing position, on some intermediate date “t” before maturity.

Q: market risk of an existing long position?
A: similar to a simple long spot position. When underlier appreciates, we have a positive  PnL. “Logistics”.

Q: delta of  such an existing fwd contract?

There are many relationships  among many variables –

K, T — part of the contract specification
Z0, S0, — observable today
F0 — defined in the EE context as the MTM value of a new position. Almost always $0
ZT := 1.0, STFT := ST – K
Zt, St, Ft,  — where t is an intermediate time between now and T. Since t is in the future, these values are unknown as of today.

An interviewer could ask you about the relationship among any 3 variables, or the relationship among any 4 variables.

Warning — I use F0 to denote today’s price of an off-mkt fwd contract with K and T. Some people use F0 to denote the fwd price of the stock S.

FX swap ^ FX loans – popularity=off balance sheet

One of the best-known motivation/attraction of FX swap over traditional FX loans is – off balance sheet.

The Trac consultancy trainers gave many specific examples. Context is commercial banking, because unlike listed securities, a “buy-side” has no way to trade FX swap on some exchange without a big bank facilitating. Most FX inventories are held by banks (even more than governments apparently). The biggest players are invariably the international banks + central banks, not big hedge funds.

Specifically, the context is a client (like IBM) coming to a commercial bank for a FX solution. Commercial banks are heavily regulated, more so than investment banks. One of the regulations is capital adequacy. Traditional loans to IBM would tie up too much capital in the bank – capital inefficiency. Even for the client (IBM), I feel borrowing would often require collateral.

FX swap in contrast requires much less capital.

A different form of IRS off-balance-sheet benefit is given in, applicable for a buy-side as well.

ccy risk in FX swap ^ forward outright

In short, FX swap entails no currency risk because no future FX rate enters the PnL formula. Currency risk, or FX risk, refers to the uncertainty/hazard of exchange rate movement during a “holding period”, when we have an “exposure”.

For a longer explanation, let’s start with a simple spot FX transaction. As soon as we convert to or from our account currency (HKD for example), we have an open (long or short) position in some silver – I treat any other currency as a commodity. Price movement in silver causes paper gain or loss. If the notional is large, then I lose sleep, until I close the position and have everything in my home currency again.

In terms of FX risk, a forward outright is different from a spot trade only logistically. As soon as we agree on a price and execute, I take on an open position and open exposure, way before the settlement date.

(In terms of credit risk however, the outright differs substantially from the spot trade.)

The simplest no-position scenario is the fixed-fixed cross-currency swap. On near date, we exchange principals – say HKD 7m vs USD 1m. On far date, we return each other the exact same amounts, not a single cent different. In between, all the pre-agreed interest payments are exchanged too, where one interest rate can be many times higher than the other. No FX risk on the principal amount.

Finally we come to the more important instrument – FX swap. It doesn’t create any open position. On trade date counterparties agree on the two exchange rates, leaving no uncertainty or exposure to the market.

use swap point bid/ask to derive FX fwd outright bid/ask

(label – FX)

See other posts on fwd swap point interpretation.

See other posts on how to compute fwd outright bid/ask without swap points — using interest rate bid/ask.

Given spot bid/ask is 105.30/105.35 (whatever ccy pair – unimportant). Suppose swap points are quoted 1.10/1.05, we can deduce the asset currency is trading at a fwd Discount[1], because the swap quote is “high/low”. Fwd Discount means that fwd outright price is Lower than spot price. Always treat the first currency as a commodity like silver.

Fwd outright bid/ask of the “silver” are 105.30 – 1.10 / 105.35 – 1.05

Note this is not some expectation/prognosis of an upcoming event, to-be-known. Instead, the 105.30 – 1.10 = 104.20 price is for execution today. Only the settlement is 1Y later.

[1] Even if we don't know “Discount”, we can still figure out whether to subtract or add the swap points. Golden Rule [2] is, fwd outright bid/ask spread must be wider than spot bid/ask spread.

Therefore, Since swap bid (1.10) is Bigger than ask, we must Subtract it from spot bid. Subtracting a bigger number from bid is the only way to WIDEN the spread.

[2] in fact, the final bid/ask spread in fwd outright pips equals the spot spread + |swap point spread|. Here we take the abs value because we don't care if the swap points are quoted “high/low” or “low/high”.

[14]JGC tuning: will these help@@

Q: have a small nursery generation, so as to increase the frequency of GC collections?

AA: An optimal nursery size for maximum application throughput is such that as many objects as possible are garbage collected by young collection rather than old collection. This value approximates to about half of the free heap.

Q: have maximum heap size exceeding RAM capacity.
A: 32-bit JVM won’t let you specify more than 4G even with 32 GB RAM. Suppose you use 64-bit JVM, then actually JVM would start and would likely use up all available RAM and starts paging.

FW: grab a critical component (and make it unnatural for other developers:)


I now see more wisdom in such a “job protector”.

I feel a critical component could be

– the release process like the one your colleague controls

– build process

– some scheduling tool like autosys. You can make it very complicated.

– some home-made diagnostic tool to troubleshoot a critical component.

– some wrapper component that everyone must go through to access messaging, or some critical library…

– some very important SQL query? Well, colleagues can copy it and figure out how it works. It's “more effective” if there are many such queries and these queries need a lot of tweaking each time. Then no one can become familiar with these queries and replace me!

a few benchmarks in finance #vwap, sharpe…

Investment Performance benchmark – Sharpe
Investment performance benchmark – various indices
Investment performance benchmark – risk free rate
Investment performance benchmark – value benchmark and size benchmark. See the construction

Execution benchmark – vwap. I feel this is the natural, logical benchmark. “Did I sell my 5000 shares at yesterday morning’s average price?”
Execution benchmark (2nd most common) — implementation shortfall (very similar to arrival price). See slippage: several similar meanings

FX Vol – Butterfly or Strangle@@

[[Managing Currency Risk Using Foreign Exchange Options]] says

Butterfly is a combination of ATM straddle and an OTM strangle, and is a more exact way of trading the smile of volatility.

The OTM strangle relates net premium, in volatility terms, over the ATM ( volatility) rate. The purchase (or sale) of an OTM Strangle still leaves the trader open to a change in the ATM rates, so it’s possible for a change in the smile shape to be compensated by a change in the ATM rates. To be more exact, trader can lock in the difference between the two (ATM vs OTM volatilities) by trading the butterfly spread.

finance model — various meanings, very briefly

I feel a financial model is any math that describes/explains/relates/predicts economic numbers.

A “model” means something different in buy-side than in derivative pricing including complex structured products.

On the buy-side, I feel a model is like a regression formula that Predicts a (single?) dependent variable using several explanatory variables. In simple words, such a model is an alpha model, which is related to a trading strategy.

what departments use the yield curve

In one mkt risk system, the USD (no other currencies!) yc is used to compute FX swap points. That’s the only usage of the yc in that system.

Why some large investment banks have a sizable IT team supporting the yield curve(s) and update it a few times a day? I was told

… that a big user is the IRS desk. IRS contracts last many years. A portfolio may be highly sensitive to the interest rate at some point on the yc. A small shift of the yc may tip the entire portfolio from ITM to OTM. Note ITM/OTM is always for the swap dealer.

I feel if a portfolio is sensitive to the yc, then the trader needs up-to-the-hour yc to help guide his quoting and trading decisions.

linear correlation: minefield

If 2 “thingies” A and B have a low (linear) correlation of 0.3, we can easily interpret it incorrectly.  Here are some of the pitfalls:

  • If A/B have a physical non-linear but strong relationship, they are not independent but corr will be low. Corr coeff measures Linear relationship only. Stat risk has a lot to say about this.
  • if sample size is small, then the calculated corr may not reflect the true population corr
    • if we take many, many large samples, the true corr would emerge.
  • As [[[Prem Mann]] points out, there may not be a causal relationship between A and B even if corr is high.

The most common confusion in my mind is the context. The 0.3 corr is typically calculated from a sample, but when folks say A and B are weakly correlated, they usually refer to the population. They say things like when A increases , we are likely to see B increase too. We automatically assume some causality.

Due to the factors mentioned above, an observed low corr often doesn’t mean A/B’s independence in the population (a healthy blood pressure reading doesn’t prove complete health). However, an observed strong corr often represents a good evidence of real corr within the population, provided the sample is statistically significant. Here’s a classic example. Your classmate stares at your head from behind. In each experiment, she either stares (1) or looks away (0). You guess.

A = the actual 1/0
B = your guess 1/0

For a small sample of 10, you may see strong correlation between A and B. You feel you could sense the stare from behind. In a large sample, corr is going to be 0.

Concept of corr is simpler within natural processes — we could repeat experiments to infer the population corr. However in most economic problems the A/B thingies are influenced by human decisions. So it’s harder to “manage”. The population corr may change over time, or change with gender, or change with nationality. For example, if we take 2 samples, then sample 1 may be from a population with mostly young Asian girls, and sample2 may be from a different population. Then unknown to us, the first population’s corr could differ from the 2nd population’s.

low-hang`@@perishable@@niche@@ #{2nd slow job search

(See also blog post, )

Evaluation in terms of long term job security, demand, job search, job interview, salary level

^^ core c#
^ python? growing demand; low-hanging fruit; might open many golden gates at baml and jpm
^ FIX? low churn. Hard to self-learn
– socket? frequently quizzed, low churn
– wcf
v wpf? not my chosen direction at the moment. Too big a domain.
– linux/c++ optimization? too niche
^ option math, stoch? often asked in-depth, but few roles in SG
– fixed income math? not used on the buy-side
– risk mgmt math? stable demand
v quant strategy? vague, dubious domain, apparently zero role in SG

what-if – (binary) option valuations – develop intuition

as T -> inf

C_0 -> S_0

P_0 -> 0.0

binary Call price ->

binary Put price ->

as t -> T

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

as S -> K

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

as S -> 0

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

as S -> inf

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

as R_disc -> inf

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

as R_ disc -> 0

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

as R_grow -> inf

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

as R_grow -> 0

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

as K -> inf

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

as K -> 0

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

as sigma -> inf

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

as sigma -> 0

C_0 ->

P_0 ->

binary Call price ->

binary Put price ->

matlab | find()

I feel a lot of textbooks skip this instrumental function, and other tutorials on this function are not focused. Let’s keep things very simple and focus on the bare essentials.

Focus on a vector, not a matrix.

Focus on find(some logical expression) rather than find(someVector) says
Logical indexing is closely related to the find function. The expression A(A > 5) is equivalent to A(find(A > 5)). Therefore, better learn logical indexing first.

matlab | logical subscripting – learning notes clearly defines it — “Suppose X is an ordinary matrix and L is a matrix of the same size that is the result of some logical operation. Then X(L)specifies the elements of X where the elements of L are nonzero.”

Note if L has 5 non-zero elements, then length(X(L)) == 5.

I think L must be an array of booleans, not doubles.

For a matrix, see

But here’s a real illustration in my code:

  step = 1/200;
  steps = 2/step;

  % generate increments
  %rng(0,’twister’); % if we want repeatable
  incr = randn(steps,reruns)*sqrt(step);

  std(incr) % should  all be around 0.07

  % random walker positions
  p = cumsum(incr);

  % select a subset of Columns, using filter on
  % “200th ROW and 400th ROW” so
  % row expression = wildcard; column expression = filter on Row.
  % If we carelessly swap the expressions, matlab won’t warn us!
  qualified = p(:, (p(200,:)>0 & p(400,:)>0));

dotnet wait handles – phrasebook

win32 – wrapper over win32 native constructs, (presumably) like file handles and other OS handles.
** p/invoke – these wrappers save you the p/i calls

kernel – the underlying are kernel constructs and probably involve kernel “Services”

predate – the kernel constructs predate the dotnet framework. I think they are part of win32 API.

conditionVar – I feel these are not like the condition variables offered by thread libraries

–some important dotnet constructs using wait handles
* IAsynchResult
* Mutex class
* Semaphore class
* signal events like AutoResetEvent and ManualResetEvent. Despite the confusing name, unrelated to the dotnet events.