Labels

_fuxi (75) _IV (146) _misc (5) {610610 (30) algo (1) automatedTrading (8) banking/economy (3) book (14) c++misc (125) c++real (15) c++STL/java_container (7) cppTemplate (1) db (13) DB_tuning (4) deepUnder (1) dotnet (69) eTip (17) excelVBA (12) finance+sys (34) financeMisc (24) financeRisk (2) financeTechMisc (4) financeVol (21) finmath (17) fixedIncome (25) forex (16) IDE (24) invest (1) java (43) latency (4) LinearAlgebra (3) math (30) matlab (24) memoryMgmt (11) metaPrograming (2) MOM (15) msfm (1) murex (4) nofx (11) nosql (3) OO_Design (1) original_content (4) scriptUnixAutosys (19) SOA (7) socket/stream (15) sticky (1) subquery+join (2) swing (32) sybase (6) tech_orphan (12) tech+fin_career (30) telco (11) thread (21) timeSaver (13) tune (10) US_imm (2) US_misc (2) windoz (20) z_algo+dataStructure (4) z_arch (2) z_c#GUI (30) z_career (10) z_career]US^Asia (2) z_careerBig20 (1) z_careerFinanceTech (11) z_FIX (6) z_forex (31) z_hib (2) z_ikm (7) z_inMemDB (3) z_j2ee (10) z_oq (14) z_php (1) z_py (26) z_quant (4) z_skillist (3) z_spr (5)

Tuesday, October 25, 2016

stick~unix command names in blog titles


"find" /  "less"  /  "make"  are hard to include in blog titles

Suggestion: use qc(...), inspired by perl qq(), qx(), qw().
More specific (and searchable) than the other solutions

Suggestion: use quotes
Suggestion: use all caps

Monday, June 13, 2016

sticky~shorthand used in blog titles

my blog titles are becoming too long...

"`" backtick without a trading space means "-ing"
"@" means on or of or at
"]" means in
"+" means and or with
2 means to
"=" means "is" or "are"

Sunday, November 29, 2015

sticky%% imprints/reputation - java ^ c++

I feel my c++ interviews aren't so successful (http://tigertanbin2.blogspot.com/2014/03/weakness-revealed-by-interviews-c.html), but many traditional efforts may generate diminishing returns. (eg: Home coding project can be very time-consuming). Instead, perhaps we should look for special "imprints" – knowledge pearls that help us impress and stand out during competitive interviews. In a way, we must beat the interviewer on some front since on many questions we would be beaten.

Venkat can often stand out within a short conversation, due to his imprints.

My java interview experience – I managed to impress interviewers and stood out although my coding/design may not stand out. Am I a stronger java guy than my friends? I guess only if you quiz me on those special topics
- lock free
- wait/notify intricacies
- condition variable as replacement of wait/notify
- custom thread pool
- volatile keyword intricacies
- skip list (sorted set)
- concurrent hash map
- special singletons

Targets (memory/threading helps efficiency) --
* subvert the virtual mechanism P928[[primer]]
* dtrace
* placement new - real use cases
* replacement of RTTI
* data alignment in market data wire format
* memory page locking
* alloca()
* custom new() and free list in [[eff c++]]
* lock free - real code not concept
* template partial specialization but I don't know the use cases?
* various custom-made smart pointers with special features -- [[safe c++]]
* memory leak detectors - home made (eff c++?)
* comma operator

Saturday, November 28, 2015

## c++ know-how for coding IV

## c++ know-how for coding challenge

cStr and std::string
array, vector, sorted data structure (i.e. stl map), unordered_map
stack, queue
pointer arithmetic
iterator – basic usage
shared_ptr
Node class used in a linked graph
dtor, copier, op=
ref
double pointer

adv: matrix
adv: circular buffer

no exception
no stl algo
no pointer to function
no template
no (very, very seldom) threading

Monday, November 23, 2015

## c++topics seldom quizzed

(master -> pearl)

some low-level details I thought would be popular but seldom asked:
* L-value
* iterator types and implementations
* static variables outside classes
* implicit acts of magic by compiler
* array and cStr – syntax, memory, ... the gory details beyond the basics
* template specialization
* ref/pointer typedef inside  templates
* non-dummy-type args in template
* MI
* enum
* exception spec
* C integration
* pimp
* fwd declaration
* namespace
* linker
* extern
* double pointers
* hiding rule
* swap – all the important usages and no-fail
* overloading and  method resolution
* casting and conversion
*** OOC and  conversion ctor

-- "mid-level"
* boost Any vs Variant
* i/o stream
* regex
* file access (including random)
* serialization
* memory leak detection
* details of boost thread
* boost smart pointer beyond the shared_ptr
* std::string details


Friday, November 13, 2015

label: eTip - tips on electronic gadget + online stuff

Could introduce to the recrec blog

Sunday, November 8, 2015

typical US job agency CEO doesn't sponsor new H1b

Here's what I wrote. Updated for this blog.

---------- Forwarded message ----------
Date: Fri, Jun 19, 2015 at 6:12 AM

Hi David,

I spoke to Alex. Alex is clear their clients aren't willing to wait for months to hire someone, so the only way is for me to be in the US first, sitting on the bench while attending interviews.

His firm seldom sponsors new H1b because Sans doesn't have a system to bring in people like me to sit on the bench for a while before placing me. I said I could return part of the bench salary but Alex knows those "backdoor" practices and he's not keen.

He said some agencies (I guess mostly South Asia) are in the business of bringing people in, and in their established process the candidate and the agency are both protected. "Protected" is the Alex's choice of word. I guess it means financial, legal and other protections.

Clearly he doesn't know me enough to take the special route and sponsor my new h1b petition. He said that's a long process and his company is unfamiliar with it so they must research. I feel this is probably true. He may have to pay someone for the research. Unfamiliar means slow process, more uncertainty and possibly risks of missteps.

Saturday, November 7, 2015

Most algo interviews don't care about efficiency

Most challenging algo interviews (onsite) are really about "solve it by hook or by crook" regardless of efficiency. (Usually there isn't, but if there's an obvious brute-force solution it gives you no credit anyway.)

In the toughest algo questions, usually there's no memory capacity issue to worry about.

Occasionally, interviewer stipulates O(N logN) or O(1)

Once we solve it we can improve efficiency. It's a second phase. Can be easier than first phase.

In that case threading, sorting ... are unimportant. Instead we need judicious use of trees, recursions, pattern recognition... and very clear thinking.

See [[EPI300]] and the green book by Zhou Xinfeng

Tuesday, October 20, 2015

hibernate - config properties 4 ways to set

Four "equivalent" methods:

1) xml -- Traditional
2) properties file -- Traditional
3) set programmatically in source code
4) pass in on java command line as -D

maven + nexus


A vanilla Maven repository is just a web server with a directory structure of versioned jars... While you can use any old web server as a Maven repository, there are many administrative headaches to consider.

Friday, October 16, 2015

[[automate the boring stuff with python]]

This book teaches just enough python features for the purpose. All
non-essentials are left out.

--sub chapter on selenium
the easiest way to use selenium and drive a browser, IMO.

--Chapter on Excel
text file <-> spreadsheet converter
merge/unmerge
setting font in a cell

--Chapter on PDF:
combine select pages from many files

----
Chapter on CSV + json
Chapter on task scheduler
Chapter on keyboard/mouse control -- powerful

Sunday, September 27, 2015

quant developer requirement

Many quant developers (in our department) program in c# (for excel
plugin) or build infrastructure code modules around quant lib, but
they don't touch c++ quant business logic classes. C++ quant lib
(model) programming is reserved for the mathematicians, typically
PhD's.

