<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Out to See]]></title><description><![CDATA[Out to See]]></description><link>https://dclarke.is</link><generator>RSS for Node</generator><lastBuildDate>Wed, 27 May 2026 09:03:41 GMT</lastBuildDate><atom:link href="https://dclarke.is/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Loading Barbadian Stocks]]></title><description><![CDATA[Objectives
We will download data from the Barbados Stock Exchange and plot a small portion of it. This will involve the following.

Download Files using R
Collate Files using R
Clean Data using R
Visualize Data using R

Introduction
I have a vested i...]]></description><link>https://dclarke.is/loading-barbadian-stocks</link><guid isPermaLink="true">https://dclarke.is/loading-barbadian-stocks</guid><category><![CDATA[R Language]]></category><category><![CDATA[business]]></category><category><![CDATA[files]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Dario J C]]></dc:creator><pubDate>Fri, 04 Feb 2022 01:52:58 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/Wb63zqJ5gnE/upload/v1643821764706/gzt22vGaV.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-objectives">Objectives</h1>
<p>We will download data from the Barbados Stock Exchange and plot a small portion of it. This will involve the following.</p>
<ol>
<li>Download Files using R</li>
<li>Collate Files using R</li>
<li>Clean Data using R</li>
<li>Visualize Data using R</li>
</ol>
<h1 id="heading-introduction">Introduction</h1>
<p>I have a vested interest in finding interesting datasets related to Barbados as that's where I'm from.</p>
<p>One site which caught my interest is the <a target="_blank" href="https://bse.com.bb/">Barbados Stock Exchange</a>.</p>
<p>Now I'm currently ignorant when it comes to all things stocks, but I do see they offer on their website the ability to download monthly reports, and I do understand 'free to download'.</p>
<h1 id="heading-downloading-files">Downloading Files</h1>
<p>The first thing we need to do is load the information into our tool of choice, yet they're quite a few files we'd need to download and edit.</p>
<p>Here we can take advantage of some automation to help us out, my tool of choice for this will be R.</p>
<p>We'll first load our libraries and start writing our code.</p>
<pre><code><span class="hljs-comment"># Load used libraries</span>

<span class="hljs-keyword">library</span>(tidyverse) <span class="hljs-comment"># The greatest (imo) swiss army knife for R</span>

<span class="hljs-keyword">library</span>(clock)     <span class="hljs-comment"># Handle datetimes</span>
<span class="hljs-keyword">library</span>(gt)        <span class="hljs-comment"># Make (imo) pretty tables</span>
</code></pre><h2 id="heading-prep-work">Prep Work</h2>
<p>First we download and look at some of the files manually. We thus confirm  that we can download the reports as csv files from the link,</p>
<blockquote>
<p>[Domain]/reports/monthly/download-csv?tradeDate=[Date]</p>
<p>where [Date] is the the date of interest in the format of yyyy-mm-dd.</p>
</blockquote>
<p>We can generate a sequence of dates using <code>seq</code> and <code>clock</code> which we can paste unto our base link.</p>
<p>This will give us a list of links for all the files we're interested in.</p>
<pre><code><span class="hljs-comment"># Download the data from the base link</span>
base_link &lt;- <span class="hljs-string">"https://bse.com.bb/reports/monthly/download-csv?tradeDate="</span>

<span class="hljs-comment"># Specify dates of interest</span>
from &lt;- clock::year_month_day(<span class="hljs-number">1910</span>, <span class="hljs-number">1</span>)
to &lt;- clock::year_month_day(<span class="hljs-number">2022</span>, <span class="hljs-number">1</span>)

<span class="hljs-comment"># Generate download links</span>
download_links &lt;- tibble::tibble(
  <span class="hljs-keyword">link</span> = paste<span class="hljs-number">0</span>(base_link,
                se<span class="hljs-string">q(from, to, by = 1)</span>,
                <span class="hljs-string">"-01"</span>)
)
</code></pre><p>We can confirm that the links were created as expected by looking at a few with the following code.</p>
<pre><code># <span class="hljs-keyword">Show</span> <span class="hljs-keyword">some</span> <span class="hljs-keyword">of</span> our <span class="hljs-keyword">generated</span> links
download_links %&gt;%
  head() %&gt;%
  gt::gt(rowname_col = <span class="hljs-keyword">NULL</span>) %&gt;%
  gt::tab_header(
    title = "List of generated links"
  )
