<commit_before><!DOCTYPE html>
<html lang="en">
<head>

  <!-- Basic Page Needs
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <meta charset="utf-8">
  <title><NAME></title>
  <meta name="description" content="All about my software development exploits.">
  <meta name="author" content="<NAME>">

  <!-- Mobile Specific Metas
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- FONT
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <link href="https://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">

  <!-- CSS
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <link rel="stylesheet" href="/css/normalize.css">
  <link rel="stylesheet" href="/css/skeleton.css">
  <link rel="stylesheet" href="/css/main.css">

  <!-- Favicon
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <link rel="icon" type="image/png" href="/images/favicon.png">

</head>
<body>
  <div class="main" style="height: 20vh;">
    <div class="mainOverlay" style="height:15vh;"></div>
    <!--
      <span id="back-btn" style="position: absolute; top: 5%; font-size: 1.5em;left: 20px;">&#8592; Back</span>
    -->
    <div style="height: 15vh; top:33%; position: relative; transform: translateY(-12.5%); text-align: center;">
      <h3><strong><a href="/" style="text-decoration: none; color:inherit;"><NAME></a></strong></h3>
    </div>
  </div>

  <div class="post-content">
    <h3 style="text-align:center;"><strong>S&amp;P 500 2x 3x ETF Simulation</strong></h3>
    <div class="post-content-text">
      <p>
      <strong><a href="https://github.com/jjestrel/SPLeverageSim">Source Code</a></strong><br/>
    </p>
      <h4><strong>What Is It?</strong></h4>
      <p>
        A simulation made in R to run possible outcomes in being able to guess the daily direction of the S&amp;P 500 with particular odds and determining success based being able to use 2x (SSO/SDS), 3x (UPRO/SPXU) leveraged ETFs
      </p>
      <h4><strong>Inspiration</strong></h4>
      <p>
        The inspiration to make this was brought on by a discussion with a friend claiming he could successfully predict the direction of the market with 60% success
        (and also knows when he should not participate, i.e knows when he doesn't know the direction). Being able to predict the direction of the market in general
        is something that is seemingly simpler than predicting the movements of a particular stock. The simulation is intended as a proof that if one were to be able
        to determine the direction of the market with a 60% success rate they should employ this strategy and see exceedingly high returns.
      </p>
      <h4><strong>Limitations and Assumptions</strong></h4>
      <p>
        <ul>
          <li>This simulation makes some assumptions that leave room for improvement.</li>
          <li>We assume our stock picker begins with $100,000.00</li>
          <li>We assume that market movement is a random walk</li>
          <li>We also assume that on the days that the simulated stock-picker chooses to buy they go all-in with their current amount of money, we also allow for fractional shares.</li>
          <li>We assume the stock picker is paying a flat ($6.95 * 2) on the sell side of their trade.</li>
          <li>We assume that the stock picker will hold until the end of each day</li>
          <li>For the sake of example, only 2x leverage will be simulated (but can be extended to 3x by a change of constants)</li>
          <li>Cost of future heart medication required from increased stress of playing daily market movement is ignored</li>
          <li>Only the trailing 10 years of daily market movement could be retrieved, thus the results may be further skewed.</li>
          <li>Each simulation is run over 365 days (365 possible buying periods)</li>
          <li>We assume that the leveraged ETFs would pay no cost to maintain their leverage (borrowing/other instruments) which is not true. This will lead to higher returns than what would be possible employing this strategy in real life.</li>
        </ul>
      </p>

      <h4><strong>Conclusions</strong></h4>
      <p>
        Ultimately the purpose of this program was to convince someone that if they truly believe they could predict the market's
        direction with 60% accuracy they should buy 2x and 3x leveraged ETFs on days where they believed they could predict the market movement.<br/>
        Running the simulation 1000 times lead to the following results: <br/>

        <pre>
          <code>
            [1] "Successes: 920"
            [1] "Greatest Success: $ 511132.699408"
            [1] "-------------"
            [1] "Failures: 80"
            [1] "Worst Failure: $ 46340.775260"
            [1] "-------------"
          </code>
        </pre>
        <br/>
        Where a success = currentMoney >= START_MONEY<br/>
        and a failure = currentMoney < START_MONEY<br/>
        <br/>
        The following is a histogram where START_MONEY was set to $10,000 for the sake of clarity in reading the histogram.
        Note the histogram is mislabelled, this does not occur in the running version of the program.

        <img src="/images/projects/sp500results.png" style="width: 400px; height: auto;"/> <br/>
        Ultimately, the assumptions made prevent the results of the simulation to be very accurate (cost of leverage, lack of historicial data in particular).
        However a general claim can be made, if one can predict the daily market direction with a > 60% accuracy they very likely can make a lot of money by
        making a "guess" daily.
      </p>

      <h4><strong>Attribution</strong></h4>
      <p>
        <a href="http://en.wikipedia.org/wiki/S%26P_500#/media/File:S%26P500_(1950-12).jpg">S&amp;P 500 image</a>
      </p>
    </div>

  </div>
</body>

<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
</html><commit_msg>Fixed image formatting in sp500leverage.html<commit_after><!DOCTYPE html>
<html lang="en">
<head>

  <!-- Basic Page Needs
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <meta charset="utf-8">
  <title><NAME></title>
  <meta name="description" content="All about my software development exploits.">
  <meta name="author" content="<NAME>">

  <!-- Mobile Specific Metas
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- FONT
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <link href="https://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">

  <!-- CSS
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <link rel="stylesheet" href="/css/normalize.css">
  <link rel="stylesheet" href="/css/skeleton.css">
  <link rel="stylesheet" href="/css/main.css">

  <!-- Favicon
  –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  <link rel="icon" type="image/png" href="/images/favicon.png">

</head>
<body>
  <div class="main" style="height: 20vh;">
    <div class="mainOverlay" style="height:15vh;"></div>
    <!--
      <span id="back-btn" style="position: absolute; top: 5%; font-size: 1.5em;left: 20px;">&#8592; Back</span>
    -->
    <div style="height: 15vh; top:33%; position: relative; transform: translateY(-12.5%); text-align: center;">
      <h3><strong><a href="/" style="text-decoration: none; color:inherit;"><NAME></a></strong></h3>
    </div>
  </div>

  <div class="post-content">
    <h3 style="text-align:center;"><strong>S&amp;P 500 2x 3x ETF Simulation</strong></h3>
    <div class="post-content-text">
      <p>
      <strong><a href="https://github.com/jjestrel/SPLeverageSim">Source Code</a></strong><br/>
    </p>
      <h4><strong>What Is It?</strong></h4>
      <p>
        A simulation made in R to run possible outcomes in being able to guess the daily direction of the S&amp;P 500 with particular odds and determining success based being able to use 2x (SSO/SDS), 3x (UPRO/SPXU) leveraged ETFs
      </p>
      <h4><strong>Inspiration</strong></h4>
      <p>
        The inspiration to make this was brought on by a discussion with a friend claiming he could successfully predict the direction of the market with 60% success
        (and also knows when he should not participate, i.e knows when he doesn't know the direction). Being able to predict the direction of the market in general
        is something that is seemingly simpler than predicting the movements of a particular stock. The simulation is intended as a proof that if one were to be able
        to determine the direction of the market with a 60% success rate they should employ this strategy and see exceedingly high returns.
      </p>
      <h4><strong>Limitations and Assumptions</strong></h4>
      <p>
        <ul>
          <li>This simulation makes some assumptions that leave room for improvement.</li>
          <li>We assume our stock picker begins with $100,000.00</li>
          <li>We assume that market movement is a random walk</li>
          <li>We also assume that on the days that the simulated stock-picker chooses to buy they go all-in with their current amount of money, we also allow for fractional shares.</li>
          <li>We assume the stock picker is paying a flat ($6.95 * 2) on the sell side of their trade.</li>
          <li>We assume that the stock picker will hold until the end of each day</li>
          <li>For the sake of example, only 2x leverage will be simulated (but can be extended to 3x by a change of constants)</li>
          <li>Cost of future heart medication required from increased stress of playing daily market movement is ignored</li>
          <li>Only the trailing 10 years of daily market movement could be retrieved, thus the results may be further skewed.</li>
          <li>Each simulation is run over 365 days (365 possible buying periods)</li>
          <li>We assume that the leveraged ETFs would pay no cost to maintain their leverage (borrowing/other instruments) which is not true. This will lead to higher returns than what would be possible employing this strategy in real life.</li>
        </ul>
      </p>

      <h4><strong>Conclusions</strong></h4>
      <p>
        Ultimately the purpose of this program was to convince someone that if they truly believe they could predict the market's
        direction with 60% accuracy they should buy 2x and 3x leveraged ETFs on days where they believed they could predict the market movement.<br/>
        Running the simulation 1000 times lead to the following results: <br/>

        <pre>
          <code>
            [1] "Successes: 920"
            [1] "Greatest Success: $ 511132.699408"
            [1] "-------------"
            [1] "Failures: 80"
            [1] "Worst Failure: $ 46340.775260"
            [1] "-------------"
          </code>
        </pre>
        <br/>
        Where a success = currentMoney >= START_MONEY<br/>
        and a failure = currentMoney < START_MONEY<br/>
        <br/>
        The following is a histogram where START_MONEY was set to $10,000 for the sake of clarity in reading the histogram.
        Note the histogram is mislabelled, this does not occur in the running version of the program.

        <img src="/images/projects/sp500results.png" style="width: 800px; height: auto; display:block;"/> <br/>
        Ultimately, the assumptions made prevent the results of the simulation to be very accurate (cost of leverage, lack of historicial data in particular).
        However a general claim can be made, if one can predict the daily market direction with a > 60% accuracy they very likely can make a lot of money by
        making a "guess" daily.
      </p>

      <h4><strong>Attribution</strong></h4>
      <p>
        <a href="http://en.wikipedia.org/wiki/S%26P_500#/media/File:S%26P500_(1950-12).jpg">S&amp;P 500 image</a>
      </p>
    </div>

  </div>
</body>

<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
</html>
{'fraction_non_alphanumeric': 0.15926784826900778, 'fraction_numerical': 0.026420407487162498, 'mean_word_length': 3.0946083418107833, 'pattern_counts': {'":': 0, '<': 257, '<?xml version=': 0, '>': 259, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6310617', 'n_tokens_mistral': 4078, 'n_tokens_neox': 3334, 'n_words': 1318}