Many of these non-C++ quant developers have good product knowledge and
can sometimes move into business side of trading.

I was told these quant developers don't need advanced math knowledge.

----quant interviews

Mostly C++ questions. Most candidates are filtered out here.

2nd group – probability, (different from statistics)

Some finance intuitions (eg -- each item in the BS formula)

Some brain teasers

-- some typical C++ questions (everything can be found from the Scott
Meyers books)

exceptions during ctor/dtor

virtual ctor

Given a codebase, how do you detect memory leak

multiple inheritance (fairly common in practice)

threading


-----
[[heard on the street]] and [[A Practical Guide To Quantitative
Finance Interviews]]
Another book by Shreve.

get any city's local time from google

Go to google site (not the browser toolbar) Type "time New York"
without Enter. Wait for a second for google to build up its cache. It
will then show you the current local time.

Now I think you can also hit Enter.

Make sure the 'search tools' is enabled. I think browser toolbar fails
for this reason.

some benefits of learning c++, even if no salary increase

1) After learning c++, i am fairly confident I could if I must pick up
c# in a few (4?) months and start passing interviews. C++ is
inherently tougher than java and C#. Java and C# both have large
libraries, but the core languages are significantly simpler/cleaner
than c++.

2) After learning C++, i have found python and perl easier to
understand and master since both are written in C/C++. I now believe
some people who claim they could pick up a new language in a few
months. Those languages have their roots in C/C++.

- The basic challenges of scope+namespace, object lifetime,
heap/stack, pointers, memory allocation, object construction,
pass-by-ref/value, arrays, function pointer, exceptions, nested
struct+array+pointer... are faced by every language designer. Many of
these challenges depend on basic library, which is invariably C.

- The common OO challenges of inheritance, virtual, static/non-static,
HAS-A/IS-A, constructor, downcast, ... are faced by every OO language
designer. Many of them borrow from java, which borrows from C++ and
smalltalk

3) c++ gave me insight into java, esp. GC, JVM, overriding,
references, heap/stack, sizeof, ...

show/hide navigation pane (win7 explorer)

Explorer top menu bar -> Organize -> layout

why front office

* exposure to pricing decisions -- the most important decisions
* closer to traders and their decision support
* closer to profit center

Tuesday, August 11, 2015

Saturday, August 8, 2015

Fwd: memorize passwords - tips

I never let browsers remember my password. Rather I always type the passwords by hand as refresher. Furthermore, I practice logging in periodically – a necessary cost of maintenance, just like workout.

Password hint questions -- I'm yet to work out the best practice. How about
* all questions about places - hangzhou

--stock password
By using the same stock password on 5 sites, we might remember it more easily. However, when we change password on one of these sites, we have to remember which site

If you already came up with a unique password for a site and use it long enough, then you can stick to that forever. However, there's a risk of theft.

As a widely useful stock password, there should be numbers and letters (not asdf....) I'd put no caps and no meta characters.

If a site requires caps, I use London

--Classify the sites :
* Those sites with 2-factor: ok to have a stock password.
* xp:  Some sites are fragile -- would lock you out after very few failures. I'd avoid caps.
* A few (like 10) sites I access frequently. Easy to commit to memory. Better work out a solution for those infrequent sites.
* Obviously some accounts are critical. I tend to feel a large number (like 30) of sites are critical, but I had better pick no more than 10 as really critical, and think carefully about them.
* Some really critical sites have a 24-hour hotline but they may not be able to authenticate you over phone
* hsbc site is notoriously difficult, so I would use the simplest password, without caps.


Thursday, August 6, 2015

combine audio songs from 2 CDs to 1

First I start Nero express audio CD -> audio CD. Then I select the songs from 1st source cdROM. Then put in 2nd source cdROM and select more.

Then put in Writable disk and burn. You get an Audio CD that you can play directly in windows media player (and hopefully a discman).

Sunday, July 26, 2015

MSVS solution is more than a folder of MSVS projects

label: IDE, book

I agree the project is a more important development concept, but the solution also has unique, important functionalities. I found many of these functionalities from [[MSVS 2010 unleashed]].

* project dependency is described in the sln file.
* you can build an entire solution, according to the predefined build order
* a solution can contain so-called non-project items such as documentation. All such files are by default put into the "Solution Items" virtual folder.

Tuesday, June 30, 2015

MSVSE 2008 initial experience

I downloaded from http://download.microsoft.com/download/E/8/E/E8EEB394-7F42-4963-A2D8-29559B738298/VS2008ExpressWithSP1ENUX1504728.iso ( according to http://stackoverflow.com/questions/15318560/visual-c-2008-express-download-link-dead )

 

·         Only the "... with SP1" is needed.

·         I used hidownload (nice downloader to keep) to download the 700M file.

·         I used 7zip to open the *.iso

·         I ran the seup.hta

·         I didn't install the bundled SQL server express

Saturday, June 27, 2015

py dict serialize - 2 ways

--pickle
import pickle
print pickle.dumps(myDict)

---------
import json
print json.dumps(myDict, indent = 4)

# to verify
print eval(  json.dumps(myDict)  ) == myDict

a new prob measure is defined by ... a new PDF - Ahsan

Lida's lecture notes have a bit more details.

Sunday, June 21, 2015

c# ^ quartz dev skill

Now i feel the time spent learning c# and msvs (+ win services, MVVM, xaml, wcf...) is more worthwhile than quartz -- portable, strategic skills given the strategic clout of Microsoft. 

There's a lot of depth in the windows ecosystem. Java and c++ seem to be following c#.

Friday, June 19, 2015

even swap in FX swap lingo

STIRT uses this term frequently. Not sure if they mean the same as Tony said --

even swap must have the same ccy1 amount between near and far legs.

laptop sleep, hibernate, shutdown ....

* start-menu shutdown button => hibernate
* physical power button => sleep
* sleep button => sleep
* close lid => nothing

To power down completely, use start menu -> shutdown drop-down

Thursday, June 18, 2015

cpp compiler flags -I (capital) -L -l (small)

Many gcc command lines feature –I, -l and -L so better know them well.


Wednesday, June 17, 2015

linker option -l vs -L

Linker option –l (small ell) for the lib file name; -L for to specify the search path

 

----------

Finally, you must tell the linker where to find the library files. The ST-Developer Windows installation contains programming libraries built for use with Visual C++ 2005 (VC8) and 2008 (VC9) with the /MD flag, as well as versions that are link compatible with other compilers. These are kept in different subdirectories under the ST-Developer "lib" directory. The library directories available for Visual Studio 2005 and 2008 are as follows:

  • $(ROSE)/lib/i86_win32_vc8_md (2005, 32bit platform, /MD)
  • $(ROSE)/lib/x64_win64_vc8_md (2005, 64bit platform, /MD)
  • $(ROSE)/lib/i86_win32_vc9_md (2008, 32bit platform, /MD)
  • $(ROSE)/lib/x64_win64_vc9_md (2008, 64bit platform, /MD)

Select the Linker category of properties and, pick the General options under that. In the Additional Library Directories property, add the appropriate ST-Developer library directory.

 

 

victor.tan@macquarie.com (+65)660-10851

 

NOTICE

The information contained in this email is confidential. If you are not the intended recipient, you must not disclose or use the information in this email in any way. If you received it in error, please tell us immediately by return email and delete the document. We do not guarantee the integrity of any e-mails or attached files and are not responsible for any changes made to them by any other person.

 

Monday, June 15, 2015

CEV, very briefly

CEV has a formulation of sigma(t). It's a function of the current underlier price. A power function, to model the volatility smile...

