Skip to content

Commit

Permalink
portfolio.py: Print all digits for price
Browse files Browse the repository at this point in the history
  • Loading branch information
gituliar committed Jan 7, 2024
1 parent 13eb5af commit 2f0bec0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/portfolio.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

from itertools import product
import sys

import QuantLib as ql

Expand Down Expand Up @@ -97,7 +98,8 @@ def to_string(x):
#fo.write('expiry,spot,strike,volatility,interest_rate,dividend_rate,parity,exercise,price,delta,gamma,vega,theta,rgo\n')
for option in product(t, s, k, z, r, q, w, e):
t, s, k, z, r, q, w, e = option
price_ = to_string(price(*option))
price_ = price(*option)
#price_ = to_string(price(*option))
#delta_ = to_string(delta(**kwargs))
#gamma_ = to_string(gamma(**kwargs))
#rho_ = to_string(rho(**kwargs))
Expand All @@ -111,6 +113,10 @@ def to_string(x):
fo.write(line)

if __name__ == '__main__':
mode = 'fd1d'
if len(sys.argv) != 2:
print("portfolio.py <mode>")
exit()

mode = sys.argv[1]
with open(f'portfolio_{mode}.csv', 'w') as fo:
generate(fo, mode)
Binary file modified test/portfolio_fd1d.csv.zst
Binary file not shown.
Binary file modified test/portfolio_qdfp.csv.zst
Binary file not shown.

0 comments on commit 2f0bec0

Please sign in to comment.