</code></pre><div class="hn-table">
<table>
<thead>
<tr>
<td>List of generated links</td></tr>
</thead>
<tbody>
<tr>
<td>link</td></tr>
<tr>
<td>https://bse.com.bb/reports/monthly/download-csv?tradeDate=1910-01-01</td></tr>
<tr>
<td>https://bse.com.bb/reports/monthly/download-csv?tradeDate=1910-02-01</td></tr>
<tr>
<td>https://bse.com.bb/reports/monthly/download-csv?tradeDate=1910-03-01</td></tr>
<tr>
<td>https://bse.com.bb/reports/monthly/download-csv?tradeDate=1910-04-01</td></tr>
<tr>
<td>https://bse.com.bb/reports/monthly/download-csv?tradeDate=1910-05-01</td></tr>
<tr>
<td>https://bse.com.bb/reports/monthly/download-csv?tradeDate=1910-06-01</td></tr>
</tbody>
</table>
</div><h2 id="heading-downloading-files">Downloading Files</h2>
<p>In our prep work, we created 1,345 links to now download our files. That's a bit, but thankfully we're not doing this by hand, instead we'll also be leveraging R here as well.</p>
<p>We'll first create a folder called "Stock_Files" to store our downloaded files to, as I may rerun this script multiple times, I'll only download the files if this folder doesn't exist.</p>
<p>We're also not particularly interested in any one file, so we'll just assign them temporary names.</p>
<pre><code><span class="hljs-comment"># Note how many files we're interested in</span>
val &lt;- nrow(download_links)

<span class="hljs-comment"># If we've downloaded the files already, just use them, otherwise download them</span>
<span class="hljs-comment"># Keep in mind I'm on a Windows machine and thus following that path convention</span>
<span class="hljs-keyword">if</span>( length( <span class="hljs-keyword">list</span>.dirs(path = <span class="hljs-string">"./Stock_Files"</span>) ) &gt;= <span class="hljs-number">1</span> ) {

  stock_dir &lt;- paste0(getwd(),<span class="hljs-string">"/Stock_Files"</span>)
  stock_files &lt;- <span class="hljs-keyword">list</span>.files(path = stock_dir,
                           pattern = <span class="hljs-string">"csv$"</span>)
} <span class="hljs-keyword">else</span> {

  <span class="hljs-comment"># Create a directory</span>
  dir.create(<span class="hljs-string">"./Stock_Files"</span>,
             showWarnings = <span class="hljs-literal">TRUE</span>,
             recursive = <span class="hljs-literal">FALSE</span>,
             mode = <span class="hljs-string">"0777"</span>)

  <span class="hljs-comment"># Create multiple temporary file names</span>
  stock_files &lt;- tibble::tibble(
    id = seq(<span class="hljs-number">1</span>, val, <span class="hljs-number">1</span>),
    file_path = seq(<span class="hljs-number">1</span>, val, <span class="hljs-number">1</span>) %&gt;%
      map(~ tempfile(
        pattern = paste0(<span class="hljs-string">"temp_stock_"</span>,.x),
        tmpdir = stock_dir,
        fileext = <span class="hljs-string">".csv"</span>))
  )

  <span class="hljs-comment"># Download the files using temporary directory and file names</span>
  <span class="hljs-keyword">for</span>(i in seq_along(<span class="hljs-number">1</span>:val)){
    <span class="hljs-keyword">try</span>(
      download.file(download_links$link[i],
                    stock_files$file_path[[i]],
                    method = <span class="hljs-string">"wininet"</span>),
      silent = <span class="hljs-literal">TRUE</span>)
  }

}
</code></pre><p>We've successfully downloaded our files, but when we open some of them, we notice they're empty!</p>
<p>It turns out only some of the files have information, those without information, are simply blank.</p>
<p>Interestingly, if we examine some of the empty files, we notice they're only 3 bytes. We can use this to our advantage by deleting any file which has a size of 3 bytes or less.</p>
<pre><code><span class="hljs-comment"># Record details of the files downloaded</span>
<span class="hljs-attribute">detail_files</span> &lt;- fileSnapshot(stock_dir)


