pieChart = Plot.piePlot("Shares Traded", totalShares, "Sym", "SharesTraded")\ .chartTitle("Total Shares")\ .show() # ************* OPEN HIGH LOW CLOSE (OHLC) PLOTTING ************* # OPEN HIGH LOW CLOSE (OHLC) - SINGLE SERIES tOHLC = db.t("LearnDeephaven","EODTrades")\ .where("Ticker=`AAPL`", "ImportDate=`2017-11-01`", "inRange(EODTimestamp, '2017-06-01T12:00 NY', '2017-07-31T12:00 NY')") plotOHLC = Plot.ohlcPlot("AAPL", tOHLC, "EODTimestamp", "Open", "High", "Low", "Close")\ .xBusinessTime()\ .lineStyle(Plot.lineStyle(2))\ .chartTitle("AAPL OHLC - June-July 2017")\ .show() # OPEN HIGH LOW CLOSE (OHLC) - MULTIPLE SERIES WITH TWINX t2OHLC = db.t("LearnDeephaven", "EODTrades").where( "Ticker in `AAPL`, `MSFT`", "ImportDate=`2017-11-01`", "inRange(EODTimestamp, '2017-06-01T12:00 NY', '2017-07-31T12:00 NY')") plotOHLC2 = Plot.ohlcPlot("AAPL", t2OHLC.where("Ticker = `AAPL`"), "EODTimestamp", "Open", "High", "Low", "Close")\ .lineStyle(Plot.lineStyle(2))\ .twinX()\ .ohlcPlot("MSFT", t2OHLC.where("Ticker = `MSFT`"),"EODTimestamp","Open","High","Low","Close")\ .xBusinessTime()\ .lineStyle(Plot.lineStyle(2))\
epBy = plt.errorBarXYBy("S1", t, "X", "XLow", "XHigh", "Y", "YLow", "YHigh", "USym").show() ep2 = plt.errorBarX("S1", t, "X", "XLow", "XHigh", "Y").show() epBy2 = plt.errorBarXBy("S1", t, "X", "XLow", "XHigh", "Y", "USym").show() ep3 = plt.errorBarY("S1", t, "X", "Y", "YLow", "YHigh").show() epBy3 = plt.errorBarYBy("S1", t, "X", "Y", "YLow", "YHigh", "USym").show() doubles = [3, 4, 3, 5, 4, 5] time = 1491946585000000000 t = tt.newTable(tt.col("USym", ["A", "B", "A", "B", "A", "B"]), tt.doubleCol("Open", doubles), tt.doubleCol("High", doubles), tt.doubleCol("Low", doubles), tt.doubleCol("Close", doubles)) t = t.updateView("Time = new DateTime(time + (MINUTE * i))") ohlc = plt.ohlcPlot("Test1", t, "Time", "Open", "High", "Low", "Close") ohlcPlotBy = plt.figure().newChart(0)\ .chartTitle("Chart Title")\ .newAxes()\ .xLabel("X")\ .yLabel("Y")\ .ohlcPlotBy("Test1", t, "Time", "Open", "High", "Low", "Close", "USym") categories = ["Samsung", "Others", "Nokia", "Apple", "MSFT"] valuesD = [27.8, 55.3, 16.8, 17.1, 23.1] valuesI = [27, 55, 16, 17, 15] ap = plt.plot("S1", valuesD, valuesI).show() ap = plt.plot3d("S1", valuesI, valuesI, valuesI).show()
.chartTitle("Total Shares")\ .show() # Histogram histogram = Plot.histPlot("MSFT", trades.where("Sym=`MSFT`"), "Last", 3)\ .chartTitle("Price Intervals")\ .show() # Category Histogram catHist = Plot.catHistPlot("Number of Trades", trades, "Sym")\ .chartTitle("Trades per Symbol")\ .show() # Open, High, Low and Close ohlcPlot = Plot.ohlcPlot("MSFT", summaries.where("Ticker=`MSFT`"), "EODTimestamp", "Open", "High", "Low", "Close")\ .chartTitle("Microsoft Activity")\ .show() # Grouping Multiple Plots in the Same Figure multipleCharts = Plot.figure(2, 3)\ .figureTitle("Trade Plots")\ \ .colSpan(3)\ .plot("Microsoft", trades.where("Sym=`MSFT`"), "ExchangeTimestamp", "Last")\ .twinX()\ .plot("Apple", trades.where("Sym=`AAPL`"), "ExchangeTimestamp", "Last")\ .chartTitle("Price Over Time")\ \ .newChart()\ .histPlot("MSFT", trades.where("Sym=`MSFT`"), "Last", 3)\ .chartTitle("Price Intervals")\