Python ipywidgets.Label() Examples
The following are 30
code examples of ipywidgets.Label().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ipywidgets
, or try the search function
.
Example #1
Source File: ABuWGSellFactor.py From abu with GNU General Public License v3.0 | 7 votes |
def _init_widget(self): """构建AbuFactorSellBreak策略参数界面""" self.description = widgets.Textarea( value=u'海龟向下趋势突破卖出策略:\n' u'趋势突破定义为当天收盘价格低于N天内的最低价,作为卖出信号,卖出操作', description=u'海龟卖出', disabled=False, layout=self.description_layout ) self.xd_label = widgets.Label(u'突破周期参数:比如21,30,42天....突破', layout=self.label_layout) self.xd = widgets.IntSlider( value=10, min=3, max=120, step=1, description=u'周期', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) self.xd_box = widgets.VBox([self.xd_label, self.xd]) self.widget = widgets.VBox([self.description, self.xd_box, self.add_box], # border='solid 1px', layout=self.widget_layout)
Example #2
Source File: progressbar.py From QuLab with MIT License | 6 votes |
def __init__(self, *, max=10, description='Progressing', loop=None, hiden=False): self.start_ts = monotonic() self.avg = 0 self._avg_update_ts = self.start_ts self._ts = self.start_ts self._xput = deque(maxlen=self.sma_window) self._ProgressWidget = widgets.IntProgress(value=0, min=0, max=max, step=1, description=description, bar_style='') self._elapsedTimeLabel = widgets.Label(value='Used time: 00:00:00') self._etaTimeLabel = widgets.Label(value='Remaining time: --:--:--') self.ui = widgets.HBox( [self._ProgressWidget, self._elapsedTimeLabel, self._etaTimeLabel]) self.loop = asyncio.get_event_loop() if loop is None else loop self._update_loop = None self._displayed = False if not hiden else True
Example #3
Source File: ABuWGBuyFactor.py From abu with GNU General Public License v3.0 | 6 votes |
def _init_widget(self): """构建AbuFactorBuyBreak策略参数界面""" self.description = widgets.Textarea( value=u'海龟向上趋势突破买入策略:\n' u'趋势突破定义为当天收盘价格超过N天内的最高价,超过最高价格作为买入信号买入股票持有', description=u'海龟买入', disabled=False, layout=self.description_layout ) self.xd_label = widgets.Label(u'突破周期参数:比如21,30,42天....突破', layout=self.label_layout) self.xd = widgets.IntSlider( value=21, min=3, max=120, step=1, description=u'周期', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) self.xd_box = widgets.VBox([self.xd_label, self.xd]) self.widget = widgets.VBox([self.description, self.xd_box, self.add], # border='solid 1px', layout=self.widget_layout)
Example #4
Source File: ABuWGPSBase.py From abu with GNU General Public License v3.0 | 6 votes |
def _pick_stock_base_ui(self): """选股策略中通用ui: xd, reversed初始构建""" xd_tip = widgets.Label(u'设置选股策略生效周期,默认252天', layout=widgets.Layout(width='300px', align_items='stretch')) self.xd = widgets.IntSlider( value=252, min=1, max=252, step=1, description=u'周期', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) self.xd_box = widgets.VBox([xd_tip, self.xd]) reversed_tip = widgets.Label(u'反转选股结果,默认不反转', layout=widgets.Layout(width='300px', align_items='stretch')) self.reversed = widgets.Checkbox( value=False, description=u'反转结果', disabled=False, ) self.reversed_box = widgets.VBox([reversed_tip, self.reversed])
Example #5
Source File: ABuWGBFBase.py From abu with GNU General Public License v3.0 | 6 votes |
def subscriber_ui(self, labels): """ 构建订阅的已添加的买入策略ui初始化 :param labels: list序列内部对象str用来描述解释 """ # 添加针对指定买入策略的卖出策略 self.accordion = widgets.Accordion() buy_factors_child = [] for label in labels: buy_factors_child.append(widgets.Label(label, layout=widgets.Layout(width='300px', align_items='stretch'))) self.buy_factors = widgets.SelectMultiple( options=[], description=u'已添加的买入策略:', disabled=False, layout=widgets.Layout(width='100%', align_items='stretch') ) buy_factors_child.append(self.buy_factors) buy_factors_box = widgets.VBox(buy_factors_child) self.accordion.children = [buy_factors_box]
Example #6
Source File: selection.py From notebook-molecular-visualization with Apache License 2.0 | 6 votes |
def __init__(self, mol): super().__init__(mol) self.selection_type = ipy.Dropdown(description='Clicks select:', value=self.viewer.selection_type, options=('Atom', 'Residue', 'Chain')) traitlets.link((self.selection_type, 'value'), (self.viewer, 'selection_type')) self.residue_listname = ipy.Label('Selected residues:', layout=ipy.Layout(width='100%')) self.residue_list = ipy.SelectMultiple(options=list(), height='150px') self.viewer.observe(self._update_reslist, 'selected_atom_indices') self.residue_list.observe(self.remove_atomlist_highlight, 'value') self.atom_list.observe(self.remove_reslist_highlight, 'value') self.subtools.children = [self.representation_buttons] self.subtools.layout.flex_flow = 'column' self.toolpane.children = [self.selection_type, HBox([self.select_all_atoms_button, self.select_none]), self.atom_listname, self.atom_list, self.residue_listname, self.residue_list]
Example #7
Source File: selection.py From notebook-molecular-visualization with Apache License 2.0 | 6 votes |
def __init__(self, mol): super().__init__(mol) self._bondset = collections.OrderedDict() self._drawn_bond_state = set() self.bond_listname = ipy.Label('Selected bonds:', layout=ipy.Layout(width='100%')) self.bond_list = ipy.SelectMultiple(options=list(), layout=ipy.Layout(height='150px')) self.viewer.observe(self._update_bondlist, 'selected_atom_indices') self.atom_list.observe(self.remove_bondlist_highlight, 'value') self.subtools.children = [HBox([self.select_all_atoms_button, self.select_none])] self.toolpane.children = (self.atom_listname, self.atom_list, self.bond_listname, self.bond_list)
Example #8
Source File: selection.py From notebook-molecular-visualization with Apache License 2.0 | 6 votes |
def __init__(self, mol): super().__init__(mol) self._atomset = collections.OrderedDict() self.atom_listname = ipy.Label('Selected atoms:', layout=ipy.Layout(width='100%')) self.atom_list = ipy.SelectMultiple(options=list(self.viewer.selected_atom_indices), layout=ipy.Layout(height='150px')) traitlets.directional_link( (self.viewer, 'selected_atom_indices'), (self.atom_list, 'options'), self._atom_indices_to_atoms ) self.select_all_atoms_button = ipy.Button(description='Select all atoms') self.select_all_atoms_button.on_click(self.select_all_atoms) self.select_none = ipy.Button(description='Clear all selections') self.select_none.on_click(self.clear_selections) self.representation_buttons = ipy.ToggleButtons(options=['stick','ribbon', 'auto', 'vdw'], value='auto') self.representation_buttons.observe(self._change_representation, 'value')
Example #9
Source File: ipython.py From OpenModes with GNU General Public License v3.0 | 6 votes |
def progress_iterator(orig_iterator, description): """Wrap an iterator so that a progress bar is displayed Parameters ---------- orig_iterator: iterator The original iterator. It must implement the __len__ operation so that its length can be calculated in advance. description: string Description will give a text label for the bar. """ progress_widget = FloatProgress(min=0, max=len(orig_iterator)-1) widget = HBox([Label(description), progress_widget]) display(widget) for count, val in enumerate(orig_iterator): yield val progress_widget.value = count
Example #10
Source File: qubit_widget.py From scqubits with BSD 3-Clause "New" or "Revised" License | 6 votes |
def create_widget(callback_func, init_params, image_filename=None): """ Displays ipywidgets for initialization of a QuantumSystem object. Parameters ---------- callback_func: function callback_function depends on all the parameters provided as keys (str) in the parameter_dict, and is called upon changes of values inside the widgets init_params: {str: value, str: value, ...} names and values of initialization parameters image_filename: str, optional file name for circuit image to be displayed alongside the qubit Returns ------- """ widgets = {} box_list = [] for name, value in init_params.items(): label = ipywidgets.Label(value=name) if isinstance(value, float): enter_widget = ipywidgets.FloatText else: enter_widget = ipywidgets.IntText widgets[name] = enter_widget(value=value, description='', disabled=False) box_list.append(ipywidgets.HBox([label, widgets[name]], layout=ipywidgets.Layout(justify_content='flex-end'))) if image_filename: file = open(image_filename, "rb") image = file.read() image_widget = ipywidgets.Image(value=image, format='png', layout=ipywidgets.Layout(width='400px')) ui_widget = ipywidgets.HBox([ipywidgets.VBox(box_list), ipywidgets.VBox([image_widget])]) else: ui_widget = ipywidgets.VBox(box_list) out = ipywidgets.interactive_output(callback_func, widgets) display(ui_widget, out)
Example #11
Source File: ABuWGSMTool.py From abu with GNU General Public License v3.0 | 5 votes |
def init_distances_ui(self): """距离分析ui""" with self._init_widget_list_action(self.distances_analyse, u'距离分析', -1) as widget_list: self.distances_mode = widgets.RadioButtons( options={u'曼哈顿距离(L1范数)': 0, u'欧式距离(L2范数)': 1, u'余弦距离': 2}, value=0, description=u'距离模式:', disabled=False ) widget_list.append(self.distances_mode) scale_end_label = widgets.Label(u'对结果矩阵进行标准化处理', layout=self.label_layout) self.scale_end = widgets.Checkbox( value=True, description=u'标准化', disabled=False ) scale_end_box = widgets.VBox([scale_end_label, self.scale_end]) widget_list.append(scale_end_box) similar_tip_label = widgets.Label(u'对结果矩阵进行转换相关性', layout=self.label_layout) self.to_similar = widgets.Checkbox( value=False, description=u'转换相关', disabled=False ) to_similar_box = widgets.VBox([similar_tip_label, self.to_similar]) widget_list.append(to_similar_box) return widgets.VBox(widget_list, # border='solid 1px', layout=self.tool_layout)
Example #12
Source File: docker.py From notebook-molecular-visualization with Apache License 2.0 | 5 votes |
def __init__(self): self.client = None self.warning = ipy.HTML(description='<b>Engine status:</b>', value=SPINNER) self.devmode_label = ipy.Label('Use local docker images (developer mode)', layout=ipy.Layout(width='100%')) self.devmode_button = ipy.Checkbox(value=mdt.compute.config.devmode, layout=ipy.Layout(width='15px')) self.devmode_button.observe(self.set_devmode, 'value') self.engine_config_description = ipy.HTML('Docker host with protocol and port' ' (e.g., <code>http://localhost:2375</code>).' ' If blank, this' ' defaults to the docker engine configured at ' 'your command line.', layout=ipy.Layout(width='100%')) self.engine_config_value = ipy.Text('blank', layout=ipy.Layout(width='100%')) self.engine_config_value.add_class('nbv-monospace') self.image_box = ipy.Box() self._reset_config_button = ipy.Button(description='Reset', tooltip='Reset to applied value') self._apply_changes_button = ipy.Button(description='Apply', tooltip='Apply for this session') self._save_changes_button = ipy.Button(description='Make default', tooltip='Make this the default for new sessions') self._reset_config_button.on_click(self.reset_config) self._apply_changes_button.on_click(self.apply_config) self._save_changes_button.on_click(self.save_config) self.children = [self.warning, VBox([self.engine_config_description, self.engine_config_value]), HBox([self._reset_config_button, self._apply_changes_button, self._save_changes_button]), HBox([self.devmode_button, self.devmode_label]), self.image_box] self.reset_config() super().__init__(children=self.children) self.connect_to_engine()
Example #13
Source File: ABuWGSMTool.py From abu with GNU General Public License v3.0 | 5 votes |
def init_market_corr_ui(self): """全市场相关分析ui""" with self._init_widget_list_action(self.corr_market_analyse, u'全市场相关分析', 1) as widget_list: self.corr_market = widgets.Dropdown( options={u'美股': EMarketTargetType.E_MARKET_TARGET_US.value, u'A股': EMarketTargetType.E_MARKET_TARGET_CN.value, u'港股': EMarketTargetType.E_MARKET_TARGET_HK.value, u'国内期货': EMarketTargetType.E_MARKET_TARGET_FUTURES_CN.value, u'国际期货': EMarketTargetType.E_MARKET_TARGET_FUTURES_GLOBAL.value, u'数字货币': EMarketTargetType.E_MARKET_TARGET_TC.value}, value=ABuEnv.g_market_target.value, description=u'分析市场:', ) market_tip1 = widgets.Label(value=u'分析市场的选择可以和分析目标不在同一市场', layout=self.label_layout) market_tip2 = widgets.Label(value=u'如分析目标为美股股票,分析市场也可选A股', layout=self.label_layout) market_box = widgets.VBox([market_tip1, market_tip2, self.corr_market]) widget_list.append(market_box) tip_label1 = widgets.Label(u'全市场相关分析不支持开放数据模式', layout=self.label_layout) tip_label2 = widgets.Label(u'非沙盒模式需先用\'数据下载界面操作\'进行下载', layout=self.label_layout) self.corr_market_data_mode = widgets.RadioButtons( options={u'沙盒数据模式': True, u'本地数据模式': False}, value=True, description=u'数据模式:', disabled=False ) corr_market_box = widgets.VBox([tip_label1, tip_label2, self.corr_market_data_mode]) widget_list.append(corr_market_box) self.corr_market_mode = widgets.RadioButtons( options={u'皮尔逊相关系数计算': 'pears', u'斯皮尔曼相关系数计算': 'sperm', u'基于+-符号相关系数': 'sign', u'移动时间加权相关系数': 'rolling'}, value='pears', description=u'相关模式:', disabled=False ) widget_list.append(self.corr_market_mode) return widgets.VBox(widget_list, # border='solid 1px', layout=self.tool_layout)
Example #14
Source File: ABuWGSMTool.py From abu with GNU General Public License v3.0 | 5 votes |
def init_relative_corr_ui(self): """全市场相对相关分析ui""" with self._init_widget_list_action(self.corr_relative_market_analyse, u'全市场相对相关分析', 2) as widget_list: relative_description = widgets.Textarea( value=u'全市场相对相关分析: \n' u'度量的是两目标(a,b)相对整个市场的相关性评级,它不关心某一个股票具体相关性的数值的大小\n' u'1. 计算a与市场中所有股票的相关性\n' u'2. 将所有相关性进行rank排序\n' u'3. 查询股票b在rank序列中的位置,此位置值即为结果\n', disabled=False, layout=self.description_layout ) widget_list.append(relative_description) tip_label1 = widgets.Label(u'全市场相对相关分析不支持实时网络数据模式', layout=self.label_layout) tip_label2 = widgets.Label(u'非沙盒模式需先用\'数据下载界面操作\'进行下载', layout=self.label_layout) self.relative_corr_data_mode = widgets.RadioButtons( options={u'沙盒数据模式': True, u'本地数据模式': False}, value=True, description=u'数据模式:', disabled=False ) corr_market_box = widgets.VBox([tip_label1, tip_label2, self.relative_corr_data_mode]) widget_list.append(corr_market_box) return widgets.VBox(widget_list, # border='solid 1px', layout=self.tool_layout)
Example #15
Source File: ABuWGSMTool.py From abu with GNU General Public License v3.0 | 5 votes |
def init_coint_corr_ui(self): """全市场协整相关分析ui""" with self._init_widget_list_action(self.coint_corr_market_analyse, u'全市场协整相关分析', 1) as widget_list: coint_similar_description = widgets.Textarea( value=u'全市场协整相关分析: \n' u'综合利用相关和协整的特性返回查询的股票是否有统计套利的交易机会\n' u'1. 通过相关性分析筛选出与查询股票最相关的前100支股票作为种子\n' u'2. 从种子中通过计算协整程度来度量查询股票是否存在统计套利机会\n' u'3. 可视化整个过程\n', disabled=False, layout=self.description_layout ) widget_list.append(coint_similar_description) tip_label1 = widgets.Label(u'全市场相对相关分析不支持实时网络数据模式', layout=self.label_layout) tip_label2 = widgets.Label(u'非沙盒模式需先用\'数据下载界面操作\'进行下载', layout=self.label_layout) self.coint_corr_data_mode = widgets.RadioButtons( options={u'沙盒数据模式': True, u'本地数据模式': False}, value=True, description=u'数据模式:', disabled=False ) corr_market_box = widgets.VBox([tip_label1, tip_label2, self.coint_corr_data_mode]) widget_list.append(corr_market_box) return widgets.VBox(widget_list, # border='solid 1px', layout=self.tool_layout)
Example #16
Source File: ABuWGGridSearch.py From abu with GNU General Public License v3.0 | 5 votes |
def __init__(self): """构建回测需要的各个组件形成tab""" tip_label1 = widgets.Label(u'最优参数grid search暂不支持实时网络数据模式', layout=widgets.Layout(width='300px')) tip_label2 = widgets.Label(u'非沙盒模式需先用\'数据下载界面操作\'进行下载', layout=widgets.Layout(width='300px')) """沙盒数据与开放数据模式切换""" self.date_mode = widgets.RadioButtons( options=[u'沙盒数据模式', u'开放数据模式'], value=u'沙盒数据模式' if ABuEnv._g_enable_example_env_ipython else u'开放数据模式', description=u'数据模式:', disabled=False ) self.date_mode.observe(self.on_data_mode_change, names='value') date_mode_box = widgets.VBox([tip_label1, tip_label2, self.date_mode]) self.sc = WidgetSymbolChoice() self.bf = BuyFactorWGManager(add_button_style='grid') self.sf = SellFactorWGManager(show_add_buy=False, add_button_style='grid') sub_widget_tab = widgets.Tab() sub_widget_tab.children = [self.bf.widget, self.sf.widget, self.sc.widget] for ind, name in enumerate([u'买策', u'卖策', u'股池']): sub_widget_tab.set_title(ind, name) self.begin_grid_search = widgets.Button(description=u'开始寻找策略最优参数组合', layout=widgets.Layout(width='98%'), button_style='danger') self.begin_grid_search.on_click(self.run_grid_search) self.widget = widgets.VBox([date_mode_box, sub_widget_tab, self.begin_grid_search])
Example #17
Source File: ABuWGSellFactor.py From abu with GNU General Public License v3.0 | 5 votes |
def _init_widget(self): """构建AbuFactorSellNDay策略参数界面""" self.description = widgets.Textarea( value=u'持有N天后卖出策略:\n' u'卖出策略,不管交易现在什么结果,买入后只持有N天\n' u'需要与特定\'买入策略\'形成配合\n,' u'单独使用N天卖出策略意义不大', description=u'N天卖出', disabled=False, layout=self.description_layout ) sell_n_label = widgets.Label(u'设定买入后只持有天数,默认1', layout=self.label_layout) self.sell_n = widgets.IntText( value=1, description=u'N天', disabled=False ) sell_n_box = widgets.VBox([sell_n_label, self.sell_n]) is_sell_today_label = widgets.Label(u'设定买入n天后,当天还是隔天卖出', layout=self.label_layout) self.is_sell_today = widgets.Dropdown( options={u'N天后隔天卖出': False, u'N天后当天卖出': True}, value=False, description=u'当天隔天:', ) is_sell_today_box = widgets.VBox([is_sell_today_label, self.is_sell_today]) self.widget = widgets.VBox([self.description, sell_n_box, is_sell_today_box, self.add_box], # border='solid 1px', layout=self.widget_layout)
Example #18
Source File: ABuWGSellFactor.py From abu with GNU General Public License v3.0 | 5 votes |
def _init_widget(self): """构建AbuFactorPreAtrNStop策略参数界面""" self.description = widgets.Textarea( value=u'风险控制止损策略:\n' u'1. 单日最大跌幅n倍atr止损\n' u'2. 当今日价格下跌幅度 > 当日atr 乘以 pre_atr_n(下跌止损倍数)卖出操作', description=u'风险止损', disabled=False, layout=self.description_layout ) self.pre_atr_n_label = widgets.Label(u'当今天价格开始剧烈下跌,采取果断平仓措施', layout=self.label_layout) self.pre_atr_n = widgets.FloatSlider( value=1.5, min=0.10, max=10.0, step=0.1, description='pre_atr_n', disabled=False, orientation='horizontal', readout=True, readout_format='.1f', ) self.pre_atr_n_box = widgets.VBox([self.pre_atr_n_label, self.pre_atr_n]) self.widget = widgets.VBox([self.description, self.pre_atr_n_box, self.add_box], # border='solid 1px', layout=self.widget_layout)
Example #19
Source File: ABuWGSellFactor.py From abu with GNU General Public License v3.0 | 5 votes |
def _init_widget(self): """构建AbuFactorCloseAtrNStop策略参数界面""" self.description = widgets.Textarea( value=u'利润保护止盈策略:\n' u'1. 买入后最大收益价格 - 今日价格 > 一定收益\n' u'2. 买入后最大收益价格 - 今日价格 < close_atr_n * 当日atr\n' u'3. 当买入有一定收益后,如果下跌幅度超过close_atr_n乘以当日atr->保护止盈卖出', description=u'保护止盈', disabled=False, layout=self.description_layout ) self.close_atr_n_label = widgets.Label(u'收益下跌超过close_atr_n乘以当日atr->保护止盈', layout=self.label_layout) self.close_atr_n = widgets.FloatSlider( value=1.5, min=0.10, max=10.0, step=0.1, description='close_atr_n', disabled=False, orientation='horizontal', readout=True, readout_format='.1f', ) self.close_atr_n_box = widgets.VBox([self.close_atr_n_label, self.close_atr_n]) self.widget = widgets.VBox([self.description, self.close_atr_n_box, self.add_box], # border='solid 1px', layout=self.widget_layout)
Example #20
Source File: ABuWGPickStock.py From abu with GNU General Public License v3.0 | 5 votes |
def _init_widget(self): """构建AbuPickStockNTop策略参数界面""" self.description = widgets.Textarea( value=u'涨跌幅top N选股因子策略:\n' u'选股周期上对多只股票涨跌幅进行排序,选取top n个股票做为交易目标:\n' u'(只对在股池中选定的symbol序列生效,对全市场回测暂时不生效)\n', description=u'top N涨跌', disabled=False, layout=self.description_layout ) n_top_label = widgets.Label(u'设定选取top个交易目标数量,默认3', layout=self.label_layout) self.n_top = widgets.IntText( value=3, description=u'TOP N', disabled=False ) self.n_top_box = widgets.VBox([n_top_label, self.n_top]) direction_top_label1 = widgets.Label(u'direction_top参数的意义为选取方向:', layout=self.label_layout) direction_top_label2 = widgets.Label(u'默认值为正:即选取涨幅最高的n_top个股票', layout=self.label_layout) direction_top_label3 = widgets.Label(u'可设置为负:即选取跌幅最高的n_top个股票', layout=self.label_layout) self.direction_top = widgets.Dropdown( options={u'正(涨幅)': 1, u'负(跌幅)': -1}, value=1, description=u'选取方向:', ) self.direction_top_box = widgets.VBox([direction_top_label1, direction_top_label2, direction_top_label3, self.direction_top]) self.widget = widgets.VBox([self.description, self.n_top_box, self.direction_top_box, self.xd_box, self.reversed_box, self.add_box], # border='solid 1px', layout=self.widget_layout)
Example #21
Source File: progress.py From pywr with GNU General Public License v3.0 | 5 votes |
def reset(self): from ipywidgets import FloatProgress, HBox, Label, Layout from IPython.display import display super(JupyterProgressRecorder, self).reset() self.progress_bar = FloatProgress(min=0, max=100, description='Running:') self.label = Label("", layout=Layout(width='100%')) self.box = HBox([self.progress_bar, self.label]) display(self.box)
Example #22
Source File: ABuWGBuyFactor.py From abu with GNU General Public License v3.0 | 5 votes |
def _init_widget(self): """构建AbuWeekMonthBuy策略参数界面""" self.description = widgets.Textarea( value=u'固定周期买入策略:\n' u'根据参数每周买入一次或者每一个月买入一次\n' u'需要与特定\'选股策略\'和\'卖出策略\'形成配合\n,' u'单独使用固定周期买入策略意义不大', description=u'定期买入', disabled=False, layout=self.description_layout ) is_buy_month_label = widgets.Label(u'可更改买入定期,默认定期一个月', layout=self.label_layout) self.is_buy_month = widgets.Dropdown( options={u'定期一个月': True, u'定期一个周': False}, value=True, description=u'定期时长:', ) is_buy_month_box = widgets.VBox([is_buy_month_label, self.is_buy_month]) self.widget = widgets.VBox([self.description, is_buy_month_box, self.add], # border='solid 1px', layout=self.widget_layout)
Example #23
Source File: ABuWGTLTool.py From abu with GNU General Public License v3.0 | 5 votes |
def init_pair_speed_ui(self): """趋势敏感速度分析ui""" with self._init_tip_label_with_step_x( self._pair_speed_analyse, u'趋势敏感速度分析', with_step_x=False) as (widget_list, _): self.pair_speed_mode = widgets.RadioButtons( options={u'对比收盘敏感速度': 'close', u'对比涨跌敏感速度': 'p_change', u'对比最高敏感速度': 'high', u'对比最低敏感速度': 'low'}, value='close', description=u'对比模式:', disabled=False ) widget_list.append(self.pair_speed_mode) resample_tip_label = widgets.Label(u'趋势敏感速度计算重采样周期', layout=self.label_layout) self.pair_resample = widgets.IntSlider( value=5, min=3, max=10, step=1, description=u'重采样', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) resample_box = widgets.VBox([resample_tip_label, self.pair_resample]) widget_list.append(resample_box) return widgets.VBox(widget_list, # border='solid 1px', layout=self.tool_layout)
Example #24
Source File: ABuWGTLTool.py From abu with GNU General Public License v3.0 | 5 votes |
def init_golden_line_ui(self): """黄金分割ui""" with self._init_tip_label_with_step_x( self._golden_line_analyse, u'黄金分割分析', with_step_x=False) as (widget_list, _): self.golden_line_mode = widgets.RadioButtons( options={u'可视化黄金分隔带': 0, u'可视化黄金分隔带+关键比例': 1, u'可视化关键比例': 2}, value=0, description=u'分隔模式:', disabled=False ) widget_list.append(self.golden_line_mode) pt_tip_label = widgets.Label(u'比例设置仅对\'可视化关键比例\'生效', layout=self.label_layout) self.pt_range = widgets.FloatRangeSlider( value=[0.2, 0.8], min=0.1, max=0.9, step=0.1, description=u'比例设置:', disabled=False, continuous_update=False, orientation='horizontal', readout=True, readout_format='.1f', ) pt_box = widgets.VBox([pt_tip_label, self.pt_range]) widget_list.append(pt_box) return widgets.VBox(widget_list, # border='solid 1px', layout=self.tool_layout)
Example #25
Source File: nbwidgets.py From msticpy with MIT License | 5 votes |
def __init__(self, completed_len: int, visible: bool = True): """ Instantiate new _Progress UI. Parameters ---------- completed_len : int The expected value that indicates 100% done. visible : bool If True start the progress UI visible, by default True. """ self._completed = 0 self._total = completed_len self._progress = widgets.IntProgress( value=0, max=100, step=1, description="Progress:", bar_style="info", orientation="horizontal", ) self._done_label = widgets.Label(value="0%") self._progress.visible = visible self._done_label.visible = visible self.layout = widgets.HBox([self._progress, self._done_label]) self.display()
Example #26
Source File: ABuWGTLTool.py From abu with GNU General Public License v3.0 | 5 votes |
def _init_tip_label_with_step_x(self, callback_analyse, analyse_name, with_step_x=True): """step_x需要的地方比较多,统一构建,外部接收赋予名字""" if not callable(callback_analyse): raise TabError('callback_analyse must callable!') tip_label = widgets.Label(self.map_tip_target_label(n_target=1), layout=self.label_layout) widget_list = [tip_label] step_x = None if with_step_x: step_x_label = widgets.Label(u'时间步长控制参数step_x,默认1.0', layout=self.label_layout) step_x = widgets.FloatSlider( value=1.0, min=0.1, max=2.6, step=0.1, description=u'步长', disabled=False, orientation='horizontal', readout=True, readout_format='.1f', ) # 返回给需要的ui,命名独有的step_x yield widget_list, step_x if with_step_x: # noinspection PyUnboundLocalVariable step_x_box = widgets.VBox([step_x_label, step_x]) # noinspection PyTypeChecker widget_list.append(step_x_box) analyse_bt = widgets.Button(description=analyse_name, layout=widgets.Layout(width='98%'), button_style='info') analyse_bt.on_click(callback_analyse) widget_list.append(analyse_bt)
Example #27
Source File: ABuWGDATool.py From abu with GNU General Public License v3.0 | 5 votes |
def __init__(self, tool_set): """初始化数据分析界面""" super(WidgetDATool, self).__init__(tool_set) da_list = [] tip_label1 = widgets.Label(u'分析目标需要在\'分析设置\'中选择', layout=self.label_layout) tip_label2 = widgets.Label(u'需要设置多个分析目标进行对比', layout=self.label_layout) da_list.append(tip_label1) da_list.append(tip_label2) date_week_wave_bt = widgets.Button(description=u'交易日震幅对比分析', layout=widgets.Layout(width='98%'), button_style='info') date_week_wave_bt.on_click(self.date_week_wave) da_list.append(date_week_wave_bt) p_change_stats_bt = widgets.Button(description=u'交易日涨跌对比分析', layout=widgets.Layout(width='98%'), button_style='info') p_change_stats_bt.on_click(self.p_change_stats) da_list.append(p_change_stats_bt) wave_change_rate_bt = widgets.Button(description=u'振幅统计套利条件分析', layout=widgets.Layout(width='98%'), button_style='info') wave_change_rate_bt.on_click(self.wave_change_rate) da_list.append(wave_change_rate_bt) date_week_win_bt = widgets.Button(description=u'交易日涨跌概率分析', layout=widgets.Layout(width='98%'), button_style='info') date_week_win_bt.on_click(self.date_week_win) da_list.append(date_week_win_bt) bcut_change_vc_bt = widgets.Button(description=u'交易日涨跌区间分析(预定区间)', layout=widgets.Layout(width='98%'), button_style='info') bcut_change_vc_bt.on_click(self.bcut_change_vc) da_list.append(bcut_change_vc_bt) qcut_change_vc_bt = widgets.Button(description=u'交易日涨跌区间分析(不定区间)', layout=widgets.Layout(width='98%'), button_style='info') qcut_change_vc_bt.on_click(self.qcut_change_vc) da_list.append(qcut_change_vc_bt) self.widget = widgets.VBox(da_list, layout=widgets.Layout(width='58%'))
Example #28
Source File: cad_display.py From jupyter-cadquery with Apache License 2.0 | 5 votes |
def slider(self, value, min, max, step, description): label = Label(description) self.labels.append(label) ind = len(self.normals) button = ImageButton( width=36, height=28, image_path="%s/plane.png" % (self.image_path), tooltip="Set clipping plane", type=str(ind), layout=Layout(margin="0px 10px 0px 0px")) button.on_click(self.handler) button.add_class("view_button") slider = FloatSlider( value=value, min=min, max=max, step=step, description="", disabled=False, continuous_update=False, orientation='horizontal', readout=True, readout_format='.2f', layout=Layout(width="%dpx" % (self.width - 20))) slider.observe(self.cq_view.clip(ind), "value") return [HBox([button, label]), slider]
Example #29
Source File: ABuWGBuyFactor.py From abu with GNU General Public License v3.0 | 4 votes |
def _init_widget(self): """构建AbuDownUpTrend策略参数界面""" self.description = widgets.Textarea( value=u'整个择时周期分成两部分,长的为长线择时,短的为短线择时:\n' u'1. 寻找长线下跌的股票,比如一个季度(4个月)整体趋势为下跌趋势\n' u'2. 短线走势上涨的股票,比如一个月整体趋势为上涨趋势\n,' u'3. 最后使用海龟突破的N日突破策略作为策略最终买入信号', description=u'长跌短涨', disabled=False, layout=self.description_layout ) xd_label = widgets.Label(u'短线周期:比如20,30,40天,短线以及突破参数', layout=self.label_layout) self.xd = widgets.IntSlider( value=20, min=5, max=120, step=5, description=u'xd', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) xd_box = widgets.VBox([xd_label, self.xd]) past_factor_label = widgets.Label(u'长线乘数:短线基础 x 长线乘数 = 长线周期', layout=self.label_layout) self.past_factor = widgets.IntSlider( value=4, min=1, max=10, step=1, description=u'长线乘数', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) past_factor_box = widgets.VBox([past_factor_label, self.past_factor]) down_deg_threshold_label = widgets.Label(u'拟合趋势角度阀值:如-2,-3,-4', layout=self.label_layout) self.down_deg_threshold = widgets.IntSlider( value=-3, min=-10, max=0, step=1, description=u'角度阀值', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) down_deg_threshold_box = widgets.VBox([down_deg_threshold_label, self.down_deg_threshold]) self.widget = widgets.VBox([self.description, xd_box, past_factor_box, down_deg_threshold_box, self.add], layout=self.widget_layout)
Example #30
Source File: ABuWGBuyFactor.py From abu with GNU General Public License v3.0 | 4 votes |
def _init_widget(self): """构建AbuSDBreak策略参数界面""" self.description = widgets.Textarea( value=u'参照大盘走势向上趋势突破买入策略:\n' u'在海龟突破基础上,参照大盘走势,进行降低交易频率,提高系统的稳定性处理,当大盘走势震荡时封锁交易,' u'当大盘走势平稳时再次打开交易,每一个月计算一次大盘走势是否平稳', description=u'平稳突破', disabled=False, layout=self.description_layout ) self.poly_label = widgets.Label(u'大盘走势拟合次数阀值,poly大于阀值=震荡', layout=self.label_layout) self.poly = widgets.IntSlider( value=2, min=1, max=5, step=1, description=u'拟合', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) self.poly_box = widgets.VBox([self.poly_label, self.poly]) self.xd_label = widgets.Label(u'突破周期参数:比如21,30,42天....突破', layout=self.label_layout) self.xd = widgets.IntSlider( value=21, min=3, max=120, step=1, description=u'周期', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) self.xd_box = widgets.VBox([self.xd_label, self.xd]) self.widget = widgets.VBox([self.description, self.poly_box, self.xd_box, self.add], # border='solid 1px', layout=self.widget_layout)