| 1 | package Quant::Framework::Utils::UnderlyingConfig; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Quant::Framework::Utils::UnderlyingConfig | ||
| 6 | |||
| 7 | =head1 DESCRIPTION | ||
| 8 | |||
| 9 | This is a data-only module to store static data related to a symbol/underlying | ||
| 10 | (e.g. Forex, Stocks, Indices, ...) | ||
| 11 | |||
| 12 | =cut | ||
| 13 | |||
| 14 | use strict; | ||
| 15 | use warnings; | ||
| 16 | use 5.010; | ||
| 17 | |||
| 18 | use Moose; | ||
| 19 | |||
| 20 | =head2 symbol | ||
| 21 | |||
| 22 | Symbol name (e.g. frxEURUSD) | ||
| 23 | |||
| 24 | =cut | ||
| 25 | |||
| 26 | has symbol => ( | ||
| 27 | is => 'ro', | ||
| 28 | isa => 'Str', | ||
| 29 | required => 1, | ||
| 30 | ); | ||
| 31 | |||
| 32 | =head2 system_symbol | ||
| 33 | |||
| 34 | The symbol used by the system to look up data. May be different from symbol, particularly on inverted forex pairs (EURUSD/USDEUR) | ||
| 35 | |||
| 36 | =cut | ||
| 37 | |||
| 38 | has system_symbol => ( | ||
| 39 | is => 'ro', | ||
| 40 | isa => 'Str', | ||
| 41 | ); | ||
| 42 | |||
| 43 | =head2 market_name | ||
| 44 | |||
| 45 | Name of the market. Can be one of: | ||
| 46 | - forex | ||
| 47 | - indices | ||
| 48 | - commodities | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 | has market_name => ( | ||
| 53 | is => 'ro', | ||
| 54 | isa => 'Str', | ||
| 55 | ); | ||
| 56 | |||
| 57 | =head2 market_prefer_discrete_dividend | ||
| 58 | |||
| 59 | Should this financial market use discrete dividend | ||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | has market_prefer_discrete_dividend => ( | ||
| 64 | is => 'ro', | ||
| 65 | ); | ||
| 66 | |||
| 67 | =head2 quanto_only | ||
| 68 | |||
| 69 | Specifies if this underlying is quanto-only | ||
| 70 | |||
| 71 | =cut | ||
| 72 | |||
| 73 | has quanto_only => ( | ||
| 74 | is => 'ro', | ||
| 75 | ); | ||
| 76 | |||
| 77 | =head2 rate_to_imply_from | ||
| 78 | |||
| 79 | Name of the underlying to imply interest rates from, when calculating implied interest rate | ||
| 80 | |||
| 81 | =cut | ||
| 82 | |||
| 83 | has rate_to_imply_from => ( | ||
| 84 | is => 'ro', | ||
| 85 | isa => 'Str', | ||
| 86 | ); | ||
| 87 | |||
| 88 | =head2 volatility_surface_type | ||
| 89 | |||
| 90 | Type of volatility surface (moneyness, delta, flat) | ||
| 91 | |||
| 92 | =cut | ||
| 93 | |||
| 94 | has volatility_surface_type => ( | ||
| 95 | is => 'ro', | ||
| 96 | isa => 'Str', | ||
| 97 | ); | ||
| 98 | |||
| 99 | =head2 exchange_name | ||
| 100 | |||
| 101 | Name of the exchange | ||
| 102 | |||
| 103 | =cut | ||
| 104 | |||
| 105 | has exchange_name => ( | ||
| 106 | is => 'ro', | ||
| 107 | isa => 'Str', | ||
| 108 | ); | ||
| 109 | |||
| 110 | =head2 locale | ||
| 111 | |||
| 112 | Locale code, used to generate some descriptions in TradingCalendar (Default is 'EN') | ||
| 113 | |||
| 114 | =cut | ||
| 115 | |||
| 116 | has locale => ( | ||
| 117 | is => 'ro', | ||
| 118 | isa => 'Str', | ||
| 119 | ); | ||
| 120 | |||
| 121 | =head2 uses_implied_rate | ||
| 122 | |||
| 123 | Whether this underlying uses implied rate or no. | ||
| 124 | |||
| 125 | =cut | ||
| 126 | |||
| 127 | has uses_implied_rate => ( | ||
| 128 | is => 'ro', | ||
| 129 | isa => 'Maybe[Bool]', | ||
| 130 | ); | ||
| 131 | |||
| 132 | =head2 spot | ||
| 133 | |||
| 134 | Current spot price | ||
| 135 | |||
| 136 | =cut | ||
| 137 | |||
| 138 | has spot => ( | ||
| 139 | is => 'ro', | ||
| 140 | ); | ||
| 141 | |||
| 142 | =head2 asset_symbol | ||
| 143 | |||
| 144 | Symbol name of the asset (Asset or Currency) | ||
| 145 | |||
| 146 | =cut | ||
| 147 | |||
| 148 | has asset_symbol => ( | ||
| 149 | is => 'ro', | ||
| 150 | isa => 'Str', | ||
| 151 | ); | ||
| 152 | |||
| 153 | =head2 uses_implied_rate_for_asset | ||
| 154 | |||
| 155 | Can we use implied rate for asset symbol? | ||
| 156 | |||
| 157 | =cut | ||
| 158 | |||
| 159 | has uses_implied_rate_for_asset => ( | ||
| 160 | is => 'ro', | ||
| 161 | isa => 'Str', | ||
| 162 | ); | ||
| 163 | |||
| 164 | =head2 quoted_currency_symbol | ||
| 165 | |||
| 166 | Quoted currency of the underlying | ||
| 167 | |||
| 168 | =cut | ||
| 169 | |||
| 170 | has quoted_currency_symbol => ( | ||
| 171 | is => 'ro', | ||
| 172 | isa => 'Str', | ||
| 173 | ); | ||
| 174 | |||
| 175 | =head2 uses_implied_rate_for_quoted_currency | ||
| 176 | |||
| 177 | Can we use implied rate from quoted currency symbol? | ||
| 178 | |||
| 179 | =cut | ||
| 180 | |||
| 181 | has uses_implied_rate_for_quoted_currency => ( | ||
| 182 | is => 'ro', | ||
| 183 | isa => 'Str', | ||
| 184 | ); | ||
| 185 | |||
| 186 | =head2 extra_vol_diff_by_delta | ||
| 187 | |||
| 188 | Volatility difference allowed for this symbol between two consecutive vol-surfaces. | ||
| 189 | This is used when validating a volatility-surface for this underlying. | ||
| 190 | |||
| 191 | =cut | ||
| 192 | |||
| 193 | has extra_vol_diff_by_delta => ( | ||
| 194 | is => 'ro', | ||
| 195 | ); | ||
| 196 | |||
| 197 | =head2 market_convention | ||
| 198 | |||
| 199 | Returns a hashref. Keys and possible values are: | ||
| 200 | |||
| 201 | =over 4 | ||
| 202 | |||
| 203 | =item * atm_setting | ||
| 204 | |||
| 205 | Value can be one of: | ||
| 206 | - atm_delta_neutral_straddle | ||
| 207 | - atm_forward | ||
| 208 | - atm_spot | ||
| 209 | |||
| 210 | =item * delta_premium_adjusted | ||
| 211 | |||
| 212 | Value can be one of: | ||
| 213 | - 1 | ||
| 214 | - 0 | ||
| 215 | |||
| 216 | =item * delta_style | ||
| 217 | |||
| 218 | Value can be one of: | ||
| 219 | - spot_delta | ||
| 220 | - forward_delta | ||
| 221 | |||
| 222 | =item * rr (Risk Reversal) | ||
| 223 | |||
| 224 | Value can be one of: | ||
| 225 | - call-put | ||
| 226 | - put-call | ||
| 227 | |||
| 228 | =item * bf (Butterfly) | ||
| 229 | |||
| 230 | Value can be one of: | ||
| 231 | - 2_vol | ||
| 232 | |||
| 233 | =back | ||
| 234 | |||
| 235 | =cut | ||
| 236 | |||
| 237 | has market_convention => ( | ||
| 238 | is => 'ro', | ||
| 239 | isa => 'HashRef', | ||
| 240 | default => sub { | ||
| 241 | return { | ||
| 242 | delta_style => 'spot_delta', | ||
| 243 | delta_premium_adjusted => 0, | ||
| 244 | }; | ||
| 245 | }, | ||
| 246 | ); | ||
| 247 | |||
| 248 | =head2 default_dividend_rate | ||
| 249 | |||
| 250 | Default dividend of this underlying (If this is not set, Quant::Framework::Dividend will be | ||
| 251 | used to lookup dividend) | ||
| 252 | |||
| 253 | =cut | ||
| 254 | |||
| 255 | has default_dividend_rate => ( | ||
| 256 | is => 'ro', | ||
| 257 | default => undef, | ||
| 258 | ); | ||
| 259 | |||
| 260 | =head2 default_interest_rate | ||
| 261 | |||
| 262 | Default interest rate of this underlying (If this is not set, Quant::Framework::Currency will be | ||
| 263 | used to lookup interest rate) | ||
| 264 | |||
| 265 | =cut | ||
| 266 | |||
| 267 | has default_interest_rate => ( | ||
| 268 | is => 'ro', | ||
| 269 | default => undef, | ||
| 270 | ); | ||
| 271 | |||
| 272 | =head2 default_volatility_duration | ||
| 273 | |||
| 274 | Default duration for this underlying when getting volatility. | ||
| 275 | |||
| 276 | =cut | ||
| 277 | |||
| 278 | has default_volatility_duration => ( | ||
| 279 | is => 'ro', | ||
| 280 | default => undef, | ||
| 281 | ); | ||
| 282 | |||
| 283 | =head2 asset_class | ||
| 284 | |||
| 285 | Type of asset for this underlying (can be either 'currency' or 'asset') | ||
| 286 | |||
| 287 | =cut | ||
| 288 | |||
| 289 | has asset_class => ( | ||
| 290 | is => 'ro', | ||
| 291 | isa => 'Str', | ||
| 292 | ); | ||
| 293 | |||
| 294 | 1; |