##what asset classes are important to PB business

Prime brokers provide a wide range of services to hedge funds. What asset classes are important in the PB market? (Note this is subtly different from the question “what asset classes are important to hedge funds”)

#1 Equities
#2 FI

(In Eq and FI, clients get financing.)

#3 futures – no financing
FX is slightly less important

Financing is the most needed “service” and includes
* stock lending
* margin lending
* repo and reverse repo

The 2nd most valuable “service” might be technology
* low-latency direct-market-access (including FX)
* collocation in exchange data center

multicast: video streaming^mkt data

These are the 2 main usages of IP multicast. In both, Lost packets are considered lost forever. Resend is sometimes considered “too late”.

I think some of the world’s most cutting-edge network services — live price feed, live event broadcast, VOD, multiplayer gaming — rely on multicast.

Multicast is more intelligent data dissemination than broadcast, and faster than unicast. Intelligence is built into routers.

I believe JMS publish is unicast based, not broadcast based. The receivers don’t comprise an IP broadcast group. Therefore JMS broker must deliver to one receiver at a time.

wpf data template, basics

DT is mostly used with collections, though it can be used for standalone objects. Let’s suppose we have a list  box of  Persons.

DT is a chunk of xaml code. (Can it be done in c# code? I have not seen any.). The list box is another chunk of xaml. You could embed the DT chunk in the listbox chunk, but it’s more common to define a “reusable” DT inside a resource dictionary (another chunk of xaml) and give it a name like MyDT. To use this DT, we assign MyDT as the RHS to ItemTemplate property (LHS) of our list box.

In Smarty, a newsletter template would need $yourName, $yourAddress and other dummies. Similarly, our DT chunk includes things like “{Binding path=Address}”. This is a data field, presented within a bunch of container visual controls. Therefore, a DataTemplate precisely describes a (hierarchy of) container holding one (or more) data item.

The same template is repeatedly applied to the Address field (+ other fields) of each list item, to “present” each item on screen.

CommandBinding – is associated with command target

From http://msdn.microsoft.com/en-us/library/system.windows.input.commandbinding.aspx, I get the feeling that a command binding (CB) instance is associated with a command target. I’d say the CB instance is injected into the command target object, which is usually a visual control.

(This seems to echo the very common and essential data binding in xaml, where the binding object is injected into the target, not the source.)

I also get the feeling that CB is used only for routed command. If that’s the case, I feel this is a slightly advanced feature. For an initial grip on the commanding paradigm, some students should probably skip this CB topic. [[wpf succinctly]] doesn’t mention command binding or command target. My delegate command implementations don’t use CB either.

I understand command binding is crucial in routed commands, since the bubble or tunnel will scan the containment hierarchy stopping at a command binding. The builtin WPF commands are all RoutedCommands.

Jump IV Aug 2012

Q1: pros and cons of vector vs linked list?
Q1b: Given a 100-element collection, compare performance of … (iteration? Lookup?)

Q: UDP vs TCP diff?
%%A: multicast needs UDP.

Q: How would you add reliability to multicast?

Q: How would you use tibco for trade messages vs pricing messages?
%%A CM for trade and non-CM for price?

Q5: In your systems, how serious was data loss in non-CM multicast?
%%A: Usually not a big problem. During peak volatile periods, messaging rates could surge 500%. Data loss would deteriorate.

Q5b: how would you address the high data loss?
%%A: test with a target message rate. Beyond the target rate, we don’t feel confident.

Q7: how is order state managed in your OMS engine?
%%A: if an order is half-processed and pending the 3nd reply from ECN, the single thread would block.
AA: in ETS, Every order is persisted till EOD (to support bust/corrections by exchange or cancels by clients)

Q7b: even if multiple orders (for the same security) are waiting in the queue?
%%A: yes. To allow multiple orders to enter the “stream” would be dangerous.

Now I think the single thread should pick up and process all new orders and keep all pending orders in cache. Any incoming exchange messages would join the same task queue (or a separate task queue) – the same single thread.

3 main infrastructure teams
* exchange connectivity – order submission
* exchange connectivity – pricing feed. I think this is incoming-only, probably higher volume. Probably similar to Zhen Hai’s role.
* risk infrastructure – no VaR mathematics.

dependency-property internals – educated guesses

The POCO property is implemented by a backing field. Now (Reason to become obvious) let’s suppose the backing field is in a base class B. Both subclasses C1 and C2 expose some property on that backing field. If there’re 33 C1 instances and 44 C2 instances, then we have 77 of this backing field in memory.

For a DProp “IsDefault” in a Button class, the backing store (there must be one) is in some base class, but there’s no field named anything like “_IsDefaultField”. Rather, I guess all DProp data for the Button class is consistently, generically stored (similar to javascript or perl objects) in some hash table, where

* value — probably nothing fancy — a bool if the DProp should be bool
* key — a combination of the actual class (Button in this case) + the value’s type + the DProp name + …

For a Button instance in memory, if there are 80 DProps, then the hash table in the base class has, logically, 80 key/value pairs.

For a Label instance in memory, if there are 70 DProps, then the hash table in the base class has, logically, 70 key/value pairs.

Given 22 Buttons and 33 Labels on a screen, we have 55 hash tables. Logically, we can safely assume one hashtable per DependencyObject.

Without going any further, let’s step back and ask “Is this design enough to implement basic POCO property?” Basically setter/getters. I would say yes.

In reality we achieve memory efficiency because the hash tables are sparse. Out of the 80 DProps in the 22 Buttons, most of the 1760 values are defaults. All the default values are “removed” from the hash tables. http://stackoverflow.com/questions/7137291/how-does-the-wpf-dependency-property-design-save-memory-consumption and
http://stackoverflow.com/questions/9463216/how-dependency-property-holds-value have concise explanations.

Now, in this design the getter/setter have power features when used in conjunction with the “Hollywood registry” — Each of the 80 DProps in a Button is registered with the “Hollywood”. Therefore when the getter/setter runs, the Hollywood intervenes. Most important power feature is change notification. Overall, this Hollywood is still a mystery to me.

VAR vs DYNAMIC in c# — first look

If you declare AND initialize a variableA of “var” type, compiler figures out the exact type of this variableA. Say it’s Account. This variableA will be this type forever. In fact, compiler must get enough info to infer the exact type of variableA. Otherwise compile time error.

If variableB is declared “dynamic” type, then you can declare it without initializing. Then at run time you can assign an Account object to it, subsequently assign an integer to it. The actual type of variableB is mutable at run time. This is a bold departure from c++/java, where every variable’s type is always immutable.

You can get run time error (not compile time) with variableB, if you reference a member of variableB and the member doesn’t exist at time of evaluation, which is run time. Put another way, Evaluation is NOT at compile time. See simple example at http://msdn.microsoft.com/en-us/library/dd264741.aspx. In this sense, dynamic type is more lenient than Object type as “evaluation” is postponed to the very last moment at run time.

Dynamic type was designed for COM objects.

Only local variables can be “var”, but dynamic can be fields, method params etc.

##most important EM asset classes

According to my own informal survey, “Emerging Market” desk covers

#1 FX
NDF – I think many EM currencies are NDF.

#2 IR and bonds of EM countries – mostly sovereign, also corp

#3a EM IRS — is the largest sub-sector within EM FixedIncomeDerivatives
#3b EM credit derivative — is mostly on sovereign bonds

In EM derivative space, equity derivative is less significant than FX and FI derivatives.

Equities, commodities, … are less significant to EM. I guess there’s no separate EM desk for eq/comm as there are specialized EM FX/FI desks.

##most popular IR drv

According to an IRD veteran friend…

1) Swaps swaptions
2) FRA
3) caps floors. Rate locks aren’t popular

