Skip to content

Operating hand book

Victor Dias edited this page Mar 21, 2016 · 4 revisions

Config yahoo API

/config/settings/stocks.php

define('YAHOO_YQL_API_URL', 'https://query.yahooapis.com/v1/public/yql');
define('YAHOO_CSV_API_URL', 'http://download.finance.yahoo.com/d/quotes.csv');
define('YAHOO_API', 'CSV');	

Set YAHOO_API to YQL if want to use Yahoo Query Language interface.

Update log mode

/config/bootstrap

	case "prod":
	default:
		ini_set('display_errors', 'Off');
		$logLevel = Logger::ERROR; 
		break;

Set Logger::DEBUG and display_errors to 'On' for debug.

Fetching quote

HTTP/1.0 400 Bad Request

[2016-03-15 16:19:48] Service.INFO: making request to:  {"url":"https://query.yahooapis.com/v1/public/yql?q=select+%2A+from+yahoo.finance.quotes+where+symbol+in+%28%27CIEL3.SA%27%29&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env"} []
[2016-03-15 16:19:57] Service.ERROR: stock error {"exception":"Exception","message":"Cannot make request.\n Error was: file_get_contents(https://query.yahooapis.com/v1/public/yql?q=select+%2A+from+yahoo.finance.quotes+where+symbol+in+%28%27CIEL3.SA%27%29&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request\r\n\n Response Header[0]: HTTP/1.0 400 Bad Request","trace":"#0 /home/meumobi/PROJECTS/services.int-meumobilesite.com/releases/20140819/services/StockService.php(11): Service->request('https://query.y...')\n#1 /home/meumobi/PROJECTS/services.int-meumobilesite.com/releases/20140819/services/StockService.php(93): StockService->call('https://query.y...')\n#2 /home/meumobi/PROJECTS/services.int-meumobilesite.com/releases/20140819/services/StockService.php(108): StockService->yahoofy()\n#3 /home/meumobi/PROJECTS/services.int-meumobilesite.com/releases/20140819/public/stocks/index.php(7): StockService->run('yahoofy', Array)\n#4 {main}"} []
[2016-03-15 16:19:57] Service.INFO: using cached response: yes [] []
[2016-03-15 16:19:57] Service.INFO: finished stock action {"action":"yahoofy","parameters":{"action":"yahoofy","codes":"CIEL3.SA"},"elapsed_time":9.7989938259125} []
Clone this wiki locally