Class dao_position

Description

data access object for table position

Located in /lib/dao_position.class.php (line 34)

vo
   |
   --vo_position
      |
      --dao_position
Variable Summary
Method Summary
 string get_css_class ([int $id_position = false])
 float get_investment ([bool $adjust_by_charges = false], [bool $adjust_by_dividend = false])
 float get_market_value ()
 float get_quote ([$return_id_quote $return_id_quote = false])
 int get_quotetime ()
 float get_weight (float $portfolio_market_value)
 void is_closed ()
 boolean is_empty ()
 void is_short ()
 void set_quote (float $quote, int $quotetime,  $id_quote)
 void set_quote2 (object $vo_quote)
Variables
float $avg_purchase = 0.0 (line 70)

average purchase quote

  • see: sql_select_positions()
  • access: public
float $charges = 0.0 (line 78)

charges recorded on orders of this position

int $date = 0 (line 41)

date form the last (?) PositionRevision

  • see: sql_select_positions()
  • access: public
float $dividend = 0.0 (line 85)

dividend received in this position

float $invested = 0.0 (line 63)

invested amount of money, BETTER use get_investment()

string $name = '' (line 48)

name of the security held in the position (stock.name)

  • see: sql_select_positions()
  • access: public
int $shares = 0 (line 55)

number of shares in the position

float $stoploss_hard = 0.0 (line 97)

stoploss hard limit

  • access: public
bool $stoploss_present = false (line 112)

stoploss present?

  • todo: convert into method
  • access: public
float $stoploss_soft = 0.0 (line 91)

stoploss soft limit

  • access: public
string $stoploss_status = 'no order present' (line 105)

stoploss status

  • todo: convert into method
  • access: public
int $_id_quote = 0 (line 124)

database id of $_quote

  • access: private
float $_quote = 0.0 (line 118)

current quote for $name

  • access: private
int $_quotetime = 0 (line 130)

unix-timestamp of current @_quote

  • access: private

Inherited Variables

Inherited from vo_position

vo_position::$closed
vo_position::$comment
vo_position::$id
vo_position::$id_portfolio
vo_position::$id_stock
Methods
get_css_class (line 225)

return a CSS classname to display this position, depends in the investment state (empty, short, ...) and/or whether the position is currently selected or not (see $id_position)

NOTE: this is here because templates get too complicated otherwise

  • access: public
string get_css_class ([int $id_position = false])
  • int $id_position
get_investment (line 199)

returns invested money automatically respects the open/close status since a gain is recorded negativ and a loss is recorded positive in the database! Optionally the investment can be adjusted by dividend and/or charges.

float get_investment ([bool $adjust_by_charges = false], [bool $adjust_by_dividend = false])
  • bool $adjust_by_charges
  • bool $adjust_by_dividend
get_market_value (line 183)

returns current market value (shares * quote)

float get_market_value ()
get_quote (line 162)

return current quote for $name or id_quote if

$return_id_quote is set

  • access: public
float get_quote ([$return_id_quote $return_id_quote = false])
  • $return_id_quote $return_id_quote: bool
get_quotetime (line 174)

return time of current quote

  • access: public
int get_quotetime ()
get_weight (line 248)

returns the "weight" of this position in relation to the total market

value of the portfolio, in percent

  • access: public
float get_weight (float $portfolio_market_value)
  • float $portfolio_market_value
is_closed (line 280)

tell whether this position has been closed

  • access: public
void is_closed ()
is_empty (line 258)

tell whether this position is empty

  • access: public
boolean is_empty ()
is_short (line 269)

tell whether this position is a short position

  • access: public
void is_short ()
set_quote (line 139)

set $quote

  • todo: deprecated, set_quote2() is how it should be done
  • access: public
void set_quote (float $quote, int $quotetime,  $id_quote)
  • float $quote
  • int $quotetime
  • $id_quote
set_quote2 (line 150)

set $quote

  • access: public
void set_quote2 (object $vo_quote)
  • object $vo_quote

Inherited Methods

Inherited From vo_position

 vo_position::get_primary_key()
 vo_position::store()

Inherited From vo

 vo::__construct()

Documentation generated on Sun, 22 Aug 2010 11:20:15 +0200 by phpDocumentor 1.4.3