How to use mplfinance - 1 common examples

To help you get started, we’ve selected a few mplfinance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mtamer / python-rsi / src / stock.py View on Github external
x = 0
            y = len(self.dates)
            newAr = []
            while x < y:
                appendLine = self.dates[x], self.opens[x], self.closes[x], self.highs[x], self.lows[x], self.volumes[x]
                newAr.append(appendLine)
                x += 1

            # Fix this
            SP = len(self.dates[200-1:])

            fig = plt.figure(facecolor='#07000d')

            ax1 = plt.subplot2grid(
                (6, 4), (1, 0), rowspan=4, colspan=4, facecolor='#07000d')
            candlestick_ohlc(ax1, newAr[-SP:], width=.6,
                             colorup='#53c156', colordown='#ff1717')

            for MA in movingAverageArr:

                computedSMA = self.SMA(MA, self.closes)

                # Used to generate random hex color to put on graph
                def r(): return random.randint(0, 255)
                randomColor = '#%02X%02X%02X' % (r(), r(), r())

                maLabel = str(MA) + ' SMA'
                ax1.plot(self.dates[-SP:], computedSMA[-SP:], randomColor,
                         label=maLabel, linewidth=1.5)

            ax1.grid(False, color='w')
            ax1.xaxis.set_major_locator(mticker.MaxNLocator(10))

mplfinance

Utilities for the visualization, and visual analysis, of financial data

BSD-2-Clause
Latest version published 12 months ago

Package Health Score

72 / 100
Full package analysis

Popular mplfinance functions