本文整理汇总了Python中pythalesians.graphics.graphs.plotfactory.PlotFactory.plot_line_graph方法的典型用法代码示例。如果您正苦于以下问题:Python PlotFactory.plot_line_graph方法的具体用法?Python PlotFactory.plot_line_graph怎么用?Python PlotFactory.plot_line_graph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pythalesians.graphics.graphs.plotfactory.PlotFactory
的用法示例。
在下文中一共展示了PlotFactory.plot_line_graph方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot_strategy_group_benchmark_pnl
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
def plot_strategy_group_benchmark_pnl(self):
pf = PlotFactory()
gp = GraphProperties()
gp.title = self.FINAL_STRATEGY
gp.display_legend = True
gp.scale_factor = self.SCALE_FACTOR
#gp.color = 'RdYlGn'
gp.file_output = self.DUMP_PATH + self.FINAL_STRATEGY + ' (Group Benchmark PnL - cumulative).png'
# plot cumulative line of returns
pf.plot_line_graph(self.reduce_plot(self._strategy_group_benchmark_pnl), adapter = 'pythalesians', gp = gp)
# needs write stats flag turned on
try:
keys = self._strategy_group_benchmark_tsd.keys()
ir = []
for key in keys: ir.append(self._strategy_group_benchmark_tsd[key].inforatio()[0])
ret_stats = pandas.DataFrame(index = keys, data = ir, columns = ['IR'])
ret_stats = ret_stats.sort_index()
gp.file_output = self.DUMP_PATH + self.FINAL_STRATEGY + ' (Group Benchmark PnL - IR).png'
gp.display_brand_label = False
# plot ret stats
pf.plot_bar_graph(ret_stats, adapter = 'pythalesians', gp = gp)
except: pass
示例2: plot_strategy_group_leverage
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
def plot_strategy_group_leverage(self):
pf = PlotFactory()
gp = GraphProperties()
gp.title = self.FINAL_STRATEGY + ' Leverage'
gp.display_legend = True
gp.scale_factor = self.SCALE_FACTOR
gp.file_output = self.DUMP_PATH + self.FINAL_STRATEGY + ' (Group Leverage).png'
pf.plot_line_graph(self.reduce_plot(self._strategy_group_leverage), adapter = 'pythalesians', gp = gp)
示例3: plot_strategy_pnl
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
def plot_strategy_pnl(self):
pf = PlotFactory()
gp = GraphProperties()
gp.title = self.FINAL_STRATEGY
gp.display_legend = True
gp.scale_factor = self.SCALE_FACTOR
gp.file_output = self.DUMP_PATH + self.FINAL_STRATEGY + ' (Strategy PnL).png'
try:
pf.plot_line_graph(self.reduce_plot(self._strategy_pnl), adapter = 'pythalesians', gp = gp)
except: pass
示例4: plot_individual_leverage
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
def plot_individual_leverage(self):
pf = PlotFactory()
gp = GraphProperties()
gp.title = self.FINAL_STRATEGY + ' Leverage'
gp.display_legend = True
gp.scale_factor = self.SCALE_FACTOR
gp.file_output = self.DUMP_PATH + self.FINAL_STRATEGY + ' (Individual Leverage).png'
try:
pf.plot_line_graph(self.reduce_plot(self._individual_leverage), adapter = 'pythalesians', gp = gp)
except: pass
示例5: plot_strategy_group_benchmark_annualised_pnl
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
def plot_strategy_group_benchmark_annualised_pnl(self, cols = None):
# TODO - unfinished, needs checking!
if cols is None: cols = self._strategy_group_benchmark_annualised_pnl.columns
pf = PlotFactory()
gp = GraphProperties()
gp.title = self.FINAL_STRATEGY
gp.display_legend = True
gp.scale_factor = self.SCALE_FACTOR
gp.color = ['red', 'blue', 'purple', 'gray', 'yellow', 'green', 'pink']
gp.file_output = self.DUMP_PATH + self.FINAL_STRATEGY + ' (Group Benchmark Annualised PnL).png'
pf.plot_line_graph(self.reduce_plot(self._strategy_group_benchmark_annualised_pnl[cols]), adapter = 'pythalesians', gp = gp)
示例6: plot_strategy_group_pnl_trades
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
def plot_strategy_group_pnl_trades(self):
pf = PlotFactory()
gp = GraphProperties()
gp.title = self.FINAL_STRATEGY + " (bp)"
gp.display_legend = True
gp.scale_factor = self.SCALE_FACTOR
gp.file_output = self.DUMP_PATH + self.FINAL_STRATEGY + ' (Individual Trade PnL).png'
# zero when there isn't a trade exit
strategy_pnl_trades = self._strategy_pnl_trades.fillna(0) * 100 * 100
try:
pf.plot_line_graph(self.reduce_plot(strategy_pnl_trades), adapter = 'pythalesians', gp = gp)
except: pass
示例7: TimeSeriesRequest
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
###### calculate seasonal moves in EUR/USD and GBP/USD (using Quandl data)
if True:
time_series_request = TimeSeriesRequest(
start_date = "01 Jan 1970", # start date
finish_date = datetime.date.today(), # finish date
freq = 'daily', # daily data
data_source = 'quandl', # use Quandl as data source
tickers = ['EURUSD', # ticker (Thalesians)
'GBPUSD'],
fields = ['close'], # which fields to download
vendor_tickers = ['FRED/DEXUSEU', 'FRED/DEXUSUK'], # ticker (Quandl)
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_ret = tsc.calculate_returns(df)
day_of_month_seasonality = seasonality.bus_day_of_month_seasonality(df_ret, partition_by_month = False)
day_of_month_seasonality = tsc.convert_month_day_to_date_time(day_of_month_seasonality)
gp = GraphProperties()
gp.date_formatter = '%b'
gp.title = 'FX spot moves by time of year'
gp.scale_factor = 3
gp.file_output = "output_data/20150724 FX spot seas.png"
pf.plot_line_graph(day_of_month_seasonality, adapter='pythalesians', gp = gp)
示例8: TimeSeriesRequest
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [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)
示例9: ticker
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
freq="daily", # daily data
data_source="bloomberg", # use Bloomberg as data source
tickers=["EURUSD", "GBPUSD"], # ticker (Thalesians)
fields=["close", "high", "low"], # which fields to download
vendor_tickers=["EURUSD BGN Curncy", "GBPUSD BGN Curncy"], # ticker (Bloomberg)
vendor_fields=["PX_LAST", "PX_HIGH", "PX_LOW"], # which Bloomberg fields to download
cache_algo="internet_load_return",
) # how to return data
ltsf = LightTimeSeriesFactory()
df = None
df = ltsf.harvest_time_series(time_series_request)
pf = PlotFactory()
pf.plot_line_graph(df, adapter="pythalesians")
###### download event dates for non farm payrolls and then print
if False:
time_series_request = TimeSeriesRequest(
start_date="01 Jan 2014", # start date
finish_date=datetime.date.today(), # finish date
category="events",
freq="daily", # daily data
data_source="bloomberg", # use Bloomberg as data source
tickers=["FOMC", "NFP"],
fields=["release-date-time-full", "release-dt", "actual-release"], # which fields to download
vendor_tickers=["FDTR Index", "NFP TCH Index"], # ticker (Bloomberg)
vendor_fields=[
"ECO_FUTURE_RELEASE_DATE_LIST",
示例10: PlotFactory
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
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)
pf = PlotFactory()
gp = GraphProperties()
gp.title = 'Spot values'
gp.file_output = 'demo.png'
gp.html_file_output = 'demo.htm'
gp.source = 'Thalesians/BBG'
# plot using PyThalesians
pf.plot_line_graph(daily_vals, adapter = 'pythalesians', gp = gp)
# plot using Bokeh (still needs a lot of work!)
pf.plot_line_graph(daily_vals, adapter = 'bokeh', gp = gp)
# do more complicated charts using several different Matplotib stylesheets (which have been customised)
if True:
ltsf = LightTimeSeriesFactory()
# load market data
start = '01 Jan 1970'
end = datetime.datetime.utcnow()
tickers = ['AUDJPY', 'USDJPY']
vendor_tickers = ['AUDJPY BGN Curncy', 'USDJPY BGN Curncy']
time_series_request = TimeSeriesRequest(
示例11: TimeSeriesRequest
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
time_series_request = TimeSeriesRequest(
start_date="01 Jan 1970", # start date
finish_date=datetime.date.today(), # finish date
freq='daily', # daily data
data_source='quandl', # use Quandl as data source
tickers=['EURUSD', # ticker (Thalesians)
'GBPUSD'],
fields=['close'], # which fields to download
vendor_tickers=['FRED/DEXUSEU', 'FRED/DEXUSUK'], # ticker (Quandl)
vendor_fields=['close'], # which Bloomberg fields to download
cache_algo='internet_load_return') # how to return data
ltsf = LightTimeSeriesFactory()
daily_vals = ltsf.harvest_time_series(time_series_request)
techind = TechIndicator()
tech_params = TechParams()
tech_params.sma_period = 20
techind.create_tech_ind(daily_vals, 'SMA', tech_params=tech_params)
sma = techind.get_techind()
signal = techind.get_signal()
combine = daily_vals.join(sma, how='outer')
pf = PlotFactory()
pf.plot_line_graph(combine, adapter='pythalesians')
示例12: PlotFactory
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
cache_algo="internet_load_return",
) # how to return data
daily_vals = ltsf.harvest_time_series(time_series_request)
pf = PlotFactory()
gp = GraphProperties()
gp.title = "Spot values"
gp.file_output = "output_data/demo.png"
gp.html_file_output = "output_data/demo.htm"
gp.source = "Thalesians/BBG"
# plot using PyThalesians
pf.plot_line_graph(daily_vals, adapter="pythalesians", gp=gp)
# plot using Bokeh (still needs a lot of work!)
pf.plot_line_graph(daily_vals, adapter="bokeh", gp=gp)
# do more complicated charts using several different Matplotib stylesheets (which have been customised)
if False:
ltsf = LightTimeSeriesFactory()
# load market data
start = "01 Jan 1970"
end = datetime.datetime.utcnow()
tickers = ["AUDJPY", "USDJPY"]
vendor_tickers = ["AUDJPY BGN Curncy", "USDJPY BGN Curncy"]
time_series_request = TimeSeriesRequest(
示例13: EventStudy
# 需要导入模块: from pythalesians.graphics.graphs.plotfactory import PlotFactory [as 别名]
# 或者: from pythalesians.graphics.graphs.plotfactory.PlotFactory import plot_line_graph [as 别名]
from pythalesians.economics.events.eventstudy import EventStudy
es = EventStudy()
# work out cumulative asset price moves moves over the event
df_event = es.get_intraday_moves_over_custom_event(df, df_event_times)
# create an average move
df_event['Avg'] = df_event.mean(axis = 1)
# plotting spot over economic data event
gp = GraphProperties()
gp.scale_factor = 3
gp.title = 'USDJPY spot moves over recent NFP'
# plot in shades of blue (so earlier releases are lighter, later releases are darker)
gp.color = 'Blues'; gp.color_2 = []
gp.y_axis_2_series = []
gp.display_legend = False
# last release will be in red, average move in orange
gp.color_2_series = [df_event.columns[-2], df_event.columns[-1]]
gp.color_2 = ['red', 'orange'] # red, pink
gp.linewidth_2 = 2
gp.linewidth_2_series = gp.color_2_series
pf = PlotFactory()
pf.plot_line_graph(df_event * 100, adapter = 'pythalesians', gp = gp)