def proceed(self, contract): try: s, d = lf(contract.upper()).plot(embed=True) bbase = f"http://cdn.pydata.org/bokeh/release/bokeh-{bv}.min" _holder = '.'.join((bbase, 'js')) bscript = f'<script type="text/javascript" \ scr="{_holder}"></script>' blink = f'<link href="{bbase}.css" \ rel="stylesheet" type="text/css" />' blink += bscript + \ f'<script type="text/javascript"> \ Bokeh.set_log_level="info"; </script>{s}' hd = HEAD( linesep.join( ['<meta charset="utf-8">', str(TITLE(contract)), blink])) bd = BODY(d) return str(HTML(linesep.join([str(v) for v in [hd, bd]]))) except Exception: if panda: i2 = PI(code=contract) opt_value = 'B' if len(i2.trade_day) > i2.period: opt_value = 'I' return PI(code=contract).fdc(option=opt_value).to_html() return summary(code=contract, format='html')
def index(self): hd = HEAD(TITLE('Analyse records')) ops = [OPTION(_, {'value': _}) for _ in waf()] if today.day == ltd(today.year, today.month): ops = [OPTION(_, {'value': _}) for _ in waf(1)] if version_info.major == 3: if version_info.minor > 6: sl = SELECT(linesep.join([f'{_}' for _ in ops]), {'name': 'contract'}) btn = BUTTON('Analyse', {'type': 'submit'}) trs = [ TR( linesep.join([ f'{_}' for _ in [ TD(LABEL('Contract: ')), TD(linesep.join([f'{__}' for __ in [sl, btn]]), {'align': 'right'}) ] ])) ] bd = BODY( FORM(TABLE(linesep.join([f'{_}' for _ in trs])), { 'method': 'post', 'action': 'proceed' })) return str(HTML(linesep.join([f'{_}' for _ in [hd, bd]]))) else: sl = SELECT(linesep.join(['{}'.format(_) for _ in ops]), {'name': 'contract'}) btn = BUTTON('Analyse', {'type': 'submit'}) trs = [ TR( linesep.join([ '{}'.format(_) for _ in [ TD(LABEL('Contract: ')), TD( linesep.join([ '{}'.format(__) for __ in [sl, btn] ]), {'align': 'right'}) ] ])) ] bd = BODY( FORM(TABLE(linesep.join(['{}'.format(_) for _ in trs])), { 'method': 'post', 'action': 'proceed' })) return str( HTML(linesep.join(['{}'.format(_) for _ in [hd, bd]])))
def proceed(self, code, pp=None): _ = Equities(int(code)) hd = HEAD(TITLE(f'{code} for {today}')) text_attrs = { 'style': 'height:70px;width:650px;', 'disabled': True, 'autofocus': False } bd = BODY( TABLE( linesep.join([ f"{TR(TD(TEXTAREA(__, text_attrs)))}" for __ in [_, _(), _.gat()] ]))) # bd = BODY(TABLE( # linesep.join([f'{TR(TD(__))}' for __ in [_, _(), _.gat()]]))) return str(HTML(linesep.join(['{}'.format(_) for _ in [hd, bd]])))
def index(self): hd = HEAD(TITLE('Estimate session range')) ae = entities() ops = [OPTION(_, {'value': _}) for _ in ae] if version_info.major == 3: if version_info.minor > 6: sl = SELECT(linesep.join([f'{_}' for _ in ops]), {'name': 'code'}) btn = BUTTON('Estimate', {'type': 'submit'}) trs = [ TR( linesep.join([ f'{_}' for _ in [ TD(LABEL('Code: ')), TD(linesep.join([f'{__}' for __ in [sl, btn]]), {'align': 'right'}) ] ])) ] # trs.append(TR(linesep.join([f'{_}' for _ in [ # TD('Pivot Point', {'align':'right'}), # TD(INPUT({'type':'text','name':'pp'}))]]))) bd = BODY( FORM(TABLE(linesep.join([f'{_}' for _ in trs])), { 'method': 'post', 'action': 'proceed' })) return str(HTML(linesep.join([f'{_}' for _ in [hd, bd]]))) else: sl = SELECT(linesep.join(['{}'.format(_) for _ in ops]), {'name': 'code'}) btn = BUTTON('Estimate', {'type': 'submit'}) trs = [ TR( linesep.join([ '{}'.format(_) for _ in [ TD(LABEL('Code: ')), TD( linesep.join([ '{}'.format(__) for __ in [sl, btn] ]), {'align': 'right'}) ] ])) ] trs.append( TR( linesep.join([ '{}'.format(_) for _ in [ TD('Pivot Point', {'align': 'right'}), TD(INPUT({ 'type': 'text', 'name': 'pp' })) ] ]))) bd = BODY( FORM(TABLE(linesep.join(['{}'.format(_) for _ in trs])), { 'method': 'post', 'action': 'proceed' })) return str( HTML(linesep.join(['{}'.format(_) for _ in [hd, bd]])))
def index(self): hd = HEAD(TITLE('Daily statistic recording')) ops = [OPTION(_, {'value': _}) for _ in waf()] if today.day == ltd(today.year, today.month): ops = [OPTION(_, {'value': _}) for _ in waf(1)] sl = SELECT(linesep.join([f'{_}' for _ in ops]), {'name': 'contract'}) btn = BUTTON('Append', {'type': 'submit'}) if version_info.major == 3: if version_info.minor > 6: sl = SELECT(linesep.join([f'{_}' for _ in ops]), {'name': 'contract'}) btn = BUTTON('Append', {'type': 'submit'}) trs = [ TR( linesep.join([ f'{_}' for _ in [ TD(LABEL('Contract: ')), TD(linesep.join([f'{__}' for __ in [sl, btn]]), {'align': 'right'}) ] ])) ] trs.extend([ TR( linesep.join([ f'{_}' for _ in [ TD(f'{__.capitalize()}', {'align': 'right'}), TD(INPUT({ 'type': 'text', 'name': __ })) ] ])) for __ in ['open', 'high', 'low', 'close', 'volume'] ]) bd = BODY( FORM(TABLE(linesep.join([f'{_}' for _ in trs])), { 'method': 'post', 'action': 'append' })) return str(HTML(linesep.join([f'{_}' for _ in [hd, bd]]))) else: sl = SELECT(linesep.join(['{}'.format(_) for _ in ops]), {'name': 'contract'}) btn = BUTTON('Append', {'type': 'submit'}) trs = [ TR( linesep.join([ '{}'.format(_) for _ in [ TD(LABEL('Contract: ')), TD( linesep.join([ '{}'.format(__) for __ in [sl, btn] ]), {'align': 'right'}) ] ])) ] trs.extend([ TR( linesep.join([ '{}'.format(_) for _ in [ TD(f'{__.capitalize()}', {'align': 'right'}), TD(INPUT({ 'type': 'text', 'name': __ })) ] ])) for __ in ['open', 'high', 'low', 'close', 'volume'] ]) bd = BODY( FORM(TABLE(linesep.join(['{}'.format(_) for _ in trs])), { 'method': 'post', 'action': 'append' })) return str( HTML(linesep.join(['{}'.format(_) for _ in [hd, bd]])))