Receiving inputs for the bot
Dec 9, 2023
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,
- Real trading — Option for real trading with brokers.
- Backtesting — Option for backtesting strategy.
- Collect Data — Option for collecting data for backtest.
- 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.