# Tag Info

Accepted

### Efficient way to store orderbook in Python

The best solution is to change how you're doing it completely: Store the data before it even gets to your program and process it later. e.g. Use your program merely as a daemon to subscribe to the ...
• 1,820
Accepted

### Problem with pricing a call option using the Monte Carlo Vasicek model

To make sure that I understand the problem: you are trying to price a call option expiring at time 0.5, which will exercise into a unit notional zero-coupon bond with a maturity of 1.0 at a strike (...
• 845

### How to minimize Nelson-Siegel parametric form

When we worked with that model several years go, we used Differential Evolution and it worked very well. See Calibrating the Nelson-Siegel-Svensson Model. At least in the standard version, a best-of-...
• 2,946
Accepted

### How to calculate Sortino ratio from a weighted portfolio with Python?

Sortino ratio in Python: Doing my own due dilligence, I found a paper depicting the formula for the Sortino ratio, which follows the same setup as from this link described in an earlier comment. For ...
• 3,903
Accepted

### Quantlib: How to print the maturity dates or pillars from the helpers in Quantlib python?

You can see at the beginning of this file the methods exported by all helpers. For the pillar dates, you can write for h in helpers: print(h.pillarDate())
• 5,753
Accepted

### QuantLib: How to import indexes from QuantLib?

That's the structure of the folders in the C++ source, but the Python module is flat. Just write: from QuantLib import EUHICP, TARGET
• 5,753
Accepted

### QuantlIb: How to use maturities in place of Tenors in OIS rate helpers Quantlib?

Use the DatedOISRateHelper class instead. It takes explicit start and end dates. (The two cases—tenor and explicit dates—needed to be implemented differently in C++...
• 5,753

### Quantlib: VanillaSwap not using underlying Index fixings correctly

That's because the default of the library is to estimate floating-rate coupons at par on the curve. This can cause the end dates of the underlying forward rates to differ from the ones implied by ...
• 5,753

### Why is my put intrinsic value greater than my actual put value in BSM? Python code

The answer to your question: A European put option can be priced below intrinsic value in a high interest rate environment (such as r=0.1) when stock price is low enough. That is due to time value of ...
• 9,657
Accepted

### Easier way than using QuantLib to compute the price and Greeks of a vanilla European option?

You should think of QuantLib as a set of very powerfull tools/parts which you can use to build your own pricers. If you are going to price a single option, yes it takes a bit of boilerplate code to ...
• 5,375

### Where can I find a Python module for Stock volatility estimators using Yang Zhang method?

There's a github repository for this: "A complete set of volatility estimators based on Euan Sinclair's Volatility Trading." https://github.com/jasonstrimpel/volatility-trading
Accepted

### How to make a schedule for amortizing bonds in python quantlib?

Amortization is included when you build the bond. Given that you're mentioning a payment of 300, I'll guess that your face amount is 1000, not 100 as you wrote. Also, you're mentioning a payment on ...
• 5,753
Accepted

### Fitting a volatility smile with pySABR -- Python implementation of SABR model

Edit: You need to specify the keyword arguments in your second example The poor calibration of your second example comes from the fact, that you didn't define the keyword arguments in the LNsabr-...
• 3,903
Accepted

### Can NumPy calculate the % change the way it is shown in multiple instrument charts?

Sure - just divide (.div()) the values in each series by the starting value in that series and subtract 1. The actual syntax will depend on how your data is ...
• 1,111

### How do Personal Finance companies get access to their customers investment accounts?

I would reach out to SnapTrade. You would connect your platform to them, and in turn they allow your customers to connect numerous brokerage accounts to your platform.

### How do you handle non integer time intervals in Quantlib for options pricing (ie intraday pricing)

QuantLib has support for intraday calculations, but it's not enabled by default because it makes the library slower. Unfortunately, it's not a runtime switch: you'll have to recompile QuantLib and ...
• 5,753
Accepted

### Triple Gaussian integrals in Python

Both values are practically zero and the difference between the two pieces of software is really, really small (almost infinitesimal compared to your inputs). Computers are not perfect calculators and ...
• 7,731
Accepted

### Simulating Correlated Stock Returns in Python (SciPy)

I have not run your code, but this is an example where Jensen's inequality holds. Suppose you look at returns of a single asset over two periods, $R_1$ and $R_2$. Returns here mean gross returns, such ...
• 2,946
Accepted

### Quantlib HW 1f model calibration not fitting to market normal vol quotes

You will need a time-dependent volatility function rather than a constant volatility, typically a piece-wise constant volatility function is used and can reproduce the swaption vols exactly (presuming ...
Accepted

### Specify fixing days for floating leg in Interest Rate Swap valuation using QuantLib Python

VanillaSwap models simple swaps, so it doesn't have a lot of bells and whistles. For more control, you can create the two legs separately and use the ...
• 5,753

### question on QuantLib schedule to get bond coupon payment dates - python

With end-of-month set to False, the schedule doesn't even try to hit the 31st; it starts from a stub on the 30th, so it uses the 30th of the month for all other ...
• 5,753
Accepted

### Option Pricing - Incorrect price outcome for Out of the Money (OTM) calls

Your end goal of obtaining "fair" theoretical option prices will unfortunately require a lot of effort if you want to get this done properly on your own. Here are a few reasons why: All ...
• 4,962

### Easier way than using QuantLib to compute the price and Greeks of a vanilla European option?

You could simply code the formulas yourself, but this would not reduce the amount of code. I would say using quantlib is already very compact.
• 103

### QuantlIb: How to use maturities in place of Tenors in OIS rate helpers Quantlib?

It seems the constructor insists on a tenor. What you could perhaps try is convert the days between the maturity date and settlement date/effective date of the curve and then create a Period object ...
• 21

### Verify numerically relation between mean deviation and standard deviation

There's a small typo, Mean absolute deviation, with 0 mean = sum(abs(x))/n Standard deviation, with 0 mean = np.sqrt(sum(x ** 2))/np.sqrt(n) So when you divide MAD over SD you should use: sum(abs(x)) /...
• 292

• 5,938