SABR is related to CEV...

Sunday, June 14, 2015

understand "signing a cert" #open_q

A) understand the basics of "signing a msg"

B) understand the content of a cert
your name, your pub key

?

C) understand what it means to "sign a cert"
"treat the cert content as a message, and generate a digsig of it"

--

validate]biz obj ^ validation@user input

Q: give 1 or 2 simple but important reasons to favor either option?

I think sometimes you need extra "information" that's unavailable at UI layer. Example? zed credit check; credit card address check

Generally, we validate asap.

--

pointer in C and other lang - (early) learning notes

Every variable in any lang is a 3-some -- name + addr + content (but see the post on mutability, initialize etc). http://aelinik.free.fr/c/ch11.htm has a good explanation:


int x;
x = 7;

the variable x now has two values:


Left value: 1000
Right value: 7

Here the left value, 1000, is the address of the memory location reserved for x. The right value, 7, is the content stored in the memory location.
----
Now a few simple rules on & and *
rule -- &var1 returns address of var1.
rule -- I don't think &var1 can be on the left side of =
rule -- var1 must be a L-value expression. See http://bigblog.tanbin.com/2011/11/c-func-call-as-l-value-key-points.html

Now suppose we assign ptr1 = &var1

rule -- *ptr1 returns the content of var1. If you print *ptr1, and print var1, you get same.
rule -- *ptr1 can be on the left side of =

I believe *ptr1 == *(&var1) == var1

telco dnlg:inventory,parser

A phone company (or a telecom operator) with millions of customers need to maintain that many "circuit descriptors" in some database. I'll call them circuit descriptor databases -- cdd, but Verizon call them INVENTORIES.

In Verizon, a complete circuit descriptor is known as a DESIGN or a LINE RECORD, to be PARSEd.

Databases can be relational or non-relational. In Verizon, most if not all of these disparate databases (NSDB, iview, Virtual Inventory ..) are accessed through their FT (flow through?). An FT is the proxy sitting in front of a database. Any system to query the cdd must go through the FT, load the line record and parse it.

circuit descriptors are stored in different INVENTORIES according to regions/states and "services" such as FTTP, Layer-1...

telco dnlg: fttp=fiber *to-the-home*

optical fibers go right up to the ont box, then cat5 (ethernet cable)
or coax cable (to re-use existing coax in the home)

--
Posted By familyman to learning finance,c++,py... <http://bigblog.tanbin.com/2007/07/fttpfiber-to-home.html> at 4/06/2007 11:24:00 AM

circuit modeling: data-driven, bottom-up, multiphase

In a published document, one of the SSCFI developers described our model building process as "data driven, bottom up and multi-phase". What are the phases in my FTTP parser?

* retrieve line record
* determine Protocol -- GigE or ATM
* build element filter for efficiency
* pre-fabricate common building blocks in anticipation of needs
* try a first template
* .... determine the best template
* instantiate connectors based on template
* propagate shared properties across circuit elements
* set AID and TID
* validate
* define previous and next
* define start and end
* (unfamiliar) add state descriptors
* record physical locations of circuit elements
* add layout for GUI

--
Posted By familyman to learning finance,c++,py... <http://bigblog.tanbin.com/2007/09/circuit-modeling-data-driven-bottom-up.html> at 9/02/2007 11:13:00 AM

to a novice programmer -- the importance of data structures in financial IT systems

Data structure is essential and non-trivial to every programming language on wall street -- java (collections), c++ (STL), python/perl (high-level data types)... A lot of algorithms (in the traditional, strict sense of the word) are created on or using classic data structures. There are a lot of jargons you need to grasp. Everyday programming requires you to be familiar with common operations on these data structures, but these are relatively straightforward. However, here are some of the non-trivial aspects of data structures and
algorithms

* sort python dict or tuple
* internals of hash table and ConcurrentHashMap
* STL container holding pointers
* STL pair
* STL stream iterators
* customize a sorted set/map for MyClass in C++, which is harder than java
* sort a map by value (real interview question) in java. Perl and python is easy.
* whiteboard-implement a blocking stack/queue (UBS)
* whiteboard-implement a basic hash table (MS)
* find top 99 in a large array (Barc) but no need to return them sorted
* choose array vs circular array vs linked list, in terms of memory efficiency (JPM).
* given 2 nodes in a binary tree, with no pointers except pointer-to-parent, find lowest common ancestor (Google)
* iterative tree walk (Barc)
* filtering iterator (MS)
* STL transform(), erase(), partition() etc
* STL allocators
* STL functors, binders
* STL iterator adaptors (back_inserter etc)




--
Posted By familyman to learning finance,c++,py... <http://bigblog.tanbin.com/2011/05/to-novice-programmer-importance-of-data.html> at 5/03/2011 07:34:00 PM

+= is the shortcut operator

a =-    3 ;
b =   -3 ;
I think they mean the same. Yes confirmed.
=- or =+ can only have one, unambiguous meaning. Therefore, if u want to subtract 3 from $c, you need
"c -= 3"


--
Posted By familyman to learning finance,c++,py... <http://bigblog.tanbin.com/2007/08/is-shortcut-operator.html> at 8/22/2007 12:17:00 AM

telco dnlg: GPON

Gigabit Passive Optical Network.

Passive = unpowered.

GPON is used exensively in FIOS.

fttp /contexx/ && trec

* More true blue hard-core telco stuff. When I described zed as telco dnlg, I felt insecure
* Right at the heart of a telco, not a peripheral system like CRM, self-care
* If you think online banking is shallow dnlg, then network testing is deep dnlg.

* standardized, portable dnlg
* needed in every telco
* FIOS glamour. u can ride on the wave.
* verizon is a market leader
* high entry barrier. Many telco-enthusiast develoeprs can gain some web or sms experience but no way to get this xp.
* deeper, higher complexity. u can ask why but i don't want to answer it.
* high volume

* high perf
* large team


--
Posted By familyman to learning finance,c++,py... <http://bigblog.tanbin.com/2007/07/thank-god-for-fttp-contexx-trec.html> at 4/05/2007 05:12:00 PM

weblogic server910_generic.jar

Q: where to find this jar?
A: according to google: go to bea download site, select "solaris 10 x86" and u will get server910_generic.jar
Q: Working on solaris on sparc hardware?
A: yes. Tested many times with T2000 servers.
Q: The jar can work on win32?
A: jdk150_08 will break weblogic910. Confirmed: jdk150_04 supports weblogic insalled from weblogic910_generic.jar


--
Posted By familyman to learning finance,c++,py... <http://bigblog.tanbin.com/2006/09/weblogic-server910genericjar.html> at 9/23/2006 12:53:00 AM

telco dnlg:expert system maintenance

sscfi and other Expert systems often make mistakes.

Q: is a mistake always easy to recognize by a human?
A: usually yes for sscfi

q: example of an obvious mistake in sccfi?
A: wrong diagnosis

Q: what other mistakes?
A: slowness

Q: How do u reduce recurring mistakes?
A: reviews by human experts

Q: how many such reviews each month?
A: about 1/day

hard edit vs soft edit when submitting order to mainframe

In one order entry system (A big European megabank), new orders are sent to mainframe. Upon validation, mainframe can return a message to the order entry system.

If the message is a hard edit, the order is rejected by mainframe validation module.

If  the message is a soft edit, the order is accepted by mainframe validation module. The soft edit is purely informational. Not necessarily a warning. No action is required on the user of the order entry system. I guess the soft edit is just "FYI".

--
Posted By familyman to learning finance,c++,py... at 3/15/2011 11:52:00 PM

