The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Finance::Alpaca::Struct::Order - A Single Order Object

SYNOPSIS

    use Finance::Alpaca;
    my @orders = Finance::Alpaca->new( ... )->orders( status => 'all' );
    say $orders[0]->id;

DESCRIPTION

The orders API allows a user to monitor, place and cancel their orders with Alpaca. Each order has a unique identifier provided by the client. This client-side unique order ID will be automatically generated by the system if not provided by the client, and will be returned as part of the order object along with the rest of the fields described below. Once an order is placed, it can be queried using the client-side order ID to check the status. Updates on open orders at Alpaca will also be sent over the streaming interface, which is the recommended method of maintaining order state.

Properties

The following properties are contained in the object.

    $trade->id();
id - Order ID; UUID
client_order_id - Client unique order ID
created_at - Timestamp as Time::Moment object
updated_at - Timestamp as Time::Moment object if available
submitted_at - Timestamp as Time::Moment object if available
filled_at - Timestamp as Time::Moment object if available
expired_at - Timestamp as Time::Moment object if available
canceled_at - Timestamp as Time::Moment object if available
failed_at - Timestamp as Time::Moment object if available
replaced_at - Timestamp as Time::Moment object if available
replaced_by - The order ID that this order was replaced by if available; UUID
replaces - The order ID that this order replaces if available; UUID
asset_id - Asset ID; UUID
symbol - Asset symbol
asset_class - Asset class
notional - Ordered notional amount. If entered, qty( ) will be undefined. Can take up to 9 decimal places.
qty - Ordered quantity. If entered, notional( ) will be undefined. Can take up to 9 decimal places.
filled_qty - Filled quantity
filled_avg_price - Filled average price
order_class - simple, bracket, oco, or oto. For details of non-simple order classes, please see Bracket Order Overview.
type - market, limit, stop, stop_limit, or trailing_stop
side - buy or sell
time_in_force - day, gtc, opg, cls, ioc, fok. See Orders page
limit_price - Limit price if applicable
stop_price - Stop price if applicable
status - See Orders page
extended_hours - Boolean value indicating whether the order is eligible for execution outside regular trading hours
legs - List of Orders; When querying non-simple order_class order in a nested style, an array of Order objects associated with this order. Otherwise, undefined.
trail_percent - The percent value away from the high water mark for trailing stop orders, if applicable.
trail_price - The dollar value away from the hight water mark for trailing stop orders, if available.
hwm - The highest (lowest) market price seen since the trailing stop order was submitted.

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.

AUTHOR

Sanko Robinson <sanko@cpan.org>