New answers tagged

2

When getting data using the quantmod package, it is a good idea to call the "Adjusted close" function Ad() directly on getSymbols(), since you might run into trouble otherwise (eg. loading prices into the R-environment directly, without saving it in a variable). Ad-hoc solution using your own code: As described above, you can call Ad() directly on ...


4

Understanding negative gamma value for the GJR-GARCH model: $\gamma > 0$ is not a required condition to ensure a "valid" GJR-GARCH model. Let me explain why: As you probably know, we need to impose some restrictions on the parameter space in order to obtain a proper volatility model. The two requirements we need to ensure, are positivity (...


1

This is not at all a quantitative finance question and will probable be moved to StackExchange, but in any case... import pandas as pd import numpy as np df = pd.DataFrame([np.nan, np.nan, -5.0, 1.4, 0.47]) df The NaN values are expected for the first periods, since there are not enough elements to compute the rolling window. To get what you want, you ...


0

“ and each Limit is also an entry in a map keyed off limitPrice.” You don’t spend O(log N) in the tree to find a price, that is a hash at worst. Might want to keep direct BBO links into the tree. Also this info is a bit dated, you probably really want cache-friendlier structures. Intrusive linked lists, flat maps etc.


0

First, couple of corrections (I am not sure, just guessing): $X_T$ - is it strike or price of forward underlying? Let it be strike, $X$ and the underlying is $S_t$ with forward: $Fwd_T=S_t/D_T$. Breeden and Litzenberger formula: No, B&L formula is this: $PDF(S_T)=D_T\cdot\frac{d^2C(X)}{dX^2}$, where $D_T$ is discount factor. Finally, my recipe to ...


3

First, note that $\epsilon_t \sim N(0,1)$ is a white noise process and the random variates are simulated from a standard normal distribution. Hence, it does not make sense for you to multiply ret[2] and ret[3] with the MA-parameters, in order to reproduce ret[4]. The source code reveals how to reproduce the simulation values of the ARMA process: From the ...


2

If you are asking these kinds of questions, it is very unlikely you will be able to successfully train any kind of ML or AI model on stock data with your current level of skill. In fact, each of the questions you ask usually involves weeks, months and -- in some cases -- years of experimentation to discover the right mix of potential features. In ...


0

If you need the column-store for OLAP use cases (not the time series, but this could be done too), try Clickhouse, for 1.1 billion taxi benchmark, it comes 2nd after kx kdb+, and the fastest if eliminating all databases with GPU-based/Xeon-Phi setup.


0

You can find exactly what you have described at algoseek.com. Check their 'Primary Exchange Daily OHLC' (advanced) or 'Standard Daily OHLC' (basic) dataset. Both provide daily bars and differ by the number of data fields. They provide historical data back to 2007 with flexible delivery options and multiple data formats support (including csv and parquet)


0

Extracting the gaps is rather trivial. You just need to use split- and dividend-adjusted OHLC bars from Yahoo Finance, IEX Cloud, polygon.io, Alpha Vantage etc. But gaps happen all the time. Maybe some additional processing is needed to filter out earnings dates, and to remove market impact (beta). The important part is to have a solid theory predicting ...


3

The replicate function works best when you fully define your discretization scheme within a function. Then you can simply replicate the function-call x amount of times. Also, try and keep code duplication to a minimum and improve your general syntax. This will help you and your peers that might need to review and/or change your code in the future. ...


2

I'm a big fan of data.table. The authors of data.table put a lot of thought into performance on big data sets and thanks to its popularity and age have had a lot of feedback and gained much experience in weighing the alternatives. I would definitely recommend that you familiarize yourself with their thinking. They allow setting the number of threads using ...


3

The problem is not in the code you posted, but somewhere before: you have apparently defined a function called c, with only one argument. Try to run the code in a new session.


1

If the primary motivation is being able to query market data with SQL, take a look at Axibase Time Series Database (my affiliation). Step 1: Sign-up for free Polygon API key. Step 2: Install the database on a Linux machine. Generate API token for POST method to /api/v1/trade-session-summary/import endpoint. Step 3: Download end of day bars for several days ...


Top 50 recent answers are included