<span class="hljs-comment"># Some months and thus files did not have any information, we make a list of those files</span>
delete_files &lt;- detail_files<span class="hljs-variable">$info</span> %&gt;%
  <span class="hljs-literal">select</span>(size) %&gt;%
  mutate(file = row.names(.),
         file = paste0(stock_dir,<span class="hljs-string">"/"</span>,file)) %&gt;%
  filter(size &lt;= <span class="hljs-number">3</span> &amp; str_detect(file, <span class="hljs-string">"csv$"</span>))

<span class="hljs-comment"># Delete all the unwanted files</span>
invisible(
  sapply(delete_files<span class="hljs-variable">$file</span>, unlink)
)


<span class="hljs-comment"># Note files which are kept</span>
kept_files &lt;- detail_files<span class="hljs-variable">$info</span> %&gt;%
  <span class="hljs-literal">select</span>(size) %&gt;%
  mutate(file = row.names(.),
         file = paste0(stock_dir,<span class="hljs-string">"/"</span>,file)) %&gt;%
  filter(size &gt; <span class="hljs-number">3</span> &amp; str_detect(file, <span class="hljs-string">"csv$"</span>))
</code></pre><p>Now after this, we can at last read our kept files into memory.</p>
<pre><code># read in all the CSV files
data_raw <span class="hljs-tag">&lt;<span class="hljs-name">-</span> <span class="hljs-attr">map_dfr</span>(<span class="hljs-attr">.x</span> = <span class="hljs-string">kept_files$file,</span>
                    <span class="hljs-attr">.f</span> = <span class="hljs-string">read_csv,</span>
                    <span class="hljs-attr">skip</span> = <span class="hljs-string">1,</span>
                    <span class="hljs-attr">col_types</span> = <span class="hljs-string">cols(</span>
                      `<span class="hljs-attr">Trade</span> <span class="hljs-attr">Date</span>` = <span class="hljs-string">col_character(),</span>
                      <span class="hljs-attr">Security</span> = <span class="hljs-string">col_character(),</span>
                      <span class="hljs-attr">Volume</span> = <span class="hljs-string">col_character(),</span>
                      <span class="hljs-attr">High</span> = <span class="hljs-string">col_character(),</span>
                      <span class="hljs-attr">Low</span> = <span class="hljs-string">col_character(),</span>
                      `<span class="hljs-attr">Last</span> <span class="hljs-attr">Close</span>` = <span class="hljs-string">col_character(),</span>
                      `<span class="hljs-attr">Current</span> <span class="hljs-attr">Close</span>` = <span class="hljs-string">col_character(),</span>
                      `<span class="hljs-attr">Price</span> <span class="hljs-attr">Change</span>` = <span class="hljs-string">col_character(),</span>
                      `<span class="hljs-attr">Bid</span> <span class="hljs-attr">Price</span>` = <span class="hljs-string">col_character(),</span>
                      `<span class="hljs-attr">Ask</span> <span class="hljs-attr">Price</span>` = <span class="hljs-string">col_character()</span>
                    ))</span>