cobol copybook = input format spec

a cobol-copybook is "a file describing an input data format".

"cobol copybook" is the standard term ("cobol-layout" is less common) for files like that mentioned in https://ssl.kundenserver.de/shop.softproject.de/downloads/CobolCopybookToolkitForJava.pdf

"copybook-datatypes"
"copybook-dataclauses"

-- based on http://edocs.bea.com/JAM/v51/program/egenapp.html
A COBOL CICS or IMS mainframe application typically uses a copybook source file to define its data layout. This file is specified in a COPY directive within the LINKAGE SECTION of the source program for a CICS application, or in the WORKING-STORAGE SECTION of an IMS program. If the CICS or IMS application does not use a copybook file, you will have to create one from the data definition contained in the program source.

A copybook is conceptually (not technically) part of a cobol program. Usually this copybook is a standalone file, included from its parent-program.

--
Posted By familyman to learning finance,c++,py... at 1/20/2008 08:53:00 PM

zed transaction volume - 50 tx/sec

Hi Tan,
Good to hear from you. We would have done close to 50 tps second during the
peak time.
Partha
----- Original Message -----
Sent: Wednesday, June 13, 2007 11:52 AM
Subject: interview question

> Hi Partha,
>
> How's your wife and daughter?
>
> I'm preparing for some interviews. One interviewer asked "how many
> transactions per minute at your (zed's) peak load". I said more than
> 50/minute and he laughed.
>
> Any idea about the peak volume in 2002?
>
> Thanks
>
>
>

JMV tuning top 2 topics GC ^ JIT

label - book

[[Java Performance: The Definitive Guide]] clearly hints that these are top 2 topics for the jvm performance experts.

Hul White -- learning notes

Hull white is simpler than LMM. Both Arbitrage free.

LMM has too many factors. Hull White can be one-factor or 2-factor.

disable python stdout buffering

http://stackoverflow.com/questions/230751/how-to-flush-output-of-python-print

python -u # didn't work for me...

sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) # worked

Friday, June 12, 2015

OIS instruments in YC bootstrapping - Jeff

Jeff's lecture notes has numerous practical tips, such as
*

fwd libor rate != instantaneous rate

Fwd libor rate , like a 20Y forward start 3-month Libor has an accrual period of 3 months. The inst fwd rate has an underlying loan with accrual period shrunk to 1 picosecond...

zero curve doesn't mean discount curve

Zero curve usually means the zero bond yield curve. I think it's usually upward sloping.

 

I think in STIRT/Sprite zero curve means the discount factor curve, so it's decreasing with maturity and always below 1.0.

 

A YC can be interchangeably represented as zero curve, discount curve, fwd curve (i.e. inst fwd rate) etc.

recombining tree requires Markov

Only a subset of HJM models have deterministic drift and vol. Without the deterministic nature, the Monte Carlo simulated binary tree would be non-recombining. See [[Hull]]

Thursday, June 11, 2015

Gaussian HJM, briefly

... is a subset of HJM models.

An HJM model is Gaussian HJM if vol term is deterministic. Note "vol" term means the coefficient of the dW term. Every Brownian motion must always refer to an implicit measure. In this case, the RN measure.

How about the drift term i.e. the "dt" coefficient? It too has to be deterministic to give us a Gaussian HJM.

Well, Under the RN measure, the drift process is determined completely by the vol process. Both evolve with time, but are considered slow-moving [1] relative to the extremely fast-moving Brownian Motion of "dW". Extremely because there's no time-derivative of a BM

[1] I would say "quasi constant"

Language is not yet precise so not ready to publish on recrec...

modified duration vs duration, briefly

http://en.wikipedia.org/wiki/Bond_duration

MacD / (1+ r/k)

So in the limit, when the compound frequency k goes to infinity (i.e. continuous compound), this becomes same as MacD.

fwd contract arbitrage concept - less useful

label - fwd deal

The basic relationship (between spot price, fwd contract price, T-maturity bond price..) is intuitive, low-math, quite accessible to the layman, so I decided to really understand it, but failed repeatedly. Now I feel it's not worth any further effort. It's not quitting. It's saving effort.

- interviewers won't ask this
- real projects won't deal with it, because the (arbitrage-enforced) precision mathematics simply doesn't manifest in the real data, perhaps due to bid/ask spread
- Only financial math literature makes extensive use of it

I think this is like the trigonometry or the integration techniques -- you seldom need them outside academics.

Tuesday, June 9, 2015

FX carry trade

 

http://www.investopedia.com/articles/forex/07/carry_trade.asp - shows example of rollover interest calc

 

 

victor.tan@macquarie.com (+65)660-10851

 

NOTICE

The information contained in this email is confidential. If you are not the intended recipient, you must not disclose or use the information in this email in any way. If you received it in error, please tell us immediately by return email and delete the document. We do not guarantee the integrity of any e-mails or attached files and are not responsible for any changes made to them by any other person.

 

Friday, June 5, 2015

arb-free IR model

... must model the (evolution of) entire YC, rather than some points on it, like (the evolution of) one Libor rate. This is a main theme of the lectures on Black's model, forward measure, HJM etc.

 

For more details, See the post on HJM

desktop search - full text, free

--Locate32 -- reviewed on http://www.techsupportalert.com/best-free-desktop-search-utility.htm. Mentioned in [[win7 annoyances]]

--Copernic -- reviewed on http://www.techsupportalert.com/best-free-desktop-search-utility.htm. The lite version is free

--SearchAndReplace -- reviewed on http://www.techrepublic.com/blog/five-apps/five-fast-windows-desktop-search-utilities/  .... supports the following file formats: ASP, DAT, HTML, INI, LOG, and plain text.

-----disqualified:
Everything - no full text... only NTFS disks

Sunday, May 24, 2015

non-static const member - is politically correct but impractical

label - cppReal

 

See http://stackoverflow.com/questions/634662/non-static-const-member-cant-use-default-assignment-operator. My take is that a non-static const member will break the standard assignment operation. You could mess around operator= but non-trivial.

Wednesday, May 20, 2015

RE: don't buy too many fin math books

For all the topics of the MSFM like option math, bond math ... my existing insight and understanding (acquired before 2013) is really in the first 10% of the course. I don't have the contexx to reach the next level:

thin -> thick -> thin...
develop intuitions

Therefore, those books I bought will not help a lot. I think reading alone without the contexx is more effective in programming.

However, good thing about fin math is low churn ... basically no change in the math theory.

No real work exposure. My c++/swing/py ... learning is more effective.

--some of the more practical topics (rough ranking)
IV questions like the red and the green book
bond math
IRS math
option math
basic Black Scholes

--some of the less practical topics
HJM
change of measure

Monday, May 18, 2015

[[api design for c++]]

pimpl – adv/disadv
scripting support by boost::python
API wrapping/layering -- extremely common technique

api styles:
- flat C style
- OO
- template

Yuri on yield curve models

HJM hard to calibrate. Usually using European swaptions.

Sunday, May 17, 2015

London bbg IV

Q: given a string of characters, find the longest "run" of any repeating character.

 

Q: given an array of integers, and a target, determine if there's any pair that add up to the target. Return true/false.

 

Q: maximum profit problem. Given a time series of historical spot FX rates, find the maximum possible trading profit by exactly one buy one sell.

Tuesday, May 12, 2015

DRW IV

a vector needs to allocate N instances of Account but Account has no default ctor. How does the compiler achieve it?

