Questions tagged [computational-finance]

Use this tag for questions related to Computational Finance, a branch of applied computer science that deals with problems of practical interest in finance.

Some slightly different definitions are the study of data and algorithms currently used in finance and the mathematics of computer programs that realize financial models or systems.

57 questions
1
vote
0 answers

R computation cost and length of vector

I am trying to generate samples of MCMC using R and I found an interesting point. At every i-th step, I add new sample as follows for(i in 1: M){ newsample=generate_sample(y.vec[i]); y.vec[i+1]=newsample; } As a consequence, I could generate length…
1
vote
1 answer

Matlab: How to specify Coupon frequency for Interest Rate Swap

Although I believe that Quantitative Finance Forum is more relevant for this question, as this is far more popular, I'll let myself to ask same question here. I'm trying to price an interest rate swap and would like to change the default coupon…
Karusmeister
  • 871
  • 2
  • 12
  • 25
0
votes
0 answers

How to price an exotic option that is the higher of two market indices?

I have a two-stage problem: (1) Given market forwad curves and current implicit volatilities, value an implicit exotic option for a contract where the buyer agrees to purchase a commodity at price: max{M_i, D_i}_i - K, where K is a constant and M_i…
0
votes
1 answer

python stock statistics, if statement on each row of dataframe

I have a dataframe with stock OHLC and would like to find how many times it crosses option strikes ( a single summary statistic). dataframe open high low close volume datetime datetime2 n_strike strk_diff …
J.Billman
  • 47
  • 5
0
votes
1 answer

What's causing this yahoo_fin get_quote_table error?

I'm trying to get the live prices, previous close, and day's range with yahoo_fin's get_quote_table. It's been working with these errors occurring some of the time, but my program is able ... up until now. Today, I've constantly been getting these…
0
votes
4 answers

Ignore None values and skip to next value?

This list of dictionaries changes regularly. search_option = [{'strike_price': '1', 'bid_price': '0.25', 'implied_volatility': '0.94' }, {'strike_price': '3.5', 'bid_price': '0.20', 'implied_volatility': '0.88'}, {'strike_price': '2', 'bid_price':…
0
votes
1 answer

Search list of dicts for values greater than given value?

So I have a list of dicts with different strike, bid prices and implied_volatility for 4 different potential option trades. search_option = [{'strike_price': '1', 'bid_price': '0.25', 'implied_volatility': '0.94' }, {'strike_price': '3.5',…
0
votes
0 answers

get() gives wrong values from dictionary?

import config import robin_stocks as r r.login(config.USERNAME,config.PASSWORD) #specify criteria to search for options of a given symbol and its exp date symbol = 'F' expirationDate = '2020-06-19' So the code searches for an option with the…
0
votes
0 answers

Convert dictionary values into separate variables? Python

So I have this code which searches for an option with the highest volatility. import config import robin_stocks as r r.login(config.USERNAME,config.PASSWORD) #specify criteria to search for options of a given symbol and its exp date symbol =…
Kam Halil
  • 35
  • 7
0
votes
1 answer

Bachelier Normal Implied Vol Python Calculation (Help) Jekel

Writing a python script to calc Implied Normal Vol ; in line with Jekel article (Industry Standard). https://jaeckel.000webhostapp.com/ImpliedNormalVolatility.pdf They say they are using a Generalized Incomplete Gamma Function Inverse. For a…
0
votes
0 answers

Optimize the units of a second option in portfolio when jump occurs in python

I'm trying to optimize the units for the second option when a jump occurs, but I'm not able to face this stuff in python (or any other code). As you already know, I've this inital situation: \Pi[:,0] = C(0,K,s0) - (initial delta of first call +…
ptf
  • 19
  • 2
0
votes
1 answer

My C# Weighted Moving Average result is different than TradingView's, how does TradingView calculate WMA?

Finance charts on TradingView provide a weighted moving average (WMA) value based on a series of past stock prices. I've written a C# method (shown below) to calculate these WMA values so they are exactly the same as the results on TradingView,…
0
votes
1 answer

Autofill rows in R, daily volatility calculation

my dataset looks like this: set.seed(1234) mydata <- data.frame("Returns" = sample(1:20,200, replace=T), "Vol" = 0) I calculated annualized daily volatilty for the first 21 rows in a new column: d_vol <- sd(mydata$Returns[1:21]) y_vol <-…
0
votes
1 answer

I am having trouble creating a class to model loans with interest and payments

I am getting having errors with the math in my loan repayment calculator. I am trying to create a class where I can create a loan, iterate it by month or year, and also apply payments to the loan. I am not entirely sure where my issue lies in this…
0
votes
0 answers

Efficiently handle Market Broadcast Data and process it using python

This might seem a broad question but it is precise that I want to achieve so please read it. I am building an application that connects to market broadcast and subscribes nearly 200 scrips for broadcast. Broadcast is received for every script every…
ap14
  • 4,393
  • 1
  • 15
  • 30