Questions tagged [finance]

Finance relates to the management of assets over time under varying conditions, usually in order to make a profit.

finance
Filter by
Sorted by
Tagged with
0 votes
1 answer
86 views

how do i construct a sas do loop to get the amount of what's left to be paid?

hope you can help me. The below table wants to show the result I want to get by using a sas code. Basically, it's about calculating the amount of an installment, starting from par_value of 10.000€, ...
Enrico's user avatar
  • 53
0 votes
0 answers
119 views

Pandas Cumprod from a certain index level

I am trying to work out the compounded returns for the SPY from select years using Pandas & Python for withdrawing backtesting for retirement. I am struggling to get the compounded returns as ...
Robert Wood's user avatar
0 votes
1 answer
467 views

List index out of range error when using Pandas and Yahoo_fin

This is a modified version of a program from a tutorial that extracts data from all of the stocks in the S&P 500 and picks stocks that match the criteria you specify. The issue is that when I run ...
Yolomashi's user avatar
0 votes
1 answer
41 views

Get financial registry every 15 days

I'm working on a system that controls the finances of the company. One of the features is to schedule fixed income/expenses that happens every 15 days. I already have a function that schedules incomes/...
celsomtrindade's user avatar
0 votes
0 answers
27 views

What is the simplest way to output financial decimal answers for beginners using JavaScript? [duplicate]

Example: convert calculated integer answer 24.025724 into 24.03 For the time being, I convert all decimal numbers into whole numbers to do the calculations by multiplying them by 100, then divide the ...
Sean Trudel's user avatar
0 votes
1 answer
74 views

how to sum values in a new column, based on conditions and occurrence of the same value in col (value recurrence) as a factor

I'm trying to find a way to update values in a new column having written a piece of code that in every step (row by row) displays the sum of buy/sell orders with the best price. stock_buy_sell = { ...
Paweł Pedryc's user avatar
0 votes
1 answer
134 views

Compounding Finance Portfolio using Pandas

