Finance-Alpaca

 view release on metacpan or  search on metacpan

lib/Finance/Alpaca/Struct/Order.pm  view on Meta::CPAN

    say $orders[0]->id;

=head1 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.

=head1 Properties

The following properties are contained in the object.

    $trade->id();

=over

lib/Finance/Alpaca/Struct/TradeUpdate.pm  view on Meta::CPAN

    use Finance::Alpaca;
    my $stream = Finance::Alpaca->new( ... )->trade_stream(
        sub ($event) {
            ...
        }
     );
    Mojo::IOLoop->start unless Mojo::IOLoop->is_running;

=head1 DESCRIPTION

Alpaca’s API offers WebSocket streaming for account and order updates. When
subscribed, events returned from Alpaca will be coerced into
Finance::Alpaca::Struct::Stream objects.

=head1 Properties

The fields present in a message depend on the type of event they are
communicating. All messages contain an event C<type> and an C<order> field,
which is the same as the order object that is returned from the REST API.
Potential event types and additional fields that will be in their messages are
listed below.



( run in 0.245 second using v1.01-cache-2.11-cpan-4d50c553e7e )