« lib/Finance/Robinhood/Equity/Fundamentals.pm
↑ Summary
lib/Finance/Robinhood/ACATS/Transfer/Position.pm »
| 1 | package Finance::Robinhood::Forex::Pair; | ||||||||||||||||||
| 2 | |||||||||||||||||||
| 3 | =encoding utf-8 | ||||||||||||||||||
| 4 | |||||||||||||||||||
| 5 | =for stopwords watchlist watchlists untradable urls forex | ||||||||||||||||||
| 6 | |||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||
| 8 | |||||||||||||||||||
| 9 | Finance::Robinhood::Forex::Pair - Represents a Single Forex Currency Pair | ||||||||||||||||||
| 10 | Watchlist | ||||||||||||||||||
| 11 | |||||||||||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||||||||||
| 13 | |||||||||||||||||||
| 14 | use Finance::Robinhood; | ||||||||||||||||||
| 15 | my $rh = Finance::Robinhood->new; | ||||||||||||||||||
| 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 | 1 | ▶ | use Finance::Robinhood::Forex::Currency; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 25 | 1 | ▶ | use Finance::Robinhood::Forex::OrderBuilder; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 26 | 1 | ▶ | use Finance::Robinhood::Forex::Quote; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 27 | |||||||||||||||||||
| 28 | 1 | ▶ | sub _test__init { | ||||||||||||||||
|
Subroutine
_test__init: called CC=1 SCAR=3.5
| |||||||||||||||||||
| 29 | 1 | my $rh = t::Utility::rh_instance(1); | |||||||||||||||||
| 30 | 0 | my $pair = $rh->forex_pair_by_id('3d961844-d360-45fc-989b-f6fca761d511') | |||||||||||||||||
| 31 | ; # BTC-USD | ||||||||||||||||||
| 32 | 0 | isa_ok($pair, __PACKAGE__); | |||||||||||||||||
| 33 | 0 | t::Utility::stash('PAIR', $pair); # Store it for later | |||||||||||||||||
| 34 | } | ||||||||||||||||||
| 35 | 0 | ▶ | use overload '""' => sub ($s, @) { $s->{id} }, fallback => 1; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
__ANON__: not called CC=1 SCAR=0.2
| |||||||||||||||||||
| 36 | |||||||||||||||||||
| 37 | 1 | ▶ | sub _test_stringify { | ||||||||||||||||
|
Subroutine
_test_stringify: called CC=2 SCAR=9.2
| |||||||||||||||||||
| 38 | 1 | ▶ | t::Utility::stash('PAIR') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("PAIR") // skip_all()
MC/DC0%0/2
t::Utility::stash("PAIR") // skip_all()
t::Utility::stash("PAIR")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("PAIR")B= skip_all()
| |||||||||||||||||||
| 39 | 0 | like(+t::Utility::stash('PAIR'), | |||||||||||||||||
| 40 | qr'^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'i | ||||||||||||||||||
| 41 | ); | ||||||||||||||||||
| 42 | } | ||||||||||||||||||
| 43 | # | ||||||||||||||||||
| 44 | 1 | has _rh => undef => weak => 1; | |||||||||||||||||
| 45 | |||||||||||||||||||
| 46 | =head1 METHODS | ||||||||||||||||||
| 47 | |||||||||||||||||||
| 48 | |||||||||||||||||||
| 49 | =head2 C<id( )> | ||||||||||||||||||
| 50 | |||||||||||||||||||
| 51 | Returns a UUID. | ||||||||||||||||||
| 52 | |||||||||||||||||||
| 53 | =head2 C<display_only( )> | ||||||||||||||||||
| 54 | |||||||||||||||||||
| 55 | Returns a boolean. If this is true, you can only add the pair to a forex | ||||||||||||||||||
| 56 | watchlist to monitor the price for now. | ||||||||||||||||||
| 57 | |||||||||||||||||||
| 58 | =head2 C<max_order_size( )> | ||||||||||||||||||
| 59 | |||||||||||||||||||
| 60 | Largest amount of this asset you may trade in a single order. | ||||||||||||||||||
| 61 | |||||||||||||||||||
| 62 | =head2 C<min_order_price_increment( )> | ||||||||||||||||||
| 63 | |||||||||||||||||||
| 64 | Smallest price of the quote currency you may place an order for. | ||||||||||||||||||
| 65 | |||||||||||||||||||
| 66 | =head2 C<min_order_quantity_increment( )> | ||||||||||||||||||
| 67 | |||||||||||||||||||
| 68 | Smallest increment of the asset you may place an order for. | ||||||||||||||||||
| 69 | |||||||||||||||||||
| 70 | =head2 C<min_order_size( )> | ||||||||||||||||||
| 71 | |||||||||||||||||||
| 72 | Smallest amount of the asset you may place an order for. | ||||||||||||||||||
| 73 | |||||||||||||||||||
| 74 | =head2 C<name( )> | ||||||||||||||||||
| 75 | |||||||||||||||||||
| 76 | Returns a string suited for display. And example would be 'Bitcoin to US | ||||||||||||||||||
| 77 | Dollar'. | ||||||||||||||||||
| 78 | |||||||||||||||||||
| 79 | =head2 C<symbol( )> | ||||||||||||||||||
| 80 | |||||||||||||||||||
| 81 | String used for display. Example of this might be 'BTC-USD'. | ||||||||||||||||||
| 82 | |||||||||||||||||||
| 83 | =head2 C<tradability( )> | ||||||||||||||||||
| 84 | |||||||||||||||||||
| 85 | Either C<tradable> or C<untradable>. | ||||||||||||||||||
| 86 | |||||||||||||||||||
| 87 | =cut | ||||||||||||||||||
| 88 | |||||||||||||||||||
| 89 | 1 | has ['id', 'display_only', | |||||||||||||||||
| 90 | 'max_order_size', 'min_order_price_increment', | ||||||||||||||||||
| 91 | 'min_order_quantity_increment', 'min_order_size', | ||||||||||||||||||
| 92 | 'name', 'symbol', | ||||||||||||||||||
| 93 | 'tradability' | ||||||||||||||||||
| 94 | ]; | ||||||||||||||||||
| 95 | |||||||||||||||||||
| 96 | =head2 C<asset_currency( )> | ||||||||||||||||||
| 97 | |||||||||||||||||||
| 98 | Returns a Finance::Robinhood::Forex::Currency object. | ||||||||||||||||||
| 99 | |||||||||||||||||||
| 100 | =cut | ||||||||||||||||||
| 101 | |||||||||||||||||||
| 102 | 0 | ▶ | sub asset_currency ($s) { | ||||||||||||||||
|
Subroutine
asset_currency: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 103 | Finance::Robinhood::Forex::Currency->new(_rh => $s, | ||||||||||||||||||
| 104 | 0 | %{$s->{asset_currency}}); | |||||||||||||||||
| 105 | } | ||||||||||||||||||
| 106 | |||||||||||||||||||
| 107 | 1 | ▶ | sub _test_asset_currency { | ||||||||||||||||
|
Subroutine
_test_asset_currency: called CC=2 SCAR=9.2
| |||||||||||||||||||
| 108 | 1 | ▶ | t::Utility::stash('PAIR') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("PAIR") // skip_all()
MC/DC0%0/2
t::Utility::stash("PAIR") // skip_all()
t::Utility::stash("PAIR")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("PAIR")B= skip_all()
| |||||||||||||||||||
| 109 | 0 | isa_ok(t::Utility::stash('PAIR')->asset_currency, | |||||||||||||||||
| 110 | 'Finance::Robinhood::Forex::Currency'); | ||||||||||||||||||
| 111 | } | ||||||||||||||||||
| 112 | |||||||||||||||||||
| 113 | =head2 C<quote_currency( )> | ||||||||||||||||||
| 114 | |||||||||||||||||||
| 115 | Returns a Finance::Robinhood::Forex::Currency object. | ||||||||||||||||||
| 116 | |||||||||||||||||||
| 117 | =cut | ||||||||||||||||||
| 118 | |||||||||||||||||||
| 119 | 0 | ▶ | sub quote_currency ($s) { | ||||||||||||||||
|
Subroutine
quote_currency: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||
| 120 | Finance::Robinhood::Forex::Currency->new(_rh => $s, | ||||||||||||||||||
| 121 | 0 | %{$s->{quote_currency}}); | |||||||||||||||||
| 122 | } | ||||||||||||||||||
| 123 | |||||||||||||||||||
| 124 | 1 | ▶ | sub _test_quote_currency { | ||||||||||||||||
|
Subroutine
_test_quote_currency: called CC=2 SCAR=9.2
| |||||||||||||||||||
| 125 | 1 | ▶ | t::Utility::stash('PAIR') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("PAIR") // skip_all()
MC/DC0%0/2
t::Utility::stash("PAIR") // skip_all()
t::Utility::stash("PAIR")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("PAIR")B= skip_all()
| |||||||||||||||||||
| 126 | 0 | isa_ok(t::Utility::stash('PAIR')->quote_currency, | |||||||||||||||||
| 127 | 'Finance::Robinhood::Forex::Currency'); | ||||||||||||||||||
| 128 | } | ||||||||||||||||||
| 129 | |||||||||||||||||||
| 130 | =head2 C<quote( )> | ||||||||||||||||||
| 131 | |||||||||||||||||||
| 132 | my $quote = $pair->quote(); | ||||||||||||||||||
| 133 | |||||||||||||||||||
| 134 | Builds a Finance::Robinhood::Forex::Quote object with this currency pair's | ||||||||||||||||||
| 135 | quote data. | ||||||||||||||||||
| 136 | |||||||||||||||||||
| 137 | You do not need to be logged in for this to work. | ||||||||||||||||||
| 138 | |||||||||||||||||||
| 139 | =cut | ||||||||||||||||||
| 140 | |||||||||||||||||||
| 141 | 0 | ▶ | sub quote ($s) { | ||||||||||||||||
|
Subroutine
quote: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||
| 142 | my $res | ||||||||||||||||||
| 143 | = $s->_rh->_get('https://api.robinhood.com/marketdata/forex/quotes/' . | ||||||||||||||||||
| 144 | 0 | $s->{id} . '/'); | |||||||||||||||||
| 145 | $res->is_success | ||||||||||||||||||
| 146 | 0 | ▶ | ? Finance::Robinhood::Forex::Quote->new(_rh => $s->_rh, %{$res->json}) | ||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||
| 147 | : Finance::Robinhood::Error->new( | ||||||||||||||||||
| 148 | $res->is_server_error ? (details => $res->message) : $res->json); | ||||||||||||||||||
| 149 | } | ||||||||||||||||||
| 150 | |||||||||||||||||||
| 151 | 1 | ▶ | sub _test_quote { | ||||||||||||||||
|
Subroutine
_test_quote: called CC=2 SCAR=9.2
| |||||||||||||||||||
| 152 | 1 | ▶ | t::Utility::stash('PAIR') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("PAIR") // skip_all()
MC/DC0%0/2
t::Utility::stash("PAIR") // skip_all()
t::Utility::stash("PAIR")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("PAIR")B= skip_all()
| |||||||||||||||||||
| 153 | 0 | isa_ok(t::Utility::stash('PAIR')->quote(), | |||||||||||||||||
| 154 | 'Finance::Robinhood::Forex::Quote'); | ||||||||||||||||||
| 155 | } | ||||||||||||||||||
| 156 | |||||||||||||||||||
| 157 | =head2 C<historicals( ... )> | ||||||||||||||||||
| 158 | |||||||||||||||||||
| 159 | my $data = $pair->historicals( interval => '15second' ); | ||||||||||||||||||
| 160 | |||||||||||||||||||
| 161 | Returns a Finance::Robinhood::Forex::Historicals object. | ||||||||||||||||||
| 162 | |||||||||||||||||||
| 163 | You may provide the following arguments: | ||||||||||||||||||
| 164 | |||||||||||||||||||
| 165 | =over | ||||||||||||||||||
| 166 | |||||||||||||||||||
| 167 | =item C<interval> Required and must be on eof the following: | ||||||||||||||||||
| 168 | |||||||||||||||||||
| 169 | =over | ||||||||||||||||||
| 170 | |||||||||||||||||||
| 171 | =item C<15second> | ||||||||||||||||||
| 172 | |||||||||||||||||||
| 173 | =item C<5minute> | ||||||||||||||||||
| 174 | |||||||||||||||||||
| 175 | =item C<10minute> | ||||||||||||||||||
| 176 | |||||||||||||||||||
| 177 | =item C<hour> | ||||||||||||||||||
| 178 | |||||||||||||||||||
| 179 | =item C<day> | ||||||||||||||||||
| 180 | |||||||||||||||||||
| 181 | =item C<week> | ||||||||||||||||||
| 182 | |||||||||||||||||||
| 183 | =item C<month> | ||||||||||||||||||
| 184 | |||||||||||||||||||
| 185 | =back | ||||||||||||||||||
| 186 | |||||||||||||||||||
| 187 | =item C<span> - Optional and must be one of the following: | ||||||||||||||||||
| 188 | |||||||||||||||||||
| 189 | =over | ||||||||||||||||||
| 190 | |||||||||||||||||||
| 191 | =item C<hour> | ||||||||||||||||||
| 192 | |||||||||||||||||||
| 193 | =item C<week> | ||||||||||||||||||
| 194 | |||||||||||||||||||
| 195 | =item C<year> | ||||||||||||||||||
| 196 | |||||||||||||||||||
| 197 | =item C<5year> | ||||||||||||||||||
| 198 | |||||||||||||||||||
| 199 | =item C<all> | ||||||||||||||||||
| 200 | |||||||||||||||||||
| 201 | =back | ||||||||||||||||||
| 202 | |||||||||||||||||||
| 203 | =back | ||||||||||||||||||
| 204 | |||||||||||||||||||
| 205 | =cut | ||||||||||||||||||
| 206 | |||||||||||||||||||
| 207 | 0 | ▶ | sub historicals ($s, %filters) { | ||||||||||||||||
|
Subroutine
historicals: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||
| 208 | 0 | my $res = $s->_rh->_get( | |||||||||||||||||
| 209 | Mojo::URL->new( | ||||||||||||||||||
| 210 | 'https://api.robinhood.com/marketdata/forex/historicals/' . | ||||||||||||||||||
| 211 | $s->id . '/' | ||||||||||||||||||
| 212 | )->query(\%filters), | ||||||||||||||||||
| 213 | ); | ||||||||||||||||||
| 214 | 0 | ▶ | require Finance::Robinhood::Forex::Historicals if $res->is_success; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 215 | $res->is_success | ||||||||||||||||||
| 216 | ? Finance::Robinhood::Forex::Historicals->new(_rh => $s->_rh, | ||||||||||||||||||
| 217 | 0 | ▶ | %{$res->json}) | ||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||
| 218 | : Finance::Robinhood::Error->new( | ||||||||||||||||||
| 219 | $res->is_server_error ? (details => $res->message) : $res->json); | ||||||||||||||||||
| 220 | } | ||||||||||||||||||
| 221 | |||||||||||||||||||
| 222 | 1 | ▶ | sub _test_historicals { | ||||||||||||||||
|
Subroutine
_test_historicals: called CC=2 SCAR=10.5
| |||||||||||||||||||
| 223 | 1 | ▶ | t::Utility::stash('PAIR') // skip_all(); | ||||||||||||||||
|
Condition50%1/2
t::Utility::stash("PAIR") // skip_all()
MC/DC0%0/2
t::Utility::stash("PAIR") // skip_all()
t::Utility::stash("PAIR")
skip_all()
Truth table33%1/3
A // B
A= t::Utility::stash("PAIR")B= skip_all()
| |||||||||||||||||||
| 224 | 0 | warn t::Utility::stash('PAIR')->historicals(interval => 'hour'); | |||||||||||||||||
| 225 | 0 | isa_ok(t::Utility::stash('PAIR')->historicals(interval => 'hour'), | |||||||||||||||||
| 226 | 'Finance::Robinhood::Forex::Historicals'); | ||||||||||||||||||
| 227 | } | ||||||||||||||||||
| 228 | |||||||||||||||||||
| 229 | =head2 C<buy( ... )> | ||||||||||||||||||
| 230 | |||||||||||||||||||
| 231 | my $order = $pair->buy(34); | ||||||||||||||||||
| 232 | |||||||||||||||||||
| 233 | Returns a Finance::Robinhood::Forex::OrderBuilder object. | ||||||||||||||||||
| 234 | |||||||||||||||||||
| 235 | Without any additional method calls, this will create an order that looks like | ||||||||||||||||||
| 236 | this: | ||||||||||||||||||
| 237 | |||||||||||||||||||
| 238 | { | ||||||||||||||||||
| 239 | account => "XXXXXXXXX", | ||||||||||||||||||
| 240 | currency_pair_id => "3d961844-d360-45fc-989b-f6fca761d511", | ||||||||||||||||||
| 241 | price => "111.700000", # Automatically grabs bid price quote on submission | ||||||||||||||||||
| 242 | quantity => 4, # Actually the amount of crypto you requested | ||||||||||||||||||
| 243 | side => "buy", | ||||||||||||||||||
| 244 | time_in_force => "ioc", | ||||||||||||||||||
| 245 | type => "market" | ||||||||||||||||||
| 246 | } | ||||||||||||||||||
| 247 | |||||||||||||||||||
| 248 | =cut | ||||||||||||||||||
| 249 | |||||||||||||||||||
| 250 | 0 | ▶ | sub buy ($s, $quantity, $account = $s->_rh->forex_accounts->next) { | ||||||||||||||||
|
Subroutine
buy: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||
| 251 | 0 | Finance::Robinhood::Forex::OrderBuilder->new(_rh => $s->_rh, | |||||||||||||||||
| 252 | _pair => $s, | ||||||||||||||||||
| 253 | _account => $account, | ||||||||||||||||||
| 254 | quantity => $quantity | ||||||||||||||||||
| 255 | )->buy; | ||||||||||||||||||
| 256 | } | ||||||||||||||||||
| 257 | |||||||||||||||||||
| 258 | 1 | ▶ | sub _test_buy { | ||||||||||||||||
|
Subroutine
_test_buy: called CC=1 SCAR=4.6
| |||||||||||||||||||
| 259 | 1 | my $rh = t::Utility::rh_instance(1); | |||||||||||||||||
| 260 | 0 | my $btc_usd | |||||||||||||||||
| 261 | = $rh->forex_pair_by_id('3d961844-d360-45fc-989b-f6fca761d511'); | ||||||||||||||||||
| 262 | # | ||||||||||||||||||
| 263 | 0 | my $market = $btc_usd->buy(4); | |||||||||||||||||
| 264 | 0 | is( {$market->_dump(1)}, | |||||||||||||||||
| 265 | {account => '--private--', | ||||||||||||||||||
| 266 | currency_pair_id => '3d961844-d360-45fc-989b-f6fca761d511', | ||||||||||||||||||
| 267 | quantity => 4, | ||||||||||||||||||
| 268 | side => 'buy', | ||||||||||||||||||
| 269 | type => 'market', | ||||||||||||||||||
| 270 | time_in_force => 'gtc', | ||||||||||||||||||
| 271 | ref_id => '00000000-0000-0000-0000-000000000000', | ||||||||||||||||||
| 272 | price => '5.00' | ||||||||||||||||||
| 273 | } | ||||||||||||||||||
| 274 | ); | ||||||||||||||||||
| 275 | |||||||||||||||||||
| 276 | #->stop(43)->limit(55);#->submit; | ||||||||||||||||||
| 277 | #ddx \{$order->_dump}; | ||||||||||||||||||
| 278 | 0 | ▶ | todo("Write actual tests!" => sub { pass('ugh') }); | ||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||
| 279 | |||||||||||||||||||
| 280 | #my $news = t::Utility::stash('MSFT')->news; | ||||||||||||||||||
| 281 | #isa_ok( $news, 'Finance::Robinhood::Utilities::Iterator' ); | ||||||||||||||||||
| 282 | #isa_ok( $news->current, 'Finance::Robinhood::News' ); | ||||||||||||||||||
| 283 | } | ||||||||||||||||||
| 284 | |||||||||||||||||||
| 285 | =head2 C<sell( ... )> | ||||||||||||||||||
| 286 | |||||||||||||||||||
| 287 | my $order = $btc->sell(34); | ||||||||||||||||||
| 288 | |||||||||||||||||||
| 289 | Returns a Finance::Robinhood::Forex::OrderBuilder object. | ||||||||||||||||||
| 290 | |||||||||||||||||||
| 291 | Without any additional method calls, this will create an order that looks like | ||||||||||||||||||
| 292 | this: | ||||||||||||||||||
| 293 | |||||||||||||||||||
| 294 | { | ||||||||||||||||||
| 295 | account => "XXXXXXXXXX", | ||||||||||||||||||
| 296 | pair_id => "3d961844-d360-45fc-989b-f6fca761d511", | ||||||||||||||||||
| 297 | price => "111.700000", # Automatically grabs ask price quote on submission | ||||||||||||||||||
| 298 | quantity => 4, # Actually the amount of currency you requested | ||||||||||||||||||
| 299 | side => "sell", | ||||||||||||||||||
| 300 | time_in_force => "ioc", | ||||||||||||||||||
| 301 | type => "market" | ||||||||||||||||||
| 302 | } | ||||||||||||||||||
| 303 | |||||||||||||||||||
| 304 | =cut | ||||||||||||||||||
| 305 | |||||||||||||||||||
| 306 | 0 | ▶ | sub sell ($s, $quantity, $account = $s->_rh->forex_accounts->next) { | ||||||||||||||||
|
Subroutine
sell: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||
| 307 | 0 | Finance::Robinhood::Forex::OrderBuilder->new(_rh => $s->_rh, | |||||||||||||||||
| 308 | _pair => $s, | ||||||||||||||||||
| 309 | _account => $account, | ||||||||||||||||||
| 310 | quantity => $quantity | ||||||||||||||||||
| 311 | )->sell; | ||||||||||||||||||
| 312 | } | ||||||||||||||||||
| 313 | |||||||||||||||||||
| 314 | 1 | ▶ | sub _test_sell { | ||||||||||||||||
|
Subroutine
_test_sell: called CC=1 SCAR=4.6
| |||||||||||||||||||
| 315 | 1 | my $rh = t::Utility::rh_instance(1); | |||||||||||||||||
| 316 | 0 | my $btc_usd | |||||||||||||||||
| 317 | = $rh->forex_pair_by_id('3d961844-d360-45fc-989b-f6fca761d511'); | ||||||||||||||||||
| 318 | # | ||||||||||||||||||
| 319 | 0 | my $market = $btc_usd->sell(4); | |||||||||||||||||
| 320 | 0 | is( {$market->_dump(1)}, | |||||||||||||||||
| 321 | {account => '--private--', | ||||||||||||||||||
| 322 | currency_pair_id => '3d961844-d360-45fc-989b-f6fca761d511', | ||||||||||||||||||
| 323 | quantity => 4, | ||||||||||||||||||
| 324 | side => 'sell', | ||||||||||||||||||
| 325 | type => 'market', | ||||||||||||||||||
| 326 | time_in_force => 'gtc', | ||||||||||||||||||
| 327 | ref_id => '00000000-0000-0000-0000-000000000000', | ||||||||||||||||||
| 328 | price => '5.00' | ||||||||||||||||||
| 329 | } | ||||||||||||||||||
| 330 | ); | ||||||||||||||||||
| 331 | |||||||||||||||||||
| 332 | #->stop(43)->limit(55);#->submit; | ||||||||||||||||||
| 333 | #ddx \{$order->_dump}; | ||||||||||||||||||
| 334 | 0 | ▶ | todo("Write actual tests!" => sub { pass('ugh') }); | ||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||
| 335 | |||||||||||||||||||
| 336 | #my $news = t::Utility::stash('MSFT')->news; | ||||||||||||||||||
| 337 | #isa_ok( $news, 'Finance::Robinhood::Utilities::Iterator' ); | ||||||||||||||||||
| 338 | #isa_ok( $news->current, 'Finance::Robinhood::News' ); | ||||||||||||||||||
| 339 | } | ||||||||||||||||||
| 340 | |||||||||||||||||||
| 341 | =head1 LEGAL | ||||||||||||||||||
| 342 | |||||||||||||||||||
| 343 | This is a simple wrapper around the API used in the official apps. The author | ||||||||||||||||||
| 344 | provides no investment, legal, or tax advice and is not responsible for any | ||||||||||||||||||
| 345 | damages incurred while using this software. This software is not affiliated | ||||||||||||||||||
| 346 | with Robinhood Financial LLC in any way. | ||||||||||||||||||
| 347 | |||||||||||||||||||
| 348 | For Robinhood's terms and disclosures, please see their website at | ||||||||||||||||||
| 349 | https://robinhood.com/legal/ | ||||||||||||||||||
| 350 | |||||||||||||||||||
| 351 | =head1 LICENSE | ||||||||||||||||||
| 352 | |||||||||||||||||||
| 353 | Copyright (C) Sanko Robinson. | ||||||||||||||||||
| 354 | |||||||||||||||||||
| 355 | This library is free software; you can redistribute it and/or modify it under | ||||||||||||||||||
| 356 | the terms found in the Artistic License 2. Other copyrights, terms, and | ||||||||||||||||||
| 357 | conditions may apply to data transmitted through this module. Please refer to | ||||||||||||||||||
| 358 | the L<LEGAL> section. | ||||||||||||||||||
| 359 | |||||||||||||||||||
| 360 | =head1 AUTHOR | ||||||||||||||||||
| 361 | |||||||||||||||||||
| 362 | Sanko Robinson E<lt>sanko@cpan.orgE<gt> | ||||||||||||||||||
| 363 | |||||||||||||||||||
| 364 | =cut | ||||||||||||||||||
| 365 | |||||||||||||||||||
| 366 | 1 | 1; | |||||||||||||||||