Skip to content

Commit

Permalink
build based on a0ae52f
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Feb 7, 2025
1 parent a52bbc9 commit 4b62efe
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 168 deletions.
2 changes: 1 addition & 1 deletion dev/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.11.3","generation_timestamp":"2025-02-06T02:50:57","documenter_version":"1.8.0"}}
{"documenter":{"julia_version":"1.11.3","generation_timestamp":"2025-02-07T02:52:33","documenter_version":"1.8.0"}}
2 changes: 1 addition & 1 deletion dev/concepts/index.html

Large diffs are not rendered by default.

46 changes: 0 additions & 46 deletions dev/examples/6e83bb1b.svg

This file was deleted.

48 changes: 48 additions & 0 deletions dev/examples/73a8fc8d.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 0 additions & 44 deletions dev/examples/977b08bf.svg

This file was deleted.

44 changes: 44 additions & 0 deletions dev/examples/a4f2251e.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 28 additions & 28 deletions dev/examples/b34a791c.svg → dev/examples/ac132618.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 34 additions & 34 deletions dev/examples/385e3a2d.svg → dev/examples/c61108b7.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions dev/examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
| 2000-01-25T00:00:00 | 112.25 |
| ⋮ | ⋮ |
</span><span class="sgr36"> 484 rows omitted
</span></span></code></pre><p>Above it is represented in a raw table-like form.<sup class="footnote-reference"><a id="citeref-1" href="#footnote-1">[1]</a></sup> We can see that this block has values of type <code>Float64</code>. For <code>Block</code>s with numeric value types, we can use the included plot recipe to visualise them:</p><pre><code class="language-julia hljs">plot(block; label=&quot;CL price&quot;)</code></pre><img src="b34a791c.svg" alt="Example block output"/><h2 id="Creating-nodes"><a class="docs-heading-anchor" href="#Creating-nodes">Creating nodes</a><a id="Creating-nodes-1"></a><a class="docs-heading-anchor-permalink" href="#Creating-nodes" title="Permalink"></a></h2><p>The core of <code>TimeDag</code> is a computational graph of <a href="../reference/fundamentals/#TimeDag.Node"><code>TimeDag.Node</code></a>s. These nodes represent time-series, and how they should be computed in terms of other time-series.</p><p>We can create a node from the block of data we already have:</p><pre><code class="language-julia hljs">price = block_node(block)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">BlockNode{Float64}</code></pre><p>The node knows its <a href="../reference/fundamentals/#TimeDag.value_type"><code>value_type</code></a>, which will be <code>Float64</code> (since the values will just be those of the block we created earlier).</p><pre><code class="language-julia hljs">value_type(price)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Float64</code></pre><p>Now let&#39;s perform some computation — let&#39;s estimate the 50 day rolling standard deviation of returns.</p><p>We start by computing relative returns using <a href="../reference/align/#TimeDag.lag"><code>lag</code></a>; given a price <span>$p_t$</span> at time <span>$t$</span>, the return series is <span>$r_t = \frac{p_t - p_{t-1}}{p_{t-1}}$</span>. We then use <a href="../reference/online_windowed/#Statistics.std"><code>Statistics.std</code></a> to define an online standard deviation over the specified window.</p><pre><code class="language-julia hljs">returns = (price - lag(price, 1)) / lag(price, 1)
</span></span></code></pre><p>Above it is represented in a raw table-like form.<sup class="footnote-reference"><a id="citeref-1" href="#footnote-1">[1]</a></sup> We can see that this block has values of type <code>Float64</code>. For <code>Block</code>s with numeric value types, we can use the included plot recipe to visualise them:</p><pre><code class="language-julia hljs">plot(block; label=&quot;CL price&quot;)</code></pre><img src="ac132618.svg" alt="Example block output"/><h2 id="Creating-nodes"><a class="docs-heading-anchor" href="#Creating-nodes">Creating nodes</a><a id="Creating-nodes-1"></a><a class="docs-heading-anchor-permalink" href="#Creating-nodes" title="Permalink"></a></h2><p>The core of <code>TimeDag</code> is a computational graph of <a href="../reference/fundamentals/#TimeDag.Node"><code>TimeDag.Node</code></a>s. These nodes represent time-series, and how they should be computed in terms of other time-series.</p><p>We can create a node from the block of data we already have:</p><pre><code class="language-julia hljs">price = block_node(block)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">BlockNode{Float64}</code></pre><p>The node knows its <a href="../reference/fundamentals/#TimeDag.value_type"><code>value_type</code></a>, which will be <code>Float64</code> (since the values will just be those of the block we created earlier).</p><pre><code class="language-julia hljs">value_type(price)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">Float64</code></pre><p>Now let&#39;s perform some computation — let&#39;s estimate the 50 day rolling standard deviation of returns.</p><p>We start by computing relative returns using <a href="../reference/align/#TimeDag.lag"><code>lag</code></a>; given a price <span>$p_t$</span> at time <span>$t$</span>, the return series is <span>$r_t = \frac{p_t - p_{t-1}}{p_{t-1}}$</span>. We then use <a href="../reference/online_windowed/#Statistics.std"><code>Statistics.std</code></a> to define an online standard deviation over the specified window.</p><pre><code class="language-julia hljs">returns = (price - lag(price, 1)) / lag(price, 1)
using Statistics
std_50 = std(returns, 50)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">TimeDag.SimpleUnary{sqrt, true, Float64}()</code></pre><p>Whilst it isn&#39;t normally necessary to inspect the graph by hand, we can visualise it with <code>AbstractTrees.print_tree</code>. This is often good enough for a simple text-based representation, but be aware that actually we have a graph, and not a tree. In the output, the <code>Lag</code> node appears twice, however it is in fact <em>exactly the same object</em>.</p><pre><code class="language-julia hljs">using AbstractTrees
print_tree(std_50)</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">SimpleUnary{sqrt, true, Float64}()
Expand All @@ -39,8 +39,8 @@
└─ BlockNode{Float64}</code></pre><p>Now that we have defined our computation, we can evaluate it to form a concrete time-series. We use <a href="../reference/fundamentals/#TimeDag.evaluate"><code>evaluate</code></a>, and here we pass in a time range that covers all our input-data.</p><p>By evaluating both <code>returns</code> and <code>std_50</code> in the same call, note that we do not duplicate work. (See <a href="../reference/internals/#Advanced-evaluation">Advanced evaluation</a> for further discussion on this.)</p><pre><code class="language-julia hljs">returns_block, std_50_block = evaluate([returns, std_50], DateTime(2000), DateTime(2003))

