FXCurrencyPairConventions.java

  1. package org.drip.sample.fx;

  2. import org.drip.market.definition.FXSettingContainer;
  3. import org.drip.service.env.EnvManager;

  4. /*
  5.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  6.  */

  7. /*!
  8.  * Copyright (C) 2019 Lakshmi Krishnamurthy
  9.  * Copyright (C) 2018 Lakshmi Krishnamurthy
  10.  * Copyright (C) 2017 Lakshmi Krishnamurthy
  11.  * Copyright (C) 2016 Lakshmi Krishnamurthy
  12.  * Copyright (C) 2015 Lakshmi Krishnamurthy
  13.  *
  14.  *  This file is part of DROP, an open-source library targeting risk, transaction costs, exposure, margin
  15.  *      calculations, valuation adjustment, and portfolio construction within and across fixed income,
  16.  *      credit, commodity, equity, FX, and structured products.
  17.  *  
  18.  *      https://lakshmidrip.github.io/DROP/
  19.  *  
  20.  *  DROP is composed of three modules:
  21.  *  
  22.  *  - DROP Analytics Core - https://lakshmidrip.github.io/DROP-Analytics-Core/
  23.  *  - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
  24.  *  - DROP Numerical Core - https://lakshmidrip.github.io/DROP-Numerical-Core/
  25.  *
  26.  *  DROP Analytics Core implements libraries for the following:
  27.  *  - Fixed Income Analytics
  28.  *  - Asset Backed Analytics
  29.  *  - XVA Analytics
  30.  *  - Exposure and Margin Analytics
  31.  *
  32.  *  DROP Portfolio Core implements libraries for the following:
  33.  *  - Asset Allocation Analytics
  34.  *  - Transaction Cost Analytics
  35.  *
  36.  *  DROP Numerical Core implements libraries for the following:
  37.  *  - Statistical Learning
  38.  *  - Numerical Optimizer
  39.  *  - Spline Builder
  40.  *  - Algorithm Support
  41.  *
  42.  *  Documentation for DROP is Spread Over:
  43.  *
  44.  *  - Main                     => https://lakshmidrip.github.io/DROP/
  45.  *  - Wiki                     => https://github.com/lakshmiDRIP/DROP/wiki
  46.  *  - GitHub                   => https://github.com/lakshmiDRIP/DROP
  47.  *  - Repo Layout Taxonomy     => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
  48.  *  - Javadoc                  => https://lakshmidrip.github.io/DROP/Javadoc/index.html
  49.  *  - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
  50.  *  - Release Versions         => https://lakshmidrip.github.io/DROP/version.html
  51.  *  - Community Credits        => https://lakshmidrip.github.io/DROP/credits.html
  52.  *  - Issues Catalog           => https://github.com/lakshmiDRIP/DROP/issues
  53.  *  - JUnit                    => https://lakshmidrip.github.io/DROP/junit/index.html
  54.  *  - Jacoco                   => https://lakshmidrip.github.io/DROP/jacoco/index.html
  55.  *
  56.  *  Licensed under the Apache License, Version 2.0 (the "License");
  57.  *      you may not use this file except in compliance with the License.
  58.  *  
  59.  *  You may obtain a copy of the License at
  60.  *      http://www.apache.org/licenses/LICENSE-2.0
  61.  *  
  62.  *  Unless required by applicable law or agreed to in writing, software
  63.  *      distributed under the License is distributed on an "AS IS" BASIS,
  64.  *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  65.  *  
  66.  *  See the License for the specific language governing permissions and
  67.  *      limitations under the License.
  68.  */

  69. /**
  70.  * <i>FXCurrencyPairConventions</i> demonstrates the accessing of the Standard FX Currency Order and Currency
  71.  * Pair Conventions.
  72.  *  
  73.  * <br><br>
  74.  *  <ul>
  75.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/AnalyticsCore.md">Analytics Core Module</a></li>
  76.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics Library</a></li>
  77.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/README.md">Sample</a></li>
  78.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/fx/README.md">FX Curve Builder</a></li>
  79.  *  </ul>
  80.  * <br><br>
  81.  *
  82.  * @author Lakshmi Krishnamurthy
  83.  */

  84. public class FXCurrencyPairConventions {

  85.     private static final void CurrencyOrder (
  86.         final String strCurrency)
  87.         throws Exception
  88.     {
  89.         System.out.println ("\t|     " + strCurrency + "   " +
  90.             FXSettingContainer.CurrencyOrder (
  91.                 strCurrency
  92.             ) + "    |"
  93.         );
  94.     }

  95.     private static final void CurrencyPairInfo (
  96.         final String strCurrency1,
  97.         final String strCurrency2)
  98.         throws Exception
  99.     {
  100.         System.out.println ("\t|  " + strCurrency1 + "/" + strCurrency2 + " => " +
  101.             FXSettingContainer.CurrencyPair (
  102.                 strCurrency1,
  103.                 strCurrency2
  104.             )
  105.         );
  106.     }

  107.     public static final void main (
  108.         final String[] astrArgs)
  109.         throws Exception
  110.     {
  111.         EnvManager.InitEnv ("");

  112.         System.out.println ("\t|----------------|");

  113.         System.out.println ("\t| CURRENCY ORDER |");

  114.         System.out.println ("\t|----------------|");

  115.         CurrencyOrder ("AUD");

  116.         CurrencyOrder ("CAD");

  117.         CurrencyOrder ("CHF");

  118.         CurrencyOrder ("EUR");

  119.         CurrencyOrder ("GBP");

  120.         CurrencyOrder ("JPY");

  121.         CurrencyOrder ("NZD");

  122.         CurrencyOrder ("USD");

  123.         CurrencyOrder ("ZAR");

  124.         System.out.println ("\t|----------------|\n\n");

  125.         System.out.println ("\t|---------------------------------------|");

  126.         System.out.println ("\t|     PAIR    NUM  DENOM  BASE   FACTOR |");

  127.         System.out.println ("\t|---------------------------------------|");

  128.         CurrencyPairInfo ("AUD", "EUR");

  129.         CurrencyPairInfo ("AUD", "USD");

  130.         CurrencyPairInfo ("EUR", "GBP");

  131.         CurrencyPairInfo ("EUR", "JPY");

  132.         CurrencyPairInfo ("EUR", "USD");

  133.         CurrencyPairInfo ("GBP", "JPY");

  134.         CurrencyPairInfo ("GBP", "USD");

  135.         CurrencyPairInfo ("USD", "BRL");

  136.         CurrencyPairInfo ("USD", "CAD");

  137.         CurrencyPairInfo ("USD", "CHF");

  138.         CurrencyPairInfo ("USD", "CNY");

  139.         CurrencyPairInfo ("USD", "EGP");

  140.         CurrencyPairInfo ("USD", "HUF");

  141.         CurrencyPairInfo ("USD", "INR");

  142.         CurrencyPairInfo ("USD", "JPY");

  143.         CurrencyPairInfo ("USD", "KRW");

  144.         CurrencyPairInfo ("USD", "MXN");

  145.         CurrencyPairInfo ("USD", "PLN");

  146.         CurrencyPairInfo ("USD", "TRY");

  147.         CurrencyPairInfo ("USD", "TWD");

  148.         CurrencyPairInfo ("USD", "ZAR");

  149.         System.out.println ("\t|---------------------------------------|");

  150.         EnvManager.TerminateEnv();
  151.     }
  152. }