Пример #1
0
/**
 * E*TRADE PHP SDK
 *
 * @package    	PHP-SDK
 * @version		1.1
 * @copyright  	Copyright (c) 2012 E*TRADE FINANCIAL Corp.
 *
 */
require_once "config.php";
require_once dirname(__FILE__) . '/../Common/Common.php';
require_once 'Market/MarketClient.class.php';
$consumer = new etOAuthConsumer(ETWS_APP_KEY, ETWS_APP_SECRET);
$consumer->oauth_token = OAUTH_ACCESS_TOKEN;
$consumer->oauth_token_secret = OAUTH_ACCESS_TOKEN_SECRET;
$ac_obj = new MarketClient($consumer);
echo "-------------------------------------------------\n";
echo "Welcome to Market SDK test utility.\n";
echo "-------------------------------------------------\n";
$valid_choice = array(0, 1, 2, 3, 4, 5, 6);
$choice = '1';
while (in_array($choice, $valid_choice)) {
    $choice = show_menu();
    try {
        switch ($choice) {
            case 1:
                $request_params = new getOptionChainsParams();
                $request_params->__set('expirationMonth', '1');
                $request_params->__set('expirationYear', '2015');
                $request_params->__set('chainType', 'PUT');
                $request_params->__set('skipAdjusted', 'true');
Пример #2
0
require_once(dirname(__FILE__) . '/Market/MarketClient.class.php'); */
include './Samples/Config.php';
include './Common/Common.php';
include './OAuth/etOAuth.class.php';
include './Market/MarketClient.class.php';
/*
$file_name = dirname(__FILE__);
echo $file_name; die(); */
$symbol = $_GET['symbol'];
$dataArray = array();
$ini_array = parse_ini_file('etrade.ini', true);
//$consumer   = new etOAuthConsumer(ETWS_APP_KEY,ETWS_APP_SECRET);
$consumer = new etOAuthConsumer($ini_array['OAuth']['oauth_consumer_key'], $ini_array['OAuth']['consumer_secret']);
$consumer->oauth_token = $ini_array['OAuth']['oauth_token'];
$consumer->oauth_token_secret = $ini_array['OAuth']['oauth_token_secret'];
$ac_obj = new MarketClient($consumer);
try {
    $request_params = new getQuoteParams();
    //    $request_params->__set('symbolList', array('GOOG','CSCO'));
    $request_params->__set('symbolList', array($symbol));
    $request_params->__set('detailFlag', 'All');
    $out = $ac_obj->getQuote($request_params);
} catch (ETWSException $e) {
    echo "***Caught exception***  \n" . "Error Code   : " . $e->getErrorCode() . "\n" . "Error Message  : " . $e->getErrorMessage() . "\n";
    if (DEBUG_MODE) {
        echo $e->getTraceAsString() . "\n";
    }
    exit;
} catch (Exception $e) {
    echo "***Caught exception***  \n" . "Error Code   : " . $e->getCode() . "\n" . "Error Message  : " . $e->getMessage() . "\n";
    if (DEBUG_MODE) {