SHOW ME THE CODE !

What are the applications in finance for fixed-size matrices?
I can't think of something off the top of my head. Overly-simplistic examples I could think of.

Market data of instruments always observed for a fixed set of maturities typically using to build discount curves, default probability vector for a reference name for a fixed number of tenor points, volatility grid of a vanilla FX option, sensitivities(risks) for a derivative product for a fixed set of maturities.

By the way, I wrote some unit tests. Hope to study and implement some basic numerics in my personal time.

Documentation
Unit tests
Source Code
 
Last edited:
Always good to think of problems up front. Otherwise it's a solution looking for a problem.

I didn't know of expression templates, pretty cool - so essentially you create an expression tree using these proxy objects and when the template is repetitively instantiated, it becomes like a single operation instead of multiple computations with temporary objects.

Original paper by Todd Voldhuizen : Expression Templates (Page 24)
 
Last edited:
Today's Code
todayCodeCandle.png
 
Can you remove ++index and put it into function call ... toFile(.... index++)?
Of course, I'm guessing.
This traversal visits several trees, INDEX carries on its value throughout a chain of trees ; idem min, max.
Every tree is a different scenario, in fact it is a cluster itself
All my code is part of a whole, this is another function/library of ExSan
ExSan is already plugged into Interactive Brokers C++ API.
 

Attachments

  • About ExSan++ Excerpt - Google Docs.pdf
    450.6 KB · Views: 8
Last edited:
C++:
    1 int main(void){
    2    //Ack & Ref: jLOSPINOSO
    3    auto i{ 0x01B99644 };
    4    std::string xst{ " DFaeeillnor" };   
    5    while (i--) std::next_permutation(xst.begin(), xst.end());
    6    std::cout << x;   
    7    return 0;   
    8 }
 
from long string to substrings:
    //split a long string into substrings
    // use of break and continue
    unsigned short nSubStrings {8};
    string* ayrFx = new string[nSubStrings + 1];
    string line;
    line = "       USD PEN     MXN    BRL   ARS    CLP    COP EUR";
    unsigned short j {0}, i{0};
    for (; i < line.length(); i++) {  
        //cout << line[i] << " ";
        if (line[i] == ' ') continue;
        while(line[i]) {
            ayrFx[j] += line[i];
            i++;
            if (line[i] == ' ') break;
        }  
        j++;
    }
 
    for (j = 1; j <= nSubStrings; j++) {  
        cout << "\n\tj:" << j << "  " << ayrFx[j];
    }
 
    OUTPUT:
    j:1      USD
    j:2      PEN
    j:3      MXN
    j:4      BRL
    j:5      ARS
    j:6      CLP
    j:7      COP
    j:8      EU

REF:

Systematic Forex Trading

 
Last edited:
Top