| 1 | package Finance::Robinhood::Forex::Historicals::Datapoint; | ||||||||||||||||||
| 2 | |||||||||||||||||||
| 3 | =encoding utf-8 | ||||||||||||||||||
| 4 | |||||||||||||||||||
| 5 | =for stopwords watchlist watchlists untradable urls | ||||||||||||||||||
| 6 | |||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||
| 8 | |||||||||||||||||||
| 9 | Finance::Robinhood::Forex::Historicals::Datapoint - Represents a Single | ||||||||||||||||||
| 10 | Interval of Time in a Forex Currency's Historical Price Data | ||||||||||||||||||
| 11 | |||||||||||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||||||||||
| 13 | |||||||||||||||||||
| 14 | use Finance::Robinhood; | ||||||||||||||||||
| 15 | my $rh = Finance::Robinhood->new->login('user', 'pass'); | ||||||||||||||||||
| 16 | |||||||||||||||||||
| 17 | # TODO | ||||||||||||||||||
| 18 | |||||||||||||||||||
| 19 | =cut | ||||||||||||||||||
| 20 | |||||||||||||||||||
| 21 | 1 | our $VERSION = '0.92_003'; | |||||||||||||||||
| 22 | 1 | ▶ | use Mojo::Base-base, -signatures; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 23 | 1 | ▶ | use Mojo::URL; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 24 | |||||||||||||||||||
| 25 | 1 | ▶ | sub _test__init { | ||||||||||||||||
|
Subroutine
_test__init: called CC=1 SCAR=3.5
| |||||||||||||||||||
| 26 | 1 | my $rh = t::Utility::rh_instance(1); | |||||||||||||||||
| 27 | 0 | my ($datapoint) | |||||||||||||||||
| 28 | = $rh->forex_pair_by_id( | ||||||||||||||||||
| 29 | '3d961844-d360-45fc-989b-f6fca761d511') # BTC-USD | ||||||||||||||||||
| 30 | ->historicals(interval => '5minute')->data_points; | ||||||||||||||||||
| 31 | 0 | isa_ok($datapoint, __PACKAGE__); | |||||||||||||||||
| 32 | 0 | t::Utility::stash('DATAPOINT', $datapoint); # Store it for later | |||||||||||||||||
| 33 | } | ||||||||||||||||||
| 34 | ## | ||||||||||||||||||
| 35 | |||||||||||||||||||
| 36 | =head1 METHODS | ||||||||||||||||||
| 37 | |||||||||||||||||||
| 38 | =cut | ||||||||||||||||||
| 39 | |||||||||||||||||||
| 40 | 1 | has _rh => undef => weak => 1; | |||||||||||||||||
| 41 | |||||||||||||||||||
| 42 | =head2 C<begins_at( )> | ||||||||||||||||||
| 43 | |||||||||||||||||||
| 44 | Returns a Time::Moment object. | ||||||||||||||||||
| 45 | |||||||||||||||||||
| 46 | =head2 C<close_price( )> | ||||||||||||||||||
| 47 | |||||||||||||||||||
| 48 | |||||||||||||||||||
| 49 | |||||||||||||||||||
| 50 | =head2 C<high_price( )> | ||||||||||||||||||
| 51 | |||||||||||||||||||
| 52 | |||||||||||||||||||
| 53 | =head2 C<interpolated( )> | ||||||||||||||||||
| 54 | |||||||||||||||||||
| 55 | |||||||||||||||||||
| 56 | =head2 C<low_price( )> | ||||||||||||||||||
| 57 | |||||||||||||||||||
| 58 | Returns a Time::Moment object. | ||||||||||||||||||
| 59 | |||||||||||||||||||
| 60 | =head2 C<open_price( )> | ||||||||||||||||||
| 61 | |||||||||||||||||||
| 62 | |||||||||||||||||||
| 63 | =head2 C<session( )> | ||||||||||||||||||
| 64 | |||||||||||||||||||
| 65 | Returns a Time::Moment object. | ||||||||||||||||||
| 66 | |||||||||||||||||||
| 67 | =head2 C<volume( )> | ||||||||||||||||||
| 68 | |||||||||||||||||||
| 69 | =cut | ||||||||||||||||||
| 70 | |||||||||||||||||||
| 71 | 1 | has ['close_price', 'high_price', 'interpolated', 'low_price', | |||||||||||||||||
| 72 | 'open_price', 'session', 'volume' | ||||||||||||||||||
| 73 | ]; | ||||||||||||||||||
| 74 | |||||||||||||||||||
| 75 | 0 | ▶ | sub begins_at ($s) { | ||||||||||||||||
|
Subroutine
begins_at: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 76 | 0 | Time::Moment->from_string($s->{begins_at}); | |||||||||||||||||
| 77 | } | ||||||||||||||||||
| 78 | |||||||||||||||||||
| 79 | 1 | ▶ | sub _test_begins_at { | ||||||||||||||||
|
Subroutine
_test_begins_at: called CC=2 SCAR=9.2
| |||||||||||||||||||
| 80 | 1 | ▶ | t::Utility::stash('DATAPOINT') | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("DATAPOINT") // skip_all("No historical datapoint object in stash")
MC/DC0%0/2
t::Utility::stash("DATAPOINT") // skip_all("No historical datapoint object in stash")
t::Utility::stash("DATAPOINT")
skip_all("No historical datapoint object in stash")
Truth table33%1/3
A // B
A= t::Utility::stash("DATAPOINT")B= skip_all("No historical datapoint object in stash")
| |||||||||||||||||||
| 81 | // skip_all('No historical datapoint object in stash'); | ||||||||||||||||||
| 82 | 0 | isa_ok(t::Utility::stash('DATAPOINT')->begins_at, 'Time::Moment'); | |||||||||||||||||
| 83 | } | ||||||||||||||||||
| 84 | |||||||||||||||||||
| 85 | =head1 LEGAL | ||||||||||||||||||
| 86 | |||||||||||||||||||
| 87 | This is a simple wrapper around the API used in the official apps. The author | ||||||||||||||||||
| 88 | provides no investment, legal, or tax advice and is not responsible for any | ||||||||||||||||||
| 89 | damages incurred while using this software. This software is not affiliated | ||||||||||||||||||
| 90 | with Robinhood Financial LLC in any way. | ||||||||||||||||||
| 91 | |||||||||||||||||||
| 92 | For Robinhood's terms and disclosures, please see their website at | ||||||||||||||||||
| 93 | https://robinhood.com/legal/ | ||||||||||||||||||
| 94 | |||||||||||||||||||
| 95 | =head1 LICENSE | ||||||||||||||||||
| 96 | |||||||||||||||||||
| 97 | Copyright (C) Sanko Robinson. | ||||||||||||||||||
| 98 | |||||||||||||||||||
| 99 | This library is free software; you can redistribute it and/or modify it under | ||||||||||||||||||
| 100 | the terms found in the Artistic License 2. Other copyrights, terms, and | ||||||||||||||||||
| 101 | conditions may apply to data transmitted through this module. Please refer to | ||||||||||||||||||
| 102 | the L<LEGAL> section. | ||||||||||||||||||
| 103 | |||||||||||||||||||
| 104 | =head1 AUTHOR | ||||||||||||||||||
| 105 | |||||||||||||||||||
| 106 | Sanko Robinson E<lt>sanko@cpan.orgE<gt> | ||||||||||||||||||
| 107 | |||||||||||||||||||
| 108 | =cut | ||||||||||||||||||
| 109 | |||||||||||||||||||
| 110 | 1 | 1; | |||||||||||||||||