Skip to content

Commit

Permalink
Merge pull request #6 from jigneshsolanki/master
Browse files Browse the repository at this point in the history
added exchange-details api
  • Loading branch information
radicalloop authored Jan 12, 2021
2 parents 85a58c6 + 4b73fcc commit 8c329f6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ $exchange = Eod::exchange();
// JSON
$exchange->symbol('US')->json();
$exchange->multipleTicker('US')->json();
$exchange->details('US')->json();

// Download CSV
$exchange->symbol('US')->download();
Expand Down
14 changes: 14 additions & 0 deletions src/Api/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,18 @@ public function multipleTicker($symbol, $params = [])
$this->setParams($symbol, $params);
return $this;
}

/**
* Get exchange details api
* url: https://eodhistoricaldata.com/financial-apis/exchanges-api-trading-hours-and-holidays/
* @param string $symbol
* @param array $params
* @return Exchange
*/
public function details($symbol, $params = [])
{
$this->urlSegment = '/exchange-details';
$this->setParams($symbol, $params);
return $this;
}
}
10 changes: 10 additions & 0 deletions tests/ExchangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,14 @@ public function save_file()
$content = $this->root->getChild('test.csv')->getContent();
$this->assertNotEmpty($content);
}

/** @test **/
public function details()
{
$content = $this->exchange->details('US')->json();
$data = json_decode($content, true);

$this->assertTrue(is_array($data));
$this->assertNotEmpty($data);
}
}

0 comments on commit 8c329f6

Please sign in to comment.