These are widespread enough to qualify as vanilla IR derivatives. All other IR derivatives are exotic.

Both vanilla and exotic are customizable and therefore “structured”.

Exotics are by definition less common, but among them the relatively popular ones are–

* range accruals (often callable)
* Cliquet? popular among Eq derivatives, not among IR derivatives.

nested list-comprehension (python): untangled#venkat

>>> [innerItr for outerItr in [[‘_’+base , base+’Const’]  for base in ‘VectorInteger EquityAssetVolatilitySurface’.split()]  for innerItr in outerItr]

[‘_VectorInteger’, ‘VectorIntegerConst’, ‘_EquityAssetVolatilitySurface’, ‘EquityAssetVolatilitySurfaceConst’]

—– That’s the python IDLE response. Now let’s unravel it. —–

The easy part — the split expression returns a LIST of strings.

[[…] for base in …split()] returns a List of List (LoL). Note You can’t inject into output stream 2 items for each input stream item. List comprehension only supports injecting one item. See P86 [[python essential ref]].

outerItr in [..split()] – the “outerItr” is an iterator and represents each inner List. To open up an inner list, we put for innerItr in outerItr at the END. This resembles a double for-loop – as explained in P85 [[python essential ref]].

First expression inside the outermost [], before the very first “for” is the select-clause. In our case it’s the expression “innerItr”. Like in SQL, this is the last thing parsed. This expression is evaluated inside the double-for-loop

