Added todo
This commit is contained in:
parent
793fd40b4c
commit
df45866b5f
@ -21,6 +21,7 @@ mod managers;
|
|||||||
mod models;
|
mod models;
|
||||||
mod strategy;
|
mod strategy;
|
||||||
mod ticker;
|
mod ticker;
|
||||||
|
mod tests;
|
||||||
|
|
||||||
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
|
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ mod common {
|
|||||||
use crate::models::{Position, PositionState, TradingPlatform};
|
use crate::models::{Position, PositionState, TradingPlatform};
|
||||||
use crate::models::PositionProfitState::Loss;
|
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".
|
// Generates two short positions with different profit/loss ratios. Both are position in "Loss".
|
||||||
pub fn get_short_loss_positions(pair: SymbolPair) -> (Position, Position) {
|
pub fn get_short_loss_positions(pair: SymbolPair) -> (Position, Position) {
|
||||||
let almost_critical = Position::new(pair.clone(),
|
let almost_critical = Position::new(pair.clone(),
|
||||||
@ -69,6 +71,7 @@ mod positions {
|
|||||||
assert_eq!(one.id(), 0);
|
assert_eq!(one.id(), 0);
|
||||||
assert_eq!(one.leverage(), 0.0);
|
assert_eq!(one.leverage(), 0.0);
|
||||||
assert_eq!(one.price_liq(), 150.0);
|
assert_eq!(one.price_liq(), 150.0);
|
||||||
|
assert_eq!(one.state(), PositionState::Open);
|
||||||
assert!(one.price_liq() > one.base_price());
|
assert!(one.price_liq() > one.base_price());
|
||||||
|
|
||||||
let (two, three) = get_short_loss_positions(pair);
|
let (two, three) = get_short_loss_positions(pair);
|
||||||
|
Loading…
Reference in New Issue
Block a user