A: indeed the call to array new would prevent the vector<Account> concrete class from compiling due to SFINE rule or something like that. (Java and c# would use type constraints instead.) The compiler must be using 2 separate lines – one to allocate raw memory, the other to initialize the object.

 

However, when is vector internal array allocated by array new? I discussed with Ashish but found no answer.

 

Q: why do you need to write your own smart ptr?

A: super simple one, just to deal with some issue of the raw ptr... probably dangle pointer, by overriding the deref operator?

 

Q: why use unique ptr when shared ptr is general purpose

A: threading...

 

Q: is the lambda functionality doable in c++98? what is the c++98 equivalent?

 

Q: OK you don't use c++11 at work, but do you hack around at home?

 

Q: why is  the bid/ask spread much wider in options than the underlier?

A: must be the risk to the writer. Competition didn't drive down the bid/ask spread like it did in FX and cash equities.

AA: delta hedge adjustment can't be done every second. Before the next adjust, the risk to the writer (market maker and quoter) would be quite high.

 

Wednesday, May 6, 2015

sticky## c++weakness revealed by interviews(+projects)

See also pearl post on "sticky:High-end c++ developer interviews tend to beat us in 2 ways"

Relative to java/c#, c++ questions are more low-level (often using non-OO constructs). This is generally my strength.

I used to feel confident I can see patterns in tech interview questions and figure out what specific types of knowledge is required at a certain seniority. I was fairly successful with java/SQL/c#, but less so with c++. Based on the past questions i'm trying to make out the patterns.
=======weaknesses revealed by interviews. Probably need more work experience
(No one tested me on MI, template wizardry, etc)
STL useful tricks (like swing) -- Shanghai, synechron, Jap, WQ
specific threading constructs/techniques -- sapient, jump, SCB
boost -- jump, Jap, synechron,
mem management/optimization (like heap-only classes) -- barc-mtg, nQuant
[lg] socket -- nquant
firm grasp of language features (like rvalue ref) -- 3Arrow, bbg
essential class-based techniques/constructs (eg ref counting) -- Miami, espeed, nQuant,
[lg] COM - Barc RnA
c++11 features - DRW, 3arrow
initializing common data structures like arrays, vectors, classes -- needed in a lot of coding challenges

==These are harder to self-study -- too specialized and no pointers
linux (instrumentation) tools like truss, LD_library_path -- jump, Miami, nQuant
[lg] essential/deeper know-how (signals, OOM, stack size) not expected of a junior developer ...-- jump, Japanese, nQuant, 3Arrow, barc-mtg
[lg] extreme low-level optimization (CPU cache, custom-RTTI, byte alignment, placement new) ..-- Miami, nquant, jump

=========much-needed practical skills not quizzed by IV
pre-processor tricks
python integration
makefiles, continuous build
pthreads
debuggers,
memory leak detectors,

Tuesday, May 5, 2015

pass individual instances of MyClass to initialize an array of MyClass

Context/Requirement is quite clumsy to describe.

 

Suppose you have an array field Student[40] in Professor object and you need to write a Professor ctor, and use initializer list for that field. It's tricky, but I did it in the Tetris code...

sticky~elements of an ideal "longevity" job

(master copy -> pripri)

Friday, May 1, 2015

sticky~why re-enter c++ if salary could be lower and jobs fewer@@

If you really write down your J4, and “discount” [1] each, you realize at some point the J4 becomes “inadequate”.
[1] find some reason to critically weaken

* Mtv: To broaden my base, I have invested in php, py, javascript, swing, FIX, tibco, Sybase... many of them got me jobs but none has the power (#1), complexity (#1), value-add, entry barrier as c++ has.
* Mtv: doldrums -- if u sit still for 12 months, then no growth in java skill, but another guy will pick up c++, Some will acquire zbs and a real competitiveeedge. b_u_t c# is more popular than c++.
* mtv: initial orgradient is fastest -- my java (not c#) growth has slowed down. My C++ is still at the fast-learning phase
* Mtv: get in the door -- I will soon become expert* mtv: SG -- Relative to US, SG java talent is even more of a commidity. c++ talent is more rare and more highly valued than in US, b_u_t the positions seem to be limited.
* Mtv: entry barrier -- c++ is higher than java? b_u_t some jobs require just basic C programming
* Mtv: commodity vs differentiation -- the java skill on wall street is a commodity. You are no different from the next java guy. (B_u_t most outsiders simply don't know how to come in.) What differentiations? c#, swing, threading...
* Mtv: xp wasted -- i have many years of professional experience in c/c++. Why not build it up to a critical mass and get a real edge?
* Mtv: cross-pollination -- threading, data structure (among other core topics) benefit from cross-pollination.
* mtv: deepens my mastery of java/c#, more than what I could without c++. Some high-end java interviews require/appreciate it.
* mtv: critical link -- between the lineage of java and c#. There's hidden insight in evolutionary history. Some interviewers drill into rationale and tradeoff, among other academic questions.
* Mtv: latency insight -- latency sensitive eq often benefit from memory knowledge of c++. If you work on such a java system, c++ insight is an advantage.
* Mtv: performance trend -- as more asset classes follow Eq, as competition heats up, low-latency will become more important. c++ is for "demanding" systems -- Scott Meyers. I would think the white-hot fields are still dominated by c++. b_u_t java is encroaching
* Mtv: lead -- need to extend the lead over non-trading developers.
* Mtv: A+B years -- many guys have A years java + B years c++ ? b_u_t they may not earn more.
* Mtv: strongest developers -- often know c++ in-depth. b_u_t look at Piroz, Yang, Avichal Gupta, Sundip Jangi...
* Mtv: older developers -- c++ is better for older guys? b_u_t many older guys are learning java, probably due to shrinking demand
* mtv: cost-amortization -- In terms of investment, i already invested so many years on threading, containers, regex, OO, design patterns... Learning c++ or c# lets me amortize this huge cost. In 1 year i can reach a 3-year proficiency level. About 20% of my core java insight can double as my c++ insight.
* Mtv: outside financial -- a lot of infrastructure and core components are in c/c++, where java isn't fast enough. Many of the most important software's are in c/c++. Consider google, facebook... http://www.lextrait.com/vincent/implementations.html
* Mtv: foundation expanded -- like DBA, c#... I prefer to expand my foundation not by learning spring, gemfire, ION … b_u_t these latter category perhaps enjoy more demand
* Mtv: low-level -- than java/c#. Look at the standard books. Low-level is my comfort zone.
* Mtv: churn and volatile -- less rapid than java and c#. Best books were 90’s. b_u_t that's a sign of investment by major vendors.
* Mtv: crowded -- java is crowded talent pool? b_u_t there are also more jobs

Tuesday, April 28, 2015

to get fwd points on a broken date

... we need to build 2 yield curves for the 2 currencies.

For a standard date, presumably we could use market quotes.

Sunday, April 26, 2015

sticky~how many years C experience...unimportant!

It's possible to code C for years without using pointers except string functions.

It's possible to code C++ for years without using virtual, new/delete, template, operator overloading or even class.

It's possible to code python for years without creating classes.

It's possible to code java/c# for years without any threading (beyond locking), or reflection

It's possible to code perl for years without using hash or regex.

It's possible to code SQL for years without writing outer joins. I guess I wrote lots of mysql queries without any join.

Saturday, April 25, 2015

[[21st century c]] - unusually practical update on C

a sub-chapter on string processing in the new world
a sub-chapter on robust Macros in the new world
a sub-chapter on function to report errors in the new world
a full chapter on pointer in the new world
a full chapter on C api to be consumed by other languages like python
a full chapter on struct syntax improvement to support returning multiple values + status code
a sub-chapter on pthreads
a sub-chapter on [[numerical recipes in C]] and the implementation – the GNU scientific library
a sub-chapter on SQLite
briefly on valgrind
function returning 2 values + status code
many innovative macro tricks
innovative and concise explanation of auto(i.e. stack) vs static vs malloc memory

Note a sub-chapter is very short, in a concise book. A remarkably practical update on C, somewhat similar to [[safe c++]]. Content isn't theoretical, and not so relevant to interviews, but relevant to real projects and GTD

[[spring data]]

chapter on redis (integration with spring data)

chapter on mongoDB (integration with spring data)

chapter on gemfire

chapter on JPA

multiple chapters on Hadoop

sub-chapter on job scheduling in the Hadoop context.

Boost Any ^ Variant - self-quiz

See also my books on boost...

 

What's the best way to remember this? Blogging can help but books are more convenient...

 

Q: Which of the 2 is more common?

 

Q: What's the use case for each?

 

Q: Is there any context both can be used?

 

Q: Any way to combine them?

 

Thursday, April 23, 2015

vector initializer -- disallowed in field declaration

label -- c++ real

in a field declaration, you can't do

vector<int> vec; //acceptable

vector<int> vec(9); // field initialization, disallowed

You can do it in a *local* variable definition though.

cstr - remove trailing comments

My order book (irage) :

 

      void processMsg(char const * cstr) {

            char * commStart = strstr(cstr, "//");

            if (commStart) {//found

                  * commStart = '\0';

 

redirect stdin/stdout to files, then restore

swaps illustration diagrams -- how to read

This write-up covers IRS, x-ccy swap...

These block diagrams are popular and partially useful, but beginners often don't realize:

* initial context -- typically a corporation has a periodic liability, or an investor has a periodic income.
** We had better ignore all the other arrows first.

* the motivation -- typically to convert the initial single arrow to other arrows. The swap contract adds 2 arrows, one of them cancelling out the pre-existing arrow.
** we had better focus on the 3 arrows and ignore other parts of the diagram.

[[c++common knowledge]]

Has shorter, simpler treatment than [[effC++]]:
* placement new
* class-specific op-new
* restrict heap allocation of my class

x-ccy swap - basis swap dominates

Most tutorials talk about fixed/fixed swap, but Tony's lecture seems to suggest the market makers always convert it into a x-ccy basis swap.

 

I think it's more standard, more liquid than other x-ccy swaps.

 

I think market makers use it for hedging once they execute any x-ccy swap.

yield curve , according to Jeff

Jeff's lecture notes (in 0x\pdf) has detailed explanations on

1) EUR OIS YC bootstrapping using specific OIS instruments
2) Libor YC under OIS discounting -- so OIS curve + libor curve needed.
3) Libor curve for a non-default tenor, such as 6M or 2M

lots of "root-finding"... but not too hard.

a YC (or a term structure) can be represented as a series of
* spot disc factors
* fwd disc factors
* spot interest rates
* fwd interest rates

Wednesday, April 22, 2015

Rebanato - good author on fixed income models

recommended by Sian Hwee.

Ronnie said Black model is popular (largely due to simplicity, and historical reason), and many option products are quoted in terms of vols implied from the Black model. 

TA seems to agree that the advanced models (beyond the Black model) are still needed but indeed harder than the earlier lectures before the Black model.

most fx op traders don't know Am style

Tony (FX lecturer) shared that most fx op traders only deal with European style and don't have any intuition about Am style options.

10am NY - typical FX option expiry time


buying (i.e. long) a given interest rate

Tony (FX lecturer) pointed out "buying" any variable means executing at the current "level" and hope the "level" moves up. (Note a mathematician would point out an interest rate is not directly tradeable, but never mind.)

Therefore, buying an interest rate means borrowing at a (rock bottom) rate.

Wrong intuition --- "locking in the interest income stream".

Eg: Say gov bond interest is super low, we would borrow now, and hope for a rise.

Eg: Say swap rate is super low, we would lock it in -- pay fixed and lock in the floating income stream, and hope for the swap rate and floating stream both to rise.

Tuesday, April 21, 2015

fuxi) bid side of fx swap point means@@

Q: given a pair of bid/ask quotes in fx swap point, what kind of trades are we talking about implicitly?
A: dealer is sell/Buy ccy1. The spot leg is sell ccy1. The far leg is Buy ccy1.


Note we are taking the dealer's position, not the market-taker's.
Note "bid" refers to the far leg, not the near leg.
Note ccy1 (not ccy2) is the asset being traded.

enough c# mileage accummulated@@

Your mileage will show in IV and in projects, but IV is way, way more important than real project performance -- You only need to be barely competent to get your job done, solving common problems at your pace (though at Baml my own pace was slower than other team members). No need to be competent to solve all tricky problems, some are too tough for everyone. But you better ace the IV.

- - I still feel less familiar with some everyday tasks than my c# veteran colleagues.
- - i did rather few complete projects like Guardian and many enhancement projects. In contrast, veteran c# guys did more big projects. The number of years isn't as important as complexity and variety of challenges. VARIETY -- for eg a web dev expert (or a DB-centric c# coder) isn't really a complete c# expert.
- - wpf is a specialized skillset, like swing, or web dev or sockets. I didn't get a lot of wpf hands-on mileage yet.
- - wcf is another specialized skillset. I lack mileage.
- - assembly, appdomain, GAC

= = people agree that I can get my job done and meet most technical challenges, even if non-trivial. ("tactical")
= = explaining, justifying my design choices - not always convincing. Not only c#, but java too.
= = excel integration is one of the most valuable among the specialized c# skills. I have some experience.

+ + When presented a new c# challenge, when pushed to the frontier of my c# know-how, I am competent to construct a basic "infrastructure" and then search on-line for the missing pieces to complete the loop meeting the challenge
+ + competent with most everyday troubleshooting.  Some troubleshooting is beyond my current skill but I feel many are hard for my veteran colleagues too. If my colleagues can solve 50% of the tech problems, then my level is close to that. This competence comes from mileage i.e. real world projects. The more projects one takes on, the more competent.
+ + like Venkat, I did practice with some hot c# features like threading, closure, remote debugging ...
+ + much more confident with MSVS than before. Perhaps comparable to my Eclipse confidence.
+ + on some of the hot but purely theoretical IV topics (fake mileage), I have read up quite a bit and appreciate their nuances. I can follow most discussions on these topics -
*GC, dtor, finalizer
*threading
*value/reference types
*dynamic type

deleting base class ptr -- non-virt dtor

This correct code produces " ~B ~A" i.e. reverse construction sequence. But what if "virtual" removed?

 

I said it's undefined behavior, but what if we know it does do something? I correctly predicted " ~A". My bloomberg interviewer predicted " ~B" but failed my test.

 

class A{

public: virtual ~A(){ cout<<" ~ A"<<endl; }

};

class B: public A{

public: ~B(){ cout<<" ~ B "; }

};

int main(){

    A * p = new B;

    delete p;

    cin.get();

}

Morris - inorder traversal running O(N), without extra storage

Sunday, April 19, 2015

c++ coding drill - books + online

alternative post titles:
c++ pre-IV coding – books
c++ coding drill - books + online
 
) hacker earth has many coding challenges, and many practice problems. https://www.hackerearth.com/problems/
) my IDE projects
) [[essential c++]]
) [[c++ primer]]
) EPI 300

