Esempio n. 1
0
def update_accordions(clicks):
    """create bot accordions"""
    acc_list = []
    pair_count = 0
    for i in tg_wrapper.helper.get_all_bot_list():
        tg_wrapper.helper.read_data(i)
        state = "defaulted"
        if "botcontrol" in tg_wrapper.helper.data:
            state = tg_wrapper.helper.data["botcontrol"]["status"]
        buttons = []
        buttons.append(
            dbc.Button(
                "Stop",
                id={
                    "type": "btn-stop",
                    "index": pair_count
                },
                n_clicks=0,
                value=i,
                className="btn btn-primary",
            ))
        if state not in ("paused", "stopped"):
            buttons.append(
                dbc.Button(
                    "Pause",
                    id={
                        "type": "btn-pause",
                        "index": pair_count
                    },
                    n_clicks=0,
                    value=i,
                    className="btn btn-primary",
                ))
        if state in ("paused"):
            buttons.append(
                dbc.Button(
                    "Resume",
                    id={
                        "type": "btn-resume",
                        "index": pair_count
                    },
                    n_clicks=0,
                    value=i,
                    className="btn btn-primary",
                ))
        if tg_wrapper.helper.data["margin"] == " ":
            buttons.append(
                dbc.Button(
                    "Buy",
                    id={
                        "type": "btn-buy",
                        "index": pair_count
                    },
                    n_clicks=0,
                    value=i,
                    className="btn btn-primary",
                ))
        else:
            buttons.append(
                dbc.Button(
                    "Sell",
                    id={
                        "type": "btn-sell",
                        "index": pair_count
                    },
                    n_clicks=0,
                    value=i,
                    className="btn btn-primary",
                ))

        acc_list.append(
            dbc.AccordionItem(
                buttons,
                title=f"{i} - {get_bot_status(i)}",
                item_id=i,
                class_name="justify-content-md-center",
            ))
        pair_count += 1

    accordion = html.Div(
        dbc.Accordion(id="bots", children=acc_list, start_collapsed=True),
        className="d-grid gap-2",
    )

    return accordion
import dash_bootstrap_components as dbc
from dash import Input, Output, html

accordion = html.Div(
    [
        dbc.Accordion(
            [
                dbc.AccordionItem(
                    "This is the content of the first section",
                    title="Item 1",
                    item_id="item-1",
                ),
                dbc.AccordionItem(
                    "This is the content of the second section",
                    title="Item 2",
                    item_id="item-2",
                ),
                dbc.AccordionItem(
                    "This is the content of the third section",
                    title="Item 3",
                    item_id="item-3",
                ),
            ],
            id="accordion",
            active_item="item-1",
        ),
        html.Div(id="accordion-contents", className="mt-3"),
    ]
)

Esempio n. 3
0
         width={
             "size": 12,
             "offset": 0
         },
     )),
 # html buttons
 dbc.Collapse(
     dbc.Card(dbc.CardBody(html.Div(id="market-scan-options"), )),
     id="scan_options",
     is_open=False,
 ),
 html.P(),
 dbc.Accordion(
     children=dbc.AccordionItem(
         id="start-accordian",
         title="Manual Start Bot List",
         class_name="justify-content-md-center",
     ),
     start_collapsed=True,
 ),
 html.P(),
 dbc.Accordion(
     children=dbc.AccordionItem(
         id="bot-accordian",
         title="Bot Controls",
         class_name="justify-content-md-center",
     ),
     start_collapsed=True,
 ),
 html.P(),
 dcc.Interval(id="interval-container", interval=30000, n_intervals=0),
import dash_bootstrap_components as dbc
from dash import html

accordion = html.Div(
    dbc.Accordion(
        [
            dbc.AccordionItem("This is the content of the first section",
                              title="Item 1"),
            dbc.AccordionItem("This is the content of the second section",
                              title="Item 2"),
            dbc.AccordionItem("This is the content of the third section",
                              title="Item 3"),
        ],
        start_collapsed=True,
    ), )