Mean Variance Optimization

Mean Variance Optimization (MVO) is a well-established but rigorous technique used in managing financial portfolios. However, the covariance calculated by MVO often contains estimation errors. To address this, the Ledoit-Wolf Shrinkage operator is frequently recommended. This approach is used as a baseline in this paper(https://icaps23.icaps-conference.org/papers/finplan/FinPlan23_paper_4.pdf) First, I will explain Mean Variance Optimization, and then I will discuss the Ledoit-Wolf Shrinkage operator, which is an improved version of MVO. Minimize risks(variances) by given returns import numpy as np import yfinance as yf import scipy....
Reading paper list
Deep Reinforcement Learning for Optimal Portfolio Allocation https://icaps23.icaps-conference.org/papers/finplan/FinPlan23_paper_4.pdf 60 days look back in MVO MVO
Policy gradient

policy gradient https://rail.eecs.berkeley.edu/deeprlcourse-fa18/static/slides/lec-5.pdf from https://rail.eecs.berkeley.edu/deeprlcourse-fa18/ lilian weng policy gradient https://lilianweng.github.io/posts/2018-04-08-policy-gradient/ The difference between policy based and value based https://www.reddit.com/r/reinforcementlearning/comments/mkz9gl/policybased_vs_valuebased_are_they_truly_different/ $$ J(\theta) = E_{\tau ∼p_\theta(\tau)} \left[ \sum_{t}r(s_t, a_t) \right]$$ $$ \theta^* = argm\underset{\theta}ax J(\theta) $$ Object function \( J(\theta)\) is the expected return of a policy parameterized by \( \theta \). \( \tau∼p_\theta(\tau) …...
The convergence of the iteration of optimal bellman equation

Bellman equation plays a vital role in reinforcement learning. Iterative Policy Evaluation $$$$ $$ V_{k+1}(s) = \sum_{a, s'} \pi(a|s) p(s'|s,a) \{ r(s, a, s') + \gamma V_{k}(s') \}$$ $$$$ \begin{flalign} &V_{k}:\text{Value function after } k \text{ th iteration.}\ & \end{flalign} \begin{flalign} & \pi : \text{Policy. The probability of performing action } a \text{ under state } s. \ & \end{flalign} \begin{flalign} & p: \text{Probability of the next state } s' \text{ under state } s \text{ and action } a....
Mplfinance tips

Plotting Financial Data with Market Color Overrides import polars as pl import mplfinance as mpf df = pl.read_csv("df.csv", try_parse_dates=True) df = df.to_pandas() df = df.set_index("datetime") # Plot the data without market color overrides mpf.plot(df,volume=False,type='candle',style='yahoo',figscale=1.4) # Initialize the MCOverrides column with the base market colors (black and white) mc = mpf.make_marketcolors(base_mpf_style='classic') # Get the target column target = df["target"] # Initialize the column with all values set to `mc` df['MCOverrides'] = [mc] * len(df) # Override the market colors based on the target value df....
Unveiling the Three Dimensions of "Resolution"

Introduction The word “resolution” is a linguistic chameleon, effortlessly donning multiple meanings across various contexts. Far from a monolithic concept, “resolution” reveals itself as a versatile term with three distinct facets that encapsulate its diverse applications. 1. Problem-Solving Prowess In its first guise, “resolution” serves as a beacon in the realm of conflict and challenges. Here, it embodies the art and science of finding solutions to problems. Whether navigating a dispute, addressing a complex issue, or unraveling a conundrum, resolution emerges as the guiding force that leads to clarity and harmony....
How to delete the contributor and its history from Github

Change the author of your local repository git rebase or when you wish to make changes to only the last commit git commit --amend --author="New Author Name <new.email@example.com>" Copy Push to a remote repository git push origin main --force Copy Rename the default branch on Github Visit your GitHub repository. Change the default branch name from “main” to “main2”. After making the change, revert the default branch name back to “main”....
Polars tips

Print DataFrame without omitting with pl.Config(tbl_rows=1, tbl_cols=100): print(df1) print(df2) with pl.Config(tbl_rows=1, tbl_cols=100): print(df) Copy df = df.unique(subset=["datetime"]) Copy polars polars polars polars polarspolars polars polars polars polars polars
This is a image test for visual formatting

Bold the title of header I only blog about things that I may want to search for and review later. Bold the title of header Bold the title of header Bold the title of header Bold the title of header Bold the title of header Bold the title of header Bold the title of header Bold the title of header Bold the title of header Bold the title of header
How I generate thumbnail image

hugginface stable diffusion https://huggingface.co/spaces/stabilityai/stable-diffusion my prompt is Sepia renaissance “title of the article” This cover image is also generated by AI. Prompt is polar bear sepia my prompt is Sepia renaissance “title of the article” This cover image is also generated by AI. Prompt is polar bear sepia