</code></pre><p>Of the 1,345 files we downloaded, we deleted 1,272 and kept only 73.
Why so little? Well it so happens that the Stock Exchange only start recording information from around 2015, and we started our count from 1910, quite inefficient of us.</p>
<p>Well the reason we did this (notice I'm still using we), was to show how we can find ways to remove unneeded files without much issue. (That, and I was too lazy to manually check when useful information was recorded.)</p>
<p>Table showing Raw Data</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Trade Date</td><td>Security</td><td>Volume</td><td>High</td><td>Low</td><td>Last Close</td><td>Current Close</td><td>Price Change</td><td>Bid Price</td><td>Ask Price</td><td>month_year</td><td>id</td></tr>
</thead>
<tbody>
<tr>
<td>2015-01-01</td><td>ABV</td><td>1,500</td><td>0.32</td><td>0.32</td><td>0.00</td><td>0.32</td><td>0.00</td><td>0.25</td><td>0.30</td><td>2015-01</td><td>1</td></tr>
<tr>
<td>2015-01-01</td><td>BHL</td><td>2,144</td><td>2.90</td><td>2.90</td><td>0.00</td><td>2.90</td><td>0.00</td><td>2.50</td><td>2.88</td><td>2015-01</td><td>2</td></tr>
<tr>
<td>2015-01-01</td><td>BCO</td><td>13,899</td><td>1.90</td><td>1.65</td><td>0.00</td><td>1.82</td><td>0.00</td><td>1.90</td><td>0.00</td><td>2015-01</td><td>3</td></tr>
<tr>
<td>2015-01-01</td><td>CWBL</td><td>11,900</td><td>3.00</td><td>3.00</td><td>0.00</td><td>3.00</td><td>0.00</td><td>0.00</td><td>2.48</td><td>2015-01</td><td>4</td></tr>
<tr>
<td>2015-01-01</td><td>CSP</td><td>1,823</td><td>3.00</td><td>3.00</td><td>0.00</td><td>3.00</td><td>0.00</td><td>2.51</td><td>3.00</td><td>2015-01</td><td>5</td></tr>
<tr>
<td>2015-01-01</td><td>CPFD</td><td>37,143</td><td>0.22</td><td>0.22</td><td>0.00</td><td>0.22</td><td>0.00</td><td>0.17</td><td>0.00</td><td>2015-01</td><td>6</td></tr>
</tbody>
</table>
</div><h1 id="heading-cleaning-data">Cleaning Data</h1>
<p>Well we have our data, but upon closer examination, we see it's not in a format that's particularly useful to us. At least not yet.</p>
<p>To hopefully make the cleaning process easier to follow, we'll be using multiple temporary objects.</p>
<p>The first thing we will do is create two unique identifiers, they will track:</p>
<ol>
<li>the month and year for that particular row: <code>month-year</code></li>
<li>the particular row: <code>row_number</code></li>
</ol>
<p>These values will prove useful later.</p>
<pre><code># Manipulate our raw data <span class="hljs-keyword">to</span> <span class="hljs-keyword">include</span> a <span class="hljs-keyword">unique</span> identifier <span class="hljs-keyword">for</span> month-year <span class="hljs-keyword">and</span> <span class="hljs-keyword">rows</span>
d_raw &lt;- data_raw %&gt;%
  mutate(month_year = clock::date_format(
    clock::date_parse(`Trade <span class="hljs-type">Date</span>`),
                      <span class="hljs-keyword">format</span> = "%Y-%m"),
    id = row_number())
</code></pre><p>We also want to keep track of which <code>row_number</code> is the first value in a new <code>month-year</code> as well.</p>
<pre><code><span class="hljs-comment"># Create a table which identifies the first index in the raw data for each month-year</span>
<span class="hljs-attribute">id_val</span> &lt;- d_raw[
  match(
    unique(d_raw<span class="hljs-variable">$month_year</span>),
    d_raw<span class="hljs-variable">$month_year</span>),] %&gt;%
  <span class="hljs-literal">select</span>(id)
</code></pre><p>Now inside our <code>Trade Date</code> column, we sometimes get useful information which isn't the date, but rather a title. We will now use our previous values to find their locations.</p>
<pre><code># <span class="hljs-keyword">Get</span> the <span class="hljs-keyword">index</span> numbers <span class="hljs-keyword">for</span> <span class="hljs-keyword">each</span> title
temp_row &lt;- c(
  which(
    !str_detect(d_raw$`Trade <span class="hljs-type">Date</span>`,
                "([:digit:]|Trade Date)") | d_raw$id %<span class="hljs-keyword">in</span>% id_val$id),
  length(d_raw$`Trade <span class="hljs-type">Date</span>`)
  )
</code></pre><p>We can now organize these temporary values into a usable table with which to use in our 'cleaning'.</p>
<pre><code># Arrange <span class="hljs-keyword">index</span> numbers <span class="hljs-keyword">into</span> a usable <span class="hljs-keyword">format</span>
temp_col &lt;- tibble::tibble(
  <span class="hljs-keyword">begin</span> = temp_row[<span class="hljs-number">1</span>:(length(temp_row)<span class="hljs-number">-1</span>)],
  end = temp_row[<span class="hljs-number">2</span>:length(temp_row)],
  Title = data_raw[<span class="hljs-keyword">begin</span>,<span class="hljs-number">1</span>][[<span class="hljs-number">1</span>]]) %&gt;%
  mutate(Title = ifelse(str_detect(Title,
                                   "[:digit:]"),
                        "BSE MAIN",
                        Title))
</code></pre><p>Now using this table, we can at last carry out the last step of cleaning.</p>
<pre><code># Clean our data <span class="hljs-keyword">and</span> assign <span class="hljs-keyword">to</span> a <span class="hljs-built_in">new</span> data frame
data_clean &lt;- left_join(d_raw,
                        temp_col,
                        <span class="hljs-keyword">by</span> = c("id"="begin")) %&gt;%
  # Fix NA <span class="hljs-keyword">values</span> <span class="hljs-keyword">with</span> a <span class="hljs-keyword">user</span> made <span class="hljs-keyword">function</span>, <span class="hljs-string">'cleanNA'</span>.
  # You can find it at http://www.cookbook-r.com/
  mutate(Title = cleanNA(Title),
         `Trade <span class="hljs-type">Date</span>` = clock::date_parse(`Trade <span class="hljs-type">Date</span>`),
         Volume = parse_number(Volume)) %&gt;%
  # Change <span class="hljs-keyword">valid</span> <span class="hljs-keyword">columns</span> <span class="hljs-keyword">from</span> characters <span class="hljs-keyword">to</span> numbers
  mutate(across(High:`Ask Price`,
                parse_number)) %&gt;%
  # Remove unneeded <span class="hljs-keyword">columns</span>
  <span class="hljs-keyword">select</span>(-month_year:-<span class="hljs-keyword">end</span>) %&gt;%
  # Remove <span class="hljs-keyword">rows</span> <span class="hljs-keyword">with</span> NAs
  <span class="hljs-keyword">filter</span>(complete.cases(.)) %&gt;%
  # Change <span class="hljs-keyword">valid</span> <span class="hljs-keyword">columns</span> <span class="hljs-keyword">from</span> characters <span class="hljs-keyword">to</span> factors
  mutate(across(c(<span class="hljs-keyword">Security</span>, Title),
                as_factor))
</code></pre><p>We've at last cleaned our data, which:</p>
<ol>
<li>Reduced our raw data table from 2,413 rows to 2,225</li>
<li>Assigned the appropriate format appropriate for each column</li>
<li>Moved all titles into a usable column</li>
<li>Removed blank spaces and the like where applicable</li>
</ol>
<p>Table showing Clean Data</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Trade Date</td><td>Security</td><td>Volume</td><td>High</td><td>Low</td><td>Last Close</td><td>Current Close</td><td>Price Change</td><td>Bid Price</td><td>Ask Price</td><td>Title</td></tr>
</thead>
<tbody>
<tr>
<td>2015-01-01</td><td>ABV</td><td>1500</td><td>0.32</td><td>0.32</td><td>0.00</td><td>0.32</td><td>0.00</td><td>0.25</td><td>0.30</td><td>BSE MAIN</td></tr>
<tr>
<td>2015-01-01</td><td>BHL</td><td>2144</td><td>2.90</td><td>2.90</td><td>0.00</td><td>2.90</td><td>0.00</td><td>2.50</td><td>2.88</td><td>BSE MAIN</td></tr>
<tr>
<td>2015-01-01</td><td>BCO</td><td>13899</td><td>1.90</td><td>1.65</td><td>0.00</td><td>1.82</td><td>0.00</td><td>1.90</td><td>0.00</td><td>BSE MAIN</td></tr>
<tr>
<td>2015-01-01</td><td>CWBL</td><td>11900</td><td>3.00</td><td>3.00</td><td>0.00</td><td>3.00</td><td>0.00</td><td>0.00</td><td>2.48</td><td>BSE MAIN</td></tr>
<tr>
<td>2015-01-01</td><td>CSP</td><td>1823</td><td>3.00</td><td>3.00</td><td>0.00</td><td>3.00</td><td>0.00</td><td>2.51</td><td>3.00</td><td>BSE MAIN</td></tr>
<tr>
<td>2015-01-01</td><td>CPFD</td><td>37143</td><td>0.22</td><td>0.22</td><td>0.00</td><td>0.22</td><td>0.00</td><td>0.17</td><td>0.00</td><td>BSE MAIN</td></tr>
</tbody>
</table>
</div><p>We'll remove some unneeded values before moving on.</p>
<pre><code><span class="hljs-comment"># Remove unneeded variables</span>
rm(data_raw,
   delete_files,
   detail_files,
   download_links,
   id_val,
   kept_files,
   temp_col,
   base_link,
   <span class="hljs-keyword">from</span>,
   to,
   stock_dir,
   stock_files,
   val,
   temp_row)
</code></pre><h1 id="heading-visualizing-data">Visualizing Data</h1>
<p>Well we now have clean data, but what do we do with it?</p>
<p>As I mentioned before, I'm completely ignorant about stocks, so my guess is definitely not as good as yours.</p>
<p>Still we'll move on undaunted, and plot something for now, we may explore this data properly at a later date.</p>
<pre><code>data_clean <span class="hljs-operator">%</span><span class="hljs-operator">&gt;</span><span class="hljs-operator">%</span>
  filter(Title <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-string">"BSE MAIN"</span>) <span class="hljs-operator">%</span><span class="hljs-operator">&gt;</span><span class="hljs-operator">%</span>
  ggplot(aes(x <span class="hljs-operator">=</span> `Trade Date`,
             y <span class="hljs-operator">=</span> `Current Close`,
             colour <span class="hljs-operator">=</span> Security)) <span class="hljs-operator">+</span>
  geom_line(show.legend <span class="hljs-operator">=</span> FALSE) <span class="hljs-operator">+</span>
  facet_wrap(vars(Security)) <span class="hljs-operator">+</span>
  labs(title <span class="hljs-operator">=</span> <span class="hljs-string">"Plot of Current Close for BSE MAIN"</span>,
       caption <span class="hljs-operator">=</span> <span class="hljs-string">"Data source: Barbados Stock Exchange (2022)"</span>) <span class="hljs-operator">+</span>
  see::theme_blackboard() <span class="hljs-operator">+</span>
  viridis::scale_fill_viridis()
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643861141596/dlKrp77oM.png" alt="2022-02 - plot - current close for BSE MAIN.png" /></p>
<pre><code>data_clean <span class="hljs-operator">%</span><span class="hljs-operator">&gt;</span><span class="hljs-operator">%</span>
  filter(Title <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-string">"Fixed Income"</span>) <span class="hljs-operator">%</span><span class="hljs-operator">&gt;</span><span class="hljs-operator">%</span>
  ggplot(aes(x <span class="hljs-operator">=</span> `Trade Date`,
             y <span class="hljs-operator">=</span> `Current Close`,
             colour <span class="hljs-operator">=</span> Security)) <span class="hljs-operator">+</span>
  geom_line(show.legend <span class="hljs-operator">=</span> FALSE) <span class="hljs-operator">+</span>
  facet_wrap(vars(Security)) <span class="hljs-operator">+</span>
  labs(title <span class="hljs-operator">=</span> <span class="hljs-string">"Plot of Current Close for BSE FIX"</span>,
       caption <span class="hljs-operator">=</span> <span class="hljs-string">"Data source: Barbados Stock Exchange (2022)"</span>) <span class="hljs-operator">+</span>
  see::theme_blackboard() <span class="hljs-operator">+</span>
  theme(axis.text.x <span class="hljs-operator">=</span> element_text(angle <span class="hljs-operator">=</span> <span class="hljs-number">90</span>)) <span class="hljs-operator">+</span>
  viridis::scale_fill_viridis()
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643861297921/RYQu6xkzM.png" alt="2022-02 - plot - current close for BSE FIX.png" /></p>
<pre><code>data_clean <span class="hljs-operator">%</span><span class="hljs-operator">&gt;</span><span class="hljs-operator">%</span>
  filter(Title <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-string">"ISM"</span>) <span class="hljs-operator">%</span><span class="hljs-operator">&gt;</span><span class="hljs-operator">%</span>
  ggplot(aes(x <span class="hljs-operator">=</span> `Trade Date`,
             y <span class="hljs-operator">=</span> `Current Close`,
             colour <span class="hljs-operator">=</span> Security)) <span class="hljs-operator">+</span>
  geom_line(show.legend <span class="hljs-operator">=</span> FALSE) <span class="hljs-operator">+</span>
  facet_wrap(vars(Security)) <span class="hljs-operator">+</span>
  labs(title <span class="hljs-operator">=</span> <span class="hljs-string">"Plot of Current Close for BSE ISM"</span>,
       caption <span class="hljs-operator">=</span> <span class="hljs-string">"Data source: Barbados Stock Exchange (2022)"</span>) <span class="hljs-operator">+</span>
  see::theme_blackboard() <span class="hljs-operator">+</span>
  viridis::scale_fill_viridis()
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643861479822/dZxzh8jQG.png" alt="2022-02 - plot - current close for BSE ISM.png" /></p>
<pre><code>data_clean <span class="hljs-operator">%</span><span class="hljs-operator">&gt;</span><span class="hljs-operator">%</span>
  filter(Title <span class="hljs-operator">=</span><span class="hljs-operator">=</span> <span class="hljs-string">"BSE ISM-BONDS"</span>) <span class="hljs-operator">%</span><span class="hljs-operator">&gt;</span><span class="hljs-operator">%</span>
  ggplot(aes(x <span class="hljs-operator">=</span> `Trade Date`,
             y <span class="hljs-operator">=</span> `Current Close`,
             colour <span class="hljs-operator">=</span> Security)) <span class="hljs-operator">+</span>
  geom_line(show.legend <span class="hljs-operator">=</span> FALSE) <span class="hljs-operator">+</span>
  facet_wrap(vars(Security)) <span class="hljs-operator">+</span>
  labs(title <span class="hljs-operator">=</span> <span class="hljs-string">"Plot of Current Close for BSE ISM-BONDS"</span>,
       caption <span class="hljs-operator">=</span> <span class="hljs-string">"Data source: Barbados Stock Exchange (2022)"</span>) <span class="hljs-operator">+</span>
  see::theme_blackboard() <span class="hljs-operator">+</span>
  viridis::scale_fill_viridis()
</code></pre><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643861623767/3K41GPAF9.png" alt="2022-02 - plot - current close for BSE ISM-BONDS.png" /></p>
<p>This was a pretty interesting task.</p>
<p>If I revisit this, I'd like to confirm if BSE has an API of some form to use, and maybe I should learn a bit about stocks so I can do something interesting with the downloaded information.</p>
]]></content:encoded></item><item><title><![CDATA[Out To See]]></title><description><![CDATA[The Journey is Eternal
I find looking out to sea to be both relaxing and terrifying. 
It's a strange disconnect, but the sea has always meant multiple, sometimes contradictory, things to me.
It's the place where I almost drowned. Twice. It's also the...]]></description><link>https://dclarke.is/out-to-see</link><guid isPermaLink="true">https://dclarke.is/out-to-see</guid><category><![CDATA[journal]]></category><dc:creator><![CDATA[Dario J C]]></dc:creator><pubDate>Tue, 25 Jan 2022 17:01:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/oQl0eVYd_n8/upload/v1643129219953/ayp8nGMQi.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-the-journey-is-eternal">The Journey is Eternal</h1>
<p>I find looking out to sea to be both relaxing and terrifying. 
It's a strange disconnect, but the sea has always meant multiple, sometimes contradictory, things to me.</p>
<p>It's the place where I almost drowned. Twice. It's also the place where my family has frequented for much of my youth. I find my view of the sea changes just as easily as my state of my mind.</p>
<p>This to me is how life works.
There're so many amazing things to discover and learn, just like in the sea, yet there remains a strangeness to it all, and if you don't treat it with respect, you can easily lose yourself and drown.</p>
<p>The pandemic has led me into a more introspective mood about what I want in life, and I wish to record my 'captain's log' somewhere both personal and public.</p>
<p>My goal is to explore my growth, both in my work (I'm aiming to transition from renewable energy into tech) and spirituality (regardless of your belief, I think we all can say belief is confusing).</p>
<p>This is for me. For my journey out to see.</p>
]]></content:encoded></item></channel></rss>