diff --git a/pytrendline/detect.py b/pytrendline/detect.py index e948e09..c9944b2 100644 --- a/pytrendline/detect.py +++ b/pytrendline/detect.py @@ -344,32 +344,31 @@ def detect_wrapped(tt): score = config.get("scoring_function", DEFAULT_CONFIG["scoring_function"])(candlestick_data, err_distances, num_points, slope) - trends_df = trends_df.append({ - 'id': pointset_id, - 'trendtype': tt, - 'pointset_indeces':points_in_trendline, - 'pointset_dates': [candlestick_data.df.iloc[pt].Date for pt in points_in_trendline], - 'starts_at_index': points_in_trendline[0], - 'starts_at_date': candlestick_data.df.iloc[points_in_trendline[0]].Date, - 'ends_at_index': points_in_trendline[-1], - 'ends_at_date': candlestick_data.df.iloc[points_in_trendline[-1]].Date, - 'is_breakout': is_breakout, - 'breakout_index': breakout_index, - 'breakout_date': breakout_date, - 'num_points': num_points, - 'm': m, - 'b': b, - 'slope': slope, - 'price_at_last_date': trend_price_at_last, - 'score': score, - 'global_maxs_or_mins': global_max_or_mins, - 'includes_global_max_or_min': global_pt_found, - 'price_at_next_future_date': trend_price_at_last + m, - 'duplicate_group_id': None, - 'is_best_from_duplicate_group': False, - 'overall_rank': None, - 'rank_within_group': 0 - }, ignore_index=True) + trends_df.loc[len(trends_df.index)] = [ + pointset_id, + tt, + points_in_trendline, + [candlestick_data.df.iloc[pt].Date for pt in points_in_trendline], + points_in_trendline[0], + candlestick_data.df.iloc[points_in_trendline[0]].Date, + points_in_trendline[-1], + candlestick_data.df.iloc[points_in_trendline[-1]].Date, + is_breakout, + breakout_index, + breakout_date, + num_points, + m, + b, + slope, + trend_price_at_last, + score, + global_pt_found, + global_max_or_mins, + trend_price_at_last + m, + None, + False, + None, + 0] # Mark which of the trendlines are duplicate trends_df = _mark_duplicates(trends_df, candlestick_data, tt, config) diff --git a/pytrendline/plot.py b/pytrendline/plot.py index 8ca6e85..35160f0 100644 --- a/pytrendline/plot.py +++ b/pytrendline/plot.py @@ -131,7 +131,7 @@ def plot_figure(self, p, candles_df, opts={}): label_y_pos = tl_y_at_last_date + (2 * m) label = Label(x=label_x_pos, y=label_y_pos, - text=label_text, render_mode='css', + text=label_text, border_line_color=color, border_line_alpha=0.8, background_fill_color='white', background_fill_alpha=1.0) p.segment( @@ -255,7 +255,7 @@ def plot_graph_bokeh(results): p = figure( x_axis_type="datetime", tools="pan,wheel_zoom,tap,crosshair,hover,poly_draw,reset,save", - plot_width=1300, + width=1300, title=site_title, y_range=(y_range_top, y_range_bottom), x_range=(x_range_left, x_range_right), @@ -308,7 +308,7 @@ def plot_table_bokeh(results): all_results = results['resistance_trendlines'] if len(all_results) > 0: - html_trends_table = all_results.drop('pointset_dates', 1).to_html(border=0, header=True, index=False, justify="left", float_format=lambda x: '%10.3f' % x) + html_trends_table = all_results.drop(columns='pointset_dates').to_html(border=0, header=True, index=False, justify="left", float_format=lambda x: '%10.3f' % x) else: html_trends_table = '

No trendlines found

'