Exemple #1
0
                           html.A('Select Files')]),
        style={
            'lineHeight': '60px',
            'borderWidth': '1px',
            'borderStyle': 'dashed',
            'borderRadius': '5px',
            'textAlign': 'center',
        },
        className='uploader',
        # Allow multiple files to be uploaded
        multiple=True),
])

page.layout = html.Div([
    html.Div([dcc.Store(id='store-local-data', storage_type='session')]),
    trade_table_display,
    html.H4("Upload excel sheet"),
    trade_upload,
])


def parse_contents(contents, filename):
    content_type, content_string = contents.split(',')
    decoded = base64.b64decode(content_string)
    try:
        if 'csv' in filename:
            # Assume that the user uploaded a CSV file
            df = pd.read_csv(io.StringIO(decoded.decode('utf-8')))
        elif 'xls' in filename:
            # Assume that the user uploaded an excel file
            df = pd.read_excel(io.BytesIO(decoded))
    except Exception as e:
Exemple #2
0
        start_date=(datetime.today() - timedelta(30)).date(),
        end_date=datetime.today().date(),
        display_format='MMM Do, YY',
        persistence=True,
        persisted_props=['start_date'],
        updatemode='bothdates',
    ),
    html.Br(),
    dcc.Graph(id='exit-quality-indicator', figure=exit_quality_fig)
])

page.layout = [
    html.H1(
        page.name,
        style={
            "margin-bottom": "10px",
            "margin-left": "4px",
        },
    ),
    generate_analysis_mode_dropdown(page.id), gauge_layout
]


@app.callback(Output('exit-quality-indicator', 'figure'), [
    Input('date-picker', 'start_date'),
    Input('date-picker', 'end_date'),
    Input('exit-quality-asset-dropdown', 'value')
], [
    State(page.id + '-buy-price-dict', 'data'),
    State(page.id + '-sell-price-dict', 'data')
])
def update_exit_quality_indicator(start_date, end_date, stock_code,