Skip to content

Commit 4a419cf

Browse files
committed
Updated before big PEP8 change
1 parent a7b72c4 commit 4a419cf

File tree

257 files changed

+28699
-2140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+28699
-2140
lines changed

golden_tests/TestFinBond.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,6 @@ def build_ibor_curve(value_dt):
214214

215215
def test_bond():
216216

217-
import pandas as pd
218-
219217
path = os.path.join(os.path.dirname(__file__), ".//data//gilt_bond_prices.txt")
220218
bond_dataframe = pd.read_csv(path, sep="\t")
221219
bond_dataframe["mid"] = 0.5 * (bond_dataframe["bid"] + bond_dataframe["ask"])

golden_tests/TestFinBondEmbeddedOptionBK.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
test_cases = FinTestCases(__file__, global_test_case_mode)
2626

27-
plot_graphs = False
27+
PLOT_GRAPHS = False
2828

2929
########################################################################################
3030

@@ -102,7 +102,7 @@ def test_BondEmbeddedOption_MATLAB():
102102

103103
values.append(v["bondwithoption"])
104104

105-
if plot_graphs:
105+
if PLOT_GRAPHS:
106106
plt.figure()
107107
plt.plot(time_steps, values)
108108

@@ -182,7 +182,7 @@ def test_BondEmbeddedOption_QUANTLIB():
182182
test_cases.print(period, num_time_steps, v["bondwithoption"], v["bondpure"])
183183
values.append(v["bondwithoption"])
184184

185-
if plot_graphs:
185+
if PLOT_GRAPHS:
186186
plt.figure()
187187
plt.title("Puttable Bond Price Convergence")
188188
plt.plot(time_steps, values)

golden_tests/TestFinBondEmbeddedOptionHW.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
test_cases = FinTestCases(__file__, global_test_case_mode)
2525

26-
plot_graphs = False
26+
PLOT_GRAPHS = False
2727

2828
########################################################################################
2929

@@ -102,7 +102,7 @@ def test_BondEmbeddedOption_MATLAB():
102102
test_cases.print(period, num_time_steps, v["bondwithoption"], v["bondpure"])
103103
values.append(v["bondwithoption"])
104104

105-
if plot_graphs:
105+
if PLOT_GRAPHS:
106106
plt.figure()
107107
plt.plot(time_steps, values)
108108

@@ -182,7 +182,7 @@ def test_BondEmbeddedOption_QUANTLIB():
182182
test_cases.print(period, num_time_steps, v["bondwithoption"], v["bondpure"])
183183
values.append(v["bondwithoption"])
184184

185-
if plot_graphs:
185+
if PLOT_GRAPHS:
186186
plt.figure()
187187
plt.title("Puttable Bond Price Convergence")
188188
plt.plot(time_steps, values)

golden_tests/TestFinBondOptionBDTModel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
test_cases = FinTestCases(__file__, global_test_case_mode)
2828

29-
plot_graphs = False
29+
PLOT_GRAPHS = False
3030

3131
########################################################################################
3232

@@ -296,7 +296,7 @@ def test_BondOptionAmericanConvergenceTWO():
296296
vec_ep.append(v_ep)
297297
vec_ap.append(v_ap)
298298

299-
if plot_graphs:
299+
if PLOT_GRAPHS:
300300

301301
plt.figure()
302302
plt.plot(num_steps_vector, vec_ec, label="European Call")

golden_tests/TestFinBondOptionBKModel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
test_cases = FinTestCases(__file__, global_test_case_mode)
2727

28-
plot_graphs = False
28+
PLOT_GRAPHS = False
2929

3030
########################################################################################
3131

@@ -305,7 +305,7 @@ def test_BondOptionAmericanConvergenceTWO():
305305
vec_ep.append(v_ep)
306306
vec_ap.append(v_ap)
307307

308-
if plot_graphs:
308+
if PLOT_GRAPHS:
309309

310310
plt.figure()
311311
plt.plot(num_steps_vector, vec_ec, label="European Call")

golden_tests/TestFinBondOptionHWModel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
test_cases = FinTestCases(__file__, global_test_case_mode)
2929

30-
plot_graphs = False
30+
PLOT_GRAPHS = False
3131

