30 Apr 2021 22:56:50 UTC
- Distribution: Finance-Alpaca
- Module version: 0.9902
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (44 / 57 / 10)
- KwaliteeBus factor: 1
- 80.44% Coverage
- License: artistic_2
- Perl: v5.22.0
- Activity24 month
- Download (39.39KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionSANKO Sanko Robinson
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.
asset_id- Asset ID (UUID)
asset_class- Asset class name (us_equity)
exchange- Exchange name of the asset
symbol- Symbol name of the asset
avg_entry_price- Average entry price of the position
qty- The number of shares
market_value- Total dollar amount of the position
cost_basis- Total cost basis in dollar
unrealized_pl- Unrealized profit/loss in dollars
unrealized_plpc- Unrealized profit/loss percent (by a factor of 1)
unrealized_intraday_pl- Unrealized profit/loss in dollars for the day
unrealized_intraday_plpc- Unrealized profit/loss percent (by a factor of 1)
current_price- Current asset price per share
lastday_price- Last day’s asset price per share based on the closing value of the last trading day
change_today- Percent change from last day price (by a factor of 1)
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 <email@example.com>
Module Install Instructions
To install Finance::Alpaca, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Finance::Alpaca
For more information on module installation, please visit the detailed CPAN module installation guide.