PHP code example of jeffreyhyer / alpaca-trade-api-php
1. Go to this page and download the library: Download jeffreyhyer/alpaca-trade-api-php 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/ */
jeffreyhyer / alpaca-trade-api-php example snippets
lpaca\Alpaca;
$alpaca = new Alpaca("--KEY--", "--SECRET--");
$positions = $alpaca->getPositions();
use Alpaca\Alpaca;
$alpaca = new Alpaca("KEY", "SECRET", true);
// This call will now work as expected if your KEY and SECRET are valid.
// If not, the response will contain an error explaining what went wrong.
$resp = $alpaca->getAccount();