| 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 uses_implied_rate | ||
| 111 | |||
| 112 | Whether this underlying uses implied rate or no. | ||
| 113 | |||
| 114 | =cut | ||
| 115 | |||
| 116 | has uses_implied_rate => ( | ||
| 117 | is => 'ro', | ||
| 118 | isa => 'Maybe[Bool]', | ||
| 119 | ); | ||
| 120 | |||
| 121 | =head2 asset_symbol | ||
| 122 | |||
| 123 | Symbol name of the asset (Asset or Currency) | ||
| 124 | |||
| 125 | =cut | ||
| 126 | |||
| 127 | has asset_symbol => ( | ||
| 128 | is => 'ro', | ||
| 129 | isa => 'Str', | ||
| 130 | ); | ||
| 131 | |||
| 132 | =head2 uses_implied_rate_for_asset | ||
| 133 | |||
| 134 | Can we use implied rate for asset symbol? | ||
| 135 | |||
| 136 | =cut | ||
| 137 | |||
| 138 | has uses_implied_rate_for_asset => ( | ||
| 139 | is => 'ro', | ||
| 140 | isa => 'Str', | ||
| 141 | ); | ||
| 142 | |||
| 143 | =head2 quoted_currency_symbol | ||
| 144 | |||
| 145 | Quoted currency of the underlying | ||
| 146 | |||
| 147 | =cut | ||
| 148 | |||
| 149 | has quoted_currency_symbol => ( | ||
| 150 | is => 'ro', | ||
| 151 | isa => 'Str', | ||
| 152 | ); | ||
| 153 | |||
| 154 | =head2 uses_implied_rate_for_quoted_currency | ||
| 155 | |||
| 156 | Can we use implied rate from quoted currency symbol? | ||
| 157 | |||
| 158 | =cut | ||
| 159 | |||
| 160 | has uses_implied_rate_for_quoted_currency => ( | ||
| 161 | is => 'ro', | ||
| 162 | isa => 'Str', | ||
| 163 | ); | ||
| 164 | |||
| 165 | =head2 extra_vol_diff_by_delta | ||
| 166 | |||
| 167 | Volatility difference allowed for this symbol between two consecutive vol-surfaces. | ||
| 168 | This is used when validating a volatility-surface for this underlying. | ||
| 169 | |||
| 170 | =cut | ||
| 171 | |||
| 172 | has extra_vol_diff_by_delta => ( | ||
| 173 | is => 'ro', | ||
| 174 | ); | ||
| 175 | |||
| 176 | =head2 market_convention | ||
| 177 | |||
| 178 | Returns a hashref. Keys and possible values are: | ||
| 179 | |||
| 180 | =over 4 | ||
| 181 | |||
| 182 | =item * atm_setting | ||
| 183 | |||
| 184 | Value can be one of: | ||
| 185 | - atm_delta_neutral_straddle | ||
| 186 | - atm_forward | ||
| 187 | - atm_spot | ||
| 188 | |||
| 189 | =item * delta_premium_adjusted | ||
| 190 | |||
| 191 | Value can be one of: | ||
| 192 | - 1 | ||
| 193 | - 0 | ||
| 194 | |||
| 195 | =item * delta_style | ||
| 196 | |||
| 197 | Value can be one of: | ||
| 198 | - spot_delta | ||
| 199 | - forward_delta | ||
| 200 | |||
| 201 | =item * rr (Risk Reversal) | ||
| 202 | |||
| 203 | Value can be one of: | ||
| 204 | - call-put | ||
| 205 | - put-call | ||
| 206 | |||
| 207 | =item * bf (Butterfly) | ||
| 208 | |||
| 209 | Value can be one of: | ||
| 210 | - 2_vol | ||
| 211 | |||
| 212 | =back | ||
| 213 | |||
| 214 | =cut | ||
| 215 | |||
| 216 | has market_convention => ( | ||
| 217 | is => 'ro', | ||
| 218 | isa => 'HashRef', | ||
| 219 | default => sub { | ||
| 220 | return { | ||
| 221 | delta_style => 'spot_delta', | ||
| 222 | delta_premium_adjusted => 0, | ||
| 223 | }; | ||
| 224 | }, | ||
| 225 | ); | ||
| 226 | |||
| 227 | =head2 default_dividend_rate | ||
| 228 | |||
| 229 | Default dividend of this underlying (If this is not set, Quant::Framework::Dividend will be | ||
| 230 | used to lookup dividend) | ||
| 231 | |||
| 232 | =cut | ||
| 233 | |||
| 234 | has default_dividend_rate => ( | ||
| 235 | is => 'ro', | ||
| 236 | default => undef, | ||
| 237 | ); | ||
| 238 | |||
| 239 | =head2 default_interest_rate | ||
| 240 | |||
| 241 | Default interest rate of this underlying (If this is not set, Quant::Framework::Currency will be | ||
| 242 | used to lookup interest rate) | ||
| 243 | |||
| 244 | =cut | ||
| 245 | |||
| 246 | has default_interest_rate => ( | ||
| 247 | is => 'ro', | ||
| 248 | default => undef, | ||
| 249 | ); | ||
| 250 | |||
| 251 | =head2 default_volatility_duration | ||
| 252 | |||
| 253 | Default duration for this underlying when getting volatility. | ||
| 254 | |||
| 255 | =cut | ||
| 256 | |||
| 257 | has default_volatility_duration => ( | ||
| 258 | is => 'ro', | ||
| 259 | default => undef, | ||
| 260 | ); | ||
| 261 | |||
| 262 | =head2 asset_class | ||
| 263 | |||
| 264 | Type of asset for this underlying (can be either 'currency' or 'asset') | ||
| 265 | |||
| 266 | =cut | ||
| 267 | |||
| 268 | has asset_class => ( | ||
| 269 | is => 'ro', | ||
| 270 | isa => 'Str', | ||
| 271 | ); | ||
| 272 | |||
| 273 | has use_official_ohlc => ( | ||
| 274 | is => 'ro', | ||
| 275 | ); | ||
| 276 | |||
| 277 | has spot_db_args => ( | ||
| 278 | is => 'ro', | ||
| 279 | ); | ||
| 280 | |||
| 281 | 1; |