コード例 #1
0
ファイル: trackfinance.py プロジェクト: shym98/MovieSearch
# Add a title to the chart
c.addTitle("Finance Chart Demonstration")

# Disable default legend box, as we are using dynamic legend
c.setLegendStyle("normal", 8, Transparent, Transparent)

# Set the data into the finance chart object
c.setData(timeStamps, highData, lowData, openData, closeData, volData,
          extraDays)

# Add the main chart with 240 pixels in height
c.addMainChart(240)

# Add a 10 period simple moving average to the main chart, using brown color
c.addSimpleMovingAvg(10, 0x663300)

# Add a 20 period simple moving average to the main chart, using purple color
c.addSimpleMovingAvg(20, 0x9900ff)

# Add candlestick symbols to the main chart, using green/red for up/down days
c.addCandleStick(0x00ff00, 0xff0000)

# Add 20 days bollinger band to the main chart, using light blue (9999ff) as the border and
# semi-transparent blue (c06666ff) as the fill color
c.addBollingerBand(20, 2, 0x9999ff, 0xc06666ff)

# Add a 75 pixels volume bars sub-chart to the bottom of the main chart, using green/red/grey for
# up/down/flat days
c.addVolBars(75, 0x99ff99, 0xff9999, 0x808080)
コード例 #2
0
c = FinanceChart(640)

# Add a title to the chart
c.addTitle("Finance Chart Demonstration")

# Set the data into the finance chart object
c.setData(timeStamps, highData, lowData, openData, closeData, volData, extraDays)

# Add a slow stochastic chart (75 pixels high) with %K = 14 and %D = 3
c.addSlowStochastic(75, 14, 3, 0x006060, 0x606000)

# Add the main chart with 240 pixels in height
c.addMainChart(240)

# Add a 10 period simple moving average to the main chart, using brown color
c.addSimpleMovingAvg(10, 0x663300)

# Add a 20 period simple moving average to the main chart, using purple color
c.addSimpleMovingAvg(20, 0x9900ff)

# Add candlestick symbols to the main chart, using green/red for up/down days
c.addCandleStick(0x00ff00, 0xff0000)

# Add 20 days donchian channel to the main chart, using light blue (9999ff) as the
# border and semi-transparent blue (c06666ff) as the fill color
c.addDonchianChannel(20, 0x9999ff, 0xc06666ff)

# Add a 75 pixels volume bars sub-chart to the bottom of the main chart, using
# green/red/grey for up/down/flat days
c.addVolBars(75, 0x99ff99, 0xff9999, 0x808080)
コード例 #3
0
volData = rantable.getCol(5)

# Create a FinanceChart object of width 640 pixels
c = FinanceChart(640)

# Add a title to the chart
c.addTitle("Finance Chart Demonstration")

# Set the data into the finance chart object
c.setData(timeStamps, highData, lowData, openData, closeData, volData, extraDays)

# Add the main chart with 240 pixels in height
c.addMainChart(240)

# Add a 5 period simple moving average to the main chart, using brown color
c.addSimpleMovingAvg(5, '0x663300')

# Add a 20 period simple moving average to the main chart, using purple color
c.addSimpleMovingAvg(20, '0x9900ff')

# Add HLOC symbols to the main chart, using green/red for up/down days
c.addHLOC('0x008000', '0xcc0000')

# Add 20 days bollinger band to the main chart, using light blue (9999ff) as the
# border and semi-transparent blue (c06666ff) as the fill color
c.addBollingerBand(20, 2, '0x9999ff', '0xc06666ff')

# Add a 75 pixels volume bars sub-chart to the bottom of the main chart, using
# green/red/grey for up/down/flat days
c.addVolBars(75, '0x99ff99', '0xff9999', '0x808080')