@@ -49,15 +49,24 @@ void CurrencyConfig::fromXML(XMLNode* baseNode) {
4949 // the digit where we switch form roundng down to rounding up, typically 5 and used across all
5050 // Integer digit = parseInteger(XMLUtils::getChildValue(node, "Digit", false));
5151 string format = XMLUtils::getChildValue (node, " Format" , false );
52+ QuantExt::ConfigurableCurrency::Type currencyType = parseCurrencyType (XMLUtils::getChildValue (node, " CurrencyType" , false , " Major" ));
5253 Rounding rounding (precision, roundingType);
53-
5454 QuantExt::ConfigurableCurrency c (name, isoCode, numericCode, symbol, fractionSymbol, fractionsPerUnit,
55- rounding, format, minorUnitCodes);
56- currencies_.push_back (c);
57-
55+ rounding, format, minorUnitCodes, currencyType);
5856 DLOG (" loading configuration for currency code " << isoCode);
5957
60- CurrencyParser::instance ().addCurrency (c.code (), c);
58+ switch (currencyType) {
59+ case QuantExt::ConfigurableCurrency::Type::Crypto:
60+ CurrencyParser::instance ().addCrypto (c.code (), c);
61+ break ;
62+ case QuantExt::ConfigurableCurrency::Type::Metal:
63+ CurrencyParser::instance ().addMetal (c.code (), c);
64+ break ;
65+ default :
66+ CurrencyParser::instance ().addCurrency (c.code (), c);
67+ break ;
68+ }
69+ currencies_.push_back (c);
6170
6271 } catch (std::exception&) {
6372 ALOG (" error loading currency config for name " << name << " iso code " << isoCode);
@@ -81,6 +90,7 @@ XMLNode* CurrencyConfig::toXML(XMLDocument& doc) {
8190 XMLUtils::addChild (doc, ccyNode, " RoundingPrecision" , to_string (ccy.rounding ().precision ()));
8291 // XMLUtils::addChild(doc, ccyNode, "Digit", to_string(ccy.rounding().roundingDigit()));
8392 XMLUtils::addChild (doc, ccyNode, " Format" , ccy.format ());
93+ XMLUtils::addChild (doc, ccyNode, " CurrencyType" , to_string (ccy.currencyType ()));
8494 }
8595 return node;
8696}
0 commit comments