Skip to content

Commit

Permalink
update borkers
Browse files Browse the repository at this point in the history
  • Loading branch information
daniwebdev committed Nov 22, 2023
1 parent c78b080 commit 7463fc7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/StockIDX.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,11 @@ public function getStockIndicators($page = 1, $date = null) {
return \GOAPI\IO\Resources\Stock\StockIndicator::fromArray($item);
});
}

public function getBrokers() {
$endpoint = "/brokers";
return (new Collection($this->makeRequest($endpoint)['data']['results']))->map(function($item) {
return new \GOAPI\IO\Resources\Stock\Broker($item['code'], $item['name']);
});
}
}
8 changes: 8 additions & 0 deletions tests/StockIDXTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,11 @@

expect($results instanceof \GOAPI\IO\Collection)->toBeTrue();
});

test('get brokers', function() use($client) {
$stockIDX = $client->createStockIDX();
$results = $stockIDX->getBrokers();

expect($results instanceof \GOAPI\IO\Collection)->toBeTrue();
expect($results[0] instanceof \GOAPI\IO\Resources\Stock\Broker)->toBeTrue();
});

0 comments on commit 7463fc7

Please sign in to comment.