Note the outermost [] pair is required. It makes the entire expression a list-expression. I don’t know exactly what happens if you omit the pair, probably not a good idea.

>>> [outerItr for outerItr in [[‘_’+base , base+’Const’]  for base in ‘VectorInteger EquityAssetVolatilitySurface’.split()]]
>>> [[‘_’+base , base+’Const’]  for base in ‘VectorInteger EquityAssetVolatilitySurface’.split()]
—-> same response
[[‘_VectorInteger’, ‘VectorIntegerConst’], [‘_EquityAssetVolatilitySurface’, ‘EquityAssetVolatilitySurfaceConst’]]

>>> [outerItr[0] for outerItr in [[‘_’+base , base+’Const’]  for base in ‘VectorInteger EquityAssetVolatilitySurface’.split()]]
[‘_VectorInteger’, ‘_EquityAssetVolatilitySurface’]


double meanings (c#): new, using, yield

In C#, a number of keywords are given 2 unrelated meanings.

using — typedef
using — name space import
——– unrelated to ———–
using — resource management (IDisposable)
Yield() — static method Thread.Yield()
——– unrelated to ———–
yield — iterator
new MyClass() — on class types
new MyStruct() — on struct types
** does NOT necessarily hit heap; See P55 [[c#preciely]]
** doesn’t return pointer;
** entirely optional. Only needed if you want to call the ctor of the struct.
**** without new, a value type object is created uninitialized when you declare the variable.
See http://stackoverflow.com/questions/7767669/why-is-it-possible-to-instantiate-a-struct-without-the-new-keyword
——– unrelated to ———–
new — redefine/hide a field, method, property etc
Not a keyword, but 2D-array in c# can be either jagged or a matrix

tabbing policy in swing, briefly

See http://docs.oracle.com/javase/tutorial/uiswing/misc/focus.html

The policy of a Swing application is determined by LayoutFocusTraversalPolicy. You can set a focus traversal policy on any Container by using the setFocusCycleRoot method.

Alternatively you can pass focus-traversal-policy-providers to the FocusTraversalPolicy() methods instead of focus cycle roots. Use the isFocusTraversalPolicyProvider() method to determine whether a Container is a focus-traversal-policy-provider. Use the setFocusTraversalPolicyProvider() method to set a container for providing focus traversal policy.

credit e-trading – basics

2 “external” venues —
$ (ECN) interdealer electronic brokers — Bloomberg, Marketaxess, TradeWeb, BondDesk, NYSE, TMC. These are like the exchange-connectivity interface.
$ Retail-facing Distributors – Fidelity, Charles Schwab etc. These are often the retail-oriented portfolio/wealth managers. These portfolio managers are like the “client connectivity” interface.
* Each external connectivity above can have a customized FIX protocol.

Volume — 300 trades/day, 1000 RFQ(client inquiries)/day, but 4000 price updates/SECOND at peak! Probably incoming quotes. These would update internal cache within the bank. These “incoming” updates must be synchronized with other updates initiated from “within” the bank. Probably the trickiest technical challenge in this platform.

Most trades are institutional (often from wealth management firms) but there are retail trades as small as $5000/trade.

The treasury work-up process also takes place on some of these ECN’s.

Most important products — corporate bonds, CDS, CDX.

(Based on a major credit trading sell-side.)

3 financing solutions PB offers hedge funds

To a hedge fund (HF), arguably the most valued service by a prime broker (PB) is financing. 2nd is probably execution. Brokers by definition provide access to liquidity, but at what speed? Both #1 and #2 give rise to white hot competitions among brokers, who often invest heavily to offer the most competitive “service” to attract the big hedge funds.

Besides the top 2, Book keeping, back office, accounting etc are essential services too.

I see 3 common financing schemes —

1) margin lending — hedge funds buying on margin is the most common form.
2) stock lending — hard-to-borrow will entail a heftier fee.
3) repo

