Skip to content

Commit fa76439

Browse files
committed
Upgraded to FinancePy 0.310
1 parent 7af86b6 commit fa76439

20 files changed

+2419
-1480
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ One possible way to fix this is to delete the `__pycache__` folders underneath w
161161
Eg. if you are using the `py38class` environment, if you've installed Anaconda in `C:\Anaconda3`, you might find the financepy
162162
folder at the below location
163163

164-
`C:\Anaconda3\envs\py38\Lib\site-packages\financepy`
164+
`C:\Anaconda3\envs\py38class\Lib\site-packages\financepy`
165165

166166
# finmarketpy examples
167167

@@ -187,6 +187,9 @@ In finmarketpy/examples you will find several examples, including some simple tr
187187

188188
# finmarketpy log
189189

190+
* 01 Jan 2024
191+
* Helper code to reduce boiler plate code for TradingModel
192+
* Upgraded to FinancePy 0.310 and refactored FXVolSurface
190193
* 26 Apr 2023
191194
* Changed sklearn to scikit-learn dependency
192195
* 05 Apr 2022

finmarketpy/backtest/backtestengine.py

+1,151-549
Large diffs are not rendered by default.

finmarketpy/curve/volatility/fxoptionspricer.py

+144-86
Large diffs are not rendered by default.

finmarketpy/curve/volatility/fxvolsurface.py

+121-124
Large diffs are not rendered by default.

finmarketpy/util/marketconstants.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,21 @@ class MarketConstants(object):
8989
fx_options_tenor_for_interpolation = ["ON", "1W", "2W", "3W", "1M", "2M", "3M", "4M", "6M", "9M", "1Y"]#, "2Y", "3Y"]
9090

9191
# What contract will we generally be trading?
92-
fx_options_trading_tenor = '1M'
92+
fx_options_trading_tenor = "1M"
9393

9494
# When constructing total return index 'mult' or 'add'
95-
fx_options_cum_index = 'mult'
95+
fx_options_cum_index = "mult"
9696

9797
# For total return index use option price in base currency/for
98-
fx_options_index_premium_output = 'pct-for'
98+
fx_options_index_premium_output = "pct-for"
9999

100-
fx_options_index_strike = 'atm'
101-
fx_options_index_contract_type = 'european-call'
100+
fx_options_index_strike = "atm"
101+
fx_options_index_contract_type = "european-call"
102102

103103
fx_options_freeze_implied_vol = False
104104

105105
# What is the point at which we roll?
106-
fx_options_roll_event = 'expiry-date' # 'month-end', 'expiry-date', 'no-roll'
106+
fx_options_roll_event = "expiry-date" # 'month-end', 'expiry-date', 'no-roll'
107107

108108
# How many days before that point should we roll?
109109
fx_options_roll_days_before = 5
@@ -114,23 +114,23 @@ class MarketConstants(object):
114114
# For fitting vol surface
115115

116116
# 'CLARK5', 'CLARK', 'BBG', 'SABR' and 'SABR3'
117-
fx_options_vol_function_type = 'CLARK5'
118-
fx_options_depo_tenor = '1M'
117+
fx_options_vol_function_type = "CLARK5"
118+
fx_options_depo_tenor = "1M"
119119

120120
# 'fwd-delta-neutral' or 'fwd-delta-neutral-premium-adj' or 'spot' or 'fwd'
121-
fx_options_atm_method = 'fwd-delta-neutral-premium-adj'
121+
fx_options_atm_method = "fwd-delta-neutral-premium-adj"
122122

123123
# 'fwd-delta' or 'fwd-delta-prem-adj' or 'spot-delta-prem-adj' or 'spot-delta'
124-
fx_options_delta_method = 'spot-delta-prem-adj'
124+
fx_options_delta_method = "spot-delta-prem-adj"
125125
fx_options_alpha = 0.5
126126

127127
# 'pct-for' (in base currency pct) or 'pct-dom' (in terms currency pct)
128-
fx_options_premium_output = 'pct-for'
129-
fx_options_delta_output = 'pct-fwd-delta-prem-adj'
128+
fx_options_premium_output = "pct-for"
129+
fx_options_delta_output = "pct-fwd-delta-prem-adj"
130130

131131
# 'nelmer-mead' or 'nelmer-mead-numba' (faster but less accurate) or 'cg' (conjugate gradient tends to be slower, but more accurate)
132-
fx_options_solver = 'nelmer-mead-numba'
133-
fx_options_pricing_engine = 'financepy' # 'financepy' or 'finmarketpy'
132+
fx_options_solver = "nelmer-mead-numba"
133+
fx_options_pricing_engine = "financepy" # 'financepy' or 'finmarketpy'
134134

135135
fx_options_tol = 1e-8
136136

finmarketpy/util/marketutil.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ def parse_date(self, date):
2424

2525
date1 = datetime.datetime.utcnow()
2626

27-
if date is 'midnight':
27+
if date == "midnight":
2828
date1 = datetime.datetime(date1.year, date1.month, date1.day, 0, 0, 0)
29-
elif date is 'decade':
29+
elif date == "decade":
3030
date1 = date1 - timedelta(days=365 * 10)
31-
elif date is 'year':
31+
elif date == "year":
3232
date1 = date1 - timedelta(days=365)
33-
elif date is 'month':
33+
elif date == "month":
3434
date1 = date1 - timedelta(days=30)
35-
elif date is 'week':
35+
elif date == "week":
3636
date1 = date1 - timedelta(days=7)
37-
elif date is 'day':
37+
elif date == "day":
3838
date1 = date1 - timedelta(days=1)
39-
elif date is 'hour':
39+
elif date == "hour":
4040
date1 = date1 - timedelta(hours=1)
4141
else:
4242
# format expected 'Jun 1 2005 01:33', '%b %d %Y %H:%M'

0 commit comments

Comments
 (0)