PHP code example of elbucho / finviz-api

1. Go to this page and download the library: Download elbucho/finviz-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elbucho / finviz-api example snippets


$screener->search();

foreach ($screener->getResults() as $result) {
    var_dump($result);
}

$screener = new Elbucho\FinvizApi\Screener();
$screener
    ->addFilter('exchange', 'nyse')
    ->addFilter('float', 'under_20m')
    ->addFilter('price', 'under_5')
    ->addFilter('relative_volume', 'over_3')
    ->search();

while (true) {
    $results = $screener->getResults();

    foreach ($results as $result) {
        printf(
            "%s:\tCap: %s\tPrice: %s\tChange: %s\tVolume: %s\n",
            $result['ticker'],
            $result['market_cap'],
            $result['price'],
            $result['change'],
            $result['volume']
        );
    }

    if ($screener->onLastPage()) {
        break;
    }

    $screener->loadNextPage();
}