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


Python GraphProperties.source方法代码示例

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


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

示例1: TimeSeriesRequest

# 需要导入模块: from pythalesians.graphics.graphs.graphproperties import GraphProperties [as 别名]
# 或者: from pythalesians.graphics.graphs.graphproperties.GraphProperties import source [as 别名]
    end = datetime.datetime.utcnow()
    start_date = end.replace(hour=0, minute=0, second=0, microsecond=0) # Returns a copy

    time_series_request = TimeSeriesRequest(
                start_date = start_date,         # start date
                finish_date = datetime.datetime.utcnow(),                       # finish date
                freq = 'intraday',                                              # intraday data
                data_source = 'bloomberg',                      # use Bloomberg as data source
                tickers = ['EURUSD'] ,                          # ticker (Thalesians)
                fields = ['close'],                             # which fields to download
                vendor_tickers = ['EURUSD BGN Curncy'],         # ticker (Bloomberg)
                vendor_fields = ['close'],                      # 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]

    gp = GraphProperties()

    gp.title = 'EURUSD stuff!'
    gp.file_output = 'EURUSD.png'
    gp.source = 'Thalesians/BBG (created with PyThalesians Python library)'

    pf = PlotFactory()
    pf.plot_line_graph(df, adapter = 'pythalesians', gp = gp)

    pytwitter.update_status("check out my plot of EUR/USD!", picture = gp.file_output)
开发者ID:BryanFletcher,项目名称:pythalesians,代码行数:31,代码来源:twitterpythalesians_examples.py

示例2: ticker

# 需要导入模块: from pythalesians.graphics.graphs.graphproperties import GraphProperties [as 别名]
# 或者: from pythalesians.graphics.graphs.graphproperties.GraphProperties import source [as 别名]
        tickers = tickers,                              # ticker (Thalesians)
        fields = ['close'],                             # which fields to download
        vendor_tickers = vendor_tickers,                # ticker (Bloomberg)
        vendor_fields = ['PX_LAST'],                    # which Bloomberg fields to download
        cache_algo = 'internet_load_return')                # how to return data

    daily_vals = ltsf.harvest_time_series(time_series_request)

    # resample for end of month
    daily_vals = daily_vals.resample('BM')

    daily_vals = daily_vals / daily_vals.shift(1) - 1
    daily_vals.index = [str(x.year) + '/' + str(x.month) for x in daily_vals.index]
    daily_vals = daily_vals.drop(daily_vals.head(1).index)

    pf = PlotFactory()

    gp = GraphProperties()

    gp.source = 'Thalesians/BBG'
    gp.html_file_output = "output_data/equities.htm"
    gp.title = 'Recent monthly changes in equity markets'
    gp.scale_factor = 2
    gp.display_legend = True
    gp.chart_type = ['bar', 'scatter', 'line']
    gp.x_title = 'Dates'
    gp.y_title = 'Pc'

    # plot using Bokeh then PyThalesians
    pf.plot_bar_graph(daily_vals * 100, adapter = 'bokeh', gp = gp)
    pf.plot_bar_graph(daily_vals * 100, adapter = 'pythalesians', gp = gp)
开发者ID:poeticcapybara,项目名称:pythalesians,代码行数:33,代码来源:bokeh_examples.py

示例3: ticker

# 需要导入模块: from pythalesians.graphics.graphs.graphproperties import GraphProperties [as 别名]
# 或者: from pythalesians.graphics.graphs.graphproperties.GraphProperties import source [as 别名]
        vendor_tickers=vendor_tickers,  # ticker (Bloomberg)
        vendor_fields=["PX_LAST"],  # which Bloomberg fields to download
        cache_algo="internet_load_return",
    )  # how to return data

    daily_vals = ltsf.harvest_time_series(time_series_request)

    # resample for end of month
    daily_vals = daily_vals.resample("BM")

    daily_vals = daily_vals / daily_vals.shift(1) - 1
    daily_vals.index = [str(x.year) + "/" + str(x.month) for x in daily_vals.index]
    daily_vals = daily_vals.drop(daily_vals.head(1).index)

    pf = PlotFactory()

    gp = GraphProperties()

    gp.source = "Thalesians/BBG"
    gp.html_file_output = "output_data/equities.htm"
    gp.title = "Recent monthly changes in equity markets"
    gp.scale_factor = 2
    gp.display_legend = True
    gp.chart_type = ["bar", "scatter", "line"]
    gp.x_title = "Dates"
    gp.y_title = "Pc"

    # plot using Bokeh then PyThalesians
    pf.plot_bar_graph(daily_vals * 100, adapter="bokeh", gp=gp)
    pf.plot_bar_graph(daily_vals * 100, adapter="pythalesians", gp=gp)
开发者ID:oditorium,项目名称:pythalesians,代码行数:32,代码来源:bokeh_examples.py

示例4: LightTimeSeriesFactory

# 需要导入模块: from pythalesians.graphics.graphs.graphproperties import GraphProperties [as 别名]
# 或者: from pythalesians.graphics.graphs.graphproperties.GraphProperties import source [as 别名]
                cache_algo = 'internet_load_return')                # how to return data

    ltsf = LightTimeSeriesFactory()

    asset_df = ltsf.harvest_time_series(time_series_request)
    spot_df = asset_df

    logger.info("Running backtest...")

    # use technical indicator to create signals
    # (we could obviously create whatever function we wanted for generating the signal dataframe)
    tech_ind = TechIndicator()
    tech_ind.create_tech_ind(spot_df, indicator, tech_params); signal_df = tech_ind.get_signal()

    # use the same data for generating signals
    cash_backtest.calculate_trading_PnL(br, asset_df, signal_df)
    port = cash_backtest.get_cumportfolio()
    port.columns = [indicator + ' = ' + str(tech_params.sma_period) + ' ' + str(cash_backtest.get_portfolio_pnl_desc()[0])]
    signals = cash_backtest.get_porfolio_signal()

    # print the last positions (we could also save as CSV etc.)
    print(signals.tail(1))

    pf = PlotFactory()
    gp = GraphProperties()
    gp.title = "Thalesians FX trend strategy"
    gp.source = 'Thalesians/BBG (calc with PyThalesians Python library)'
    gp.scale_factor = 3
    gp.file_output = 'output_data/FX-trend-example.png'

    pf.plot_line_graph(port, adapter = 'pythalesians', gp = gp)
开发者ID:CARLOSMANZUETA2000,项目名称:pythalesians,代码行数:33,代码来源:cashbacktest_examples.py


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