flaviovs/php-questrade

围绕Questrade API的PHP薄抽象层

0.0.3 2020-08-25 00:37 UTC

This package is auto-updated.

Last update: 2024-09-25 09:58:24 UTC


README

此软件包为Questrade API提供薄抽象层

此软件包与Questrade没有任何关联、赞助或认可。Questrade及其相关名称和图片是各自所有者的注册商标。

需求

  • PHP >= 5.6
  • CURL扩展

安装

composer require flaviovs/php-questrade

使用

use fv\questrade\Client;
use fv\questrade\Error;
use fv\questrade\Token;

// Manual authorization can be done in
// https://login.questrade.com/APIAccess/UserApps.aspx
const REFRESH_TOKEN = 'MANUAL-AUTH-API-KEY';

$client = new Client(Client::URL_LIVE);

try {
	$token = $client->getAccessToken(REFRESH_TOKEN);
} catch (Error $ex) {
	echo $ex->getMessage() . "\n";
	exit(1);
}

foreach ($client->symbolSearch($token, 'DJI') as $result) {
	print_r($result);
}

// By default this will fetch daily quotes from 7 day ago until
// today. See the code for more information.
// Note: 16434 == DJI symbol ID.
foreach ($client->marketsCandles($token, 16434) as $result) {
	print_r($result);
}

有bug吗?有建议吗?

访问https://github.com/flaviovs/php-questrade/issues