Python ipywidgets.Textarea() Examples
The following are 28
code examples of ipywidgets.Textarea().
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: 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 #3
Source File: gui.py From pyiron with BSD 3-Clause "New" or "Revised" License | 5 votes |
def create_widgets(self): """ Returns: """ select = widgets.Select # Multiple self.w_group = select(description="Groups:") self.w_node = select(description="Nodes:") self.w_file = select(description="Files:") self.w_text = widgets.HTML() # self.w_text = widgets.Textarea() self.w_text.layout.height = "330px" self.w_text.layout.width = "580px" self.w_text.disabled = True # self.w_plot = self.fig w_list = widgets.VBox([self.w_group, self.w_node, self.w_file]) self.w_tab = widgets.HBox([w_list, self.w_text]) # tab = widgets.Tab(children=[self.w_group, self.w_node, self.w_file, self.w_text]) # [tab.set_title(num, name) for num, name in enumerate(['groups', 'nodes', 'files', 'text'])] # self.w_tab = tab self.w_path = widgets.Text(name="Path: ") self.w_path.layout.width = "680px" self.w_type = widgets.Text(name="Type: ") self.refresh_view()
Example #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
Source File: ABuWGUmp.py From abu with GNU General Public License v3.0 | 5 votes |
def _init_feature_ui(self): """裁判特征采集界面初始化""" ml_feature_description = widgets.Textarea( value=u'裁判特征采集\n' u'裁判是建立在机器学习技术基础上的,所以必然会涉及到特征,abu量化系统支持在回测过程中生成特征数据,切分训练测试集,' u'甚至成交买单快照图片,通过打开下面的开关即可在生成最终的输出结果数据订单信息上加上买入时刻的很多信息,' u'比如价格位置、趋势走向、波动情况等等特征, 注意需要生成特征后回测速度效率会降低\n' u'如在下拉选择中选中\'回测过程生成交易特征\'在回测完成后将保存回测结果,通过在\'裁判特征训练\'可进行查看并进行' u'裁判训练', disabled=False, layout=widgets.Layout(height='150px') ) self.enable_ml_feature = widgets.Dropdown( options={u'回测过程不生成交易特征': 0, u'回测过程生成交易特征': 1}, value=0, description=u'特征生成:', ) return widgets.VBox([ml_feature_description, self.enable_ml_feature])
Example #11
Source File: ABuWGUmp.py From abu with GNU General Public License v3.0 | 5 votes |
def _init_train_ui(self): """裁判特征训练面初始化""" description = widgets.Textarea( value=u'裁判特征训练:\n' u'通过在\'裁判特征采集\'选中\'回测过程生成交易特征\'可在回测完成后保存当此回测结果\n' u'所有回测的结果将显示在下面的\'备选回测:\'框中\n' u'通过\'开始训练裁判\'进行指定的回测裁判训练,训练后的裁判在\'裁判预测拦截\'下可进行选择,选中的裁判将在对应的' u'回测中生效,即开始在回测中对交易进行预测拦截等智能交易干涉行为', disabled=False, layout=widgets.Layout(height='150px') ) self.abu_result = widgets.Select( options=[], description=u'备选回测:', disabled=False, layout=widgets.Layout(width='100%', align_items='stretch') ) self.load_abu_result() train_bt = widgets.Button(description=u'开始训练裁判', layout=widgets.Layout(width='98%'), button_style='info') train_bt.on_click(self._do_train) delete_bt = widgets.Button(description=u'删除选择的备选回测本地数据', layout=widgets.Layout(width='98%'), button_style='warning') delete_bt.on_click(self._do_delete_abu_result) return widgets.VBox([description, self.abu_result, train_bt, delete_bt])
Example #12
Source File: configurator.py From notebook-molecular-visualization with Apache License 2.0 | 5 votes |
def __init__(self, paramlist, paramdefs, title=None): super(Configurator, self).__init__(layout=ipy.Layout(display='flex', flex_flow='column', align_self='flex-start', align_items='stretch', max_width='100%')) self.paramlist = paramlist self.paramdefs = paramdefs self.apply_button = ipy.Button(description='Apply') self.apply_button.on_click(self.apply_values) self.reset_button = ipy.Button(description='Reset') self.reset_button.on_click(self.reset_values) self.buttons = ipy.Box([self.reset_button, self.apply_button], layout=ipy.Layout(align_self='center')) self.selectors = collections.OrderedDict([(p.name, ParamSelector(p)) for p in paramdefs]) self.reset_values() title = utils.if_not_none(title, 'Configuration') self.title = ipy.HTML('<center><h4>%s</h4></center><hr>' % title, align_self='center') self.currentconfig = ipy.Textarea(description='<i>Current params</i>', disabled=True, value=self._pretty_print_config(), layout=ipy.Layout(width='350px', min_height='300px', max_height='500px', display='flex', flex_flow='column')) self.middle = HBox([VBox(list(self.selectors.values())), self.currentconfig]) self.children = [self.title, self.middle, self.buttons]
Example #13
Source File: data.py From jupyter-innotater with MIT License | 5 votes |
def _create_widget(self): if self.multiline: return Textarea(layout=self.layout, disabled=self.disabled) return Text(layout=self.layout, disabled=self.disabled)
Example #14
Source File: ontologysearch.py From tellurium with Apache License 2.0 | 5 votes |
def __init__(self): self.ch = bioservices.ChEBI() self.kegg = bioservices.KEGG() self.wOntologySelect = w.Dropdown(description='Ontology:', options=['ChEBI', 'KEGG.Reaction']) self.wSearchTerm = w.Text(description='Search Term:', value="glucose") self.wSearchTerm.on_submit(self.search) self.wSearchButton = w.Button(description='Search') self.wSearchButton.on_click(self.search) self.wResultsSelect = w.Select(description='Results:', width='100%') self.wResultsSelect.on_trait_change(self.selectedTerm) self.wResultsURL = w.Textarea(description='URL:', width='100%') self.wResults = w.VBox(children=[ self.wResultsSelect, self.wResultsURL ], width='100%') for ch in self.wResults.children: ch.font_family = 'monospace' ch.color = '#AAAAAA' ch.background_color = 'black' # <Container> self.wContainer = w.VBox([ self.wOntologySelect, self.wSearchTerm, self.wSearchButton, self.wResults ]) # display the container display(self.wContainer) self.init_display()
Example #15
Source File: compute.py From notebook-molecular-visualization with Apache License 2.0 | 5 votes |
def __init__(self): from pip._vendor.packaging import version super().__init__() self.version = ipy.HTML('<div class="nbv-loader"></div>') self.textarea = ipy.Textarea(layout=ipy.Layout(width='700px', height='300px')) threading.Thread(target=self.version_check).start() p1 = os.path.join(mdt.PACKAGEPATH, "HISTORY.rst") p2 = os.path.join(mdt.PACKAGEPATH, "..", "HISTORY.rst") if os.path.exists(p1): path = p1 elif os.path.exists(p2): path = p2 else: path = None if path is not None: with open(path, 'r') as infile: self.textarea.value = infile.read() else: self.textarea.value = 'HISTORY.rst not found' self.textarea.disabled = True self.children = (self.version, self.textarea)
Example #16
Source File: ABuWGUmp.py From abu with GNU General Public License v3.0 | 5 votes |
def _init_manager_ui(self): """裁判数据管理界面初始化""" description = widgets.Textarea( value=u'删除选择的裁判本地数据:\n' u'删除所选择的已训练好的本地裁判数据,谨慎操作!\n' u'分享选择的裁判:\n' u'将训练好的裁判数据分享到交易社区,供其他交易者使用\n' u'下载更多的裁判:\n' u'从交易社区,下载更多训练好的裁判数据\n', disabled=False, layout=widgets.Layout(height='150px') ) self.manager_umps = widgets.Select( options=[], description=u'本地裁判:', disabled=False, layout=widgets.Layout(width='100%', align_items='stretch') ) self.load_train_ump(self.manager_umps) delete_bt = widgets.Button(description=u'删除选择的裁判本地数据', layout=widgets.Layout(width='98%'), button_style='warning') delete_bt.on_click(self._do_delete_ump) share_bt = widgets.Button(description=u'分享选择的裁判', layout=widgets.Layout(width='98%'), button_style='info') share_bt.on_click(permission_denied) down_bt = widgets.Button(description=u'下载更多的裁判', layout=widgets.Layout(width='98%'), button_style='info') down_bt.on_click(permission_denied) return widgets.VBox([description, self.manager_umps, delete_bt, share_bt, down_bt])
Example #17
Source File: logwidget.py From notebook-molecular-visualization with Apache License 2.0 | 5 votes |
def __init__(self, widget=None): """ Initialize the handler. If stream is not specified, sys.stderr is used. """ super(WidgetValueHandler, self).__init__() self.buffer = [] if widget is None: self.widget = ipy.Textarea() else: self.widget = widget
Example #18
Source File: ABuWGTLTool.py From abu with GNU General Public License v3.0 | 5 votes |
def init_regress_ui(self): """线性拟合ui""" with self._init_tip_label_with_step_x( self._regress_analyse, u'线性拟合分析') as (widget_list, step_x): self.regress_step_x = step_x self.regress_mode_description = widgets.Textarea( value=u'1. 技术线最少拟合次数:\n' u'检测至少多少次拟合曲线可以代表原始曲线y的走势,' u'通过度量始y值和均线y_roll_mean的距离和原始y值和拟合回归的趋势曲线y_fit的距离的方法,默认使用metrics_rmse\n' u'2. 技术线最优拟合次数:\n' u'寻找多少次多项式拟合回归的趋势曲线可以完美的代表原始曲线y的走势\n' u'3. 可视化技术线拟合曲线:\n' u'通过步长参数在子金融序列中进行走势拟合,形成拟合曲线及上下拟合通道曲线,返回三条拟合曲线,组成拟合通道', disabled=False, layout=self.description_layout ) widget_list.append(self.regress_mode_description) self.regress_mode = widgets.RadioButtons( options={u'技术线最少拟合次数': 0, u'技术线最优拟合次数': 1, u'可视化技术线拟合曲线': 2}, value=0, description=u'拟合模式:', disabled=False ) widget_list.append(self.regress_mode) return widgets.VBox(widget_list, # border='solid 1px', layout=self.tool_layout)
Example #19
Source File: ABuWGPosition.py From abu with GNU General Public License v3.0 | 4 votes |
def _init_widget(self): """构建AbuAtrPosition策略参数界面""" description = widgets.Textarea( value=u'atr资金仓位管理策略:\n' u'默认的仓位资金管理全局策略\n' u'根据决策买入当天的价格波动决策资金仓位配比\n' u'注意不同于卖策,选股,一个买入因子只能有唯一个资金仓位管理策略', description=u'atr资管', disabled=False, layout=self.description_layout ) atr_pos_base_label = widgets.Label(u'仓位基础配比:默认0.1即资金10%为仓位基数', layout=self.label_layout) # 需要精确到小数点后5位 self.atr_pos_base = widgets.FloatSlider( value=0.10, min=0.00001, max=1.0, step=0.00001, description=u'基配', disabled=False, orientation='horizontal', readout=True, readout_format='.5f' ) atr_pos_base_box = widgets.VBox([atr_pos_base_label, self.atr_pos_base]) atr_base_price_label = widgets.Label(u'常数价格设定:默认15,建议在12-20之间', layout=self.label_layout) self.atr_base_price = widgets.IntSlider( value=15, min=12, max=20, step=1, description=u'常价', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) atr_base_price_box = widgets.VBox([atr_base_price_label, self.atr_base_price]) # TODO AbuAtrPosition策略中std_atr_threshold的设置 self.widget = widgets.VBox([description, atr_pos_base_box, atr_base_price_box, self.add_box], layout=self.widget_layout)
Example #20
Source File: ABuWGSellFactor.py From abu with GNU General Public License v3.0 | 4 votes |
def _init_widget(self): """构建AbuFactorAtrNStop策略参数界面""" self.description = widgets.Textarea( value=u'止盈策略 & 止损策略:\n' u'1. 真实波幅atr作为最大止盈和最大止损的常数值\n' u'2. 当stop_loss_n 乘以 当日atr > 买入价格 - 当日收盘价格->止损卖出\n' u'3. 当stop_win_n 乘以 当日atr < 当日收盘价格 -买入价格->止盈卖出', description=u'止盈止损', disabled=False, layout=self.description_layout ) self.stop_loss_n_label = widgets.Label(u'stop_loss_n乘以当日atr大于买价减close->止损', layout=self.label_layout) self.stop_loss_n = widgets.FloatSlider( value=1.0, min=0.10, max=10.0, step=0.1, description='stop_loss_n', disabled=False, orientation='horizontal', readout=True, readout_format='.1f', ) self.stop_loss_n_box = widgets.VBox([self.stop_loss_n_label, self.stop_loss_n]) self.stop_win_n_label = widgets.Label(u'stop_win_n乘以当日atr小于close减买价->止盈', layout=self.label_layout) self.stop_win_n = widgets.FloatSlider( value=3.0, min=0.10, max=10.0, step=0.10, description='stop_win_n', disabled=False, orientation='horizontal', readout=True, readout_format='.1f', ) self.stop_win_n_box = widgets.VBox([self.stop_win_n_label, self.stop_win_n]) self.widget = widgets.VBox([self.description, self.stop_loss_n_box, self.stop_win_n_box, self.add_box], # border='solid 1px', layout=self.widget_layout)
Example #21
Source File: ABuWGSellFactor.py From abu with GNU General Public License v3.0 | 4 votes |
def _init_widget(self): """构建AbuDoubleMaSell策略参数界面""" self.description = widgets.Textarea( value=u'双均线卖出策略:\n' u'双均线策略是量化策略中经典的策略之一,其属于趋势跟踪策略: \n' u'1. 预设两条均线:如一个ma=5,一个ma=60, 5的均线被称作快线,60的均线被称作慢线\n' u'2. 择时卖出策略中当快线下穿慢线(ma5下穿ma60)称为形成死叉卖点信号,卖出股票\n', description=u'双均线卖', disabled=False, layout=self.description_layout ) self.slow_label = widgets.Label(u'默认慢线ma=60:当快线下穿慢线称为形成死叉', layout=self.label_layout) self.slow_int = widgets.IntSlider( value=60, min=10, max=120, step=1, description=u'慢线', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) self.slow_box = widgets.VBox([self.slow_label, self.slow_int]) self.fast_label = widgets.Label(u'默认快线ma=5:当快线下穿慢线称为形成死叉', layout=self.label_layout) self.fast_int = widgets.IntSlider( value=5, min=1, max=90, step=1, description=u'快线', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) self.fast_box = widgets.VBox([self.fast_label, self.fast_int]) self.widget = widgets.VBox([self.description, self.slow_box, self.fast_box, self.add_box], # border='solid 1px', layout=self.widget_layout)
Example #22
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)
Example #23
Source File: ABuWGPosition.py From abu with GNU General Public License v3.0 | 4 votes |
def _init_widget(self): """构建AbuKellyPosition策略参数界面""" description = widgets.Textarea( value=u'kelly资金仓位管理策略:\n' u'根据策略历史胜率期望,盈利期望,亏损期望决策资金仓位配比\n' u'仓位资金配比 = 胜率 - 败率/(盈利期望/亏损期望)\n' u'注意不同于卖策,选股,一个买入因子只能有唯一个资金仓位管理策略', description=u'kelly资管', disabled=False, layout=self.description_layout ) win_rate_label = widgets.Label(u'策略历史胜率期望,默认0.5即50%胜率', layout=self.label_layout) # 需要精确到小数点后5位 self.win_rate = widgets.FloatSlider( value=0.50, min=0.01, max=1.00, step=0.0001, description=u'胜率期望', disabled=False, orientation='horizontal', readout=True, readout_format='.4f' ) win_rate_box = widgets.VBox([win_rate_label, self.win_rate]) gains_mean_label = widgets.Label(u'策略历史盈利期望,默认0.1即10%', layout=self.label_layout) self.gains_mean = widgets.FloatSlider( value=0.10, min=0.01, max=100.00, step=0.0001, description=u'盈利期望', disabled=False, orientation='horizontal', readout=True, readout_format='.4f' ) gains_mean_box = widgets.VBox([gains_mean_label, self.gains_mean]) losses_mean_label = widgets.Label(u'策略历史亏损期望,默认0.05即5%', layout=self.label_layout) self.losses_mean = widgets.FloatSlider( value=0.05, min=0.01, max=100.00, step=0.0001, description=u'亏损期望', disabled=False, orientation='horizontal', readout=True, readout_format='.4f' ) losses_mean_box = widgets.VBox([losses_mean_label, self.losses_mean]) self.widget = widgets.VBox([description, win_rate_box, gains_mean_box, losses_mean_box, self.add_box], layout=self.widget_layout)
Example #24
Source File: speciessearch.py From tellurium with Apache License 2.0 | 4 votes |
def __init__(self, debug=False): """ Creates and displays the search form. """ self.debug = debug self.s = bioservices.BioModels() self.ch = bioservices.ChEBI() # Define widgets # <Search> self.wSearchTerm = w.Text(description='Search biomodels by species:', value="CHEBI:17925") self.wSearchTerm.on_submit(self.searchChebi) self.wSearchButton = w.Button(description='Search') self.wSearchButton.on_click(self.searchChebi) self.wSearchChebi = w.HBox(children=[ self.wSearchTerm, self.wSearchButton ]) self.wSelectChebis = w.Select(description='Matching ChEBI:', width='600px', height='250px') # FIXME: update the deprecated functions self.wSelectChebis.on_trait_change(self.selectChebi) self.wSelectModels = w.Select(description='Matching BioModels:', width='200px') self.wSelectModels.on_trait_change(self.selectedModel) # <Model> self.wModelId = w.Text(description='Model ID:', value="No model selected") self.wModelCode = w.Text(description='Install Code:') self.wModelImport = w.Text(description='Import module code:') self.wModelSbml = w.Textarea(description='Model SBML:', width='800px', height='300px') # <Container> self.wModel = w.VBox([ self.wModelId, self.wModelCode, self.wSelectModels, self.wModelImport, self.wModelSbml ]) for ch in self.wModel.children: ch.font_family = 'monospace' ch.color = '#AAAAAA' ch.background_color = 'black' self.wContainer = w.VBox([ self.wSearchChebi, self.wSelectChebis, self.wModel ]) # display the widgets display(self.wContainer)
Example #25
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 #26
Source File: ABuWGPickStock.py From abu with GNU General Public License v3.0 | 4 votes |
def _init_widget(self): """构建AbuPickStockPriceMinMax策略参数界面""" self.description = widgets.Textarea( value=u'价格选股因子策略:\n' u'根据交易目标的一段时间内收盘价格的最大,最小值进行选股,选中规则:\n' u'1. 交易目标最小价格 > 最小价格阀值\n' u'2. 交易目标最大价格 < 最大价格阀值\n', description=u'价格选股', disabled=False, layout=self.description_layout ) self.price_min_label = widgets.Label(u'设定选股价格最小阀值,默认15', layout=self.label_layout) self.price_min_float = widgets.FloatText( value=15, description=u'最小:', disabled=False ) self.price_min_ck = widgets.Checkbox( value=True, description=u'使用最小阀值', disabled=False ) def price_min_ck_change(change): self.price_min_float.disabled = not change['new'] self.price_min_ck.observe(price_min_ck_change, names='value') self.price_min_box = widgets.VBox([self.price_min_label, self.price_min_ck, self.price_min_float]) self.price_max_label = widgets.Label(u'设定选股价格最大阀值,默认50', layout=self.label_layout) self.price_max_float = widgets.FloatText( value=50, description=u'最大:', disabled=False ) self.price_max_ck = widgets.Checkbox( value=True, description=u'使用最大阀值', disabled=False ) def price_max_ck_change(change): self.price_max_float.disabled = not change['new'] self.price_max_ck.observe(price_max_ck_change, names='value') self.price_max_box = widgets.VBox([self.price_max_label, self.price_max_ck, self.price_max_float]) self.widget = widgets.VBox([self.description, self.price_min_box, self.price_max_box, self.xd_box, self.reversed_box, self.add_box], # border='solid 1px', layout=self.widget_layout)
Example #27
Source File: ABuWGPickStock.py From abu with GNU General Public License v3.0 | 4 votes |
def _init_widget(self): """构建AbuPickRegressAngMinMax策略参数界面""" self.description = widgets.Textarea( value=u'拟合角度选股因子策略:\n' u'将交易目标前期走势进行线性拟合计算一个角度,选中规则:\n' u'1. 交易目标前期走势拟合角度 > 最小拟合角度\n' u'2. 交易目标前期走势拟合角度 < 最大拟合角度\n', description=u'角度选股', disabled=False, layout=self.description_layout ) self.ang_min_label = widgets.Label(u'设定选股角度最小阀值,默认-5', layout=self.label_layout) self.ang_min_float = widgets.IntText( value=-5, description=u'最小:', disabled=False ) self.ang_min_ck = widgets.Checkbox( value=True, description=u'使用最小阀值', disabled=False ) def ang_min_ck_change(change): self.ang_min_float.disabled = not change['new'] self.ang_min_ck.observe(ang_min_ck_change, names='value') self.ang_min_box = widgets.VBox([self.ang_min_label, self.ang_min_ck, self.ang_min_float]) self.ang_max_label = widgets.Label(u'设定选股角度最大阀值,默认5', layout=self.label_layout) self.ang_max_float = widgets.IntText( value=5, description=u'最大:', disabled=False ) self.ang_max_ck = widgets.Checkbox( value=True, description=u'使用最大阀值', disabled=False ) def ang_max_ck_change(change): self.ang_max_float.disabled = not change['new'] self.ang_max_ck.observe(ang_max_ck_change, names='value') self.ang_max_box = widgets.VBox([self.ang_max_label, self.ang_max_ck, self.ang_max_float]) self.widget = widgets.VBox([self.description, self.ang_min_box, self.ang_max_box, self.xd_box, self.reversed_box, self.add_box], # border='solid 1px', layout=self.widget_layout)
Example #28
Source File: ABuWGPosition.py From abu with GNU General Public License v3.0 | 4 votes |
def _init_widget(self): """构建AbuPtPosition策略参数界面""" description = widgets.Textarea( value=u'价格位置仓位管理策略:\n' u'针对均值回复类型策略的仓位管理策略\n' u'根据买入价格在之前一段时间的价格位置来决策仓位大小\n' u'假设过去一段时间的价格为[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n' u'如果当前买入价格为2元:则买入仓位配比很高(认为均值回复有很大向上空间)\n' u'如果当前买入价格为9元:则买入仓位配比很低(认为均值回复向上空间比较小)', description=u'价格位置', disabled=False, layout=self.description_layout ) pos_base_label = widgets.Label(u'仓位基础配比:默认0.1即资金10%为仓位基数', layout=self.label_layout) # 需要精确到小数点后5位 self.pos_base = widgets.FloatSlider( value=0.10, min=0.00001, max=1.0, step=0.00001, description=u'基配', disabled=False, orientation='horizontal', readout=True, readout_format='.5f' ) pos_base_box = widgets.VBox([pos_base_label, self.pos_base]) past_day_cnt_label = widgets.Label(u'根据过去多长一段时间的价格趋势做为参考,默认20', layout=self.label_layout) self.past_day_cnt = widgets.IntSlider( value=20, min=5, max=250, step=1, description=u'参考天数', disabled=False, orientation='horizontal', readout=True, readout_format='d' ) past_day_cnt_box = widgets.VBox([past_day_cnt_label, self.past_day_cnt]) self.widget = widgets.VBox([description, pos_base_box, past_day_cnt_box, self.add_box], layout=self.widget_layout)