当前位置: 首页>>代码示例>>Python>>正文


Python matplotlib.finance方法代码示例

本文整理汇总了Python中matplotlib.finance方法的典型用法代码示例。如果您正苦于以下问题:Python matplotlib.finance方法的具体用法?Python matplotlib.finance怎么用?Python matplotlib.finance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib的用法示例。


在下文中一共展示了matplotlib.finance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: lPullYahooToTxtfile

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import finance [as 别名]
def lPullYahooToTxtfile(sSymbol):
    '''
        Use this to dynamically pull a sSymbol:
    '''
    try:
        print 'Currently Pulling', sSymbol
        print str(datetime.datetime.fromtimestamp(int(time.time())).strftime('%Y-%m-%d %H:%M:%S'))
        #Keep in mind this is close high low open, lol.
        urlToVisit = 'http://chartapi.finance.yahoo.com/instrument/1.0/'+sSymbol+'/chartdata;type=quote;range=10y/csv'
        lStockLines = []
        try:
            sourceCode = urllib2.urlopen(urlToVisit).read()
            splitSource = sourceCode.split('\n')
            for eachLine in splitSource:
                splitLine = eachLine.split(',')
                if len(splitLine) == 6:
                    if 'values' not in eachLine:
                        lStockLines.append(eachLine)
            return lStockLines
        except Exception as e:
            print str(e), 'failed to organize pulled data.'
    except StandardError, e:
        print str(e), 'failed to pull pricing data' 
开发者ID:OpenTrading,项目名称:OpenTrader,代码行数:25,代码来源:OTPpnAmgc.py

示例2: plot_p

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import finance [as 别名]
def plot_p(df):
    import matplotlib.pyplot as plt
    from matplotlib.finance import candlestick2_ohlc
    fig, ax = plt.subplots()
    candlestick2_ohlc(ax,
                      df['price_open'].values,
                      df['price_high'].values,
                      df['price_low'].values,
                      df['price_close'].values,
                      width=0.6,
                      colorup='g',
                      colordown='r',
                      alpha=1)
    plt.show()
    print('Done.') 
开发者ID:philipperemy,项目名称:deep-learning-bitcoin,代码行数:17,代码来源:utils.py

示例3: save_to_file

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import finance [as 别名]
def save_to_file(df, filename):
    import matplotlib.pyplot as plt
    from matplotlib.finance import candlestick2_ohlc
    fig, ax = plt.subplots()
    candlestick2_ohlc(ax,
                      df['price_open'].values,
                      df['price_high'].values,
                      df['price_low'].values,
                      df['price_close'].values,
                      width=0.6,
                      colorup='g',
                      colordown='r',
                      alpha=1)
    plt.savefig(filename)
    plt.close(fig) 
开发者ID:philipperemy,项目名称:deep-learning-bitcoin,代码行数:17,代码来源:utils.py


注:本文中的matplotlib.finance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。