RESTful - phrase book

agile –

 

coupling – less coupling between client and server, so server side changes are easier. I think SOAP requires client rebuild.

 

b2b – still dominated by SOAP

 

resource-oriented services –

 

object – each URL logically represents an object, which you can Get (query), POST (create), PUT (update its content) or DELETE

 

AOC c++ iv (Jens/Ruban)

Q: buffer overflow?
%%A: avoid arrays, use vector

Q: XOR usage?
AA: usages? easy to google

Q: why bitwise shift?
%%A: mostly an optimization as far as I know, but the compiler probably translates integer multiply/divide already.
AA: usages? easy to google

what's wrong with pointers?
dangling pointer?

Q3: what are the common exceptions in c++?
%%A: c++ has a few standard exceptions and a lot of UB; java has lots of standard exceptions and no UB.
A: http://google-styleguide.googlecode.com/svn/trunk/cppguide.html?showone=Exceptions#Exceptions

Q3b: undefined behavior?
%%A: much worse than exceptions or error codes
%%A: perhaps fairly consistent on one platform, but I know writing beyond an array's limit is indeterminate. See [[c++ debugging)]

Q: exceptions – why do you not want to use it in your API?
%%A: can of worm. If I throw I can't control how clients use this API. What if it's thrown in a dtor? What if they don't catch by reference? What if they catch a sliced one or a copy rather than the original exception object I want them to get? What if they catch by pointer and try to delete or forget to delete? Java cleaned it up.
%%A: I don't see a lot of well-regarded API's exposing exceptions
%%A: there's performance cost
A: now I think we should be consistent throughout – either throw exceptions consistently or never.

