Esempio n. 1
0
def show_menu():
    user_name = build.get_first_name()
    resp = inline_keyboard(f"Hi {user_name}. Let's get started")
    resp.add_button("new_strat", "Launch New Strategy")
    resp.add_button("performance_report", "Run performance report")
    resp.add_button("update_goals", "Update Goals")
    resp.add_button("upgrade_skills", "Upgrade Skills")
    resp.add_button("adjust_keytpos", "Adjust Kryptos")

    return resp
Esempio n. 2
0
def prompt_exchange(existing_strategy):
    current_app.logger.debug(f"Building strategy for {existing_strategy}")
    context_manager.set("strat-config-data", "existing_strategy",
                        existing_strategy)
    speech = "Which exchange would you like to trade on?"
    resp = inline_keyboard(dedent(speech))
    for e in build.EXCHANGES:
        resp.add_button(*e)
        current_app.logger.debug("Engqueuing exchange option jobs")
        # enqueue job to be ready when needed
        task.get_exchange_asset_pairs(e[1])
        task.get_exchange_quote_currencies(e[1])

    return resp
Esempio n. 3
0
def prompt_trade_currency(capital_base):
    current_app.logger.debug(f"Setting capital base as {capital_base}")
    context_manager.set("strat-config-data", "captial_base", capital_base)

    speech = "Which asset would you like to trade?"
    resp = inline_keyboard(speech)

    exchange = context_manager.get("strat-config-data").get("exchange")
    quote_currency = context_manager.get("strat-config-data").get(
        "quote_currency")

    options = task.get_available_base_currencies(exchange, quote_currency)

    for o in options:
        resp.add_button(o, o)
    return resp
Esempio n. 4
0
def prompt_quote_currency(exchange):
    current_app.logger.debug(f"Setting exchange as {exchange}")
    context_manager.set("strat-config-data", "exchange", exchange)
    speech = f"""\
    Which currency would you like to use as the quote currency?
    This is the currency you will sell when making a buy order, and recieve when making a sell order.

    You must also allocate an amount of this currency to the strategy as capital base
    This means you must hold the currency on {exchange} for live trading.
    """
    resp = inline_keyboard(dedent(speech))
    quotes = task.get_exchange_quote_currencies(exchange)

    for q in quotes:
        resp.add_button(q.lower(), q)
    return resp
Esempio n. 5
0
def launch_strategy_live(existing_strategy):
    context = context_manager.get("strat-config-data")
    job_id = build.launch_live(context)

    url = os.path.join(current_app.config["FRONTEND_URL"], "strategy", job_id)

    hours = context.get("hours")
    speech = f"""\
    Great! The strategy is now live and will run for the next {hours} hours.

    You can view your strategy's progress by clicking the link \
    below and I will keep you updated on how it performs.
    """.format(hours)

    resp = inline_keyboard(dedent(speech))
    resp.add_button(url, "View your Strategy")
    return resp
Esempio n. 6
0
def prompt_for_mode():
    context = context_manager.get("strat-config-data")
    # backtest_id = build.launch_backtest(context)

    # current_app.logger.info(f"Queues Strat {backtest_id}")
    # backtest_url = os.path.join(
    #     current_app.config["FRONTEND_URL"], "strategy/backtest/strategy/", backtest_id
    # )

    speech = f"Your strategy is now configured!\n\n Would you like to launch it?\n\n"

    resp = inline_keyboard(dedent(speech))
    # resp.add_button("View Past Performance", url=backtest_url)
    resp.add_button("paper", "Launch in Paper Mode")
    resp.add_button("live", "Lauch in Live mode")
    resp.add_button("no", "Nevermind")

    return resp
Esempio n. 7
0
def welcome_message():
    user_name = build.get_first_name()
    msg = f"Hello {user_name}!"
    msg += """I’m Kryptos AI, your virtual investment assistant\
    that manages your cryptocurrency portfolio and automate\
    your cryptocurrency trading"""

    if build.get_user() is None:
        current_app.logger.info("Prompting user to login")
        msg += """\n\n \
        Before we can get started,you'll need to \
        create a free Kryptos account and authentiate with Telegram
        """
        resp = inline_keyboard(msg)
        url = os.path.join(current_app.config["FRONTEND_URL"],
                           "account/telegram")
        resp.add_button("Create an account", url=url)
        return resp

    return ask(msg)
Esempio n. 8
0
def display_available_strats():
    context_manager.add("strat-config-data")
    resp = inline_keyboard("Which strategy do you wish to try?")
    for i in build.EXISTING_STRATS:
        resp.add_button(*i)
    return resp