NAME
Finance::Robinhood::Equity::OrderBuilder - Provides a Sugary Builder-type Interface for Generating an Equity Order
SYNOPSIS
use Finance::Robinhood;
my $rh = Finance::Robinhood->new;
my $msft = $rh->instruments_by_symbol('MSFT');
# This package isn't used directly; instead, try this...
my $order = $msft->buy(3)->post;
DESCRIPTION
This is cotton candy for creating valid order structures.
Without any additional method calls, this will create a simple market order that looks like this:
{
account => "https://api.robinhood.com/accounts/XXXXXXXXXX/",
instrument => "https://api.robinhood.com/instruments/50810c35-d215-4866-9758-0ada4ac79ffa/",
price => "111.700000", # Automatically grabs last trade price quote
quantity => 4, # Actually the number of shares you requested
side => "buy", # Or sell
symbol => "MSFT", # Grabs ticker symbol automatically from instrument object
time_in_force => "gfd",
trigger => "immediate",
type => "market"
}
You may chain together several methods to generate and submit advanced order types such as stop limits that are held up to 90 days:
$order->stop(24.50)->gtc->limit->submit;
METHODS
account( ... )
Expects a Finance::Robinhood::Equity::Account object.
instrument( ... )
Expects a Finance::Robinhood::Equity::Instrument object.
quantity( ... )
Expects a whole number of shares.
stop( ... )
$order->stop( 45.20 );
Expects a price.
Use this to create stop limit or stop loss orders.
limit( ... )
$order->limit( 17.98 );
Expects a price.
Use this to create limit and stop limit orders.
market( )
$order->market( );
Use this to create market and stop loss orders.
gfd( )
$order->gfd( );
Use this to change the order's time in force value to Good-For-Day.
gtc( )
$order->gtc( );
Use this to change the order's time in force value to Good-Till-Cancelled (actually 90 days from submission).
fok( )
$order->fok( );
Use this to change the order's time in force value to Fill-Or-Kill.
This may require special permissions.
ioc( )
$order->ioc( );
Use this to change the order's time in force value to Immediate-Or-Cancel.
This may require special permissions.
opg( )
$order->opg( );
Use this to change the order's time in force value to Market-On-Open or Limit-On-Open orders.
This is not valid for orders marked for execution during extended hours.
pre_ipo( [...] )
$order->pre_ipo( );
Enables special pre-IPO submission of orders.
$order->pre_ipo( 1 );
$order->pre_ipo( 0 );
Enable or disables pre-IPO submission of orders.
override_day_trade_checks( [...] )
$order->override_day_trade_checks( );
Disables server side checks for possible day trade violations.
$order->override_day_trade_checks( 1 );
$order->override_day_trade_checks( 0 );
Enables or disables server side checks for possible day trade violations.
override_dtbp_checks( )
$order->override_dtbp_checks( );
Disables server side checks for possible day trade buying power violations.
$order->override_dtbp_checks( 1 );
$order->override_dtbp_checks( 0 );
Enables or disables server side checks for possible day trade buying power violations.
extended_hours( [...] )
$order->extended_hours( )
Enables order execution during pre- and after-hours.
$order->extended_hours( 1 );
$order->extended_hours( 0 );
Enables or disables execution during pre- and after-hours.
Note that the market orders may be converted to a limit orders (at or near the current price) by the API server's back end. You would be wise to set your own limit price instead.
submit( )
$order->submit( );
Use this to finally submit the order. On success, your builder is replaced by a new Finance::Robinhood::Equity::Order object is returned. On failure, your builder object is replaced by a Finance::Robinhood::Error object.
LEGAL
This is a simple wrapper around the API used in the official apps. The author provides no investment, legal, or tax advice and is not responsible for any damages incurred while using this software. This software is not affiliated with Robinhood Financial LLC in any way.
For Robinhood's terms and disclosures, please see their website at https://robinhood.com/legal/
LICENSE
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. Please refer to the LEGAL section.
AUTHOR
Sanko Robinson <sanko@cpan.org>