finance

Using QuantLib to compute cash flows for FloatingRateBond with Floor

女生的网名这么多〃 提交于 2019-12-04 14:57:55
Very new to QuantLib so guessing this is a rookie mistake. Enjoyed getting to know this powerful library so thank you to the authors and contributors! I'm able to generate amounts for cashflows for a FloatingRateBond without a pricer if there isn't a floor argument, so I don't understand why including a floor argument would necessitate a pricer. I would think the addition of the floor would just provide a min for each of the fixing values. Wanted to see if anyone has gotten the FloatingRateBond cashflows to work while using a floor. And, if so, if anyone can spot where I'm going astray. Thanks

Python: Plot candlesticks with automatic Y zoom

陌路散爱 提交于 2019-12-04 14:43:58
I am looking for a Python plotting library that allows me to plot candlesticks (preferably the OHLC bars variant) with X zoom via mousewheel scrolling (or similar) and an automatically scaled Y axis when zooming. As an example of what I am looking for, tradingview.com does this perfectly. See https://uk.tradingview.com/chart/?symbol=NASDAQ:NDX . OHLC bars can be seen by clicking the candlestick icon near the top left and selecting 'Bars'. Plotly is almost able to do this. The Ohlc class in plotly.graph_objs give the OHLC bars, and the default rangeslider is a nice feature for X zoom

Group OHLC-Stockmarket Data into multiple timeframes with T-SQL

痞子三分冷 提交于 2019-12-04 14:28:57
I'm using SQL Server 2008 R2 and need to create new tables grouped in Time intervals. The data is data from a stock market index. I have the data in 1 minute intervals, now i need them in 5,10,15,30,45,60...minute intervals. My primary key is the time stamp. My question is: how to query the 1 minute data table to return data that is grouped by a specific time interval for example 5 minute intervals. The query must return the Highest, Lowest, Last and First values in that particular group and most importantly also the last entry of the time-stamp in the group. I'm very new to the SQL language

R Generating a 1 min spaced time sequence

不羁岁月 提交于 2019-12-04 13:56:01
I would like to generate a 1 min spaced time sequence to paste then to a xts object. Basically, I've got a tick-by-tick dateTime object like that : [1] "2010-02-02 08:00:03 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" [6] "2010-02-02 08:00:04 CET" "2010-02-02 08:00:04 CET" "2010-02-02 08:00:05 CET" "2010-02-02 08:00:05 CET" "2010-02-02 08:00:05 CET" I'm aggregating my xts series (by previous tick) to get a 1 min (equally)-spaced time series using an RTAQ package function : price_1m<-aggregatets(price,FUN="previoustick",k=1,on=

Speed up WMA (Weighted Moving Average) calculation

空扰寡人 提交于 2019-12-04 13:33:15
问题 I am trying to calculate exponential moving average on 15 day bars, but want to see "evolution" of the 15 day bar EMA on each (end of) day/bar. So, this means that I have 15 day bars. When new data comes in on a daily basis I would like to recalculate EMA using new information. Actually I have 15 day bars and then, after each day my new 15 day bar starts to grow and each new bar that comes along is supposed to be used for EMA calculation together with previous full 15 day bars. Lets say we

Bloomberg BDH function with ISIN

我是研究僧i 提交于 2019-12-04 08:24:46
问题 I have to download historical end of day data for a huge list of stocks. I found on the bloomberg excel add-in the function BDH that is very useful. That is what I need but there is an issue: my stocks are identified by ISINs and i have tried in many way to put the ISINs in the first field of the function but it doesn't work. The function isn't able to identify the security by the ISIN despite the fact that is reported as security identifier in the bloomberg formula syntax: look at slide 24

Calculating returns from a dataframe with financial data

跟風遠走 提交于 2019-12-04 08:19:25
问题 I have a dataframe with monthly financial data: In [89]: vfiax_monthly.head() Out[89]: year month day d open close high low volume aclose 2003-01-31 2003 1 31 731246 64.95 64.95 64.95 64.95 0 64.95 2003-02-28 2003 2 28 731274 63.98 63.98 63.98 63.98 0 63.98 2003-03-31 2003 3 31 731305 64.59 64.59 64.59 64.59 0 64.59 2003-04-30 2003 4 30 731335 69.93 69.93 69.93 69.93 0 69.93 2003-05-30 2003 5 30 731365 73.61 73.61 73.61 73.61 0 73.61 I'm trying to calculate the returns like that: In [90]:

Get complete stock list for specific index

杀马特。学长 韩版系。学妹 提交于 2019-12-03 21:33:43
Just wondering what kind of free finance API's are out there. I'm looking for something where I can specify the index and get a list of all the companies, by ticker symbol, that are included in that index. Currently I'm only interested in NYSE-listed company stocks. I'd really appreciate any suggestions on API's or methods. Other than doing the hard work, like downloading the symbols for the various exchanges from NASDAQ, then is a way to get Google Finance to display all of the stocks and/or companies listed on an exchange. Here is a sample url for obtaining the list of companies on NASDAQ:

Optimize moving averages calculation - is it possible?

纵饮孤独 提交于 2019-12-03 21:07:33
Is it possible to optimize (make it much faster) this piece of code: out <- do.call(rbind, lapply(split(Cl(cumulativeBars), "days"), function(x) { previousFullBars <- barsEndptCl[as.Date(index(barsEndptCl), tz=indexTZ(barsEndptCl)) < as.Date(last(index(x)), tz=indexTZ(x)), ] if (NROW(previousFullBars) >= 4) { last(SMA(last(rbind(previousFullBars, x), n=6), n=5)) } else { xts(NA, order.by=index(x)) } })) Below you can find my original question with all the code example that runs but a bit to slow for my needs. ORIGINAL QUESTION: After I was able to transform xts to lower frequency in cumulative

How to efficiently calculate a moving Standard Deviation

倖福魔咒の 提交于 2019-12-03 18:40:28
问题 Below you can see my C# method to calculate Bollinger Bands for each point (moving average, up band, down band). As you can see this method uses 2 for loops to calculate the moving standard deviation using the moving average. It used to contain an additional loop to calculate the moving average over the last n periods. This one I could remove by adding the new point value to total_average at the beginning of the loop and removing the i - n point value at the end of the loop. My question now