Appendices
Appendix A: Quantlab Types and C++
Primitive Types
Type |
Identifier for |
Representation |
Test |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Object Types
Type |
Identifier |
Representation |
Test |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String-Based Types
Type |
Identifier |
Representation |
Test |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Compound Types
Type |
Identifier |
Representation |
Test |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Appendix B: API Functions in ql_base.h
Vector Functions
Function |
Description |
|---|---|
|
Returns the size of a vector |
|
Returns a number element |
|
Returns an integer element |
|
Returns a logical element |
|
Returns a date element |
|
Returns a string element (handle) |
|
Returns an object element (handle) |
|
Creates a vector of numbers |
|
Creates a vector of integers |
|
Creates a vector of strings |
|
Creates a vector of dates |
|
Creates a vector of objects |
|
Sets a number element |
|
Sets an integer element |
|
Sets a string element |
|
Sets an object element |
Matrix Functions
Function |
Description |
|---|---|
|
Returns rows and columns |
|
Returns a number element |
|
Creates a matrix of numbers |
|
Creates a matrix of strings |
|
Sets a number element |
|
Sets a string element |
Validation & Null Sentinel Functions
Function |
Description |
|---|---|
|
Tests if a number is valid (not NaN) |
|
Tests if a logical is valid |
|
Tests if a date is valid |
|
Tests if a month is valid |
|
Tests if a timestamp is valid |
|
Tests if an enum value is valid |
|
Returns null/invalid number (NaN) |
|
Returns null logical |
|
Returns null date |
|
Returns null month |
|
Returns null timestamp |
|
Returns null enum |
String Functions
Function |
Description |
|---|---|
|
Creates a QL string handle |
|
Creates string with explicit length |
|
Creates string from wide-char |
|
Extract C string (checked, throws) |
|
Extract C string, null-safe (returns nullptr) |
|
Returns string length |
Date / Month / Timestamp Functions
Function |
Description |
|---|---|
|
Creates a date value |
|
Returns today’s date |
|
Decomposes date into components |
|
Add n years to date |
|
Add n months to date |
|
Creates a month value |
|
Decomposes month |
|
Creates a timestamp |
|
Creates timestamp from date + time |
|
Current local timestamp |
|
Current UTC timestamp |
|
Decomposes timestamp |
Calendar Functions
Function |
Description |
|---|---|
|
Creates a calendar object |
|
Creates an empty calendar |
|
Merges two calendars |
|
Tests if date is a holiday |
|
Move n business days |
Blob Functions
Function |
Description |
|---|---|
|
Creates a binary blob |
|
Returns blob size in bytes |
|
Returns pointer to blob data |
Error Functions
Function |
Description |
|---|---|
|
Creates and throws a QL error (returns handle) |
|
Creates error with QL string message |
|
Converts error code to string |
|
Extracts error type from error handle |
|
Extracts error message from error handle |
Raw Data Access
Function |
Description |
|---|---|
|
Returns |
Use for high-performance access to vector/matrix internals without per-element function calls.
Appendix C: Blending Functions
Four C++ blending functions for combining deposit, FRA, and swap curves. Also available in QLang:
curve blend_curves_depo_swap(curve depo_c, curve swap_c)
option(category: 'Curve blending')
{
if (swap_c.empty())
return depo_c;
else {
depo_c = depo_c.chop_long(v_min(swap_c.instruments.maturity) - 1);
return merge(depo_c, swap_c);
}
}
Appendix D: User-Defined Yield Curve Models
Using QL::model_create_custom() you can define your own yield curve model. Inherit from QL::custom_model and implement four virtual functions: n_params(), default_param_guess(), default_param_min(), default_param_max(), and disc_fact().