Beispiel #1
0
cal = Calendars.calendar("USNYSE")
trades = db.t("LearnIris", "StockTrades").where("Date=`2017-08-25`")
trades = trades.where("cal.isBusinessTime(ExchangeTimestamp)")

#  CATEGORY PLOTTING - SINGLE

t1c = db.t("LearnDeephaven", "StockTrades")\
   .where("Date >`2017-08-20`", "USym = `MSFT`")\
   .view("Date", "USym", "Last", "Size", "ExchangeTimestamp")

totalSharesByUSym = t1c.view("Date", "USym",
                             "SharesTraded=Size").sumBy("Date", "USym")

categoryPlot = Plot.catPlot("MSFT", totalSharesByUSym.where("USym = `MSFT`"), "Date", "SharesTraded")\
   .chartTitle("Shares Traded")\
   .show()

# CATEGORY PLOTTING - MULTIPLE

t2c = db.t("LearnDeephaven", "StockTrades")\
   .where("Date >`2017-08-20`", "USym in `AAPL`, `MSFT`")\
   .view("Date", "USym", "Last", "Size", "ExchangeTimestamp")

totalSharesByUSym2 = t2c.view("Date", "USym",
                              "SharesTraded=Size").sumBy("Date", "USym")

categoryPlot2 = Plot.catPlot("MSFT", totalSharesByUSym2.where("USym = `MSFT`"), "Date", "SharesTraded")\
   .catPlot("AAPL", totalSharesByUSym2.where("USym = `AAPL`"), "Date", "SharesTraded")\
   .chartTitle("Shares Traded")\
   .show()
Beispiel #2
0
t = tt.emptyTable(50)\
    .update("X = i + 5", "XLow = X -1", "XHigh = X + 1", "Y = Math.random() * 5", "YLow = Y - 1", "YHigh = Y + 1", "USym = i % 2 == 0 ? `AAPL` : `MSFT`")

p = plt.plot("S1", t, "X", "Y").lineColor("black").show()
p2 = plt.plot("S1", t, "X", "Y").plotStyle("bar").gradientVisible(True).show()
p3 = plt.plot(
    "S1", t, "X",
    "Y").plotStyle("scatter").pointColor("black").pointSize(2).show()
p4 = plt.plot("S1", t, "X", "Y").plotStyle("area").seriesColor("red").show()

p4 = plt.plot3d("S1", t, "X", "X", "Y").show()

pBy = plt.plotBy("S1", t, "X", "Y", "USym").show()
pBy = plt.plot3dBy("S1", t, "X", "X", "Y", "USym").show()

cp = plt.catPlot("S1", t, "X", "Y").lineColor("black").show()
cp2 = plt.catPlot("S1", t, "X",
                  "Y").plotStyle("bar").gradientVisible(True).show()
cp3 = plt.catPlot(
    "S1", t, "X",
    "Y").plotStyle("scatter").pointColor("black").pointSize(2).show()
cp4 = plt.catPlot("S1", t, "X",
                  "Y").plotStyle("area").seriesColor("red").show()

cp = plt.catPlot3d("S1", t, "X", "X", "Y").show()

cpBy = plt.catPlotBy("S1", t, "X", "Y", "USym").show()

cpBy = plt.catPlot3dBy("S1", t, "X", "X", "Y", "USym").show()

pp = plt.piePlot("S1", t, "X", "Y")
Beispiel #3
0
summaries = db.t("LearnDeephaven",
                 "EODTrades").where("ImportDate=`2017-11-01`")

# XY Series
timePlot = Plot.plot("Microsoft", trades.where("Sym=`MSFT`"), "ExchangeTimestamp", "Last")\
   .show()

multiSeries = Plot.plot("Microsoft", trades.where("Sym=`MSFT`"), "ExchangeTimestamp", "Last")\
   .twinX()\
   .plot("Apple", trades.where("Sym=`AAPL`"), "ExchangeTimestamp", "Last")\
   .chartTitle("Price Over Time")\
   .show()

# Category
categoryPlot = Plot.catPlot("Shares Traded", totalShares, "Sym", "SharesTraded")\
   .chartTitle("Total Shares")\
   .show()

# Pie
pieChart = Plot.piePlot("Shares Traded", totalShares, "Sym", "SharesTraded")\
   .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")\