\begin{algorithm}[H]
\caption{APO Spread Trading Strategy Algorithm}\label{algo2}
\begin{algorithmic}[1]
\State \textbf{Input:} Stock data for two assets $S_1$ and $S_2$, buy threshold, sell threshold
\State \textbf{Output:} Trade signals for pairs trading
\State
\Procedure{Compute Hedge Ratio}{data1, data2}
\State model $\gets$ perform OLS regression (data1, data2)
\State \Return model.params$[1]$
\EndProcedure
\State
\Procedure{Initialize}{fast, slow}
\State hedge$\_$ratio $\gets$ \Call{Compute Hedge Ratio}{$S_1$, $S_2$}
\State Calculate spread $\gets$ $S_1$$-$hedge$\_$ratio $\times$ $S_2$
\State fast$\_$ema $\gets$ \Call{EMA}{spread, fast}
\State slow$\_$ema $\gets$ \Call{EMA}{spread, slow}
\State apo$\_$spread $\gets$ fast$\_$ema$-$slow$\_$ema
\State position $\gets 0$
\EndProcedure
\State
\Procedure{Next}{buy threshold, sell threshold}
\State \textbf{if}{~apo$\_$spread $<$ buy$\_$threshold} \textbf{then}
\State \hspace{1cm} Execute Buy for $S_1$ and Sell Short for $S_2$
\State \textbf{else if}{apo$\_$spread $>$ sell$\_$threshold} \textbf{then}
\State \hspace{1cm} Execute Sell Short for $S_1$ and Buy for $S_2$
\State \textbf{end if}
\EndProcedure
\end{algorithmic}
\end{algorithm}

\begin{algorithm}
[H]
\caption{APO Spread Trading Strategy Algorithm}\begin{algorithmic}
[1]
\State \textbf{Input:} Stock data for two assets $S_1$ and $S_2$, buy threshold, sell threshold
\State \textbf{Output:} Trade signals for pairs trading
\State
\Procedure{Compute Hedge Ratio}{data1, data2}
\State model $\gets$ perform OLS regression (data1, data2)
\State \Return model.params$[1]$
\EndProcedure
\State
\Procedure{Initialize}{fast, slow}
\State hedge$\_$ratio $\gets$ \Call{Compute Hedge Ratio}{$S_1$, $S_2$}
\State Calculate spread $\gets$ $S_1$$-$hedge$\_$ratio $\times$ $S_2$
\State fast$\_$ema $\gets$ \Call{EMA}{spread, fast}
\State slow$\_$ema $\gets$ \Call{EMA}{spread, slow}
\State apo$\_$spread $\gets$ fast$\_$ema$-$slow$\_$ema
\State position $\gets 0$
\EndProcedure
\State
\Procedure{Next}{buy threshold, sell threshold}
\State \textbf{if}{~apo$\_$spread $<$ buy$\_$threshold} \textbf{then}
\State \hspace{1cm} Execute Buy for $S_1$ and Sell Short for $S_2$
\State \textbf{else if}{apo$\_$spread $>$ sell$\_$threshold} \textbf{then}
\State \hspace{1cm} Execute Sell Short for $S_1$ and Buy for $S_2$
\State \textbf{end if}
\EndProcedure
\end{algorithmic}
\end{algorithm}
{
    "title": "esg driven pairs algorithm for sustainable trading: analysis from the   indian market",
    "id": "2401.14761",
    "abstract": "this paper proposes an algorithmic trading framework integrating environmental, social, and governance (esg) ratings with a pairs trading strategy. it addresses the demand for socially responsible investment solutions by developing a unique algorithm blending esg data with methods for identifying co-integrated stocks. this allows selecting profitable pairs adhering to esg principles. further, it incorporates technical indicators for optimal trade execution within this sustainability framework. extensive back-testing provides evidence of the model's effectiveness, consistently generating positive returns exceeding conventional pairs trading strategies, while upholding esg principles. this paves the way for a transformative approach to algorithmic trading, offering insights for investors, policymakers, and academics.",
    "categories": "q-fin.tr",
    "doi": "",
    "created": "2024-01-26",
    "updated": "",
    "authors": [
        "eeshaan dutta",
        "sarthak diwan",
        "siddhartha p. chakrabarty"
    ],
    "affiliation": [],
    "url": "https://arxiv.org/abs/2401.14761"
}
{
    "ToxicityFilter": {
        "text_to_toxicity_attributes": {
            "bib.bib": {
                "toxicity_score": 0.012063419,
                "severe_toxicity_score": 0.0014019012,
                "identity_attack_score": 0.0023401144,
                "insult_score": 0.008519882,
                "profanity_score": 0.016172111,
                "threat_score": 0.006822242,
                "sexually_explicit_score": 0.0115595255,
                "flirtation_score": 0.2017521
            },
            "ED_SD_SPC_260124.tex": {
                "toxicity_score": 0.012126249,
                "severe_toxicity_score": 0.0011730194,
                "identity_attack_score": 0.0038292783,
                "insult_score": 0.0076838774,
                "profanity_score": 0.015488927,
                "threat_score": 0.007598988,
                "sexually_explicit_score": 0.01250316,
                "flirtation_score": 0.21894184
            },
            "ED_SD_SPC_260124.bbl": {
                "toxicity_score": 0.011874928,
                "severe_toxicity_score": 0.0011348724,
                "identity_attack_score": 0.003866276,
                "insult_score": 0.0075508766,
                "profanity_score": 0.014532468,
                "threat_score": 0.007521313,
                "sexually_explicit_score": 0.010969753,
                "flirtation_score": 0.27629572
            }
        },
        "reason": null
    }
}
{
    "num_done": {
        "figure": 0,
        "algorithm": 3,
        "plot": 0
    }
}
{
    "NonTrivialRenderingFilter": {
        "white_pixels_ratio": 87.3581322268664,
        "hash": "078f8f8f9f9f813f",
        "most_frequent_color_ratio": 87.3581322268664
    }
}