I am trying to create a finance back tester for finance portfolio construction. I have imported the historical data and created variables for equity and bond allocation in terms of % & fiat terms(...
Robert Wood's user avatar
0 votes
1 answer
1k views

Buy/sell strategy with indicators?

I have a dataframe similar to the one below; Price return indicator 5 0.05 1 6 0.20 -1 5 -0.16 1 Where the indicator is based upon the forecasted return on the following day. what I would like to ...
Joe Steele's user avatar
0 votes
1 answer
982 views

Python plotting put and call options

I am trying to plot the put/call option using python but I am having some errors when obtaining my values and plot looks weird. I think there is something wrong with my loop of the matrices. My put ...
themathone's user avatar
0 votes
2 answers
191 views

Modify data frame based on the row index - Python

Given a pandas dataframe (20, 40), I would like to modify the first 10 rows of the first 20 columns using the value index. For example, if: df.iloc[5,6] = 0.98, I would like to modify the value in ...
Federico's user avatar
0 votes
1 answer
99 views

R Creating Portfolio Returns of Historic Trades

I created this thread because there are currently no threads for the portfolio calendar approach in an event study. Although this approach is used in finance, this question relates to the code used in ...
M1ke's user avatar
  • 67
0 votes
1 answer
220 views

Internal rate of return calculation with a growing perpetuity

I'm pretty new in coding and I'm trying to learn it for application in finance. I should to find the r variable in this equation that I'm sharing. Can someone help me? enter image description here ...
Vincenzo Nerone's user avatar
0 votes
2 answers
770 views

How can we find the IRR of cash flows in a Dataframe?

I can easily find the NPV if items in a dataframe using the code below. But how can I get the IRR of the same items? import numpy_financial as npf import pandas as pd # Intitialise data of lists data ...
ASH's user avatar
  • 19.8k
0 votes
1 answer
2k views

Event study with multiple event dates and multiple companies in R

I am trying to run an financial event study, and after reading several posts and packages I still don't know how to handle my problem. I have three dataframes: Multiple Event dates for multiple firms ...
BalDaBer's user avatar
0 votes
1 answer
357 views

Create multiple dataframes with a loop in Python

So I got this part of code that I want to make shorter: df_1 = investpy.stocks.get_stock_recent_data('Eco','Colombia',False) df_2 = investpy.stocks.get_stock_recent_data('JPM','United States',False) ...
Tomaxto's user avatar
-1 votes
2 answers
322 views

How can i calculate the total percentage change in a portfolio(assume 100 buy in)if i have a list which shows each percentage change of each trade?

I am using the following code but I am missing something percentagechange = [-2.704974336321264, -9.75579724548381, 161.1083287764476, -2.3049580623481725, -3.2221603096622586, -2.03531529638451, -6....
Paddy Connolly's user avatar
5 votes
3 answers
19k views

Python yfinance: Failed downloads - "No data found, symbol may be delisted"

Just trying to download historical closing prices for specific tickers found in a .CSV file, however I am having issues with yfinance pulling the data for some bizarre reason. I have another file that ...
benzaloga's user avatar
1 vote
1 answer
58 views

Pandas data frame adding a column based on data from 2 other columns

I have a data frame. One column is called fractal. It has 0's or 1's in which the 1's represents a fractal. Here is the output of np.flatnonzero to get an idea of the frequency of fractals: np....
horsehead97's user avatar
1 vote
1 answer
56 views

Error in getOptionChain expiry date for multiple tickers

I'm running the Getting options chain for multiple tickers but something is wrong with the expiration date for multiple tickers. Here's a sample code: library(quantmod) Symbols <- c("XOM",...
Rick's user avatar
  • 181
0 votes
2 answers
606 views

Why I cannot use the natural logarithm function with the data set?

I've got a code that works with the Data Set. I found out that it doesn't want to work with the ln(x) function. The data set can be found here. LY <- ln(Apple$Close - Apple$Open) Warning in log(x) ...
tiredd's user avatar
  • 1
1 vote
0 answers
22 views

What GARCH model do I use for relative spread series?

I have tried multiple GARCH model variations to remove financial time series characteristics from my dataset. I mainly tried ARMA(1,1),sGARCH models with normal distribution. My standardized residuals ...
ameliedc's user avatar
1 vote
2 answers
196 views

R: Finance - Compute Beta via CAPM for Panel Data

I have the following data containing three Funds (A, B and C) and their the respective data for (Return minus Risk Free Rate) and (Market Return minus Risk Free Rate): structure(list(`Fund Name` = c(&...
nima's user avatar
  • 37
0 votes
1 answer
51 views

Index Error when performing simple calculation

Goal is to pull stock tickers from Wikipedia, use yfinance to grab the historical closing prices, and perform the Relative Strength Index (RSI) calculation for each of the tickers listed in the S&...
benzaloga's user avatar
1 vote
3 answers
476 views

Syncing another company's financial year to another company using EDGAR database

I'm working on a school project that was built by a previous group, and one of my tasks is to synchronize the fiscal year's start date according to the start date of the company of focus. This is the ...
MG0310's user avatar
  • 11
0 votes
1 answer
232 views

How to simulate hedging position with cumprod with python correctly?

I was trying to simulate a hedging position using a single stock on python import yfinance as yf #getting the data data = yf.download("AAPL", start="2021-01-01", end="2022-...
Tiago's user avatar
  • 43
2 votes
3 answers
175 views

XBRL: How do you merge rows from different filings?

We use a XBRL processor to ingest filings from SEC. Often times, a company declares a metric in different filings with different concepts - with or without exactly matching values - but to be regarded ...
DebD's user avatar
  • 383
0 votes
0 answers
175 views

ICB industrial classification code for companies

I need ICB Industrial classification code for US stock companies, I know stocks listed in the Nasdaq index are provided with this classification code, I search but did not find any source which I can ...
Farhad's user avatar
  • 1
0 votes
1 answer
967 views

Calculating a Rolling IRR in Excel

I have two columns that I'd like to use to calculate a rolling monthly IRR with. The data looks like this: Date Net Cash Flow Principal IRR 2023-01-31 0 0 idk ...
weskpga's user avatar
  • 2,067
0 votes
2 answers
1k views

drawing a binomial tree in latex with python

I want to have some code that draws a binomial tree (for finance) for how ever many periods I give it. \documentclass{article} \usepackage{tikz} \usetikzlibrary{matrix} \begin{document} \begin{...
gmv's user avatar
  • 199
0 votes
1 answer
60 views

Azure Data Explorer (Kusto/KQL) Financial Asset Backtesting Trail Stop Follow-Up

This is a follow-up question from Stack Overflow question 71501098 Original Question I have a data set of financial asset prices over time and I'd like to mimic a trail stop for back testing ...
Damien Johnston's user avatar
1 vote
1 answer
2k views

Problems using Rangebreaks plotly

I was making a time series graph using Plotly however the x-axis has too many labels. I did some research and I think that I could use Rangebreaks to help fix this issue but I'm not sure. I would ...
Faiz's user avatar
  • 143
0 votes
1 answer
390 views

Read .csv file and make all values float

I have a .csv file that contains only rows with cashflows in different lengths. I have a function that calculates the cashflow's NPVs, and all I have left is to calculate NPVs for all rows in the ...
Shoshan Ben-Tzvi's user avatar
0 votes
1 answer
77 views

How to combine the result of dataframe produced in the for loop?

I am trying to extract stock closing price and concatenate them into the same dataframe (in python) and using a for loop. For excample : url = f'https://www.alphavantage.co/query?function=...
Lin Lex's user avatar
  • 31
2 votes
1 answer
93 views

Azure Data Explorer (Kusto/KQL) Financial Asset Backtesting Trail Stop

I have a data set of financial asset prices over time and I'd like to mimic a trail stop for back testing strategies against this data set. Trail stops are a type of trade order supported by some ...
Damien Johnston's user avatar
0 votes
2 answers
162 views

How to access a single element of a series in python

I'm new to python, I normally use c++ or Java. I'm trying to access one element of a series to compare it to others. When I run the code it says there's an error because the truth value of a series is ...
V N's user avatar
  • 33
0 votes
2 answers
2k views

How do I keep the date-format from Excel when importing a time series in R?

When I import a financial time series from Excel to R, the dates turn into integers. Each column represents a date. I understand that Excel converted them to a form where they represent the number of ...
ameliedc's user avatar
0 votes
1 answer
692 views

IBKR TWS API - How to tell when reqOptionsMktData is complete for all strikes?

I am just getting started with IBKR API on Java. I am following the API sample code, specifically the options chain example, to figure out how to get options chains for specific stocks. The example ...
h_k's user avatar
  • 1,684
0 votes
1 answer
2k views

Dynamics 365 : User roles project timesheet user work flow errors

We have upgraded our ERP environment to 10.0.24, after that timesheets are not getting for approval and when I check the workflow history on timesheets for review. It's showing an error : “Stopped (...
Theja Pachipala's user avatar
0 votes
1 answer
375 views

How to compute financial ratio based on specific date range for multiple stocks dataframe?

I am trying to write a code that will compute Sharpe ratio for a list of stocks for every calendar quarter. Here is a sample of my dataframe (df): DataFrame So, firstly, I wrote a function that ...
Egor K's user avatar
  • 15
2 votes
3 answers
3k views

Calculate quarter for dates given an example end date and quarter number

I have an issue where I need to determine fiscal quarters, but won't always know the start/end dates for the quarters. They will, however, always be 3 months long. What I will know is the ending date ...
Jeff Brady's user avatar
  • 1,476
1 vote
1 answer
694 views

PowerBI Total Cost/Unit sums monthly calculations rather than creating a total for selected months

In my dashboard I'm adding a cost/unit metric. The problem is, if I select more than one month, it just adds the monthly calculations. For example, Store Month Units Cost Cost/Unit Blue Jan 10 20 2 ...
diegoh01's user avatar
0 votes
3 answers
1k views

Python, Pandas, Yahoo Finance API

Having trouble getting Pandas data reader to retrieve price quotes from Yahoo’s API. The most up to date answer seems to be: "pip install --upgrade pandas pip install --upgrade pandas-datareader ...
amp's user avatar
  • 27
2 votes
2 answers
2k views

Removing gaps between data on a Plotly graph

I was trying to make a graph plotting time series data on stock prices. However markets are only open 9:30-16:00 but the graph automatically plots times where the market isn't open. This leads to ...
Faiz's user avatar
  • 143
1 vote
1 answer
203 views

Shading stock/date plot based on indicator

My problem is that I have some stock prices(numbers) that are plotted against dates(strings). Now I have an indicator variable. I would like to shade the area on the graph for those dates where the ...
Marc Allan's user avatar
0 votes
1 answer
299 views

How to construct the daily returns of a index

I should using the snp500 series, which contains the closing prices of S&P500 index for the years 2010-2019, construct the daily returns of this index (returns can be defined a percentage increase ...
SoftwareTurtle's user avatar
0 votes
1 answer
434 views

How to calculate cumulative profit of a trades list

Here is a ETH/USDT trades history, I want to calculate the cumulative profit: import pandas as pd data_list = [('2022-01-29T01:41:43.584Z', 'buy', 2540.87, 0.0079, 20.072873), ('2022-01-31T02:01:09....
DennisLi's user avatar
  • 4,038
1 vote
1 answer
170 views

find nlargest ID for a value for each date

I am looking for the 10 IDs that have the highest a value at each date. for date in df: a = df.nlargest(10, ['a']) Top_performer.append(a[['ID','Renta','Date']]) as output I would like the ...
ALIZET's user avatar
  • 27
2 votes
1 answer
573 views

Pandas groupby apply slow - alternative suggestions?

I have a small toy dataset of 23 hours of irregular time series data (financial tick data) with millisecond granularity, roughly 1M rows. By irregular I mean that the timestamps are not evenly spaced. ...
des224's user avatar
  • 129
0 votes
2 answers
64 views

In Python, can the "replace function" replace strings equal to instead containting in a dataframe?

I have a dataframe that I scraped from Yahoo Finance. I want to replace missing values (which are noted as "-") so that I can adjusted the dataframe to numeric. However, when I use the ...
RudeFerret's user avatar
0 votes
1 answer
17 views

how do i insert row value into column by group

I have a dataframe containing 4000 tickers, resembling: ticker close date_a date_b AMZN 3350 2022-01-03 2022-01-03 AMZN 3400 2022-01-03 2022-01-04 AMZN ...
jd_h2003's user avatar
  • 294

1
7 8
9
10 11
57