public function testGetBacenCdi()
 {
     $quandl = new Quandl($this->api_key);
     $symbol = 'BCB/4389';
     # CDI
     $result = $quandl->getSymbol($symbol, array('trim_start' => '2015-06-22', 'trim_end' => '2015-06-22', "sort_order" => "desc", "exclude_headers" => true, "rows" => 1));
     $date = new \DateTime($result->data[0][0]);
     $value = $result->data[0][1];
     $this->assertEquals(13.64, $value);
     $this->assertEquals(new \DateTime('2015-06-22'), $date);
 }
Exemplo n.º 2
0
 /**
  * @param string $format
  * @param integer $length
  */
 private function _testGetSymbol($format, $length, $force_curl = false)
 {
     $quandl = new Quandl($this->api_key, $format);
     $quandl->force_curl = $quandl->no_ssl_verify = $force_curl;
     $result = $quandl->getSymbol($this->symbol, $this->dates);
     $quandl_format = $format;
     if (is_object($result)) {
         $result = serialize($result);
         $quandl_format = "json";
     }
     $this->assertGreaterThan($length, strlen($result), "TEST {$format} length");
     $url_expected = "https://www.quandl.com/api/v1/datasets/{$this->symbol}.{$quandl_format}?trim_start={$this->dates['trim_start']}&trim_end={$this->dates['trim_end']}&auth_token={$this->api_key}";
     $this->assertEquals($url_expected, $quandl->last_url, "TEST {$format} url");
 }