3232
########################################################################################
3333

@@ -340,7 +340,7 @@ def test_BondOptionAmericanConvergenceTWO():
340340
vec_ep.append(v_ep)
341341
vec_ap.append(v_ap)
342342

343-
if plot_graphs:
343+
if PLOT_GRAPHS:
344344
plt.figure()
345345
plt.plot(num_steps_vector, vec_ac, label="American Call")
346346
plt.legend()

golden_tests/TestFinBondPortfolio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import os
66
import datetime as dt
7+
import pandas as pd
78

89
import sys
910

@@ -22,8 +23,6 @@
2223

2324
def test_BondPortfolio():
2425

25-
import pandas as pd
26-
2726
path = os.path.join(os.path.dirname(__file__), "./data/gilt_bond_prices.txt")
2827
bond_dataframe = pd.read_csv(path, sep="\t")
2928
bond_dataframe["mid"] = 0.5 * (bond_dataframe["bid"] + bond_dataframe["ask"])
@@ -36,6 +35,7 @@ def test_BondPortfolio():
3635
test_cases.header("DCTYPE", "MATDATE", "CPN", "PRICE", "ACCD", "YTM")
3736

3837
for dc_type in DayCountTypes:
38+
3939
if dc_type == DayCountTypes.ZERO:
4040
continue
4141
for _, bond in bond_dataframe.iterrows():

golden_tests/TestFinBondZeroCoupon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
test_cases = FinTestCases(__file__, global_test_case_mode)
2323

24-
plot_graphs = False
24+
PLOT_GRAPHS = False
2525

2626

2727
########################################################################################

golden_tests/TestFinBondZeroCurve.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import sys
77
import datetime as dt
8+
import pandas as pd
89

910
sys.path.append("..")
1011

@@ -17,15 +18,13 @@
1718

1819
test_cases = FinTestCases(__file__, global_test_case_mode)
1920

20-
plot_graphs = False
21+
PLOT_GRAPHS = False
2122

2223
########################################################################################
2324

2425

2526
def test_BondZeroCurve():
2627

27-
import pandas as pd
28-
2928
path = os.path.join(os.path.dirname(__file__), "./data/gilt_bond_prices.txt")
3029
bond_dataframe = pd.read_csv(path, sep="\t")
3130
bond_dataframe["mid"] = 0.5 * (bond_dataframe["bid"] + bond_dataframe["ask"])
@@ -62,7 +61,7 @@ def test_BondZeroCurve():
6261
zero_rate = bondCurve.zero_rate(maturity_dt)
6362
test_cases.print(maturity_dt, zero_rate)
6463

65-
if plot_graphs:
64+
if PLOT_GRAPHS:
6665
bondCurve.plot("BOND CURVE")
6766

6867

golden_tests/TestFinDiscountCurve.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# TODO: Add other discount discount
2323
########################################################################################
2424

25-
plot_graphs = False
25+
PLOT_GRAPHS = False
2626

2727

2828
def test_FinDiscountCurve():
@@ -48,7 +48,7 @@ def test_FinDiscountCurve():
4848
zero_rates_M = curve.zero_rate(plot_dts, FrequencyTypes.MONTHLY)
4949
zero_rates_C = curve.zero_rate(plot_dts, FrequencyTypes.CONTINUOUS)
5050

51-
if plot_graphs:
51+
if PLOT_GRAPHS:
5252
plt.figure(figsize=(6, 4))
5353
plt.plot(plot_years, scale(zero_rates_A, 100), label="A")
5454
plt.plot(plot_years, scale(zero_rates_S, 100), label="S")
@@ -71,7 +71,7 @@ def test_FinDiscountCurve():
7171
zero_rates = curve.zero_rate(plot_dts, FrequencyTypes.ANNUAL)
7272
par_rates = curve.swap_rate(start_dt, plot_dts, FrequencyTypes.ANNUAL)
7373

74-
if plot_graphs:
74+
if PLOT_GRAPHS:
7575
plt.figure(figsize=(6, 4))
7676
plt.plot(plot_years, scale(fwd_rates, 100), label="FWD RATES")
7777
plt.plot(plot_years, scale(zero_rates, 100), label="ZERO RATES")

0 commit comments

Comments
 (0)