function endOfDayEmail() { $email = new email(email::ADDRESSES_ALL_ACTIVE); $allText = array(BREAKOUT_TRADE => '', LONG_TRADE => '', PULLBACK_TRADE => '', SHORT_TRADE => '', BACKDRAFT_TRADE => '', BREAKDOWN_TRADE => ''); $transHistory = new transactions(); while ($transHistory->loadNext(' DATE(`transaction_date`) = DATE(NOW()) ')) { $hId = $transHistory->get_variable('transaction_holdings_id'); $holdings = new holdings(); $holdings->set_variable("holdings_id", $hId); if (!$holdings->load()) { continue; } $tId = $holdings->get_variable("holdings_ticker_id"); $ticker = new ticker(); $ticker->set_variable('ticker_id', $tId); if ($ticker->load()) { $symbol = $ticker->get_variable('ticker_symbol'); //echo "Adding to EOD EMAIL " . $symbol . "\n\n"; $tranDate = $transHistory->get_variable('transaction_date'); $tz = new DateTimeZone('America/New_York'); $date = new DateTime($tranDate); $date->setTimeZone($tz); $dateStr = $date->format("h:i A"); $tradeType = $transHistory->get_variable('transaction_tradetype'); $action = intval($transHistory->get_variable('transaction_action')); $actionPrice = floatval($transHistory->get_variable('transaction_price')); $actionInfo = email::GetEmailText($tradeType, $action, $symbol, $actionPrice, "", false); if (strlen($actionInfo["body"]) > 0) { $allText[$tradeType] .= "<div style=\"\" >" . $dateStr . " - " . $actionInfo["body"] . "</div>"; } } } $bodyText = ''; foreach ($allText as $key => $value) { if (strlen($value) > 0) { $bodyText .= "<div style=\"font-size:13pt;font-family:Helvetica;text-decoration:underline;text-align:center;padding-bottom:7px;padding-top:20px;font-weight:bold\">" . GetTradeTypeConstantName($key) . "</div>" . $value; } } if (strlen($bodyText) == 0) { echo "NO TRANSACTIONS TODAY " . $transHistory->debug(); $email->endOfDay("There were no BioBounce events today."); } else { echo "SENDING EOD EMAIL\n\n"; $email->endOfDay($bodyText); } }
public function newEmail($tradeType, $action, $symbol, $actionPrice, $optionalMessage = "") { $emailInfo = email::GetEmailText($tradeType, $action, $symbol, $actionPrice, $optionalMessage); if (strlen($emailInfo["body"]) > 0) { $this->sendMail($emailInfo["subject"], $emailInfo["body"], true); $this->sendTextMail($emailInfo["subject"], $emailInfo["body"]); } }
public function newTweet($tradeType, $action, $symbol, $last, $optionalMessage = "") { $tweetInfo = email::GetEmailText($tradeType, $action, $symbol, $last, $optionalMessage); $this->sendTweet($tweetInfo["body"]); }