當前位置: 首頁>>代碼示例>>PHP>>正文


PHP stock_transaction_record函數代碼示例

本文整理匯總了PHP中stock_transaction_record函數的典型用法代碼示例。如果您正苦於以下問題:PHP stock_transaction_record函數的具體用法?PHP stock_transaction_record怎麽用?PHP stock_transaction_record使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了stock_transaction_record函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: json_encode

     echo json_encode($retArray);
 } elseif ($_GET['action'] == 'get_stock_transaction_record') {
     $symbol = $_GET['symbol'];
     $start_date = $_GET['start_date'];
     $end_date = $_GET['end_date'];
     $pid = $_GET['portfolio_id'];
     // if end date is not supplied, default to today
     if (!$end_date) {
         $end_date = date("Y-m-d");
     }
     if (!$pid) {
         $pid = 1;
     }
     $retArray = array();
     $stockRetArray = array();
     $stockRetArray = stock_transaction_record($symbol, $start_date, $end_date, $pid);
     $arrayLen = count($stockRetArray);
     for ($x = 0; $x < $arrayLen; $x++) {
         $newDateStr = strtotime($stockRetArray[$x]['trade_date']);
         $newDateStr = $newDateStr * 1000 - 14400000;
         $price = $stockRetArray[$x]['price'] * 1 / 1;
         $title = $stockRetArray[$x]['trade_type'];
         $text = $stockRetArray[$x]['trade_type'] . " " . $stockRetArray[$x]['shares'] . " shares at " . $price;
         $eachRow = array();
         $eachRow['x'] = $newDateStr;
         $eachRow['y'] = $price;
         $eachRow['title'] = $title;
         $eachRow['text'] = $text;
         array_push($retArray, $eachRow);
     }
     echo json_encode($retArray);
開發者ID:jimmyc815,項目名稱:algo,代碼行數:31,代碼來源:connorsRSI_strat_5.php

示例2: array

     $stockRetArray = array();
     $stockRetArray = historical_stock_return($symbol, $start_date);
     $arrayLen = count($stockRetArray);
     for ($x = 0; $x < $arrayLen; $x++) {
         $newDateStr = strtotime($stockRetArray[$x]['trade_date']);
         $newDateStr = $newDateStr * 1000 - 14400000;
         $ma_200 = $stockRetArray[$x]['200_MA'] * 1 / 1;
         array_push($retArray, array($newDateStr, $ma_200));
     }
     echo json_encode($retArray);
 } elseif ($_GET['action'] == 'get_stock_transaction_record') {
     $symbol = $_GET['symbol'];
     $start_date = $_GET['start_date'];
     $retArray = array();
     $stockRetArray = array();
     $stockRetArray = stock_transaction_record($symbol, $start_date);
     $arrayLen = count($stockRetArray);
     for ($x = 0; $x < $arrayLen; $x++) {
         $newDateStr = strtotime($stockRetArray[$x]['trade_date']);
         $newDateStr = $newDateStr * 1000 - 14400000;
         $price = $stockRetArray[$x]['price'] * 1 / 1;
         $title = $stockRetArray[$x]['trade_type'];
         $text = $stockRetArray[$x]['trade_type'] . " " . $stockRetArray[$x]['shares'] . " shares at " . $price;
         $eachRow = array();
         $eachRow['x'] = $newDateStr;
         $eachRow['y'] = $price;
         $eachRow['title'] = $title;
         $eachRow['text'] = $text;
         array_push($retArray, $eachRow);
     }
     echo json_encode($retArray);
開發者ID:jimmyc815,項目名稱:algo,代碼行數:31,代碼來源:portfolio_selection.php


注:本文中的stock_transaction_record函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。