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


Python TimeSeriesCalcs.get_bottom_valued_sorted方法代码示例

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


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

示例1: ticker

# 需要导入模块: from pythalesians.timeseries.calcs.timeseriescalcs import TimeSeriesCalcs [as 别名]
# 或者: from pythalesians.timeseries.calcs.timeseriescalcs.TimeSeriesCalcs import get_bottom_valued_sorted [as 别名]
                data_source = 'bloomberg',                      # use Bloomberg as data source
                tickers = ['USDBRL'] ,                          # ticker (Thalesians)
                fields = ['close'],                             # which fields to download
                vendor_tickers = ['USDBRL BGN Curncy'],         # ticker (Bloomberg)
                vendor_fields = ['PX_LAST'],                    # which Bloomberg fields to download
                cache_algo = 'internet_load_return')            # how to return data

        ltsf = LightTimeSeriesFactory()

        df = ltsf.harvest_time_series(time_series_request)
        df.columns = [x.replace('.close', '') for x in df.columns.values]

        df = tsc.calculate_returns(df) * 100
        df = df.dropna()

        df_sorted = tsc.get_bottom_valued_sorted(df, "USDBRL", n = 20)
        # df = tsc.get_top_valued_sorted(df, "USDBRL", n = 20) # get biggest up moves

        # get values on day after
        df2 = df.shift(-1)
        df2 = df2.ix[df_sorted.index]
        df2.columns = ['T+1']

        df_sorted.columns = ['T']

        df_sorted = df_sorted.join(df2)
        df_sorted.index = [str(x.year) + '/' + str(x.month) + '/' + str(x.day) for x in df_sorted.index]

        gp = GraphProperties()
        gp.title = 'Largest daily falls in USDBRL'
        gp.scale_factor = 3
开发者ID:hedgefair,项目名称:pythalesians,代码行数:33,代码来源:summaryanalysis_examples.py


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