NAME
Finance::Robinhood::Forex::OrderBuilder - Provides a Sugary Builder-type Interface for Generating a Forex Order
SYNOPSIS
use Finance::Robinhood;
my $rh = Finance::Robinhood->new;
my $btc_usd = $rh->forex_pair_by_id('3d961844-d360-45fc-989b-f6fca761d511');
$btc_usd->buy(1)->submit;
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 => "XXXXXXXXXXXXXXXXXXXXXX",
currency_pair_id => "3d961844-d360-45fc-989b-f6fca761d511",
price => "111.700000", # Automatically grabs ask or bid price quote
quantity => 4, # Actually the amount of crypto you requested
side => "buy", # Or sell
time_in_force => "ioc",
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->gtc->limit->submit;
METHODS
account( ... )
Expects a Finance::Robinhood::Forex::Account object.
pair( ... )
Expects a Finance::Robinhood::Forex::Pair object.
quantity( ... )
Expects a whole number of shares.
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.
gtc( )
$order->gtc( );
Use this to change the order's time in force value to Good-Till-Cancelled (actually 90 days from submission).
ioc( )
$order->ioc( );
Use this to change the order's time in force value to Immediate-Or-Cancel.
This may require special permissions.
submit( )
$order->submit( );
Use this to finally submit the order. On success, your builder is replaced by a new Finance::Robinhood::Forex::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>