Warning: session_start(): open(/var/lib/php/sessions/sess_vqq1tn5itsitdfsucgir5oi4bj, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass MPM {
new Set imaginaryPositions;
new Set realPositions;
Position newShort() { ret new Position().direction(-1); }
Position newLong() { ret new Position().direction(1); }
abstract class CloseReason {}
class LossClose > CloseReason {}
class HappyClose > CloseReason {}
class RegularClose > CloseReason {} // pullback close
settable double fees = 0.12;
settable double minReasonableProfit = .1; // in percent before leverage
class Position {
settable bool real;
// -1 (short) or 1 (long)
settable int direction;
settable double openingTime;
settable double openingPrice;
simplyCached double openingPriceWithFees() {
ret openingPrice*(1-fees/100*direction);
}
settable double relativeValue;
settable double maxRelativeValue;
// null when position is open, not null when position was closed
settable CloseReason closeReason;
}
}