Q: memory leak – what is it and how do you deal with it?
%%A: valgrind replaces malloc with ...?
%%A: provide class-specific op-new (and delete), which is safer (see effC++) than a customized global op-new. Add your own house keeping code therein...

Q: how is semaphore different from a mutex
%%A: I think a mutex is more basic and usually provided by the kernel (For a userland thread the thread library not the kernel must provide the mutex). I guess the counting semaphore is implemented using mutex + condition variables, since the semephore may need to inform the waiting threads.

Q: preprocessors?
%%A: 3 usages in my projects – includes, macros and conditional compile. Now I think template meta programming also uses a lot of macros.

Q: stack trace?
%%A: very useful, that's why java, c#, python, perl provide it, and GDB too.
A: [[safe c++]] shows simple and robust technique to build a stack trace upon assertion failure

I said many times "I'm philosophical about that" – meaning "it's controversial IMO and I have my views which may look naive or extreme or eccentric"

Saturday, April 18, 2015

[[java performance]] by Scott Oaks

--[[java performance]] by Scott Oaks

 

best of breed..see chapter details on

[jvm] heap memory

[jvm] threading

[jvm] instrumentation

JPA

serialization

lambda, stream  (java 8 interviews!)

 

The Introduction chapter outlines 3 broad aspects

* JVM – like memory tuning

* java language – like threading, collections

* Java API -- like xml parser, JDBC, serialization, Json...

 

JVM tuning is done by "system engineers" who may not be developers.

 

