Class AntherPosition

java.lang.Object
com.bluebell.greenhouse.anther.models.position.AntherPosition
All Implemented Interfaces:
Comparable<AntherPosition>

public class AntherPosition extends Object implements Comparable<AntherPosition>
Class representation of a position taken in an AntherTradingStrategy.
Version:
2.0.3
Author:
Stephen Prizio
  • Constructor Details

    • AntherPosition

      public AntherPosition()
  • Method Details

    • getPoints

      public double getPoints()
      Returns the net points gained/lost by comparing the open and closing price.
      Returns:
      close price - open price
    • getPositionDuration

      public long getPositionDuration()
      Returns the duration of the position in minutes.
      Returns:
      time between position open and close time
    • calculateProfit

      public double calculateProfit(double pricePerPoint)
      Calculates the total profit for this position.
      Parameters:
      pricePerPoint - price per point
      Returns:
      price per point * net points
    • isLong

      public boolean isLong()
      Returns whether the position is a short or long position.
      Returns:
      true if long, false if short
    • compareTo

      public int compareTo(AntherPosition o)
      Defines the sort order.
      Specified by:
      compareTo in interface Comparable<AntherPosition>
      Parameters:
      o - AntherPosition
      Returns:
      sort order
    • equals

      public boolean equals(Object o)
      Defines an object's equivalence with this entity.
      Overrides:
      equals in class Object
      Parameters:
      o - the reference object with which to compare
      Returns:
      true if equal
    • hashCode

      public int hashCode()
      Computes the hash code.
      Overrides:
      hashCode in class Object
      Returns:
      hash code