opcvm360/sdk-php

用于与OPCVM360 REST API通信的PHP库

此软件包的官方仓库似乎已不存在,因此该软件包已被冻结。

v0.6 2014-03-31 13:42 UTC

This package is not auto-updated.

Last update: 2019-12-23 03:06:42 UTC


README

OPCVM360每天提供欧洲基金的财务数据。

请向FINANCE Web Working请求登录名和密码。或者通过以下方式联系:

安装 OPCVM360/sdk-php

通过Composer

OPCVM360/sdk-php 作为以下OPCVM360/sdk-php软件包在Packagist上提供。

通过ZIP文件

点击此处下载源代码 (.zip),其中包含所有依赖项。

下载库后,将OPCVM360/sdk-php文件夹移动到您的项目目录中,然后包含库文件

require ('/path/to/OPCVM360/Services/OPCVM360.php');

然后您就可以开始使用了!

通过git

git clone https://github.com/OPCVM360/sdk-php.git

代码示例

获取2013年的数据,以了解ISIN为LU0068578508的基金的价格。

<?php
require('path/to/the/sdk-php/Services/OPCVM360.php');
$service = new Services_OPCVM360('My_OPCVM360_Login', 'My_OPCVM360_Password');

//inputs
$isin="LU0068578508";		//FIRST EAGLE AMUNDI INTERNATIONAL
$HistoryFrom="2013-01-01";	//from jan 1st 2013
$HistoryTo=Null;			//till now


//retrieve the fundShare by its ISIN
$fundShare=$service->getFundShareByIsin($isin);

//retrieve history of that fundShare, for the specified range of dates
//the $fundShareHistory object act as an iterator
$fundShareHistory = $fundShare->getHistoryRange($HistoryFrom,$HistoryTo);
?>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css">
	td, th { border: 1px solid }
	th { font-weight: bold }
</style>
<h1>Raw fundshare meta data for <?php echo $isin ?></h1>
<?php var_dump($fundShare) ?>
<hr/>
<h1>Prices table from <?php echo $HistoryFrom==null ? inception : $HistoryFrom ?> to <?php echo $HistoryTo==null ? now : $HistoryTo ?></h1>
<table>
	<?php
	$firstRow=true;
	while ($fundShareHistory->getCurrentPage() < $fundShareHistory->getNumberOfPages())
	{
		foreach ($fundShareHistory->getResults() as $historyLine)
		{
			if ($firstRow)
					{echo "<tr><th>".implode("</td><th>",array_keys($historyLine))."</th></tr>";$firstRow=false;}
			echo "<tr><td>".implode("</td><td>",$historyLine)."</td></tr>";
		}
		$fundShareHistory->goToNextPage();
	}
	?>
</table>

数据模型

https://docs.google.com/a/idm.io/presentation/d/1mMebINgxVJpfNDRLN2leE7hpUINmC8-jZAC85P0GVIg/edit#slide=id.g2b66ed8ed_00

服务可用的类方法

  • $service->getCompanyById($id) // 返回一个Company对象
  • $service->getFundById($id) // 返回一个Fund对象
  • $service->getFundshareById($id) // 返回一个FundShare对象
  • $service->getFundshareByIsin($isin) // 返回一个FundShare对象

对象可用的方法

company

  • $this->getFunds() // 返回一个与该公司链接的Fund对象数组;

fund

  • $this->getFundShares() // 返回与当前基金链接的Fundshare对象数组

fundshare

  • $this->getHistoryRange($fromDate=null,$toDate=null) // 返回一个包含数据 = fundshareHistory对象数组的对象List。使用List对象可以分页结果。当List对象被构造时,活动页面是第一个,即最旧的数据集。然后您可以使用以下方法在此对象上操作
    • $this->getResults() //返回当前页面的数据数组(vl, 日期,...)
    • $this->goToNextPage() //将当前页面设置为下一页
    • $this->getNumberOfPages() //返回总页数
    • $this->getCurrentPage() //返回当前页码
    • $this->setCurrentPage($page) // 设置当前页码为 $page
    • $this->goToLastPage() // 设置当前页码为最后一页
  • $this->getHistoryLastValue() // 返回与当前 FundShare 关联的最后一个 fundshareHistory
  • $this->get($field) // 返回字段值,如果需要则格式化

管理器

无可用方法

文档

无可用方法