From b25f03de6547ebc26d527980e7463f1e171918db Mon Sep 17 00:00:00 2001 From: Iblis Lin Date: Tue, 9 May 2017 09:45:48 +0800 Subject: [PATCH 1/2] doc: add docstring for util/typical --- src/utilities.jl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utilities.jl b/src/utilities.jl index 1d4b2b0..c72676a 100644 --- a/src/utilities.jl +++ b/src/utilities.jl @@ -1,5 +1,14 @@ +doc""" + typical(ohlc; h="High", l="Low", c="Close") + +Typical Price + +```math + \text{Typical Price} = \frac{H + L + C}{3} +``` +""" function typical{T,N}(ohlc::TimeArray{T,N}; h="High", l="Low", c="Close") - val = (ohlc[h] .+ ohlc[l] .+ ohlc[c]) ./3 + val = (ohlc[h] .+ ohlc[l] .+ ohlc[c]) ./ 3 TimeArray(val.timestamp, val.values, ["typical"], ohlc.meta) end From 45e174fa2aa72a27aaf6db8c8b40681ccd3f9d39 Mon Sep 17 00:00:00 2001 From: Iblis Lin Date: Tue, 9 May 2017 10:02:26 +0800 Subject: [PATCH 2/2] doc: add a new page for utils --- docs/make.jl | 1 + docs/src/index.md | 1 + docs/src/utils.md | 14 ++++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 docs/src/utils.md diff --git a/docs/make.jl b/docs/make.jl index 0ead875..1ebd38a 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -14,6 +14,7 @@ makedocs( "volatility.md", "volume.md", "candlesticks.md", + "utils.md", ] ) diff --git a/docs/src/index.md b/docs/src/index.md index 943108f..789996c 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -15,5 +15,6 @@ Pages = [ "volatility.md", "volume.md", "candlesticks.md", + "utils.md", ] ``` diff --git a/docs/src/utils.md b/docs/src/utils.md new file mode 100644 index 0000000..b02b855 --- /dev/null +++ b/docs/src/utils.md @@ -0,0 +1,14 @@ +# Utilities + +## Typical Price + +```@docs +typical +``` + +```@repl +using MarketData +using MarketTechnicals + +merge(ohlc, typical(ohlc)) +```