forked from goldmansachs/gs-quant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
115a06b
commit 1b82ff4
Showing
3 changed files
with
511 additions
and
0 deletions.
There are no files selected for viewing
140 changes: 140 additions & 0 deletions
140
...sk/00_instruments_and_measures/examples/02_fx/000205_fx_var_swap_trade_construction.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"pycharm": { | ||
"is_executing": true | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from gs_quant.instrument import FXVarianceSwap" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from gs_quant.session import GsSession\n", | ||
"# external users should substitute their client id and secret; please skip this step if using internal jupyterhub\n", | ||
"GsSession.use(client_id=None, client_secret=None, scopes=('run_analytics'))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# get list of properties of an fx var swap\n", | ||
"FXVarianceSwap.properties()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"swap = FXVarianceSwap(pair='GBPUSD', last_fixing_date='3m', buy_sell='Buy')\n", | ||
"swap.resolve()\n", | ||
"print(swap.strike_vol*100)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import pprint \n", | ||
"pp = pprint.PrettyPrinter(indent=4)\n", | ||
"\n", | ||
"#forward starting var swap\n", | ||
"fwd_6m6m_swap = FXVarianceSwap(pair='USDJPY', first_fixing_date='6m', last_fixing_date='1y', buy_sell='Buy')\n", | ||
"fwd_6m6m_swap.resolve()\n", | ||
"pp.pprint(fwd_6m6m_swap.as_dict())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"pycharm": { | ||
"name": "#%% md\n" | ||
} | ||
}, | ||
"source": [ | ||
"**Fixing frequency** defaults to 'Daily/Business Days' but many other conventions are supported such as:\n", | ||
"* 'Daily/All Days'\n", | ||
"* 'Daily/Holiday'\n", | ||
"* 'Daily/MonToSat'\n", | ||
"* 'Daily/Weighted Lagging'\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"weighted_swap = FXVarianceSwap(pair='GBPUSD', last_fixing_date='1y', buy_sell='Buy', fixing_frequency='Daily/Weighted Lagging')\n", | ||
"weighted_swap.resolve()\n", | ||
"pp.pprint(weighted_swap.as_dict())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"pycharm": { | ||
"name": "#%% md\n" | ||
} | ||
}, | ||
"source": [ | ||
"**Fixing source** defaults to 'WM Company LDN 4pm Mid' but other options include:\n", | ||
"* 'GS NYC 3PM'\n", | ||
"* 'WM Company NYC 10am Mid'\n", | ||
"* 'BFIX LDN 4PM'\n", | ||
"* 'WMC Company LDN 1pm Mid'\n", | ||
"\n", | ||
"We also have bloomberg options as well such as 'BFIX TKO 3pm-m'. \n", | ||
"We're happy to confirm the syntax if you are looking for a fixing source that is not mentioned here.\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"bfix = FXVarianceSwap(pair='GBPUSD', last_fixing_date='1y', buy_sell='Buy', fixing_source='BFIX LDN 4PM')\n", | ||
"bfix.resolve()\n", | ||
"print(bfix.strike_vol)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
Oops, something went wrong.