本文整理汇总了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;未经允许,请勿转载。 |
请发表评论