"yours/mine" in FX spot trading room

Think of USD as a commodity (like silver or oil) and is quoted in commodity markets

—-One client—-
market-maker: USD/CHF 96/99 ## MM is bidding silver at 1.2196 and offering silver at 1.2199
market-taker1: “Yours” ## market-taker1 hit and sold at bid price. MT1 declaring “silver is now yours
MM: given at 96 ## “we are given the silver” at 1.2196 CHF
—Another client—-
MM: USD/CHF 96/99
MT2: “Mine” ## market-taker2 lifted and bought at offer price. MT2 declaring “the silver is now mine
MM: 99 paid ## “we are paid 1.2199 CHF” for selling our silver
In each case, the last announcement by MM is to his boss and colleagues (NOT to market-taker) so they can feel the buzz.
– If boss hears repeated “given” she knows this silver (base currency) is under heavy selling by clients.
– If boss hears repeated “paid” she knows many customers are buying (paying for) the silver ie base currency.

Whoever giving the quote is the market-maker. Whoever saying “yours” or “mine” is the market-taker, who can be another dealer bank.

real time PnL in FX spot (and forward) trading

The position master (heart of spot trading platform) marks all positions in real time through the day, but at 4pm it closes the book and marks all open positions one last time and computes unrealized PnL and realized PnL for the day.

Same as Reo.

In spot FX, most positions are “flat”, at any time, there are a small number of non-flat positions. These jargons all refer to the same concept and are the subject of marking and unrealized PnL report.
– “current position”,
– “open position”,
– open trades

Note In forward FX, marking is done with live forward prices, not spot prices.

operator-overload used to the max in STL

I feel STL uses op overloading whenever it makes sense. When a container has a bunch of operators and a bunch of methods, the former is always more important than the latter. Iterators have operators only.

[] // vectors, deque, map yes map, but not list or queue due to random-access
++ // forward iterators
— // bidirection iterators
== != // iterator,
>= // map+set (sorted), list, queue, stack, vector
q( * ) deference // iterator. Note that we don’t use ->. It’s not overloaded in the Iterator class.

Note q( >= ) is overloaded “provided” we have already overloaded > < != == etc.

multiple PnL currencies in 1 FX trading account

(For large banks, see other blog)
Q: how and why would a system maintain 2 pnl reporting currencies in a single fx trading account?
Be it client accounts maintained at a sell-side dealer or sell side trader accounts, in most cases there’s probably good reason to consolidate all open positions into a single reporting currency. However, I think there are important exceptions.

One possible exception is house account handover, say from NY to Tokyo. It might make sense to have a book using both USD and JPY as reporting currencies, so NY open positions can be handed over Tokyo.
Here’s another exception.

Based on http://www.surefire-forex-trading.com/forex-trading-accounts.html
You sell (go short) USD/JPY and as such are short USD and Long (bought) JPY. You enter the trade at 116.10 and exit 116.90. You in fact made 80,000 Japanese Yen (1 lot traded) not US Dollars.
If you traded all four major currencies against the US Dollar you would in fact have made or lost in EUR, GPY, JPY and CHF. This might give you a ledger balance at the end of the day or month with four different currencies.

This is common in London. They will __stay__ in that currency until you instruct the broker to exchange the currencies into your own base currency. Most US based (retail) traders assume they will see their balance at the end of each day in US Dollars.

OMS in FX vs equities

OMS is often the biggest and the core module in any trading platform that supports pending orders and FIX execution.

What are the differences between an eq OMS (see [[Complete Guide]]) and an FX OMS?

FX is fundamentally OTC and quote-driven, not order driven as listed markets are.

Q: in FX, there’s no exchange making the (irrevocable) matching?

1900 tiers of quotes, RFS over FIX, indicative/executable quotes #400w

One of the REAL bottlenecks in a large SELL-side FX dealer system is tiered pricer. Trigger event could be a market data change. Since such an event could trigger an avalanche of messages, the frequency of such events is not very high, probably below 10 events/second on 1 currency pair. If you have 10(or 50 or whatever) active currency pairs, then you could get 100 triggers/sec through your entire system.

Once a trigger is activated, pricer computers new bid/ask quotes for Tier 1 Gold clients. Pricer then adds a distinct spread for each tier. For an active pair like EUR/USD, there can be 1900 tiers. There can be up to 1900 (non-unique) pairs of bid/ask quotes. Typically, the “best” quotes would have a bid/ask spread of 2 to 3 pip, applicable to the best and largest clients. For a *retail* client, it could be 20 – 100 pips.

