math learning curve in FX business

In FX business (not saying “system”) , most of the initial learning obstacles are math-related. A large part of it is due to the need to forecast fx rates. “Hedge” and “risk” are all about uncertainty in FX rate movements.

To avoid confusion, in this blog we don’t really talk about FX Futures contracts at all. “Future” doesn’t mean “Futures contract”.

If you as an enterprise just needs to convert currency at the spot rate, it’s straightforward. But any solution to future-proof your corporate FX needs tends to involve derivatives tied to future FX rates. Incidentally, every derivative (forwards, options, swaps ..) has an expiration date.

Whenever you consider future FX rates, the 2 countries’ interest rates come into play. I feel the Interest-Rate-Parity formula is quite basic and unavoidable, just like PCP and price/yield conversion. Other obstacles include
– Cross rate calc
– triangular arbitrage


sybase triggers to print debug msg

(“debug msg” to show what’s going on. )

Looks like a jdbc insert might fail due to the debug msg. EVEN if u can keep your debug msg and keep jdbc happy, there would still be a lingering doubt — debug msg is not perfectly compatible with java …. In view of the cost of production support, to play safe in a large, fast-paced environment,

Suggestion: enable debug msg during trigger development only, unless you are very sure how to make the debug msg compatible.

This affects sybase, and may affect mssql.

Perl: defensible turf but y@@

Reason: in every team including GS, no one has a deeper or more complete experience than mine.

reason: i explored way beyond everyday language features. if i walk into a perl shop, most of the features used i already know.

Lesson: “3 years on a … job” seems to prove qualification for similar jobs, but nonono, because those x years could be very limited.

Look at C. i used it in Chartered Semi but almost no pointers, no memory management, no threading, no system programming… For java i actually used a lot of things, but there are many more experienced guys.

A lot of 5-year java developers are completely unprepared against threading challenges.

Which area can I target as my next?

* threading?
* MOM?
* SQL + relational design?

some pro^con of triggers

+ if 2 programs need to CUD but can’t share the DAO.
Example: 2 java programs running on 2 machines. U may have to copy the jar to share code.
Example: sometimes u may even use command line to CUD

+ to achieve the same data quality level, those same SQL must be run anyway, in trigger or in app


– perf. extra load on the bottleneck — DB server
– migrating to another DB vendor

assignment overloading && other op overloading

Notice many overloaded operators return a value to be used as RHS of assignment. It’s good to become thoroughly familiar with this interaction — [ op= and overloaded operators ]

When you assign returned value of any (pbclone/pbref) function, you get op= . op= simply reads the RHS, and doesn’t care if the func is pbclone or pbref.

financial jargon: financing ie capital formation

“in response to a $-seeker, finding $-providers and getting the $ to the receiver.” The return side of the transaction is perhaps(?) supported by other teams

financing means
– getting $ for party A
– getting $ from party B
(Party A is always a client to me. Party B usually is a client too.)

Financing is always(?) a kind of broker job between $-seekers and $–providers. Our firm (the financing team) earns fees from them.

Financing usually involves
– debt, lending.
– equity

“financing a position” means? I think it means finding fund so Party A can take a particular position.

A “financing solution” is a clever deal.

“financing services”

“financing professionals”. Often a person working in the financing business focuses on that business.

protected virtual dtor #tricky

[[boost]] P 24 explains the technique of protected virtual destructor. Here’s my take —

The superclass A destructor is called by B’s destructor. See Remember you first clean up the outermost layer of the onion, and remember the B fields exist on the outer layer, outside A’s real estate.

Now, if someone gets hold of an A pointer, where the pointee is B, she can’t call delete on the pointer. Compile time (not run time) error. The special dtor is a protection.

class Base{
  protected: virtual ~Base(){cout <<"base dtor" <<endl;}
class Derived : public Base {
  public: virtual ~Derived(){cout <<"derived dtor" <<endl;}
int main(){
  Base * p1 = new Derived;
  Derived * p2 = new Derived;
  delete p1; //won't compile
  delete p2; // ok

If I swap the 2 words public and protected then I can delete Base ptr but not Derived ptr (compiler error)!

So it seems declared type must have a public dtor. In our examples, even though object is Derived, delete is allowed only on the ptr whose declared type has a public dtor.

Now, What if i have a private dtor? Probably less common, but it’s possible to invoke this private virtual dtor —

class Base{
  public:virtual ~Base(){cout <<"base dtor" <<endl;}
class Derived : public Base {
  private: virtual ~Derived(){cout <<"derived dtor" <<endl;}
int main(){
  Base * p1 = new Derived;
  delete p1; // ok private destructor called!

In my experiments, qq(new) is mandatory as a stackVar or this class will trigger a compiler error, because compiler can’t destroy the object automatically.

operator-overload return type — some examples

Summary — return type MUST be void in some cases, MUST be some specific type in some other cases, and can be up-to-you in other cases.

C++FAQ P297 points out that

A) overloaded operator often returns by reference to provide L-value semantics. Look at subscript operator and de-reference (the asterisk) a.k.a “unwrap” operators

B) In contrast, op-overload-converter (OOC) must have no return type since that’s redundant and confusing. Examples —

MyClass::operator const char*() const {…} // notice the double const. See full source code of String in [[nittyGrittyC++]]

operator string(); // P203 [[stl tutorial]]. You can also put your own class in there, like

operator myType();

—————– in contrast,
operator ()(){…} // can return bool or anything you like
operator= needs return type which is usually qq(return *this) by reference
operator+ must have return type since the result of addition or concat must be returned.