plot(returns_block; alpha=0.5, label=&quot;returns&quot;)
plot!(std_50_block; label=&quot;50 day std&quot;)</code></pre><img src="385e3a2d.svg" alt="Example block output"/><h2 id="Other-sources"><a class="docs-heading-anchor" href="#Other-sources">Other sources</a><a id="Other-sources-1"></a><a class="docs-heading-anchor-permalink" href="#Other-sources" title="Permalink"></a></h2><p>The example so far has used a <em>source node</em> that simply wraps data that is already held in memory. More interesting cases are nodes that read or generate their data only when evaluated.</p><p>Here we use <a href="../reference/misc_ops/#Base.rand"><code>Base.rand</code></a> to generate a stream of random numbers. It produces a value whenever its argument ticks — in this case, <a href="../reference/sources/#TimeDag.iterdates"><code>iterdates</code></a> will tick once a day at midnight.<sup class="footnote-reference"><a id="citeref-2" href="#footnote-2">[2]</a></sup></p><p>It is good practice to consider this time to always be in UTC.</p><pre><code class="language-julia hljs">x = rand(iterdates())
plot!(std_50_block; label=&quot;50 day std&quot;)</code></pre><img src="c61108b7.svg" alt="Example block output"/><h2 id="Other-sources"><a class="docs-heading-anchor" href="#Other-sources">Other sources</a><a id="Other-sources-1"></a><a class="docs-heading-anchor-permalink" href="#Other-sources" title="Permalink"></a></h2><p>The example so far has used a <em>source node</em> that simply wraps data that is already held in memory. More interesting cases are nodes that read or generate their data only when evaluated.</p><p>Here we use <a href="../reference/misc_ops/#Base.rand"><code>Base.rand</code></a> to generate a stream of random numbers. It produces a value whenever its argument ticks — in this case, <a href="../reference/sources/#TimeDag.iterdates"><code>iterdates</code></a> will tick once a day at midnight.<sup class="footnote-reference"><a id="citeref-2" href="#footnote-2">[2]</a></sup></p><p>It is good practice to consider this time to always be in UTC.</p><pre><code class="language-julia hljs">x = rand(iterdates())
plot(evaluate(x, DateTime(2001), DateTime(2003)); label=&quot;[2001, 2003)&quot;)
plot!(evaluate(x, DateTime(2001), DateTime(2002)); label=&quot;[2001, 2002)&quot;)</code></pre><img src="977b08bf.svg" alt="Example block output"/><p>There are a couple of interesting things to note here:</p><ol><li>We can generate more data by evaluating over a longer range.</li><li>So long as we start at the same time, we get exactly the same random numbers.</li></ol><p>This second property is a <strong>general</strong> property of node evaluation — repeated evaluation should always give the same answer.</p><p>Finally, we show the correlation for two random numbers over an expanding window. As expected, it converges towards zero as more data is observed:</p><pre><code class="language-julia hljs">y = rand(iterdates())
plot!(evaluate(x, DateTime(2001), DateTime(2002)); label=&quot;[2001, 2002)&quot;)</code></pre><img src="a4f2251e.svg" alt="Example block output"/><p>There are a couple of interesting things to note here:</p><ol><li>We can generate more data by evaluating over a longer range.</li><li>So long as we start at the same time, we get exactly the same random numbers.</li></ol><p>This second property is a <strong>general</strong> property of node evaluation — repeated evaluation should always give the same answer.</p><p>Finally, we show the correlation for two random numbers over an expanding window. As expected, it converges towards zero as more data is observed:</p><pre><code class="language-julia hljs">y = rand(iterdates())
correlation = cor(x, y)
plot(evaluate(correlation, DateTime(2001), DateTime(2002)); label=&quot;correlation&quot;)</code></pre><img src="6e83bb1b.svg" alt="Example block output"/><p>Information on other source nodes included with <code>TimeDag</code> is available in <a href="../reference/sources/#Sources">Sources</a>. If you wish to create your own source nodes, e.g. to read data directly from a database table, refer to <a href="../reference/creating_ops/#Creating-sources">Creating sources</a>.</p><section class="footnotes is-size-7"><ul><li class="footnote" id="footnote-1"><a class="tag is-link" href="#citeref-1">1</a>A <a href="../reference/fundamentals/#TimeDag.Block"><code>Block</code></a> is compatible with <code>Tables.jl</code>, which means that it can be easily converted to a <code>DataFrame</code> or similar.</li><li class="footnote" id="footnote-2"><a class="tag is-link" href="#citeref-2">2</a>Note that <code>TimeDag</code>&#39;s time axis doesn&#39;t include timezone information.</li></ul></section></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../concepts/">« Concepts</a><a class="docs-footer-nextpage" href="../reference/fundamentals/">Fundamentals »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.8.0 on <span class="colophon-date" title="Thursday 6 February 2025 02:50">Thursday 6 February 2025</span>. Using Julia version 1.11.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
plot(evaluate(correlation, DateTime(2001), DateTime(2002)); label=&quot;correlation&quot;)</code></pre><img src="73a8fc8d.svg" alt="Example block output"/><p>Information on other source nodes included with <code>TimeDag</code> is available in <a href="../reference/sources/#Sources">Sources</a>. If you wish to create your own source nodes, e.g. to read data directly from a database table, refer to <a href="../reference/creating_ops/#Creating-sources">Creating sources</a>.</p><section class="footnotes is-size-7"><ul><li class="footnote" id="footnote-1"><a class="tag is-link" href="#citeref-1">1</a>A <a href="../reference/fundamentals/#TimeDag.Block"><code>Block</code></a> is compatible with <code>Tables.jl</code>, which means that it can be easily converted to a <code>DataFrame</code> or similar.</li><li class="footnote" id="footnote-2"><a class="tag is-link" href="#citeref-2">2</a>Note that <code>TimeDag</code>&#39;s time axis doesn&#39;t include timezone information.</li></ul></section></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../concepts/">« Concepts</a><a class="docs-footer-nextpage" href="../reference/fundamentals/">Fundamentals »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.8.0 on <span class="colophon-date" title="Friday 7 February 2025 02:52">Friday 7 February 2025</span>. Using Julia version 1.11.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit 4b62efe

Please sign in to comment.