In all 3 cases, PB earns a fee/interest proportional to the loan duration.

For (3), the PB can provide either repo or reverse-repo service to a hedge fund. Either collateral-out-cash-in or collateral-in-cash-out. I feel the cash-out version (PB-cash->HF) is what hedge funds need most. Overnight to 3 months, rarely longer.

high volume low latency trading GUI techniques

thread pool??
heavy processing done in the background?
paging — table to speed up table updates
subset – each user selects a subset of the symbols
multiple sorted views of the same underlier data?
avoid fireTableDataChanged(). Favor the smaller fireXXX() methods
keyboard shortcuts
sorting — often needed by user, given the large data volume.
minimize hand movements

reliably convert Any c++ source to C : IV

More than one person asked me “Can you compile a c++ app if you only have a c compiler?”

Some of the foremost experts on c/c++ compiler said on http://www.edg.com/faq/convert —

If you mean “can you convert C++ source to C source, and run the C through a C compiler to get object code“, as a way to run C++ code on a system that has only a C compiler, yes it is possible to implement all of the features of ISO standard C++ by translation to C source code, and except for exception handling this produces object code with efficiency comparable to that of the code generated by a conventional compiler.

For exception handling, it is possible to do an implementation using setjmp/longjmp that is completely conformant, but the code generated will be 5-20% slower than code generated by a true c++ compiler.

long gamma + delta hedging

Long-gamma is one of the most important business models. I believe both buy-side and sell-side like it.

To keep delta-hedging you need to continually buy/sell underlier. There is a transaction cost per trade, so typically you adjust once a day, either buying or selling the udnerlier. Another way to reduce the transaction cost is via limit orders.

If you long a call,

* When stock rises, delta rises, you have too much delta. So you sell stock (high)

* When stock drops, delta drops, you have too little delta. So you buy stock (low)

If you long a put,

* When stock drops, your negative delta balloons, you have too much negative delta, so you Buy stock (low)

* when stock rises, your negative delta shrinks, you have too little negative delta, so you Sell stock (high)

Therefore, long-gamma would buy low and sell high the underlier. Someone said “the larger the underlier moves, the larger the profit”.

Long gamma has other costs — the initial premium, and theta decay. Someone said

“If realized vol loss

If realized vol > implied vol => profit”

I think the author means “implied vol at time of purchase”.

See also http://www.volcube.com/resources/options-articles/gamma-trading-and-option-time-decay/

16bit page-counter to Estimate when a webpage is hit the 1,000,000th time

We don’t need to estimate the hit Frequency which could be time-varying.

If we can use a 2 counters, we can precisely determine the 1,000,000th hit. One slow-counter one regular fast counter. But that means we use 32 bits for our counters, like a 32-bit counter!

