Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 3 additions & 48 deletions main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
{\Huge Synthetic Assets on Cardano}\\[2\baselineskip]
{\Large Indigo Laboratories, Inc.}\\[0.5\baselineskip]
{\large info@indigo-labs.io}\\[3\baselineskip]
{\large November 2022, v1.0.1}
{\large November 2022, v1.1.0}
}
\end{titlepage}

Expand Down Expand Up @@ -1101,43 +1101,12 @@ \subsubsection{Stability Pool Staking
is based on three variables:

\begin{enumerate}
\item
Volatility of the SP's iAsset's underlying asset (\(\sigma\))
\item
Stability Pool Saturation (\(\varphi\))
\item
Market cap of the SP's iAsset (\(\omega\))
\end{enumerate}

\hypertarget{volatility-for-a-sp-sigma}{%
\paragraph{\texorpdfstring{Volatility for a SP
(\(\sigma\))}{Volatility for a SP (\textbackslash sigma)}}\label{volatility-for-a-sp-sigma}}

can be calculated using the formula:

\[\sigma = \left\{ \begin{matrix}
\begin{pmatrix}
\text{let}\text{\ y\ }\text{equal}\ \left\langle \frac{x_{j}}{x_{j - 1}} - 1\ :j\ \in \ \left\langle 2,\ldots,\left| x \right| \right\rangle \right\rangle \\
\ \\
\sqrt{\frac{\sum_{i = 1}^{\left| y \right|}\left( y_{i} - \overline{y} \right)^{2}}{\left| y \right|}} \\
\end{pmatrix} & \text{if}\ \left| x \right| > 30 \\
\ & \ \\
0 & \text{if}\ \left| x \right| \leq 30 \\
\end{matrix} \right.\ \]

Where:

\begin{itemize}
\item
\(\sigma\) is the volatility of the iAsset
\item
\(x\) is the sequence of the iAsset's tracked asset's historical daily
close price for the past year (or maximum amount of time that data
exists for) denominated in iAsset's collateral (i.e., ADA)
\end{itemize}

\filbreak

\hypertarget{stability-pool-saturation-varphi}{%
\paragraph{\texorpdfstring{Stability Pool Saturation
(\(\varphi\))}{Stability Pool Saturation (\textbackslash varphi)}}\label{stability-pool-saturation-varphi}}
Expand Down Expand Up @@ -1204,12 +1173,6 @@ \subsubsection{Stability Pool Staking
\(\sigma\), \(\varphi\), and \(\omega\), and is calculated daily using:

\[\rho = \begin{pmatrix}
\text{let}\ \sigma_{s}\ \text{equal}\ \sum_{i = 1}^{\left| \sigma \right|}\left\{ \begin{matrix}
\frac{1}{\sigma_{i}} & \text{if}\ \sigma_{i} > 0\ \text{and}\ t_{i} > 0 \\
\ & \ \\
0 & \text{otherwise} \\
\end{matrix} \right.\ \\
\ \\
\text{let}\ \varphi_{s}\ \text{equal}\ \sum_{i = 1}^{\left| \varphi \right|}\left\{ \begin{matrix}
\frac{1}{\varphi_{i}} & \text{if}\ \varphi_{i} > 0\ \text{and}\ t_{i} > 0 \\
\ & \ \\
Expand All @@ -1226,12 +1189,6 @@ \subsubsection{Stability Pool Staking
0 & \text{if}\ t_{a} \leq 0 \\
\ & \ \\
\begin{pmatrix}
\text{let}\ \sigma_{v}\ \text{equal}\ \left\{ \begin{matrix}
\frac{1}{\sigma_{a}}/\sigma_{s} & \text{if}\ \sigma_{a} > 0\ \text{and}\ \sigma_{s} > 0 \\
\ & \ \\
0 & \text{otherwise} \\
\end{matrix} \right.\ \\
\ \\
\text{let}\ \varphi_{v}\ \text{equal}\ \left\{ \begin{matrix}
\frac{1}{\varphi_{a}}/\varphi_{s} & \text{if}\ \varphi_{a} > 0\ \text{and}\ \varphi_{s} > 0 \\
\ & \ \\
Expand All @@ -1245,9 +1202,9 @@ \subsubsection{Stability Pool Staking
\end{matrix} \right.\ \\
\ \\
\left\{ \begin{matrix}
\frac{\sigma_{v} + \varphi_{v} + \omega_{v}}{3} & \text{if}\ \varphi_{s} > 0\ \text{and}\ \omega_{s} > 0 \\
\frac{\varphi_{v} + \omega_{v}}{2} & \text{if}\ \varphi_{s} > 0\ \text{and}\ \omega_{s} > 0 \\
\ & \ \\
\sigma_{v} & \text{otherwise} \\
0 & \text{otherwise} \\
\end{matrix} \right.\ \\
\end{pmatrix} & \text{otherwise} \\
\end{matrix} \right.\ \\
Expand All @@ -1258,8 +1215,6 @@ \subsubsection{Stability Pool Staking
\begin{itemize}
\item
\(\rho\) is the distribution coefficient for the iAsset
\item
\(\sigma\) is the sequence of volatility values of each iAsset
\item
\(\varphi\) is the sequence of Stability Pool saturation values of
each iAsset
Expand Down
34 changes: 17 additions & 17 deletions preprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ set -e

# Convert tabularx tables to longtables so pandoc can understand
sed 's/\\end{tabularx}/\\end{longtable}/g' "${1:-main.tex}" > main.tex.tmp.pandoc
sed -i 's/\\begin{tabularx}{\\linewidth}{/\\begin{longtable}[]{/g' main.tex.tmp.pandoc
sed -i 's/\\begin{longtable}.*/\L&/g' main.tex.tmp.pandoc
sed -i '' -e 's/\\begin{tabularx}{\\linewidth}{/\\begin{longtable}[]{/g' main.tex.tmp.pandoc
sed -i '' -e 's/\\begin{longtable}.*/\L&/g' main.tex.tmp.pandoc

# Fix texttt
sed -i 's/}\\texttt{//g' main.tex.tmp.pandoc
sed -i '' -e 's/}\\texttt{//g' main.tex.tmp.pandoc

# Process with pandoc
pandoc main.tex.tmp.pandoc -f latex -t latex -o main.tex.tmp.pandoc
Expand All @@ -29,7 +29,7 @@ start=$(grep -n '\tableofcontents' main.tex.tmp | head -1 | cut -d ':' -f 1)
end=$(grep -n '\hypertarget' main.tex.tmp | head -1 | cut -d ':' -f 1)
start=$((start + 1))
end=$((end - 2))
sed -i "${start},${end}d" main.tex.tmp
sed -i '' -e "${start},${end}d" main.tex.tmp

# Copy over end of main.tex
total_lines=$(wc -l main.tex | cut -d ' ' -f 1)
Expand All @@ -39,20 +39,20 @@ echo "" >> main.tex.tmp
tail -n "$end" main.tex >> main.tex.tmp

# Format tables
sed -i 's/\\tabularnewline/\n\\tabularnewline\n\\midrule/g' main.tex.tmp
sed -i -e '1h;2,$H;$!d;g' -e 's/\\midrule\n\\midrule/\\midrule/g' main.tex.tmp
sed -i -e '1h;2,$H;$!d;g' -e 's/\\midrule\n\\toprule/\\toprule/g' main.tex.tmp
sed -i -e '1h;2,$H;$!d;g' -e 's/\\midrule\n\\bottomrule/\\bottomrule/g' main.tex.tmp
sed -i 's/\\strut//g' main.tex.tmp
sed -i '/^\\begin{minipage}/d' main.tex.tmp
sed -i 's/^\\end{minipage}.*/\&/g' main.tex.tmp
sed -i -e '1h;2,$H;$!d;g' -e 's/\&\n\\tabularnewline/\\tabularnewline/g' main.tex.tmp
sed -i '/\\endfirsthead/,/\\midrule/d' main.tex.tmp
sed -i -e '1h;2,$H;$!d;g' -e 's/\\\midrule\n\\midrule/\\midrule/g' main.tex.tmp
sed -i 's/\\ldots{}/\\ldots/g' main.tex.tmp
sed -i '' -e 's/\\tabularnewline/\n\\tabularnewline\n\\midrule/g' main.tex.tmp
sed -i '' -e '1h;2,$H;$!d;g' -e 's/\\midrule\n\\midrule/\\midrule/g' main.tex.tmp
sed -i '' -e '1h;2,$H;$!d;g' -e 's/\\midrule\n\\toprule/\\toprule/g' main.tex.tmp
sed -i '' -e '1h;2,$H;$!d;g' -e 's/\\midrule\n\\bottomrule/\\bottomrule/g' main.tex.tmp
sed -i '' -e 's/\\strut//g' main.tex.tmp
sed -i '' -e '/^\\begin{minipage}/d' main.tex.tmp
sed -i '' -e 's/^\\end{minipage}.*/\&/g' main.tex.tmp
sed -i '' -e '1h;2,$H;$!d;g' -e 's/\&\n\\tabularnewline/\\tabularnewline/g' main.tex.tmp
sed -i '' -e '/\\endfirsthead/,/\\midrule/d' main.tex.tmp
sed -i '' -e '1h;2,$H;$!d;g' -e 's/\\\midrule\n\\midrule/\\midrule/g' main.tex.tmp
sed -i '' -e 's/\\ldots{}/\\ldots/g' main.tex.tmp

# Convert longtables back to tabularx
sed -i 's/\\end{longtable}/\\end{tabularx}/g' main.tex.tmp
sed -i '' -e 's/\\end{longtable}/\\end{tabularx}/g' main.tex.tmp
tabularx_headers=($(grep '\\begin{tabularx}' main.tex))
longtable_headers=($(grep -n '\\begin{longtable}' main.tex.tmp | cut -d ':' -f 1))

Expand All @@ -67,7 +67,7 @@ script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
python3 $script_dir/figures.py

# Remove height from images
sed -i 's/\,height=\\textheight//g' main.tex.tmp
sed -i '' -e 's/\,height=\\textheight//g' main.tex.tmp

# Done
mv main.tex.tmp main.tex
14 changes: 7 additions & 7 deletions to-docx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ set -e

# Convert tabularx tables to longtables so pandoc can understand
sed 's/\\end{tabularx}/\\end{longtable}/g' "${1:-main.tex}" > main.tex.tmp.pandoc
sed -i 's/\\begin{tabularx}{\\linewidth}{/\\begin{longtable}[]{/g' main.tex.tmp.pandoc
sed -i 's/\\begin{longtable}.*/\L&/g' main.tex.tmp.pandoc
sed -i '' -e 's/\\begin{tabularx}{\\linewidth}{/\\begin{longtable}[]{/g' main.tex.tmp.pandoc
sed -i '' -e 's/\\begin{longtable}.*/\L&/g' main.tex.tmp.pandoc

# Convert formulas
sed -i 's/\\genfrac{}{}{}{}/\\frac/g' main.tex.tmp.pandoc
sed -i 's/\\cfrac/\\frac/g' main.tex.tmp.pandoc
sed -i 's/\\raisebox//g' main.tex.tmp.pandoc
sed -i 's/{\$/{/g' main.tex.tmp.pandoc
sed -i 's/\$}/}/g' main.tex.tmp.pandoc
sed -i '' -e 's/\\genfrac{}{}{}{}/\\frac/g' main.tex.tmp.pandoc
sed -i '' -e 's/\\cfrac/\\frac/g' main.tex.tmp.pandoc
sed -i '' -e 's/\\raisebox//g' main.tex.tmp.pandoc
sed -i '' -e 's/{\$/{/g' main.tex.tmp.pandoc
sed -i '' -e 's/\$}/}/g' main.tex.tmp.pandoc

# Process with pandoc
pandoc main.tex.tmp.pandoc -f latex -t docx -o main.docx
Expand Down