Core of the tiered pricer is a Drools rule engine.

Another module is the messaging engine using Nirvana by My-Channels. If a particular bid/ask quote applies for all (say, 20) tiers in Silver category, then pricer broadcast the quote to a topic like Quote.EURUSD.Silver. This is kind of alias for 20 different “tier” topics. For efficiency, this is probably multicast.

In the worst case, one event can trigger an avalanche of 1900 messages for one currency pair alone.

Last module is the FIX engine. Quotes often go out the door in FIX format, just as RFQ. Now there are 1900 tiers but the number of clients could be higher or lower than 1900. If there are more than 1900 clients and if all of them subscribe to our quote, then each must be sent the quote. I know a Chicago prop trading firm (Gelber?) subscribe to a lot of “bank feeds”.

The most demanding type of subscription is a RequestForStream (RFS). A typical RFS could ask for a stream of EURUSD quotes for 10 (up to 120 minutes), during which time all quotes must be delivered.

Unlike RFQ, RFS requires special approval. The bid/ask quotes in an RFS can be indicative or *executable* (similar to Firm, but see separate blot post). If a client hit an executable bid or lift an executable offer, then the trade is considered executed, though I believe cancellation is still a possibility, just like any Firm quote in bonds.

How does a dealer make sure he has enough position to honor the quote? Perhaps by setting aside reserve quantities, or by monitoring the open market.

Unlike bidwanted systems (non-negotiable quotes), it’s possible for a client to negotiate on our quote electronically, though I feel manual negotiation is more practical.

jms q&&a

q: how do u create a topic in a jms provider?
a: below

Q: beside topic names, what other names exist in a jndi registry?
a: below

a: one way is xml. create it, hot-deploy it (make sure the server picks it up).
A: ejb home names, connection factory names, queue names….

SABR model #pdf of forward rate

IR Swap – often using SABR (citi/barc/Macquarie…)

A key factor in Fixed Income VaR is vol calculation. You need (?) a pdf of the forward-rate, either normal, log-normal or something similar.

A popular model in Citi muni department is the SABR model. This model describes a single forward rate, such as a forward Libor rate.

Yuri — it is related to CEV and models the vol skew.

eurodollar futures — phrasebook

* deposits — first understand the simpler concept of eurodollar deposit
** remember the deposit rate (2% for 3 months) is a forward int rate (not a spot rate) beginning on an IMM date.

* futures — eurodollar futures, very similar to commodity futures

* guaranteed — by exchange
** counterparty — of every trade is the exchange
** margin and daily mark to market settlement, just as in commodities futures

* libor — the reference rate for ED futures
* speculator and hedgers — corporations borrowing money
* rate lock — you can lock in the 3m borrowing cost [1/1/2013 – 4/1/2013] at 2.01%. Similarly, you can lock in 2013 corn price at $1025/tonn.
* IRS pricing
* Libor curve — Note all rates are 3m USD libor rates. We plot the “expected” rates against 40 contract expiration dates.

pointer is usually to the heap@@ !! in CSM project

I feel In general a pointer to a stack object is 2nd best as it may become stray pointer. However, in my CSM data validation, statistical, visualization system, i used many arrays and strings without malloc().

a pointer to a global object is possible, but I didn’t use a whole lot of globals.

I guess my CSM team constructed many local arrays in outer functions (main()), and pass them into nested functions, so they stay in scope (throughout). Pointer to local is fine.

Also, static local variables were probably the 2nd popular choice we took.

In conclusion, we probably did use pointer-based collections but without heap/malloc(). Pointers to static locals, globals and main() method locals.

Also note function pointers point to neither heap nor stack.

implicit low-level non-OO operations — in-depth lesson #1 on c++

This self-contained, focused, in-depth lesson covers copier, assignment, destructors, heap/stack, new/delete, pbclone/pbref (see separate post). I feel it pays to slow down and get the concepts right before moving on.

This lesson doesn’t need any OO feature.

The following implicit operations are “part of the fabric” ie implicit and pervasive
* assignment
* constructor calls at var declarations
* pbclone/pbref is even more part-of-the-fabric than others
* heap/stack is a prerequisite of pbclone/pbref

—– 2nd lesson —–
What would be the 2nd “focus lesson”? inheritance + redefinition/overriding + slicing.

After the inheritance lesson, we could tackle static member and templates in inheritance.

How many such lessons needed before becoming “experienced”? I guess about 3 or 4.