Questions tagged [finance]

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

Introduction

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

The finance (or "financial services") industry is an umbrella term for organisations that manage money & assets. It includes businesses like banks, credit card companies, insurance companies, consumer finance companies, stock brokerages, hedge funds and investment funds and some government sponsored enterprises.

These businesses are usually subject to government regulation, often rely on global standards and interact with each other through purely electronic markets. They employ many thousands of programmers who often turn up common programming problems.

What questions should have this tag?

Programming problems specific to the finance industry, such as:

  • financial messaging standards & protocol implementations (e.g. FIX or SWIFT)
  • domain models/patterns for accounting, currency, trading & brokerage, etc.
  • application of programming techniques to financial businesses & problems (e.g. risk management, pricing, trade netting, etc.)
  • low latency, high volume/frequency trading systems
  • implementation of common mathematical problems (e.g. time value of money, compound interest, etc.)
  • management and processing of market data
  • regulatory issues as they relate to systems programming

Other relevant forums

Questions which have more of a financial background than a programming background should rather be asked at quant.stackexchange. In particular, this tag should never be used on its own but rather in combination with a programming language.

2470 questions
0
votes
1 answer

Error with a python string to dateconversion using Pandas

I'm struggling to change the format of the dates of my dataframe. I get the following error: ValueError: to assemble mappings requires at least that [year, month, day] be specified: [day,month,year] is missing That's my code, price_spx =…
sw21P
  • 1
0
votes
0 answers

Stock Research Terminal

import requests import pandas as pd import plotly.graph_objects as go import pandas as pd from datetime import datetime def income_statement(stock): number_yrs = input('how many yr(s)?').strip() api_key =…
Oscar
  • 1
0
votes
1 answer

How can I loop through the r tvm "XIRR" function to calculate xirr for different trade strategies?

I'm importing a data frame from a csv file that looks like the below, however with hundreds of strategies and thousands of cash flows for each strategy: TRADE_STRATEGY EVENT_DATE BOOK_VALUE_USD A 1/1/2021 -1.5 A …
0
votes
0 answers

Query for Portfolio VaR in SQL Server

I am trying to get log of share prices (matrix) in SQL Server. The column name are dynamic and have been by applying PIVOT DECLARE @cmd AS NVARCHAR(MAX), @cols AS NVARCHAR(MAX), @query AS NVARCHAR(MAX) SET @cols = (SELECT DISTINCT…
0
votes
1 answer

Why is plotly plotting my chart this way?

I am trying to analyse previous market corrections and found a dataset with a date format year.month (ex: 2021.11 for this month) and other data including the price at the given date. I imported it via pandas and made it into a pandas dataframe,…
Luk
  • 19
  • 2
0
votes
0 answers

Pandas Vectorize a Custom Lookback for each Row

I am looking at OHLC data using Pandas and a little stuck on whether I can avoid a loop for what I need to achieve. Basically, for the 'high' column, I want to lookback an arbitrary number of rows, say 10, looking for situation where the previous…
0
votes
0 answers

How to compute greeks for option pricing in Montecarlo Simulation

I have to complete an assignment in Rstudio but I'm pretty new to it: Compute the first order greeks (delta, vega, theta, rho, lambda, epsilon) for a plain vanilla European option using R. I have generated the code to price the option both with…
0
votes
1 answer

Unsupported operand type(s) for +: 'int' and 'datetime.timedelta'

Am getting this error, while trying to plot a chart. I am trying to plot a chart using the values provided. I am using yahoo finance and want to plot a resistance line using python. for index in range(len(pivots)): …
Mreazy
  • 3
  • 2
0
votes
0 answers

Finding minimum by optimising a vector in R

I need to find a minimum of an objective function by optimising a vector. The problem is finance related if that helps - the function RC (provided below) computes the sum of squared differences of risk contribution of different assets, where the…
0
votes
1 answer

How to apply a cumulative function pandas dataframe but restart the cumulative function when a different column changes?

This is a pretty hard question to me. The answer might come simply to fresh eyes, but I'm stuck. Basically, I have a dataframe of bulk balance sheets from simfin.com. I want to get the percent change in the Retained Earnings column, but restart the…
Calvin K
  • 104
  • 2
  • 9
0
votes
0 answers

Extract S&P symbols during the last N years

How do I extract the list of all stocks that were part of the S&P 500 index during the last N years (e.g., 20 years) in R? (or perhaps just get this list). I know how to get the list of the current stocks: url <-…
YefR
  • 369
  • 3
  • 12
0
votes
1 answer

How to calculate XIRR for each investment using python

I am trying to apply an XIRR Formula so that the percentage of each investment is calculated separately. I Have data in excel file like: https://i.stack.imgur.com/yqMiV.png headers: Script,date,Values result : Scrip and XIRR Used Python…
0
votes
1 answer

Power law test using XY scatter plot

I have Daily Crude oil prices downloaded from FRED, about 10k observations, some values are blank(code cleans them). I believe that I cannot share excel sheets here, so I will just give you a screenshot of what the data looks like: I calculate the…
Dio
  • 231
  • 1
  • 2
  • 10
0
votes
1 answer

Python resample function not resampling

I'm trying to resample the data, however, it does not seem to be working properly. I want to have start-of-month data to start-of-month. The code is the following df = pd.read_csv('OSEBX_daily.csv') df = data[['time', 'OSEBX GR']] df['time'] =…
0
votes
1 answer

DolphinDB: Calculate mwavg for each stock by using "context by" or "for loop"?

Please help compare the performance between these two methods. How many times will the difference be and what are the causes?
dontyousee
  • 458
  • 2
  • 9
1 2 3
99
100