| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Finance::Robinhood::ACATS::Transfer::Position; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | =encoding utf-8 | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | =for stopwords watchlist watchlists untradable urls | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =head1 NAME | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | Finance::Robinhood::ACATS::Transfer::Position - Represents a Single Position in | 
| 10 |  |  |  |  |  |  | an ACATS Transfer | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | use Finance::Robinhood; | 
| 15 |  |  |  |  |  |  | my $rh = Finance::Robinhood->new; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | ... | 
| 18 |  |  |  |  |  |  | CORE::say $_->instrument->symbol for @{$transfer->equity_positions}; | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | =cut | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | our $VERSION = '0.92_001'; | 
| 23 | 1 |  |  | 1 |  | 8 | use Mojo::Base-base, -signatures; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 24 | 1 |  |  | 1 |  | 185 | use Mojo::URL; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 25 | 1 |  |  | 1 |  | 26 | use Time::Moment; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 356 |  | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | sub _test__init { | 
| 28 | 1 |  |  | 1 |  | 11058 | my $rh       = t::Utility::rh_instance(1); | 
| 29 | 0 |  |  |  |  | 0 | my $transfer = $rh->acats_transfers->current; | 
| 30 | 0 | 0 |  |  |  | 0 | skip_all('No ACATS transfers found') if !defined $transfer; | 
| 31 | 0 |  |  |  |  | 0 | isa_ok( $transfer->equity_positions->[0], __PACKAGE__ ); | 
| 32 | 0 |  |  |  |  | 0 | t::Utility::stash( 'POSITION', $transfer->equity_positions->[0] );    #  Store it for later | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  | # | 
| 35 |  |  |  |  |  |  | has _rh => undef => weak => 1; | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | =head1 METHODS | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | =head2 C | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | Average price for this position. | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =head2 C | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | Number of shares in this position | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =cut | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | has [ 'price', 'quantity' ]; | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | =head2 C | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | my $instrument = $position->instrument(); | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | Loops back to a Finance::Robinhood::Equity::Instrument object. | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | =cut | 
| 59 |  |  |  |  |  |  |  | 
| 60 | 0 |  |  | 0 | 1 | 0 | sub instrument ($s) { | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 61 | 0 |  |  |  |  | 0 | my $res = $s->_rh->_get( $s->{instrument} ); | 
| 62 |  |  |  |  |  |  | $res->is_success | 
| 63 | 0 | 0 |  |  |  | 0 | ? Finance::Robinhood::Equity::Instrument->new( _rh => $s->_rh, %{ $res->json } ) | 
|  | 0 | 0 |  |  |  | 0 |  | 
| 64 |  |  |  |  |  |  | : Finance::Robinhood::Error->new( | 
| 65 |  |  |  |  |  |  | $res->is_server_error ? ( details => $res->message ) : $res->json ); | 
| 66 |  |  |  |  |  |  | } | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | sub _test_instrument { | 
| 69 | 1 |  | 50 | 1 |  | 1980 | t::Utility::stash('POSITION') // skip_all(); | 
| 70 | 0 |  |  |  |  |  | isa_ok( t::Utility::stash('POSITION')->instrument, 'Finance::Robinhood::Equity::Instrument' ); | 
| 71 |  |  |  |  |  |  | } | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =head1 LEGAL | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | This is a simple wrapper around the API used in the official apps. The author | 
| 76 |  |  |  |  |  |  | provides no investment, legal, or tax advice and is not responsible for any | 
| 77 |  |  |  |  |  |  | damages incurred while using this software. This software is not affiliated | 
| 78 |  |  |  |  |  |  | with Robinhood Financial LLC in any way. | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | For Robinhood's terms and disclosures, please see their website at | 
| 81 |  |  |  |  |  |  | https://robinhood.com/legal/ | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =head1 LICENSE | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | Copyright (C) Sanko Robinson. | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | This library is free software; you can redistribute it and/or modify it under | 
| 88 |  |  |  |  |  |  | the terms found in the Artistic License 2. Other copyrights, terms, and | 
| 89 |  |  |  |  |  |  | conditions may apply to data transmitted through this module. Please refer to | 
| 90 |  |  |  |  |  |  | the L section. | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | =head1 AUTHOR | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | Sanko Robinson Esanko@cpan.orgE | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | =cut | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | 1; |