bbg C++ Standard IV Questions { Zack

1. How is keyword virtual used in C++?
2. Does better O() algorithm always works faster in real cases?
3. Between pre-increment (++i) and post-increment (i++) operator, which one is more efficient in both built-in and overloading case? ........ [[more eff c++]] item 6
4. Please compare array and linked-list in terms of insertion and access
5. Please name some sorting algorithms and their time complexity
6. Can you tell me the difference between stack and heap?
7. What Linux command do I use the find a file in a directory recursively?
8. what is the virtual functions and destructors
9. what is the constructor destructor orders of a class then an inherited class
10. what is the most known sort algorithms , and what is the complexity of each
11. Smart Pointer, how does it work.
12. Templates, when use instead of inheritance........ [[eff c++]] Item 41
13. Polymorphism, when use multi inheritance, problems that can happen, ....... [[eff c++]]
14. Sockets, monitoring sockets.
15. Multithreading, give a small example of Producer, Consumer.
16. Debugging issues, using GDB
17. Linux (Windows doesn't work, it's difficult to test the person since we don't know Windows)
18. Multithreading
19. TCP/IP and Multicast
20. STL and Boost libraries

ED future = a fwd interest rate

What about TED?

par swap rate drop means ...@@

For a given tenor (say 1Y)

 

I think treasury yield rise (or drop) has a simpler interpretation....

 

I think Libor ED deposit rate drop (or rise) has another simple interpretation .... and has a credit element.

 

Libor par swap rate drop has a non-trivial interpretation....

 

OIS swap rate is even more complicated...

yield curves - y-axis defaults to fwd rates

In theory inst fwd rates, actually discrete fwd rates...

 

fwd rate is a better choice than zero bond rates or par swap rates...

 

See Jeff's lecture notes

Wednesday, April 15, 2015

Tuesday, April 14, 2015

destructors should be simple.. really?

This is typical of c++ -- destructor (dtor) is one of the most important features but quite tricky beneath the surface

* exception
* dtor sequence - DCBC
* virtual dtor
* synthesized dtor is usually no good if there's any pointer field
* lots of undefined behaviors
* there are guidelines for dtor in a base class vs leaf class -- never mindless
* objects put into containers need a reasonable dtor
* when the best practice is to leave the dtor to the compiler, you could look stupid by writing one, esp. in an interview.
* smart pointer classes is all about dtor
* RAII is all about dtor

* interplay with delete
*** placement new, array-delete vs delete
*** override operator delete
*** double-delete
*** ownership !

entity means ...in ORM lingo

It means an object in memory, backed by a DB record... see [[beginning java EE 7]]

Sunday, April 12, 2015

noexcept -- c++11

 

http://en.cppreference.com/w/cpp/language/noexcept has good examples of noexcept operator

DOM and other components of ajax

[[beginning java ee7]] P372 points out that ajax technology stack includes

• DOM
• xhtml as "final data format" to render the page on browser
• xml or json or plan text as payload

data types in jason

numbers, strings, booleans

 

arrays

 

object – basically associative array of name-value pairs

JPA2 supports stored proc (empty

 

blogger posts page - to clear the text in the search box

F5

socket monitor -- resources

My Dtrace book covers this topic. Many solaris tools, including snoop, dtrace and lots of network statistics

 

the linux "ss" command -- http://www.binarytides.com/linux-ss-command/. can track down pid, among other things

 

http://www.javaspecialists.eu/archive/Issue169.html is a solution in the java world

 

 

Saturday, April 11, 2015

option math : thin -> thick -> thin

Many topics I may have to give up for lack of bandwidth. For the rest of the topics, let's try to grow the "book" from thin to thick then to thin.

-----

+ PCP

+ delta hedging

+ graphs of greeks

+ arbitrage constraints on prices of European calls, puts etc. Intuition to be developed

+ basic strategies like straddle                     

 

LG American options

LG GBM

LG binary options but ..

+ Roger's summary on N(d1) and N(d2)

LG div

LG most of the stoch calc math but ..

LG vol surface models

+ some of the IV questions on martingale and BM

 

I know more about c++ than c#

I blogged about exactly the same thing before ...

Here's a paradox -- i spent 2 years in a full time c# job, arguably longer than my full time c++ experience. However, sometimes I feel I understand dotnet less than C++. Reason? Many aspects of the languages are never used in-depth on work projects, so length of experience != depth of experience. We need spare time self-exploration to learn those aspects like:
- template meta programming
- custom operator new/delete
- memory tuning
- memory leak detection
- threading
- async communications
- pure virtual
- ++i vs i++

(... not a complete list by any measure.) Interviewers are notorious for testing these obscure or advanced, theoretical topics.

## some of my c# dotnet achievements

1) home-grown web server to download any file in the local file system - essentially my invention, as no one in the team know how to do it

GUI - full ownership

stability improvement in the microagent and Guardian server

Bloomberg piece - no one dared to touch it given the complexity

Excel add-in

Created many windows services

FX hedge fund trading profit - 18% pa

 

Friday, April 10, 2015

bbg algo IV - binary tree inorder walk

Is there a way to design an iterator over a binary search tree with the following properties?
1. Elements are visited in ascending order (i.e. an inorder traversal)
2. next() and hasNext() queries run in O(1) time.
3. Memory usage is O(1)
-------
I feel O(1) memory is impossible since this is recursive (though all recursions can convert to iteration), with a stack data structure of size H := height of tree.

Similarly, hasNext() need to work through the stack of size H, so O(1) run time impossible

academic route as a long term career option (Sam)

A letter never sent out...

Hi Sam
(This is more like a personal blog, to record my thoughts and conversations.)

I never considered those options you posed today

Q: 2nd master's degree?
A: I liked the part time study experience so far. Will take a 2nd Masters if someone pays for me.

Q: I did think about teaching at polytechnic level, but teach what subject?
A: Either IT or financial math, or perhaps data science -- after I spoke to Bernie.

Thursday, April 9, 2015

simplest java web server using thread pool

hazard rate, a few pointers

For life insurance, hazard rate is increasing with age

 

Jostein's lecture notes gives a good definition.

 

http://en.wikipedia.org/wiki/Survival_analysis#Hazard_function_and_cumulative_hazard_function is similar, but I prefer books. I think other books I have may also have a good definition.

 

 

kernel time > 25% (linux tuning

label - tuning

Here's a rule of thumb from P244 [[optimizing linux performance]].

"time" command can show it. If kernel time > 25%, then it's excessive and warrants investigation. The investigation is relatively standard – use strace to rank the most time-consuming system calls.

aync architecture - some examples

In each case there's a data buffer holding the "details" of the pending operation.

 

async – DB query

async - disk IO

async - http request

async - unix signal processing. Signal is "stored" in the kernel and the callback is invoked at a later time.

async - UDP read and write?

 

buying home ] US

If staying 5Y+ then buy not rent...

 

Prop tax - $8k/year  for a 500k home

 

Most wood houses need lots of maintenance... Condos may also need maintenance and require have maintenance fees...

 

If you are forced to leave US, you can find a management firm to rent it out and maintain the house. Common in Florida.

T+0 settled FX is a ... derivative contract

Tony (UChicago) pointed out the underlier is a spot contract with T+2 (or T+1 for CAD) settlement. The T+0 contract is actually a fwd contract, based on the spot contract.

NDF fixing - multiple alternative publishers

Central banks (like Chinese gov) compete with private agencies... An NDF contract could reference any one of them.

Sunday, April 5, 2015

green card process

1-2Y to get 140 approval.

(If re-apply again under another employer, then another 2Y to get 140 approval.)

Another 3Y or so to get 485. 180 days later, free to change job with EAD.

For job stability, I will go with a contract agency. Some companies tend to retrench and terminate the green card process.

IV c++11 (3arrow)

Q: In a move constructor, is the parameter an rvalue reference? is there another rvalue reference in the call?

Q: What's an rvalue reference actually?

Q: mutable keyword's usage? How about in c++11?
AA: closure - captured variables can be modified if "mutable".
http://stackoverflow.com/questions/105014/does-the-mutable-keyword-have-any-purpose-other-than-allowing-the-variable-to

Translation lookaside buffer

What part of the boost thread library did you use?

for-loop in c++11?

Why did you implement your own smart pointer?
A: to avoid uninitialized primitives? That's a wrapper not a smart ptr

noexcept
AA: both an operator and a function specifier...

Can ctor throw exception? Why do you say it's not best practice?

How does a vector resize?
A: after copying the objects, destroy the old objects. (move ctor?)

What kind of algo is qsort? Average and worst runtime complexity?
A: average nLog(n), worse n^2

Recursive vs iterative, which is faster?
A: comparable, but space complexity lower for iterative?

what's lockfree? How did you make it work in your projects?

How did you use parallel processing in GS?
A: data parallellism, threading, and other techniques. Coarse-grained is ideal.
A: i guess pipelining parallellism is also relevant, using task queues

Friday, April 3, 2015

H1b-1 rejections

https://www.overseassingaporean.sg/public/forum/upload/index.php?/topic/4383-visa-denied-reapplication-advice/ shows many cases of h1b-1 rejection at Singapore consulate

* need to prepare for questions about employer and offer
* need to show  intent to return to Singapore i.e. non-immigration intent
* need to give a definite timeframe when to return. I guess 3Y sounds reasonable.

Monday, March 30, 2015

advanced c++ interview questions - contributed by real interviewers

http://www.quora.com/Anyone-can-list-good-common-and-advanced-questions-for-testing-C++-STL-skill-during-interview

These authors are real interviewers. They really do care about the topics I mentioned to you Monday night. They are seeking c++ specialists who understand the low level details. They don't care about the high level, architecture, design, picking the right framework or library etc.

Victor

Fwd: difficult phone screen with Credit Suisse

Hi Bin,

I just finished a frustrating interview with Credit Suisse.
It's just a phone screen, but many questions I cannot answer. When you have time, please add some comments to below questions.

And because I work from home for the interview, so I can record the whole call. It's shared to you in another email. Please give me some comments about how I behaved, just assume if you were the interviewer, what's your feeling about this candidate?

It's not that urgent, so just do it only when you can find time. I know you have a lot of work to do, so don't waste too much of you time.

------------------------------------------------------
1. describe one of your best coding challenges in 2 to 3 years, that can show off your coding abilities and your object oriented skills.
Rong: I mentioned NIO server I had hands on experience.

Interrupted by him, he said: the key thing I'm asking for is the specific coding that you personally did.
Rong: I should not mention I lead a team, because maybe that's the reason he suspect I describe other developers' work as mine. I feel for developer role, management experience is a downside factor.

2. Describe how did the single threaded application avoid blocking IO.
Rong: I cannot articulate how NIO works. I actually indeed created a NIO server. That's true, but I don't know how to explain well in phone screen, and I cannot recall some details such as the class, methods.

3. He continued to asked some details about NIO, and I cannot recall details.

4. Now he start normal quiz procedure. I only list difficult ones here, but I attached the full list FYI.
......
Would you want to implement a maximum queue depth?(I didn't know what's maximum queue depth mean)
What happens if your queue backsup?(I don't known what's that mean)
Would you want a maximum length? Why?
What happens if your producer hit the maximum length?
Do you know what's the completion services?
There is an alternative that you can implement producer/consumer without a queue?
What are the 3 different ways of creating a thread?(implement Runnable, extend thread, what's the third?)
Different between Runnable and Callable? (Callable return result, Callable throw Exception)
Any other differences or advantages for one over the other?

Let's say we have a process that receives request to do work. And each request has no dependency on each other.
And the request queue backs up. How would you solve this? 
(I don't know what's backs up mean. So I assume it means the queue is full. So requesters are blocked and processor will process one by one.)

When you want to use a timer of some kind, what are the different way you can do it in your code?
(I said there is a scheduler class?? not sure if there is)
How would you shut down the multi-threaded system? let's assume you write your own multi-threaded system.
(use countdownlatch?)
What if the thread is blocked?
(call thread.interrupt())
That's it?
What's the exception chaining? (I don't know)
Apart from try-catch block, how can you ensure all exceptions in thread pool are caught by our code?
What's meant by safe publication and the context thread safty shared object retrieval?
fail-fast vs fail-safe?
How would you use the future task? Which method would you use? How would you retrieve the result later?
Do you know the method, what's that called?
Difference between semophore and mutex?
......