diff options
| -rw-r--r-- | docs/process.rst | 105 |
1 files changed, 72 insertions, 33 deletions
diff --git a/docs/process.rst b/docs/process.rst index 6851ad13..c1ba6f72 100644 --- a/docs/process.rst +++ b/docs/process.rst @@ -2,49 +2,88 @@ Preamble --------
In everything that follows the paths are relative from
-our directory ``//WDSENTINEL/share/CorpCDOs``.
+our directory ``//WDSENTINEL/share/CorpCDOs`` on Windows and
+``/home/share/CorpCDOs`` on Linux.
Load data from intex and populate the database
----------------------------------------------
we need to fill up three tables:
-- cusip_universe table
-- et_collateral
-- cusip_universe
-This is driven by the ``clo_universe.xslx`` file in the data directory.
-It contains a clean deals tab. These deals need to be pasted as a
-portfolio in intex. I use a custom layout in the portfolio to export
-the column we need.
+* cusip_universe table
+* et_collateral
+* cusip_universe
-First thing is to export the data as a text file from the portfolio
-tab and save it as ``clo_universe_intex_%Y-%m-%d.txt`` in the data
-directory. It can be loaded in the clo_universe table by using the
-python script: ``code/python/clo_universe.py``. This script needs to
-be edited so that it loads the correct date.
+From the spreadsheet, this is driven but the twho shortcuts
+``CTRL+Shift+Y`` and ``CTRL+Shift+G``.
-Next, we go the Collat Detail tab in Collateral, make sure Asset detail
-is selected, and export all bonds to a text file. It probably needs to
-be cut in a few chunks. We extract the zip file generated by intex in
-a folder inside ``./`` named ``Collaterals_%Y-%m-%d``. It should be the same
-date as for the ``clo_universe_intex_%Y-%m-%d.txt`` file.
+* First select the cusips of interest, do ``CTRL+Shift+Y`` and paste them
+ into a new portfolio tab in intex. On the portfolio tab itself,
+ right click, then Export to text, delete all the extraneous lines
+ and save into ``data/clo_universe_intex_%Y-%m-%d.txt``
+* Then in the Collat Detail tab, make sure Asset Detail is
+ toggled. Right click, then Export to text, All bonds and extract the
+ resulting zip file into a folder named ``data/Collaterals_%Y-%m-%d``
+* Last step, select the cusips again, do ``CTRL+SHIFT+G``, paste into a
+ new portfolio tab. Click on All Tranches, Right Click, Export to
+ text, and save the file into a folder named ``data/Trinfo_%Y-%m-%d``
-Next, we have to load all the cusip information into the
-``cusip_universe`` table. To get the list of cusips from the
-``clo_universe`` table, we can use the query: ``SELECT UNNEST("Deal
-Cusip List") FROM latest_clo_universe;``. The R function
-``cusipsfromdealnames`` in ``intex_deal_functions.R`` is a convenient
-wrapper around it. The resulting list of cusips needs to be set up as a
-new portfolio in intex, and the All Tranches tab exported as text
-files. They are saved in the ``Trinfo_%Y-%m-%d`` folder. The script to
-load them in the database is called ``cusip_universe.py``.
+We're done exporting the data from intex, now we need to load it into
+the database. We need to run 3 scripts. To do so, after connecting to
+the remote server, at the prompt do: ::
+
+ cd /home/share/CorpCDOs/code/python
+ python clo_universe.py
+ python load_intex_collateral.py
+ python cusip_universe.py
+
+The script ``load_intex_collateral.py`` might errror out, just type c and
+enter to keep it going.
Steps to build the model
------------------------
-- first we need to calibrate the implied factor distribution. This is
- done by using ``calibrate_tranches.R`` inside ``code/R``. The
- spreads data is generated from the ``HY indices.xlsx`` spreadsheet
- in the ``NewSpreadsheet`` directory.
-- then for each deal in the universe, we build the portfolio data, and
- scenarios using ``code/R/build_SC.R``
+* We need to have a monitor running that will trigger the scenarios
+ generations for us. ::
+
+ cd /home/share/CorpCDOs/scripts
+ bash monitor.sh
+
+ **Note** need to set it up as a deamon so that it get automatically
+ started at boot.
+* After that, scenarios generation can be triggered by selecting the
+ cusips in the excel spreadsheet and using the ``CTRL+Shift+H`` shortcut.
+* This will trigger three scripts: first it will build the survival
+ curves: these are saved into ``Scenarios/Portfolios_%Y_%m_%d``,
+ second it will generate the loss and prepay distributions and save
+ them into ``Scenarios/Intex curves_%Y-%m%d/csv``, and finally
+ generate the sss files that we can load into intex in
+ ``Scenarios/Intex curves_%Y-%m%d/sss``.
+* You can look at the logs file in ``scripts/logs``
+ to monitor the process.
+
+
+Running the scenarios in Intex
+------------------------------
+
+* First make sure that Intex look for the sss files in the right
+ directory. Go into Tools, Options, Data Access and change it
+ appropriately.
+* Select the cusips of interest on the spreadsheet (make sure the
+ corresponding sss files exist), do ``CTRL+Shift+I`` and paste them
+ into a new portfolio tab in Intex... twice so that Intex actually
+ paste the data.
+* Then go onto the Scenarios Tab, and click the cross next to Rate
+ Update to make sure it reloads the Interest Rates (otherwise intex
+ will run it with libor set at 0... not good)
+* Then go onto the Cashflows tab and wait... Once it's down, export
+ the cashflows into ``Scenarios/Prices_%Y-%m%-%d``.
+* Finally, on the server do: ::
+
+ cd /home/share/CorpCDOs/code/R
+ Rscript load_cf.R
+
+ This will load the cashflows and compute the deltas, and save it in
+ the database.
+* Enjoy your work by typing ``CTRL+T`` on the spreadsheet and see how
+ all the columns get filled. Yay!
|
