Skip to content

Commit 067cca0

Browse files
martinrobersonrazvan-dorobantu
authored andcommitted
Chore: Make release 1.4.25
1 parent 6474f62 commit 067cca0

File tree

5 files changed

+207
-1
lines changed

5 files changed

+207
-1
lines changed
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {
7+
"ExecuteTime": {
8+
"end_time": "2025-08-11T12:19:09.294055700Z",
9+
"start_time": "2025-08-11T12:19:03.376662500Z"
10+
}
11+
},
12+
"outputs": [],
13+
"source": [
14+
"from gs_quant.instrument import IRSwaption, IRSwap, IRCapFloor\n",
15+
"from gs_quant.common import AggregationLevel\n",
16+
"from gs_quant.markets.portfolio import Portfolio\n",
17+
"from gs_quant.risk import IRVanna, IRVolga\n",
18+
"from gs_quant.session import Environment, GsSession"
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": 2,
24+
"metadata": {
25+
"pycharm": {
26+
"name": "#%%\n"
27+
},
28+
"ExecuteTime": {
29+
"end_time": "2025-08-11T12:19:16.393303500Z",
30+
"start_time": "2025-08-11T12:19:11.738322600Z"
31+
}
32+
},
33+
"outputs": [],
34+
"source": [
35+
"# external users should substitute their client id and secret\n",
36+
"GsSession.use(Environment.PROD, client_id=None, client_secret=None, scopes=('run_analytics',))"
37+
]
38+
},
39+
{
40+
"cell_type": "markdown",
41+
"metadata": {},
42+
"source": [
43+
"### Solve for Vanna and Volga\n",
44+
"Size swap to match swaption vanna"
45+
]
46+
},
47+
{
48+
"cell_type": "code",
49+
"execution_count": 3,
50+
"metadata": {
51+
"tags": [
52+
"Instrument - Solving - Size one trade by the risk of another trade"
53+
],
54+
"ExecuteTime": {
55+
"end_time": "2025-08-11T12:19:21.346721500Z",
56+
"start_time": "2025-08-11T12:19:18.268449900Z"
57+
}
58+
},
59+
"outputs": [],
60+
"source": [
61+
"port = Portfolio(\n",
62+
" (\n",
63+
" IRSwaption('Pay', '5y', 'USD', expiration_date='1y', buy_sell='Sell', name='payer_swaption'),\n",
64+
" IRSwap(\n",
65+
" 'Receive',\n",
66+
" '5y',\n",
67+
" 'USD',\n",
68+
" fixed_rate='atm',\n",
69+
" notional_amount='=solvefor([payer_swaption].risk.IRDeltaParallel,bp)',\n",
70+
" name='hedge1',\n",
71+
" ),\n",
72+
" )\n",
73+
")\n",
74+
"port.resolve()"
75+
]
76+
},
77+
{
78+
"cell_type": "code",
79+
"execution_count": null,
80+
"metadata": {},
81+
"outputs": [],
82+
"source": [
83+
"port.calc(IRVanna).to_frame()"
84+
]
85+
},
86+
{
87+
"cell_type": "code",
88+
"execution_count": null,
89+
"outputs": [],
90+
"source": [
91+
"port.calc(IRVolga).to_frame()"
92+
],
93+
"metadata": {
94+
"collapsed": false
95+
}
96+
},
97+
{
98+
"cell_type": "markdown",
99+
"source": [
100+
"Swaption (return) is non-linear (to interest change), that's why we can calculate Vanna and Volga for it, while IRSwap is linear and have it as zero."
101+
],
102+
"metadata": {
103+
"collapsed": false
104+
}
105+
},
106+
{
107+
"cell_type": "markdown",
108+
"source": [
109+
"We can also check IRVanna and IRVolga with IRCapFloor instruments, which return new options for every defined period. "
110+
],
111+
"metadata": {
112+
"collapsed": false
113+
}
114+
},
115+
{
116+
"cell_type": "code",
117+
"execution_count": null,
118+
"outputs": [],
119+
"source": [
120+
"cap = IRCapFloor(\n",
121+
" cap_floor=\"Cap\",\n",
122+
" notional_currency=\"USD\",\n",
123+
" notional_amount=1000,\n",
124+
" effective_date='2025-07-18',\n",
125+
" termination_date='2030-07-18',\n",
126+
" floating_rate_option='USD-LIBOR-BBA',\n",
127+
" floating_rate_designated_maturity='3m',\n",
128+
" floating_rate_frequency='3m',\n",
129+
" strike=0.015, # 1. 5% floor rate\n",
130+
")\n",
131+
"cap.resolve(in_place=False).to_dict()"
132+
],
133+
"metadata": {
134+
"collapsed": false
135+
}
136+
},
137+
{
138+
"cell_type": "code",
139+
"execution_count": null,
140+
"outputs": [],
141+
"source": [
142+
"cap.calc(IRVanna)"
143+
],
144+
"metadata": {
145+
"collapsed": false
146+
}
147+
},
148+
{
149+
"cell_type": "code",
150+
"execution_count": null,
151+
"outputs": [],
152+
"source": [
153+
"cap.calc(IRVanna(aggregation_level=AggregationLevel.Type))"
154+
],
155+
"metadata": {
156+
"collapsed": false
157+
}
158+
},
159+
{
160+
"cell_type": "code",
161+
"execution_count": null,
162+
"outputs": [],
163+
"source": [
164+
"cap.calc(IRVolga)"
165+
],
166+
"metadata": {
167+
"collapsed": false
168+
}
169+
},
170+
{
171+
"cell_type": "code",
172+
"execution_count": null,
173+
"outputs": [],
174+
"source": [
175+
"cap.calc(IRVolga(aggregation_level=AggregationLevel.Type))"
176+
],
177+
"metadata": {
178+
"collapsed": false
179+
}
180+
}
181+
],
182+
"metadata": {
183+
"kernelspec": {
184+
"display_name": "Python 3 (ipykernel)",
185+
"language": "python",
186+
"name": "python3"
187+
},
188+
"language_info": {
189+
"codemirror_mode": {
190+
"name": "ipython",
191+
"version": 3
192+
},
193+
"file_extension": ".py",
194+
"mimetype": "text/x-python",
195+
"name": "python",
196+
"nbconvert_exporter": "python",
197+
"pygments_lexer": "ipython3",
198+
"version": "3.11.5"
199+
}
200+
},
201+
"nbformat": 4,
202+
"nbformat_minor": 4
203+
}

