Receiving inputs for the bot

Sungmin Kim
Dec 9, 2023

--

An image depicting a quant bot, designed as a futuristic robot with sleek, metallic surfaces, sitting in a modern, high-tech office environment.
image made with DALL-E

Making options for bot

First of all, I’ll make bot to accept options for the run.

cargo add dialoguer

I’ll use dialoguer to get option selects from console.

    log::info!("Select option to run");

let options = [
"0. Real trading",
"1. Backtesting",
"2. Collect data",
"3. Exit",
];

The bot gets 4 options,

  1. Real trading — Option for real trading with brokers.
  2. Backtesting — Option for backtesting strategy.
  3. Collect Data — Option for collecting data for backtest.
  4. Exit — Option for exiting the bot.
Select::with_theme(&ColorfulTheme::default())
.with_prompt("Run option")
.items(&options[..])
.default(0)
.interact()
.unwrap();

Then, Bot will receive input with dialoguer::Select.

[2023-12-09T16:30:26Z INFO  quant_v2] Select option to run
? Run option ›
❯ 0. Real trading
1. Backtesting
2. Collect data
3. Exit
4. Development - Aggregates count diff test

The bot will able to receive with keyboard up, down or number input.

--

--