forked from JuliaPlots/PlotlyJS.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update examples with finance and ternary
- Loading branch information
Showing
18 changed files
with
735 additions
and
718 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
```julia | ||
function ohlc1() | ||
t = ohlc(open=[33.0, 33.3, 33.5, 33.0, 34.1], | ||
high=[33.1, 33.3, 33.6, 33.2, 34.8], | ||
low=[32.7, 32.7, 32.8, 32.6, 32.8], | ||
close=[33.0, 32.9, 33.3, 33.1, 33.1]) | ||
plot(t) | ||
end | ||
ohlc1() | ||
``` | ||
|
||
|
||
<div id="63995747-13a6-46e6-aea6-ec5dfb0a3240" class="plotly-graph-div"></div> | ||
|
||
<script> | ||
window.PLOTLYENV=window.PLOTLYENV || {}; | ||
window.PLOTLYENV.BASE_URL="https://plot.ly"; | ||
Plotly.newPlot('63995747-13a6-46e6-aea6-ec5dfb0a3240', [{"high":[33.1,33.3,33.6,33.2,34.8],"open":[33.0,33.3,33.5,33.0,34.1],"type":"ohlc","low":[32.7,32.7,32.8,32.6,32.8],"close":[33.0,32.9,33.3,33.1,33.1]}], | ||
{"margin":{"r":30,"l":40,"b":80,"t":100}}, {showLink: false}); | ||
|
||
</script> | ||
|
||
|
||
|
||
```julia | ||
function ohlc2() | ||
@eval using Quandl | ||
|
||
function get_ohlc(ticker; kwargs...) | ||
df = quandlget("WIKI/$(ticker)", format="DataFrame") | ||
ohlc(open=df[:Open], high=df[:High], low=df[:Low], close=df[:Close]; kwargs...) | ||
end | ||
|
||
p1 = plot(get_ohlc("AAPL", name="Apple")) | ||
p2 = plot(get_ohlc("GOOG", name="Google")) | ||
|
||
|
||
[p1 p2] | ||
end | ||
ohlc2() | ||
``` | ||
|
||
|
||
<div id="d46b7504-150d-40b3-bda0-f0d8cf533833" class="plotly-graph-div"></div> | ||
|
||
<script> | ||
window.PLOTLYENV=window.PLOTLYENV || {}; | ||
window.PLOTLYENV.BASE_URL="https://plot.ly"; | ||
Plotly.newPlot('d46b7504-150d-40b3-bda0-f0d8cf533833', [{"yaxis":"y1","high":[99.99,99.3457,99.12,98.475,98.41,97.75,96.65,96.57,96.35,96.89,96.29,94.655,93.05,93.66,94.55,95.77,96.465,95.4,95.66,96.5,96.89,97.65,97.7,97.67,98.99,99.3,100.13,100.0,100.46,101.0,99.3,98.84,97.97,104.35,104.45,104.55,106.15,106.07,105.84,106.0,107.65,108.37,108.94,108.9,108.93,108.44,109.54,110.23,109.37,109.6,109.69,109.1,109.32,108.75,107.88,107.95,107.44,106.5,106.5699,106.8,108.0,108.3,108.76,107.27,105.72,105.72,108.79,113.03,115.73,116.13,116.18,114.12,113.989,114.94,114.79,113.39,113.18,114.64,113.8,113.37,113.05,114.31,113.66,114.34,114.56,116.75,118.69,117.98,117.44,118.17,117.84,118.21,117.76,117.38,116.91,117.74,118.36,115.7,115.86,115.21],"open":[98.5,98.53,98.69,97.32,97.82,96.45,96.62,96.0,94.94,96.25,95.94,92.91,93.0,92.9,93.97,94.44,95.49,95.39,94.6,95.7,96.49,96.75,97.17,97.41,97.39,98.92,98.7,99.56,100.0,99.83,99.26,98.25,96.82,104.265,102.83,104.19,104.41,106.05,104.81,105.58,106.27,107.52,108.23,108.71,108.52,107.78,108.14,109.63,109.1,109.23,108.77,108.86,108.59,108.565,107.39,107.41,106.62,105.8,105.66,106.14,107.7,107.9,107.83,107.25,104.64,102.65,107.51,108.73,113.86,115.12,115.19,113.05,113.85,114.35,114.42,111.64,113.0,113.69,113.16,112.46,112.71,113.06,113.4,113.7,114.31,115.02,117.7,117.35,116.79,117.88,117.33,118.18,117.25,116.86,116.81,117.1,117.95,114.31,115.39,113.87],"name":"Apple","type":"ohlc","xaxis":"x1","low":[98.46,98.48,97.1,96.75,97.03,96.07,95.3,95.03,94.676,95.35,95.25,92.65,91.5,92.14,93.63,94.3,95.33,94.46,94.37,95.62,96.05,96.73,97.12,96.84,97.32,98.5,98.6,99.34,99.735,99.13,98.31,96.92,96.42,102.75,102.82,103.68,104.41,104.0,104.77,105.28,106.18,107.16,108.01,107.76,107.85,107.78,108.08,109.21,108.34,109.02,108.36,107.85,108.53,107.68,106.68,106.31,106.29,105.5,105.64,105.62,106.82,107.51,107.07,105.24,103.13,102.53,107.24,108.6,113.49,114.04,113.25,112.51,112.441,114.0,111.55,111.55,112.34,113.43,111.8,111.8,112.28,112.63,112.69,113.13,113.51,114.72,116.2,116.75,115.72,117.13,116.78,117.45,113.8,116.33,116.28,117.0,117.31,113.31,114.1,113.45],"close":[99.65,98.83,97.34,97.46,97.14,97.55,95.33,95.1,95.91,95.55,96.1,93.4,92.04,93.59,94.4,95.6,95.89,94.99,95.53,95.94,96.68,96.98,97.42,96.87,98.79,98.78,99.83,99.87,99.96,99.43,98.66,97.34,96.67,102.95,104.34,104.21,106.05,104.48,105.79,105.87,107.48,108.37,108.81,108.0,107.93,108.18,109.48,109.38,109.22,109.08,109.36,108.51,108.85,108.03,107.57,106.94,106.82,106.0,106.1,106.73,107.73,107.68,108.3808,105.52,103.13,105.44,108.1292,111.8308,115.57,114.92,113.58,113.57,113.55,114.62,112.71,112.88,113.09,113.95,112.17,112.97,112.52,113.0,113.05,113.89,114.06,116.06,116.35,117.34,116.98,117.66,117.55,117.47,117.12,117.06,116.6,117.6292,118.25,115.59,114.51,113.69]},{"yaxis":"y2","high":[729.54,725.89,725.44,722.47,722.98,716.65,708.82,702.48,702.77,700.86,701.95,689.4,672.3,680.33,687.4292,692.32,700.65,696.94,701.68,698.2,705.71,716.51,722.94,724.0,722.21,725.74,736.13,736.99,742.13,741.69,743.24,742.61,741.69,744.46,748.65,778.55,780.43,775.84,773.21,774.07,783.04,782.63,788.94,786.8123,789.75,783.395,787.49,780.98,780.81,782.86,777.1,774.54,776.44,774.5,771.89,776.0799,774.99,774.466,769.09,771.02,773.9199,782.0,782.73,780.35,773.245,770.29,766.2195,767.68,773.8,769.75,774.0,773.33,777.16,789.85,788.93,782.74,785.9899,781.81,785.8,780.94,776.065,778.71,782.07,780.48,779.66,789.38,792.28,788.13,781.22,783.95,785.85,801.61,804.63,803.97,799.5,815.18,816.68,806.98,803.49,815.49],"open":[722.87,719.47,716.51,716.48,719.0,714.91,708.65,698.77,698.4,699.06,697.45,675.17,671.0,678.97,683.0,685.47,692.2,696.06,689.98,698.08,699.5,708.05,719.12,723.62,721.58,725.73,722.71,729.89,737.33,740.36,741.86,740.67,739.04,738.28,747.04,772.71,761.09,768.69,767.18,772.22,773.78,782.0,781.1,783.75,785.0,781.5,783.75,780.3,777.32,780.01,775.0,773.27,775.48,770.58,767.0,769.0,768.74,769.33,767.01,769.25,773.01,773.45,780.0,778.59,770.1,755.13,764.48,759.61,762.89,769.75,772.42,769.0,772.66,780.0,786.59,782.74,775.5,777.85,781.44,776.33,774.25,776.03,779.31,779.0,779.66,777.71,786.66,783.76,781.22,781.65,779.8,787.85,798.86,803.3,795.0,804.9,816.68,806.34,801.0,808.35],"name":"Google","type":"ohlc","xaxis":"x2","low":[722.3361,716.43,716.51,713.12,717.31,703.26,688.4515,693.41,692.01,693.0819,687.0,673.45,663.284,673.0,681.41,683.65,692.1301,688.88,689.09,688.215,696.435,707.24,715.91,716.85,718.03,719.055,721.19,729.0,737.1,735.831,736.56,737.5,734.27,737.0,739.3,766.77,761.09,767.85,766.82,768.795,772.34,778.091,780.57,782.778,782.97,780.4,780.11,773.444,773.53,777.0,773.13,770.0502,771.785,767.07,763.1846,765.85,766.615,766.84,765.38,764.3,768.41,771.0,776.2,773.58,759.66,754.0001,755.8,759.11,759.96,764.66,764.4406,768.53,768.301,778.44,784.15,773.07,774.308,774.97,774.232,774.09,769.5,772.89,775.65,775.54,770.75,775.87,780.58,782.06,773.0,776.0,777.5,785.565,797.635,796.03,794.0,804.82,805.14,796.32,791.5,793.59],"close":[728.58,719.41,718.36,718.27,718.92,710.36,691.72,693.71,695.94,697.46,701.87,675.22,668.26,680.04,684.11,691.875,699.21,694.49,697.77,695.36,705.63,715.09,720.64,716.98,720.95,719.85,733.78,736.96,741.19,738.63,742.74,739.77,738.42,741.77,745.91,768.79,772.88,771.07,773.18,771.61,782.22,781.76,784.26,784.68,784.85,783.22,782.44,777.14,779.91,777.5,775.42,772.15,772.08,769.64,769.41,769.54,772.15,769.09,767.05,768.78,771.46,780.08,780.35,775.32,759.66,769.02,759.69,762.49,771.76,768.26,765.7,771.41,776.22,787.21,786.9,774.21,783.01,781.56,775.01,777.29,772.56,776.43,776.47,776.86,775.08,785.94,783.07,786.14,778.19,778.53,779.96,795.26,801.56,796.97,799.37,813.11,807.67,799.07,795.35,795.37]}], | ||
{"yaxis2":{"domain":[0.0,1.0],"anchor":"x2"},"yaxis1":{"domain":[0.0,1.0],"anchor":"x1"},"xaxis1":{"domain":[0.0,0.45],"anchor":"y1"},"margin":{"r":30,"l":40,"b":80,"t":100},"xaxis2":{"domain":[0.55,1.0],"anchor":"y2"}}, {showLink: false}); | ||
|
||
</script> | ||
|
||
|
||
|
||
```julia | ||
function candlestick1() | ||
t = candlestick(open=[33.0, 33.3, 33.5, 33.0, 34.1], | ||
high=[33.1, 33.3, 33.6, 33.2, 34.8], | ||
low=[32.7, 32.7, 32.8, 32.6, 32.8], | ||
close=[33.0, 32.9, 33.3, 33.1, 33.1]) | ||
plot(t) | ||
end | ||
candlestick1() | ||
``` | ||
|
||
|
||
<div id="85ef0ba1-5031-4e51-9308-2f114cf4420a" class="plotly-graph-div"></div> | ||
|
||
<script> | ||
window.PLOTLYENV=window.PLOTLYENV || {}; | ||
window.PLOTLYENV.BASE_URL="https://plot.ly"; | ||
Plotly.newPlot('85ef0ba1-5031-4e51-9308-2f114cf4420a', [{"high":[33.1,33.3,33.6,33.2,34.8],"open":[33.0,33.3,33.5,33.0,34.1],"type":"candlestick","low":[32.7,32.7,32.8,32.6,32.8],"close":[33.0,32.9,33.3,33.1,33.1]}], | ||
{"margin":{"r":30,"l":40,"b":80,"t":100}}, {showLink: false}); | ||
|
||
</script> | ||
|
||
|
||
|
||
```julia | ||
function candlestick2() | ||
@eval using Quandl | ||
|
||
function get_candlestick(ticker; kwargs...) | ||
df = quandlget("WIKI/$(ticker)", format="DataFrame") | ||
candlestick(open=df[:Open], high=df[:High], low=df[:Low], close=df[:Close]; kwargs...) | ||
end | ||
|
||
p1 = plot(get_candlestick("AAPL", name="Apple")) | ||
p2 = plot(get_candlestick("GOOG", name="Google")) | ||
|
||
|
||
[p1 p2] | ||
end | ||
candlestick2() | ||
``` | ||
|
||
|
||
<div id="d60006ef-45db-4ccb-aa6f-d3f2d05d0e28" class="plotly-graph-div"></div> | ||
|
||
<script> | ||
window.PLOTLYENV=window.PLOTLYENV || {}; | ||
window.PLOTLYENV.BASE_URL="https://plot.ly"; | ||
Plotly.newPlot('d60006ef-45db-4ccb-aa6f-d3f2d05d0e28', [{"yaxis":"y1","high":[99.99,99.3457,99.12,98.475,98.41,97.75,96.65,96.57,96.35,96.89,96.29,94.655,93.05,93.66,94.55,95.77,96.465,95.4,95.66,96.5,96.89,97.65,97.7,97.67,98.99,99.3,100.13,100.0,100.46,101.0,99.3,98.84,97.97,104.35,104.45,104.55,106.15,106.07,105.84,106.0,107.65,108.37,108.94,108.9,108.93,108.44,109.54,110.23,109.37,109.6,109.69,109.1,109.32,108.75,107.88,107.95,107.44,106.5,106.5699,106.8,108.0,108.3,108.76,107.27,105.72,105.72,108.79,113.03,115.73,116.13,116.18,114.12,113.989,114.94,114.79,113.39,113.18,114.64,113.8,113.37,113.05,114.31,113.66,114.34,114.56,116.75,118.69,117.98,117.44,118.17,117.84,118.21,117.76,117.38,116.91,117.74,118.36,115.7,115.86,115.21],"open":[98.5,98.53,98.69,97.32,97.82,96.45,96.62,96.0,94.94,96.25,95.94,92.91,93.0,92.9,93.97,94.44,95.49,95.39,94.6,95.7,96.49,96.75,97.17,97.41,97.39,98.92,98.7,99.56,100.0,99.83,99.26,98.25,96.82,104.265,102.83,104.19,104.41,106.05,104.81,105.58,106.27,107.52,108.23,108.71,108.52,107.78,108.14,109.63,109.1,109.23,108.77,108.86,108.59,108.565,107.39,107.41,106.62,105.8,105.66,106.14,107.7,107.9,107.83,107.25,104.64,102.65,107.51,108.73,113.86,115.12,115.19,113.05,113.85,114.35,114.42,111.64,113.0,113.69,113.16,112.46,112.71,113.06,113.4,113.7,114.31,115.02,117.7,117.35,116.79,117.88,117.33,118.18,117.25,116.86,116.81,117.1,117.95,114.31,115.39,113.87],"name":"Apple","type":"candlestick","xaxis":"x1","low":[98.46,98.48,97.1,96.75,97.03,96.07,95.3,95.03,94.676,95.35,95.25,92.65,91.5,92.14,93.63,94.3,95.33,94.46,94.37,95.62,96.05,96.73,97.12,96.84,97.32,98.5,98.6,99.34,99.735,99.13,98.31,96.92,96.42,102.75,102.82,103.68,104.41,104.0,104.77,105.28,106.18,107.16,108.01,107.76,107.85,107.78,108.08,109.21,108.34,109.02,108.36,107.85,108.53,107.68,106.68,106.31,106.29,105.5,105.64,105.62,106.82,107.51,107.07,105.24,103.13,102.53,107.24,108.6,113.49,114.04,113.25,112.51,112.441,114.0,111.55,111.55,112.34,113.43,111.8,111.8,112.28,112.63,112.69,113.13,113.51,114.72,116.2,116.75,115.72,117.13,116.78,117.45,113.8,116.33,116.28,117.0,117.31,113.31,114.1,113.45],"close":[99.65,98.83,97.34,97.46,97.14,97.55,95.33,95.1,95.91,95.55,96.1,93.4,92.04,93.59,94.4,95.6,95.89,94.99,95.53,95.94,96.68,96.98,97.42,96.87,98.79,98.78,99.83,99.87,99.96,99.43,98.66,97.34,96.67,102.95,104.34,104.21,106.05,104.48,105.79,105.87,107.48,108.37,108.81,108.0,107.93,108.18,109.48,109.38,109.22,109.08,109.36,108.51,108.85,108.03,107.57,106.94,106.82,106.0,106.1,106.73,107.73,107.68,108.3808,105.52,103.13,105.44,108.1292,111.8308,115.57,114.92,113.58,113.57,113.55,114.62,112.71,112.88,113.09,113.95,112.17,112.97,112.52,113.0,113.05,113.89,114.06,116.06,116.35,117.34,116.98,117.66,117.55,117.47,117.12,117.06,116.6,117.6292,118.25,115.59,114.51,113.69]},{"yaxis":"y2","high":[729.54,725.89,725.44,722.47,722.98,716.65,708.82,702.48,702.77,700.86,701.95,689.4,672.3,680.33,687.4292,692.32,700.65,696.94,701.68,698.2,705.71,716.51,722.94,724.0,722.21,725.74,736.13,736.99,742.13,741.69,743.24,742.61,741.69,744.46,748.65,778.55,780.43,775.84,773.21,774.07,783.04,782.63,788.94,786.8123,789.75,783.395,787.49,780.98,780.81,782.86,777.1,774.54,776.44,774.5,771.89,776.0799,774.99,774.466,769.09,771.02,773.9199,782.0,782.73,780.35,773.245,770.29,766.2195,767.68,773.8,769.75,774.0,773.33,777.16,789.85,788.93,782.74,785.9899,781.81,785.8,780.94,776.065,778.71,782.07,780.48,779.66,789.38,792.28,788.13,781.22,783.95,785.85,801.61,804.63,803.97,799.5,815.18,816.68,806.98,803.49,815.49],"open":[722.87,719.47,716.51,716.48,719.0,714.91,708.65,698.77,698.4,699.06,697.45,675.17,671.0,678.97,683.0,685.47,692.2,696.06,689.98,698.08,699.5,708.05,719.12,723.62,721.58,725.73,722.71,729.89,737.33,740.36,741.86,740.67,739.04,738.28,747.04,772.71,761.09,768.69,767.18,772.22,773.78,782.0,781.1,783.75,785.0,781.5,783.75,780.3,777.32,780.01,775.0,773.27,775.48,770.58,767.0,769.0,768.74,769.33,767.01,769.25,773.01,773.45,780.0,778.59,770.1,755.13,764.48,759.61,762.89,769.75,772.42,769.0,772.66,780.0,786.59,782.74,775.5,777.85,781.44,776.33,774.25,776.03,779.31,779.0,779.66,777.71,786.66,783.76,781.22,781.65,779.8,787.85,798.86,803.3,795.0,804.9,816.68,806.34,801.0,808.35],"name":"Google","type":"candlestick","xaxis":"x2","low":[722.3361,716.43,716.51,713.12,717.31,703.26,688.4515,693.41,692.01,693.0819,687.0,673.45,663.284,673.0,681.41,683.65,692.1301,688.88,689.09,688.215,696.435,707.24,715.91,716.85,718.03,719.055,721.19,729.0,737.1,735.831,736.56,737.5,734.27,737.0,739.3,766.77,761.09,767.85,766.82,768.795,772.34,778.091,780.57,782.778,782.97,780.4,780.11,773.444,773.53,777.0,773.13,770.0502,771.785,767.07,763.1846,765.85,766.615,766.84,765.38,764.3,768.41,771.0,776.2,773.58,759.66,754.0001,755.8,759.11,759.96,764.66,764.4406,768.53,768.301,778.44,784.15,773.07,774.308,774.97,774.232,774.09,769.5,772.89,775.65,775.54,770.75,775.87,780.58,782.06,773.0,776.0,777.5,785.565,797.635,796.03,794.0,804.82,805.14,796.32,791.5,793.59],"close":[728.58,719.41,718.36,718.27,718.92,710.36,691.72,693.71,695.94,697.46,701.87,675.22,668.26,680.04,684.11,691.875,699.21,694.49,697.77,695.36,705.63,715.09,720.64,716.98,720.95,719.85,733.78,736.96,741.19,738.63,742.74,739.77,738.42,741.77,745.91,768.79,772.88,771.07,773.18,771.61,782.22,781.76,784.26,784.68,784.85,783.22,782.44,777.14,779.91,777.5,775.42,772.15,772.08,769.64,769.41,769.54,772.15,769.09,767.05,768.78,771.46,780.08,780.35,775.32,759.66,769.02,759.69,762.49,771.76,768.26,765.7,771.41,776.22,787.21,786.9,774.21,783.01,781.56,775.01,777.29,772.56,776.43,776.47,776.86,775.08,785.94,783.07,786.14,778.19,778.53,779.96,795.26,801.56,796.97,799.37,813.11,807.67,799.07,795.35,795.37]}], | ||
{"yaxis2":{"domain":[0.0,1.0],"anchor":"x2"},"yaxis1":{"domain":[0.0,1.0],"anchor":"x1"},"xaxis1":{"domain":[0.0,0.45],"anchor":"y1"},"margin":{"r":30,"l":40,"b":80,"t":100},"xaxis2":{"domain":[0.55,1.0],"anchor":"y2"}}, {showLink: false}); | ||
|
||
</script> | ||
|
||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.