gs_quant/documentation/Contents.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
" - 📄 [20_fix_float_legs_price.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/20_fix_float_legs_price.ipynb)\n",
123123
" - 📄 [21_asset_swap_definition.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/21_asset_swap_definition.ipynb)\n",
124124
" - 📄 [22_cap_floor.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/22_cap_floor.ipynb)\n",
125+
" - 📄 [23_solve_vanna_&_volga.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/23_solve_vanna_&_volga.ipynb)\n",
125126
" - 📁 02_fx\n",
126127
" - 📄 [01_fx_fwd_trade_construction.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/02_fx/01_fx_fwd_trade_construction.ipynb)\n",
127128
" - 📄 [02_fx_option_trade_construction.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/02_fx/02_fx_option_trade_construction.ipynb)\n",

gs_quant/documentation/Index.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
" [02_pricing_and_risk/00_instruments_and_measures/examples/02_fx/04_fx_binary_trade_construction.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/02_fx/04_fx_binary_trade_construction.ipynb) cell 5\n",
105105
"- **Instrument - Solving - Size one trade by the risk of another trade** - \n",
106106
" [02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/19_solve_delta.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/19_solve_delta.ipynb) cell 3\n",
107+
" [02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/23_solve_vanna_&_volga.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/23_solve_vanna_&_volga.ipynb) cell 3\n",
107108
"- **Instrument - Solving - Solving FXVolSwap strike vol** - \n",
108109
" [02_pricing_and_risk/00_instruments_and_measures/examples/02_fx/03_fx_vol_swap_trade_construction.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/02_fx/03_fx_vol_swap_trade_construction.ipynb) cell 10\n",
109110
"- **Instrument - Solving across multiple instruments** - \n",

gs_quant/documentation/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ examples providing a searchable library of short specific snippets.
7878
- 📄 [20_fix_float_legs_price.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/20_fix_float_legs_price.ipynb)
7979
- 📄 [21_asset_swap_definition.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/21_asset_swap_definition.ipynb)
8080
- 📄 [22_cap_floor.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/22_cap_floor.ipynb)
81+
- 📄 [23_solve_vanna_&_volga.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/01_rates/23_solve_vanna_&_volga.ipynb)
8182
- 📁 02_fx
8283
- 📄 [01_fx_fwd_trade_construction.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/02_fx/01_fx_fwd_trade_construction.ipynb)
8384
- 📄 [02_fx_option_trade_construction.ipynb](02_pricing_and_risk/00_instruments_and_measures/examples/02_fx/02_fx_option_trade_construction.ipynb)

gs_quant/timeseries/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def get_dataset_with_many_assets(
349349

350350
) -> pd.DataFrame:
351351
tasks = [partial(ds.get_data, assetId=assets[i:i + batch_limit], start=start, end=end,
352-
return_type=None, limit=batch_limit, **kwargs) for i in range(0, len(assets), batch_limit)]
352+
return_type=None, **kwargs) for i in range(0, len(assets), batch_limit)]
353353
results = ThreadPoolManager.run_async(tasks)
354354
return pd.concat(results)
355355

0 commit comments

Comments
 (0)