30 lines
620 B
Rust
30 lines
620 B
Rust
pub enum PositionState {
|
|
Critical,
|
|
Loss,
|
|
BreakEven,
|
|
MinimumProfit,
|
|
Profit,
|
|
}
|
|
|
|
impl PositionState {
|
|
fn color(self) -> String {
|
|
match self {
|
|
PositionState::Critical | PositionState::Loss => { "red" }
|
|
PositionState::BreakEven => { "yellow" }
|
|
PositionState::MinimumProfit | PositionState::Profit => { "green" }
|
|
}.into()
|
|
}
|
|
}
|
|
|
|
// TODO: implement position in bitfinex API before completing this struct
|
|
pub struct PositionWrapper {
|
|
position: String,
|
|
net_profit_loss: f64,
|
|
net_profit_loss_percentage: f64,
|
|
state: PositionState
|
|
}
|
|
|
|
|
|
|
|
|