Added todo

This commit is contained in:
Giulio De Pasquale 2021-02-25 20:39:04 +00:00
parent 793fd40b4c
commit df45866b5f
2 changed files with 4 additions and 0 deletions

View File

@ -21,6 +21,7 @@ mod managers;
mod models;
mod strategy;
mod ticker;
mod tests;
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;

View File

@ -3,6 +3,8 @@ mod common {
use crate::models::{Position, PositionState, TradingPlatform};
use crate::models::PositionProfitState::Loss;
// TODO: generate other helper generator functions like the one below
// Generates two short positions with different profit/loss ratios. Both are position in "Loss".
pub fn get_short_loss_positions(pair: SymbolPair) -> (Position, Position) {
let almost_critical = Position::new(pair.clone(),
@ -69,6 +71,7 @@ mod positions {
assert_eq!(one.id(), 0);
assert_eq!(one.leverage(), 0.0);
assert_eq!(one.price_liq(), 150.0);
assert_eq!(one.state(), PositionState::Open);
assert!(one.price_liq() > one.base_price());
let (two, three) = get_short_loss_positions(pair);