meaningful endeavor: algo^zbs

In the quiet hours, inevitably I would have get my share of self-doubt about the value of my endeavors…

[1] The IV-preparation effort has huge impact on my kids and family well-being such as education, health, housing and life-chances. It builds my confidence and capacity to provide for them.

Peers — I feel their personal endeavors are not much better:

  • ….
mental fitness,
anti-aging
career{65
(RnD/teach)
family well-being spread
%%nlg
social value? endeavor
good none HUGE value [1] none none IV: algo/ECT
minimal 😦 minimal HUGE value [1] minimal minimal IV: QQ/BP
good N.A. good none none compare: gym
good possible good due to PKI minimal minimal zbs (+GTD)
minimal none good due to IV minimal none build dnlg(+quant)
good minimal none good churn! Get Real
no bandwidth!
contribute to OSS??
Advertisements

container of smart^raw pointer

In many cases, people need to store addresses in a container. Let’s use std::vector for example. Both smart ptr and raw ptr are common and practical

  • Problem with raw ptr — stray pointer. Usually we the vector doesn’t “own” the pointee, and won’t delete them. But what if the pointee is deleted somewhere and we access the stray pointer in this vector? smart pointer would solve this problem nicely.
  • J4 raw ptr — footprint efficiency. Raw ptr object is smaller.

fastest container: array of POD #or pre-sized vector

relevant to low-latency market data.

  • raw array is the most memory efficient; vector is very close, but need to avoid reallocation
  • std::array is less popular but should offer similar performance to vector
  • all other containers are slower and bigger footprint
  • For high-performance, avoid container of pointers — Cache affinity loves contiguous memory. After accessing 1st element, the accessing 2nd element is likely a cache-hit

q(less)functor ^ operator<() again, briefly

[[effSTL]] P177 has more details than I need. Here are a few key points:

  1. std::map and std::set — by default uses less<Trade>, which uses a “method” operator<() in the Trade class
    • If you omit this operator, you get verbose STL build error messages about missing operator<()
    • this operator<() must be a const method, otherwise you get lengthy STL build error.
  2. ptr-to-Trade as a key — see [[effSTL]] P88. Basically, you need a custom functor class deriving from std::binary_function. Beware the syntax pitfall highlighted in my blog post
    • Note shared_ptr is an option, not a must
  3. if you don’t need a red-black tree container, but need sorting, binary_search, lower_bound etc — then you have flexibility. Simplest is a pointer to a global bool function. See https://bintanvictor.wordpress.com/2017/10/01/binary-search-in-sorted-vector-of-tick-pointer/

 

##xp@career diversification #instead of stack-up/deepen

  • biz wing — in addition to my tech wing. I learned a bit but not enough. Not strategic
  • quant? The on-the-job learning was effective and helped me with subsequent interviews, but further push (UChicago) are not bearing fruits
  • data science?
  • —-diversify within the tech space, where I have proven strengths
  • swing? positive experience
  • unix -> web dev -> java? extremely successful
  • c++? slowly turning positive
  • dotnet? reasonable

some international securities have no cusip/isin but never missing both

A collateral system professional told me some securities in his system have no cusip or isin, but must have one of them.

I believe some international assets pledged as collateral could be missing one of them.

Japanese gov bond is a common repo asset — cross-currency repo. The borrower needs USD but uses Japanese bond as collateral.

collateral: trade booked before confirmation

In collateral system, a margin call requires the counter party to post additional collateral (within a short window like a day). If the collateral is in the form of a bond (or another security), then it’s considered a “trade”. There are often pre-agreed procedures to automatically transfer the bond.

So the IT system actually books the trade automatically, even before the collateral operations team gets to confirm the trade with the counter party. That’s what I heard from an application owner. However, I suspect these bonds could be held in some special account and transferred and confirmed automatically when required. In such a case, the trade booking is kind of straight-through-processing.

I guess the counter-party is often an margin account owner, perhaps hedge funds in a prime brokerage system.

tail-recursion Fibonacci

Tail recursion is a “halo” skill in coding interviews.

Easiest problem is factorial(N). For Fibonacci, https://stackoverflow.com/questions/22111252/tail-recursion-fibonacci has a very short python implementation. Let me rephrase the question:

Q: Given f(firstVal=0, secondVal=1, length=0) returns 0, f(0,1,1) returns 1, can you implement f(0,1,N) using recursion but in O(N) time and O(1) space? Note Fib(N) ==f(0,1,N)

Key points in the python solution:

  • Start with iterative algo, then convert it to tail recursion.
  • use 2 extra arguments to hold last two intermediate values like Fib(2) Fib(3) etc
  • We saw in the iterative solution that memory usage is O(1), a good sign that tail recursion might be possible.
  • if you observe the sequence of Fib() values computed in the blackbox, actually, you see Fib(2), Fib(3) … up to Fib(N), exactly like the iterative solution.
  • solution is extremely short but non-trivial

real-time symbol reference-data: architecture

Real Time Symbol Data is responsible for sending out all security/product reference data in real time, without duplication.

  • latency — typically 2ms (not microsec) latency, from receiving to sending out the enriched reference data to downstream.
  • persistence — any data worthing sending out need to be saved. In fact, every hour the same system sends a refresh snapshot to downstream.
    • performance penalty of disk write — is handled by innoDB. Most database access is in-memory. Disk write is rare. Enough memory to hold 30GB of data. https://bintanvictor.wordpress.com/2017/05/11/exchange-tickers-and-symbols/ shows how many symbols there across all trading venues.
  • insert is actually slower than update. But first, system must check if there’s a need to insert or update. If no change, then don’t save the data or send out.
  • burst / surge — is the main performance headache. We could have a million symbols/messages flooding in
  • relational DB with mostly in-memory storage

##accumu lens:which past accumu(zbs+)proved long-term #!quant

(There’s a recoll on this accumulation lens concept…. )

Holy grail is orgro, thin->thick->thin…, but most of my attempts failed.

I have no choice but keep shifting focus. A focus on apache+mysql+php+javascript would have left me with few options.

  • —-hall of famers
  • 1) data structure theory + implementation in java, STL, c# —- unneeded in any project!
  • 2) [CRT] core java including java OO has seen rather low churn,
    • comparable to c++
    • much better than j2EE and c#
  • 3) [T] threading? Yes insight and essential techniques. Only for interviews. C# is adding to the churn.
  • 4) [j] instrumentation in java codebase and to a lesser extent c#. Essential for real projects and indirectly helps interviews
  • [C] core C++
  • [j] google-style algo quiz —- Only for high-end tech interviews. Unneeded in any project
  • [R] SQL? yes but not a tier one skill like c++ or c#
  • regex – needed for many coding interviews and real projects
  • —-also-ran :
  • [!T] bond math? Not really my chosen direction, so no serious investment
  • [!T] option math?
  • SQL tuning? not much demand in the c++ interviews, but better in other interviews
  • py? increasing use in projects
  • [R] Unix instrumentation, automation? frequently used but only occasionally quizzed
  • [R] Excel + VBA? Not my chosen direction

–strengths
C= churn rate is comfortable
D = has depth, can accumulate
R= robust demand
T= thin->thick->thin achieved
j|J = relevant|important to job hunting