void increment(){ // was named count()?
  static int count16bit;

  long unsigned int now = system_time_in_nanos();
  if (now%16 == 0){ //just check last 4 bits of “now”
     //now check count16bit
     if  (count16bit <= 0){cout<<"got it"<<endl; }

https://en.wikipedia.org/wiki/Approximate_counting_algorithm#Algorithm is the standard implementation of a similar idea.

daily PnL of a trading account, basics

Typically, for a given Book, EOD “daily-pnl” is defined as

   closing-MV – open-MV.

Open-MV could be yesterday’s closing-MV. I think yesterday’s closing MV could be negative — if you short-sold IBM before IBM doubled. If you buy some IBM today but  closing price is the same as your trade price, then this new trade has zero impact on PnL. The cash you spent was part of yesterday’s closing total book value.

All the PnL numbers are total PnL i.e. unrealized + realized.

To see how daily-pnl adds up, suppose today is Day 8.

Day 8 daily PnL = Day8 closing MV – Day7 closing MV.
Day 7 daily PnL = Day7 closing MV – Day6 closing MV.

Day 7 pnl could be a loss, but it doesn’t affect Day 8 PnL.

BNP (NY) FX algo trading IV 2012

Tick data needed for … back testing, analysis? Quants use R, matlab etc to analyze data. IT don’t use those.

Q: how can you help my desk make more money?

Q: from a low-level interviewer — describe to me a challenging technical design (and expect me to drill in).

Q: We know the drawback of auto_ptr. Now write an auto_ptr template class spec (without function bodies) with private op=()

Q: describe some threading challenge in your low-latency system.

Q: how would you use pigeons for IPC (possibly across machines)?
Q: what’s a unix domain socket?

Q: is Throwable checked or unchecked exception?

Q: how many incoming/outgoing orders a day?
Q: peak incoming order rate

(I feel they noticed my pretrade pricer as it’s similar to their market making engine.)

Q3: what pretrade pricing rules did you have? Describe how they work in real life
Q3b: what’s the peak price update frequency?

Q: in your pretrade pricing engine, how many messages do you send out each day?

Q: how does the pretrade pricing system interact with other systems?
Q: are the conduits more retail or institutional?
Q: how does the asset valuation work?

%%Q: what do quants here do differently from quants in der pricing?
A: tune parameters; analyze data and come up with strategies; Sounds simple but a lot of work.
%%A: constantly improve the strategies and parameters.

%%Q: 20,000 euro loss would be realized loss?
A: yes

%%Q: what if multiple strategies trade the same currency pair without knowing each other?
A: multiple live strategies can trade the same pair. They should be designed to minimize correlation and know each other.

non-event-driven trade origination (Charles River)

(Background — all order origination must be driven by something, sometimes by the clock!)

Apart from event driven algo trading, a lesser-known type of semi-algo trading system is what I call trading signal generation. In some trading software (Charles River?), you can configure portfolio balancing “rules” to automatically generate candidate trades — trades needed to balance a portfolio. These candidate orders start a “workflow” and show up on the order blotter. Trader can take her time to decide when to hit the market.

These trading signals are not event driven, not CEP type. They could be driven by a periodic revaluation. I think it’s also possible to start a book-revaluation on-demand, perhaps when the asset manager decides to do so.

The asset manager could be a private wealth advisor or a fund manager. Portfolio balancing is important to asset allocation ratios.

Unlikely high frequency shops, these candidate trades are not automatically sent to the exchange. Therefore, the impact and risk are less severe. Without human intervention, the risk is much higher. I guess that’s why the high frequency shops usually use small orders, making many small gains and many small losses.

There’s also a 3rd (middle-ground) type of algo-trading, where a human trader (not an operations person) monitors the automated trading machine, either by market order, limit order, RFQ, RFQ-auto-response, or ECN quotes (always executes off the ECN). Under each category, human intervention level (and risk) are rather different. The human trader watches the orders sent, requests received, quotes sent/received and can jump in and take over. This 3rd type is also event-driven.

replace STL with more efficient containers@@

Q: Does anyone ever need to replace STL with more efficient containers?

I have not heard of any.

I feel many attempts to “optimize” or “enhance” STL will resort to RTTI and inheritance. Note inheritance is hard without RTTI — See http://bigblog.tanbin.com/2012/03/virtual-keyword-adding-complexity.html. RTTI incurs several run time costs, usually negligible, but not in the most competitive high performance systems. STL inventors made the conscious decision to completely avoid RTTI. See [[STL tutorial]]. I think a major justifications is efficiency.

Most large c++ systems have their complexity in OO object hierarchy/graph. (Remember all 23 classic design patterns involve some kind of type hierarchy.) However, STL complexity lies in templates. I feel container/algorithm templates add compile time complexity but zero (?) run time complexity.

I feel iterators and functors also add overall system complexity but not run time complexity.

Allocator is an efficiency feature, so it improves efficiency not reduce efficiency.

prop trading^mkt-making – intertwined

These terms’ meaning become progressively vague as they spread into everyday English, but for now, let’s look at the strict definitions.

Prop Trading basically means “orders initiated regardless of client requests”, which is different from sell-side Mkt-maker’s trading.

However, a market maker often needs to initiate orders as a hedge, or to exit a position.

Additionally, a market maker always has discretion as to which client order to ignore.

A lot of prop trading takes place in sell-side firms, along with the market-making system, so these special prop traders can often gain insight from the MM order flows. Look at front-runners.

order internalization

I guess internalization is not automatic. Special logic needed.

https://www.fool.com/investing/2018/03/19/how-does-robinhood-make-money.aspx explains

Brokers can also match up buyers and sellers on their own in a process known as “internalization.” If one client wants to buy 100 shares of Advanced Micro Devices and another wants to sell 100 shares, the two orders could be matched up internally, and Robinhood could collect the very small difference between what the buyer pays and the seller receives.

———- a veteran’s answer ———-
“I don’t think we have logic locally to cross against firm automatically. The trader would have to send an explicit order to cross against firm. There is a Smart Order Router layer that intercepts order and they may have some logic there to automatically cross against firm.”

On 6/20/2012 3:10 AM, Bin TAN (Victor) wrote:

See job spec below about “internalization”. Is there non-trivial business logic about that in your system? I guess if a client places a limit buy order and the internal best offer is better than the exchange best offer then do it internally.  Is it that simple or there are hidden complications.

Not sure about market orders but I guess if the internal best offer is better than the exchange best offer then obvious…

coherence Q&A

What is coherence used for in a typical project? What kind of financial data is cached?
[BTan] position data, booking, product data, (less important) market data

[BTan] Coherence could in theory be a market data subscriber.

Why those data need to be cached?
[BTan] replication, cluster failover

Do we know the cached data’s structure already before caching them? [BTan] (yes) ( for instance, are they predefined JAVA beans ), is POFSerilizer used ([BTan] no) or are they implementing Portableobject ([BTan] yes) and registered with pof-config.xml ([BTan] yes)? Why one is chosen over the other?
[BTan] we have huge business objects. rooted hierarchy

Do the data have a life cycle?
[BTan]  no

How do coherence know if the data expired and remove them?
[BTan]  http://download.oracle.com/otn_hosted_doc/coherence/341/com/tangosol/net/cache/CacheMap.html#put(java.lang.Object, java.lang.Object, long)

Why do people need coherence? For performance or for large data caching purpose?
[BTan]  both

How many coherence nodes are installed on how many servers?
[BTan]  60 nodes on 6 machines 16GB / machine

What is the magnitude we are looking at?
[BTan]  at least 12GB of base data. Each snap takes 12GB+. Up to 5 snaps a day.

Why that many servers are needed?
[BTan]  machine failover

is it constrained by the individual server’s memory? How to define a coherence node’s size?
[BTan]  1G/node

What is the topology of the coherence architecture? Why is it designed that way?
[BTan]  private group communication

Is it Multicasting or WKA? Why is it designed in that way?
[BTan]  multicast, because internal network

How do you do the trouble-shooting? Do you have to check the log file, where are those log files?
[BTan]  JMX monitor + logs on NAS storage

quantitative feel of bond duration – mapping absolute 1% -> relative x%

In the simplest illustration of modified duration, if a bond has modified duration == 5 years, then a 100bps yield change translates to 5% dollar price (valuation) change.

Note that 100 bps is an Absolute 1% change in yield, whereas the 5% is a Relative 5% change in valuation. If original valuation == $90 [1], then 100 bps =>> $4.5 change.

After we clear this little confusion, we can look at dv01. Simply set the absolute yield change to 1 bp. The valuation change would be a Relative 0.05% i.e. $0.045. The pattern is

Duration == 5 years => dv01 == 0.05% Relative change
Duration == 6 years => dv01 == 0.06% Relative change
Duration == 7 years => dv01 == 0.07% Relative change

Note 0.05% Relative change means 0.05% times Original price, not Par price.  Original price can be very different from par price, esp. for zero bonds.

[1] 90 in bond price quote means 90% of par value. For simplicity we would assume par is $100, though smallest unit is $1000 in practice.

(See P10 of YieldBook publication on Duration.)

long gamma == long realized vol@@

A rule suggested by http://www.surlytrader.com/trading-gamma/ says “Long Gamma -> Profit when realized volatility is greater than the implied volatility of the purchased option”.

That’s a bit complicated for me, but here is what I know — If you buy either a put or a call ATM and then delta hedge, you would make (unrealized) profit when realized volatility turns out to be high. If instead sigma_r is low, I guess you still make a small profit. You get 0 PnL (ignoring premiums) if sigma_r is 0.

sigma_r means realized vol; sigma_i means implied vol.

http://tylerstrading.blogspot.com/2009/05/gamma-facts.html says “Typically in positive Gamma trades we seek realized volatility, as the more the underlying moves the better your chances for raking in profits.”

I believe this assumes delta hedge. The scenario is that during the holding period underlier moves but your delta hedge (by a stock position) is fairly effective so whatever your option gain or loss due to its delta (say around 50%) is offset by the gain or loss of your stock position. However, the gamma contribution to your PnL would be positive.

Another observation (“rule”) is
* vega measures your exposure and sensitivity to Implied vol.
* gamma measures your exposure and sensitivity to Realized vol.

Someone said, if sigma_i goes up by 1 basis point, your PnL is equal to vega.

##autoREO quote pricing rules, again

For each position in a trader’s book, she can pick one of the pricing rules. Once a rule is attached to a position, the rule has a life of its own in this “algo-trading” engine. Whenever one of the observables change, the rule would fire a cache trigger to update the quotes, which exists off that position. Everything lives in the cache. CEP-like.

#1 pin rule – “pin my position” to the primary YieldCurve of the desk. We basically add a spread on the pin yield to get the bid-ask yield.

#2 eval rule – use last traded price on the live market for that security. We basically add a spread on the eval yield to get the bid-ask yield.

#3 DCA rule – use dollar-cost-average to get a “cost price”. Convert to yield, and add a spread on it to get the bid-ask yield.

#4 Treasury rule – we follow the live Treasury quotes. We periodically (10 sec) poll our live cache to reprice our quotes. We basically add a spread on the T yield to get the bid-ask yield.

** Less popular – Libor futures quotes, T-futures quotes.

#7 Arb rule — There are 2 “model” accounts, aka prop trading accounts. Any security in those accounts is priced by the model. Outputs both bid and ask. We just take them as is, without adding any spread.

#8 Lastly, MTM rule – there’s real time mark-to-market done on most positions – supposed to be fair valuations. This rule basically says take the “mark” yield and apply a spread to get the bid-ask yield. Now the confusing part – many of the marking rules are the _same_ ones listed above. However, there was a separate family of marking rules and a separate family of quote pricing rules.

I now think this can give rise to a cascade or ripple effect. Position A has a mark rule triggered by an eval, so position A mark-to-market valuation is updated. Then Position A or B has a quote pricing rule referencing A’s mark, so in a 2nd wave the bid/ask gets updated.

small old-guard quant fund – some facts and figures

This is one of the earliest quant funds – stat arb sort of thing. “Definitely a quant fund, rather than a macro fund, but not high frequency.”

Quant group 12 guys. Write most of (what i call) the business modules. (In contrast, mkt data consumption and OMS – 2 infrastructure pillars — are owned by the System group — what i call the pure tech, math-free modules) These business modules generate orders, achieve certain target positions, manage risks… As [[blackbox]] pointed out, quant traders think in terms of entering/exiting positions.

System group – 2 system admins and 4 c++ developers. I guess one of them is a network guy.

Mostly equity cash, but also commodities and (eq?) options. Trading is fully automated, forecast-based.

One model may have a trading horizon of hours
One model may have a trading horizon of days
These 2 models may overlap if they cover the same name. There is a feature of the trading system to manage the overlap.

(No model with trading horizon of seconds – not really high frequency.)

GUI is x-win. Whole company is linux/solaris, without windows.

Sybase – used lightly, now phased out. Persistence is done without database, probably in flat files.

Primary app language is c++ — threading, IPC, TCP, multicast for mkt data feed handler. No RV.

Various scripts – often in perl.

vol surface needed for risk mgmt

How is vol surface used for risk management? Mostly for vega i.e. sensitivity to implied vol fluctuations.

There are 2 advanced concepts — term-structure vega vs vega maturity, but the basic one is just “vega”, defined as position MV change due to implied vol move.

For an European style position, you don’t need vol surface. Just simulate a bump in sigma and calculate the new MV using BS.

For any non-European style option or option strategy, we assume a parallel shift of entire vol surface.

A more fundamental need for vol surface is marking and PnL. Liquid option positions may not need the vol surface (can use market prices) but most other option positions do. Needless to day, realistic valuation is the basis of risk management.

default-default table cell renderer

System.out.println(System.identityHashCode(new JTable().getDefaultRenderer(Object.class)));

System.out.println(System.identityHashCode(new JTable().getDefaultRenderer(Object.class))); // different address

You can see each jtable has a default-default-default render instance. When I say default-default… I mean the renderer for Object.class.

Given this renderer instance is shared by all cells of the jtable, you can customise this instance to control the default appearance of many, many cells. This object is stateful — actually a subclass instance of JLabel.