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


Python Parser.getTickerFromFullPath方法代码示例

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


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

示例1: Parser

# 需要导入模块: from Parser import Parser [as 别名]
# 或者: from Parser.Parser import getTickerFromFullPath [as 别名]
from Parser import Parser

dataPath = '/Users/marcel/workspace/Equities/data/'
keyStatsPath = dataPath + 'Yahoo/forward/data/*'
fileGlob = '*html'

p = Parser(dataPath)
fullpaths = (e for e in glob(keyStatsPath))

output_df = pd.DataFrame()

for fullpath in fullpaths:
    output = {}
    keyStats = {}
    regex = 'market_time.....,\s(...)\s(..),\s(....)'
    ticker = p.getTickerFromFullPath(fullpath, 'forward/data/', '.html')
    forwardDate, _ = p.getDateFromMarketTime(fullpath)
    fwdUnixTime, date = p.getDateFromMarketTime(fullpath)

    # pull key stats from Yahoo screen
    for feature in p.features:
        value = p.searchSourceForFeature(fullpath, feature)
        value = p.cleanup(value)
        keyStats[feature] = value

    # Pull stock price and s&p adjusted close on date and forward date and clean missing values
    price = p.getValueFromDf(p.stock_df, ticker.upper(), p.oneYearAgo(fwdUnixTime))
    priceFwd = p.getValueFromDf(p.stock_df, ticker.upper(),forwardDate)

    sp500 = p.getValueFromDf(p.sp500_df, 'Adjusted Close', p.oneYearAgo(fwdUnixTime))
    sp500Fwd = p.getValueFromDf(p.sp500_df, 'Adjusted Close', forwardDate)
开发者ID:mstampfer,项目名称:Equities,代码行数:33,代码来源:YahooForward.py

示例2: Parser

# 需要导入模块: from Parser import Parser [as 别名]
# 或者: from Parser.Parser import getTickerFromFullPath [as 别名]
from glob import glob

dataPath = '/Users/marcel/workspace/Equities/data/'
keyStatsPath = dataPath + 'Yahoo/intraQuarter/_KeyStats/*'
fileGlob = '[0-9]*'

p = Parser(dataPath)
tickerDirs = (e for e in glob(keyStatsPath))
filesInTickerDirs = (glob(os.path.join(d, fileGlob)) for d in tickerDirs)  # no hidden files
fullpaths = (file for files in filesInTickerDirs for file in files)
output_df = pd.DataFrame()

for fullpath in fullpaths:
    output = {}
    keyStats = {}
    ticker = p.getTickerFromFullPath(fullpath, '_KeyStats/', '/.*')
    dateStamp, unixTime = p.getDateStampAndUnixTime(os.path.basename(fullpath))

    # pull key stats from Yahoo screen
    for feature in p.features:
        value = p.searchSourceForFeature(fullpath, feature)
        value = p.cleanup(value)
        keyStats[feature] = value

    # Pull stock price and s&p adjusted close on date and forward date and clean missing values
    price = p.getValueFromDf(p.stock_df, ticker.upper(), unixTime)
    priceIn1y = p.getValueFromDf(p.stock_df, ticker.upper(), p.oneYearLater(unixTime))

    sp500 = p.getValueFromDf(p.sp500_df, 'Adjusted Close', unixTime)
    sp500In1y = p.getValueFromDf(p.sp500_df, 'Adjusted Close', p.oneYearLater(unixTime))
开发者ID:mstampfer,项目名称:Equities,代码行数:32,代码来源:QuandlForward.py


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