Finance::Alpaca::Struct::Position - A Single Account Object
use Finance::Alpaca; my $tsla = Finance::Alpaca->new( ... )->position( 'TSLA' ); say sprintf '%s %f shares of %s', ucfirst $tsla->side, abs $tsla->qty, $tsla->symbol
The positions API provides information about an account’s current open positions. The response will include information such as cost basis, shares traded, and market value, which will be updated live as price information is updated. Once a position is closed, it will no longer be queryable through this API.
The following properties are contained in the object.
$position->change_today();
asset_id
asset_class
exchange
symbol
avg_entry_price
qty
side
market_value
cost_basis
unrealized_pl
unrealized_plpc
unrealized_intraday_pl
unrealized_intraday_plpc
current_price
lastday_price
change_today
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.
Sanko Robinson <sanko@cpan.org>
To install Finance::Alpaca, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Finance::Alpaca
CPAN shell
perl -MCPAN -e shell install Finance::Alpaca
For more information on module installation, please visit the detailed CPAN module installation guide.