dakshhmehta/php-tradebook

dev-main 2022-12-27 09:43 UTC

This package is auto-updated.

Last update: 2024-11-10 06:02:02 UTC


README

Example

use Dakshhmehta\PhpTradebook\Trade;
use Dakshhmehta\PhpTradebook\TradeBook;

$tradebook = new TradeBook([
    new Trade([
        'id' => 2,
        'symbol' => 'TCS',
        'date' => '2022-09-26',
        'qty' => 5,
        'type' => 'buy',
    ]),
    new Trade([
        'id' => 1,
        'symbol' => 'TCS',
        'date' => '2022-10-24',
        'qty' => 10,
        'type' => 'buy',
    ]),
    new Trade([
        'id' => 3,
        'symbol' => 'TCS',
        'date' => '2022-09-19',
        'qty' => 5,
        'type' => 'sell',
    ]),
]);

$trades = $tradebook->getTrades();
$ledger = $tradebook->getLedger();
echo $tradebook->getHolding();