36 lines
849 B
Rust
36 lines
849 B
Rust
use tokio::time::{delay_for, Duration};
|
|
|
|
use crate::bot::BfxBot;
|
|
use crate::connectors::BfxWrapper;
|
|
use crate::currency::{Symbol, SymbolPair};
|
|
use crate::strategy::TrailingStop;
|
|
|
|
mod bot;
|
|
mod connectors;
|
|
mod currency;
|
|
mod events;
|
|
mod orders;
|
|
mod pairs;
|
|
mod positions;
|
|
mod strategy;
|
|
mod ticker;
|
|
|
|
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<(), BoxError> {
|
|
let test_api_key = "P1EVE68DJByDAkGQvpIkTwfrbYXd2Vo2ZaIhTYb9vx2";
|
|
let test_api_secret = "1nicg8z0zKVEt5Rb7ZDpIYjVYVTgvCaCPMZqB0niFli";
|
|
//
|
|
let bfx = BfxWrapper::new(test_api_key, test_api_secret);
|
|
let mut bot = BfxBot::new(
|
|
bfx,
|
|
vec![Symbol::TESTBTC],
|
|
Symbol::TESTUSD,
|
|
Duration::new(20, 0),
|
|
)
|
|
.with_strategy(Box::new(TrailingStop::new()));
|
|
|
|
Ok(bot.start_loop().await?)
|
|
}
|