{"id":15286186,"url":"https://github.com/sanko/finance-alpaca","last_synced_at":"2025-08-16T13:40:21.485Z","repository":{"id":56840829,"uuid":"358408588","full_name":"sanko/Finance-Alpaca","owner":"sanko","description":"Perl Wrapper for Alpaca's Commission-free Stock Trading API","archived":false,"fork":false,"pushed_at":"2022-02-18T03:44:32.000Z","size":356,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T03:13:01.298Z","etag":null,"topics":["algotrading","alpaca","finance","historical-data","perl","stock-market"],"latest_commit_sha":null,"homepage":"https://metacpan.org/release/Finance-Alpaca","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sanko.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"sanko","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-04-15T22:28:08.000Z","updated_at":"2025-02-18T17:46:34.000Z","dependencies_parsed_at":"2022-08-29T01:51:23.696Z","dependency_job_id":null,"html_url":"https://github.com/sanko/Finance-Alpaca","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanko%2FFinance-Alpaca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanko%2FFinance-Alpaca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanko%2FFinance-Alpaca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanko%2FFinance-Alpaca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanko","download_url":"https://codeload.github.com/sanko/Finance-Alpaca/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657923,"owners_count":21140846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algotrading","alpaca","finance","historical-data","perl","stock-market"],"created_at":"2024-09-30T15:10:55.013Z","updated_at":"2025-04-13T03:13:26.718Z","avatar_url":"https://github.com/sanko.png","language":"Perl","funding_links":["https://github.com/sponsors/sanko"],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/sanko/Finance-Alpaca/actions/workflows/linux.yaml/badge.svg)](https://github.com/sanko/Finance-Alpaca/actions/workflows/linux.yaml) [![Actions Status](https://github.com/sanko/Finance-Alpaca/actions/workflows/windows.yaml/badge.svg)](https://github.com/sanko/Finance-Alpaca/actions/workflows/windows.yaml) [![Actions Status](https://github.com/sanko/Finance-Alpaca/actions/workflows/osx.yaml/badge.svg)](https://github.com/sanko/Finance-Alpaca/actions/workflows/osx.yaml) [![Actions Status](https://github.com/sanko/Finance-Alpaca/actions/workflows/freebsd.yaml/badge.svg)](https://github.com/sanko/Finance-Alpaca/actions/workflows/freebsd.yaml) [![MetaCPAN Release](https://badge.fury.io/pl/Finance-Alpaca.svg)](https://metacpan.org/release/Finance-Alpaca)\n# NAME\n\nFinance::Alpaca - Perl Wrapper for Alpaca's Commission-free Stock Trading API\n\n# SYNOPSIS\n\n    use Finance::Alpaca;\n    my $alpaca = Finance::Alpaca-\u003enew(\n        paper =\u003e 1,\n        keys  =\u003e [ ... ]\n    );\n    my $order = $alpaca-\u003ecreate_order(\n        symbol =\u003e 'MSFT',\n        qty    =\u003e .1,\n        side   =\u003e 'buy',\n        type   =\u003e 'market',\n        time_in_force =\u003e 'day'\n    );\n\n# DESCRIPTION\n\nFinance::Alpaca allows you to buy, sell, and short U.S. stocks with zero\ncommissions with Alpaca, an API first, algo-friendly brokerage.\n\n# METHODS\n\n## `new( ... )`\n\n    my $camelid = Finance::Alpaca-\u003enew(\n        keys =\u003e [ 'MDJOHHAE5BDE2FAYAEQT',\n                  'Xq9p6ovxaa5XKihaEDRgpMapjeWYd5gIM63iq5BL'\n                ] );\n\nCreates a new Finance::Alpaca object.\n\nThis constructor accepts the following parameters:\n\n- `keys` - `[ $APCA_API_KEY_ID, $APCA_API_SECRET_KEY ]`\n\n    Every API call requires authentication. You must provide these keys which may\n    be acquired in the developer web console and are only visible on creation.\n\n- `paper` - Boolean value\n\n    If you're attempting to use Alpaca's paper trading system, this **must** be a\n    true value. Otherwise, you will be making live trades with real assets!\n\n    **Note**: This is a false value by default.\n\n## `account( )`\n\n    my $acct = $camelid-\u003eaccount( );\n    CORE::say sprintf 'I can%s short!', $acct-\u003eshorting_enabled ? '' : 'not';\n\nReturns a [Finance::Alpaca::Struct::Account](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AAccount) object.\n\nThe account endpoint serves important information related to an account,\nincluding account status, funds available for trade, funds available for\nwithdrawal, and various flags relevant to an account’s ability to trade.\n\n## `clock( )`\n\n    my $clock = $camelid-\u003eclock();\n    say sprintf\n        $clock-\u003etimestamp-\u003estrftime('It is %l:%M:%S %p on a %A and the market is %%sopen!'),\n        $clock-\u003eis_open ? '' : 'not ';\n\nReturns a [Finance::Alpaca::Struct::Clock](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AClock) object.\n\nThe clock endpoint serves the current market timestamp, whether or not the\nmarket is currently open, as well as the times of the next market open and\nclose.\n\n## `calendar( [...] )`\n\n        my @days = $camelid-\u003ecalendar(\n            start =\u003e Time::Moment-\u003enow,\n            end   =\u003e Time::Moment-\u003enow-\u003eplus_days(14)\n        );\n        for my $day (@days) {\n            say sprintf '%s the market opens at %s Eastern',\n                $day-\u003edate, $day-\u003eopen;\n        }\n\nReturns a list of [Finance::Alpaca::Struct::Calendar](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3ACalendar) objects.\n\nThe calendar endpoint serves the full list of market days from 1970 to 2029.\n\nThe following parameters are accepted:\n\n- `start` - The first date to retrieve data for (inclusive); Time::Moment object or RFC3339 string\n- `end` - The last date to retrieve data for (inclusive); Time::Moment object or RFC3339 string\n\nBoth listed parameters are optional. If neither is provided, the calendar will\nbegin on January 1st, 1970.\n\n## `assets( [...] )`\n\n    say $_-\u003esymbol\n        for sort { $a-\u003esymbol cmp $b-\u003esymbol } @{ $camelid-\u003eassets( status =\u003e 'active' ) };\n\nReturns a list of [Finance::Alpaca::Struct::Asset](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AAsset) objects.\n\nThe assets endpoint serves as the master list of assets available for trade and\ndata consumption from Alpaca.\n\nThe following parameters are accepted:\n\n- `status` - e.g. `active` or `inactive`. By default, all statuses are included\n- `asset_class` - Defaults to `us_equity`\n\n## `asset( ... )`\n\n    my $msft = $camelid-\u003easset('MSFT');\n    my $spy  = $camelid-\u003easset('b28f4066-5c6d-479b-a2af-85dc1a8f16fb');\n\nReturns a [Finance::Alpaca::Struct::Asset](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AAsset) object.\n\nYou may use either the asset's `id` (UUID) or `symbol`. If the asset is not\nfound, an empty list is returned.\n\n## `bars( ... )`\n\n    my %bars = $camelid-\u003ebars(\n          symbol    =\u003e 'MSFT',\n          timeframe =\u003e '1Min',\n          start     =\u003e Time::Moment-\u003enow-\u003ewith_hour(10),\n          end       =\u003e Time::Moment-\u003enow-\u003eminus_minutes(20)\n      );\n\nReturns a list of [Finance::Alpaca::Struct::Bar](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3ABar) objects along with other\ndata.\n\nThe bar endpoint serves aggregate historical data for the requested securities.\n\nThe following parameters are accepted:\n\n- `symbol` - The symbol to query for; this is required\n- `start` - Filter data equal to or before this time in RFC-3339 format or a Time::Moment object. Fractions of a second are not accepted; this is required\n- `end` - Filter data equal to or before this time in RFC-3339 format or a Time::Moment object. Fractions of a second are not accepted; this is required\n- `limit` - Number of data points to return. Must be in range `1-10000`, defaults to `1000`\n- `page_token` - Pagination token to continue from\n- `timeframe` - Timeframe for the aggregation. Available values are: `1Min`, `1Hour`, and `1Day`; this is required\n\nThe method returns a hash reference with bar data included as a list under the\nsymbol as well as a `next_page_token` for pagination if applicable.\n\n## `quotes( ... )`\n\n    my %quotes = $camelid-\u003equotes(\n        symbol =\u003e 'MSFT',\n        start  =\u003e Time::Moment-\u003enow-\u003ewith_hour(10),\n        end    =\u003e Time::Moment-\u003enow-\u003eminus_minutes(20)\n    );\n\nReturns a list of [Finance::Alpaca::Struct::Quote](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AQuote) objects along with other\ndata.\n\nThe bar endpoint serves quote (NBBO) historical data for the requested\nsecurity.\n\nThe following parameters are accepted:\n\n- `symbol` - The symbol to query for; this is required\n- `start` - Filter data equal to or before this time in RFC-3339 format or a Time::Moment object. Fractions of a second are not accepted; this is required\n- `end` - Filter data equal to or before this time in RFC-3339 format or a Time::Moment object. Fractions of a second are not accepted; this is required\n- `limit` - Number of data points to return. Must be in range `1-10000`, defaults to `1000`\n- `page_token` - Pagination token to continue from\n\nThe method returns a hash reference with quote data included as a list under\nthe symbol as well as a `next_page_token` for pagination if applicable.\n\n## `trades( ... )`\n\n    my %trades = $camelid-\u003etrades(\n        symbol =\u003e 'MSFT',\n        start  =\u003e Time::Moment-\u003enow-\u003ewith_hour(10),\n        end    =\u003e Time::Moment-\u003enow-\u003eminus_minutes(20)\n    );\n\nReturns a list of [Finance::Alpaca::Struct::Trade](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3ATrade) objects along with other\ndata.\n\nThe bar endpoint serves historical trade data for a given ticker symbol on a\nspecified date.\n\nThe following parameters are accepted:\n\n- `symbol` - The symbol to query for; this is required\n- `start` - Filter data equal to or before this time in RFC-3339 format or a Time::Moment object. Fractions of a second are not accepted; this is required\n- `end` - Filter data equal to or before this time in RFC-3339 format or a Time::Moment object. Fractions of a second are not accepted; this is required\n- `limit` - Number of data points to return. Must be in range `1-10000`, defaults to `1000`\n- `page_token` - Pagination token to continue from\n\nThe method returns a hash reference with trade data included as a list under\nthe symbol as well as a `next_page_token` for pagination if applicable.\n\n## `trade_stream( ... )`\n\n    my $stream = $camelid-\u003etrade_stream( sub ($packet) {  ... } );\n\nReturns a new [Finance::Alpaca::TradeStream](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3ATradeStream) object.\n\nYou are ready to receive real-time account and order data!\n\nThis method expects a code reference. This callback will receive all incoming\ndata.\n\n## `data_stream( ... )`\n\n    my $stream = $camelid-\u003edata_stream( sub ($packet) {  ... } );\n    $stream-\u003esubscribe(\n        trades =\u003e ['MSFT']\n    );\n\nReturns a new [Finance::Alpaca::DataStream](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3ADataStream) object.\n\nYou are ready to receive real-time market data!\n\nYou can send one or more subscription messages (described in\n[Finance::Alpaca::DataStream](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3ADataStream)) and after confirmation you will receive the\ncorresponding market data.\n\nThis method expects a code reference. This callback will receive all incoming\ndata.\n\n## `orders( [...] )`\n\n    my @orders = $camelid-\u003eorders( status =\u003e 'open' );\n\nReturns a list of [Finance::Alpaca::Struct::Order](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AOrder) objects.\n\nThe orders endpoint returns a list of orders for the account, filtered by the\nsupplied parameters.\n\nThe following parameters are accepted:\n\n- `status` - Order status to be queried. `open`, `closed`, or `all`. Defaults to `open`.\n- `limit` - The maximum number of orders in response. Defaults to `50` and max is `500`.\n- `after` - The response will include only ones submitted after this timestamp (exclusive.)\n- `until` - The response will include only ones submitted until this timestamp (exclusive.)\n- `direction` - The chronological order of response based on the submission time. `asc` or `desc`. Defaults to `desc`.\n- `nested` - Boolean value indicating whether the result will roll up multi-leg orders under the `legs( )` field of the primary order.\n- `symbols` - A comma-separated list of symbols to filter by (ex. `AAPL,TSLA,MSFT`).\n\n## `order_by_id( ..., [...] )`\n\n    my $order = $camelid-\u003eorder_by_id('0f43d12c-8f13-4bff-8597-c665b66bace4');\n\nReturns a [Finance::Alpaca::Struct::Order](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AOrder) object.\n\nYou must provide the order's `id` (UUID). If the order is not found, an empty\nlist is returned.\n\nYou may also provide a boolean value; if true, the result will roll up\nmulti-leg orders under the `legs( )` field in primary order.\n\n    my $order = $camelid-\u003eorder_by_id('0f43d12c-8f13-4bff-8597-c665b66bace4', 1);\n\n## `order_by_client_id( ... )`\n\n    my $order = $camelid-\u003eorder_by_client_id('17ff6b86-d330-4ac1-808b-846555b75b6e');\n\nReturns a [Finance::Alpaca::Struct::Order](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AOrder) object.\n\nYou must provide the order's `client_order_id` (UUID). If the order is not\nfound, an empty list is returned.\n\n## `create_order( ... )`\n\n    my $order = $camelid-\u003ecreate_order(\n        symbol =\u003e 'MSFT',\n        qty    =\u003e .1,\n        side   =\u003e 'buy',\n        type   =\u003e 'market',\n        time_in_force =\u003e 'day'\n    );\n\nIf the order is placed successfully, this method returns a\n[Finance::Alpaca::Struct::Order](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AOrder) object. Failures result in hash references\nwith data from the API.\n\nAn order request may be rejected if the account is not authorized for trading,\nor if the tradable balance is insufficient to fill the order.\n\nThe following parameters are accepted:\n\n- `symbol` - symbol or asset ID to identify the asset to trade (Required)\n- `qty` - number of shares to trade. Can be fractionable for only `market` and `day` order types (Required)\n- `notional` -dollar amount to trade. Cannot work with qty. Can only work for `market` order types and `day` for time in force (Required)\n- `side` - `buy` or `sell` (Required)\n- `type` - `market`, `limit`, `stop`, `stop_limit`, or `trailing_stop` (Required)\n- `time_in_force` - `day`, `gtc`, `opg`, `cls`, `ioc`, `fok`. Please see [Understand Orders](https://alpaca.markets/docs/trading-on-alpaca/orders/#time-in-force) for more info (Required)\n- `limit_price` - Required if `type` is `limit` or `stop_limit`\n- `stop_price` - Required if `type` is `stop` or `stop_limit`\n- `trail_price` - This or `trail_percent` is required if `type` is `trailing_stop`\n- `trail_percent` - This or `trail_price` is required if `type` is `trailing_stop`\n- `extended_hours` - If a `true` value, order will be eligible to execute in premarket/afterhours. Only works with `type` is `limit` and `time_in_force` is `day`\n- `client_order_id` - A unique identifier (UUID v4) for the order. Automatically generated by Alpaca if not sent.\n- `order_class` - `simple`, `bracket`, `oco` or `oto`. For details of non-simple order classes, please see [Bracket Order Overview](https://alpaca.markets/docs/trading-on-alpaca/orders#bracket-orders)\n- `take_profit` - Additional parameters for `take_profit` leg of advanced orders\n    - `limit_price` - Required for bracket orders\n- `stop_loss` - Additional parameters for stop-loss leg of advanced orders\n    - `stop_price` - Required for bracket orders\n    - `limit_price` - The stop-loss order becomes a stop-limit order if specified\n\n## `replace_order( ..., ... )`\n\n    my $new_order = $camelid-\u003ereplace_order(\n        $order-\u003eid,\n        qty           =\u003e 1,\n        time_in_force =\u003e 'fok',\n        limit_price   =\u003e 120\n    );\n\nReplaces a single order with updated parameters. Each parameter overrides the\ncorresponding attribute of the existing order. The other attributes remain the\nsame as the existing order.\n\nA success return code from a replaced order does NOT guarantee the existing\nopen order has been replaced. If the existing open order is filled before the\nreplacing (new) order reaches the execution venue, the replacing (new) order is\nrejected, and these events are sent in the trade\\_updates stream channel.\n\nWhile an order is being replaced, buying power is reduced by the larger of the\ntwo orders that have been placed (the old order being replaced, and the newly\nplaced order to replace it). If you are replacing a buy entry order with a\nhigher limit price than the original order, the buying power is calculated\nbased on the newly placed order. If you are replacing it with a lower limit\nprice, the buying power is calculated based on the old order.\n\nIn addition to the original order's ID, this method expects the following\nparameters:\n\n- `qty` - number of shares to trade\n- `time_in_force` - `day`, `gtc`, `opg`, `cls`, `ioc`, `fok`. Please see [Understand Orders](https://alpaca.markets/docs/trading-on-alpaca/orders/#time-in-force) for more info\n- `limit_price` - required if `type` is `limit` or `stop_limit`\n- `stop_price` - required if `type` is `stop` or `stop_limit`\n- `trail` - the new value of the `trail_price` or `trail_percent` value (works only where `type` is `trailing_stop`)\n- `client_order_id` - A unique identifier (UUID v4) for the order. Automatically generated by Alpaca if not sent.\n\n## `cancel_orders( )`\n\n    $camelid-\u003ecancel_orders( );\n\nAttempts to cancel all open orders.\n\nOn success, an array of hashes will be returned each with the following\nelements:\n\n- `body` - Finance::Alpaca::Struct::Order object\n- `id` - the order ID (UUID)\n- `status` - HTTP status code for the request\n\nA response will be provided for each order that is attempted to be cancelled.\nIf an order is no longer cancelable, the server will reject the request and and\nempty list will be returned.\n\n## `cancel_order( ... )`\n\n    $camelid-\u003ecancel_order( 'be07eebc-13f0-4072-aa4c-f67046081276' );\n\nAttempts to cancel an open order. If the order is no longer cancelable\n(example: `status` is `filled`), the server will respond with status 422,\nreject the request, and an empty list will be returned. Upon acceptance of the\ncancel request, it returns status 204 and a true value.\n\n## `positions( )`\n\n    $camelid-\u003epositions( );\n\nRetrieves a list of the account’s open positions and returns a list of\n[Finance::Alpaca::Struct::Position](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3APosition) objects.\n\n## `position( ... )`\n\n    my $elon = $camelid-\u003eposition( 'TSLA' );\n    my $msft = $camelid-\u003eposition( 'b6d1aa75-5c9c-4353-a305-9e2caa1925ab' );\n\nRetreves the account's open position for the given symbol or asset ID and\nreturns a [Finance::Alpaca::Struct::Position](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3APosition) object if found.\n\nIf not found, and empty list is returned.\n\n## `close_all_positions( [...] )`\n\n    my $panic = $camelid-\u003eclose_all_positions( );\n\nCloses (liquidates) all of the account’s open long and short positions.\n\n    $panic = $camelid-\u003eclose_all_positions( 1 );\n\nThis method accepts one optional parameter which, if true, will cancel all open\norders before liquidating all positions.\n\nOn success, an array of hashes will be returned each with the following\nelements:\n\n- `body` - [Finance::Alpaca::Struct::Order](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AOrder) object\n- `id` - the order ID (UUID)\n- `status` - HTTP status code for the request\n\nA response will be provided for each position that is attempted to be closed.\n\n## `close_position( ..., [...] )`\n\n    my $order = $camelid-\u003eclose_position('MSFT');\n    $order    = $camelid-\u003eclose_position( 'b6d1aa75-5c9c-4353-a305-9e2caa1925ab' );\n\nCloses (liquidates) the account’s open position for the given symbol or asset\nID and returns a [Finance::Alpaca::Struct::Order](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AOrder) object. Works for both long\nand short positions.\n\n    my $order = $camelid-\u003eclose_position('MSFT', 0.5);\n\nThis method accepts a second, optional parameter which is the number of shares\nto liquidate.\n\n## `portfolio_history( [...] )`\n\n    $camelid-\u003eportfolio_history( );\n\nThe portfolio history API returns the timeseries data for equity and profit\nloss information of the account.\n\n    $camelid-\u003eportfolio_history( period =\u003e '2W' );\n\nThis method accepts the following optional parameters:\n\n- `period` - The duration of the data in `\u003cnumber\u003e + \u003cunit\u003e`, such as 1D, where \u0026lt;unit\u003e can be D for day, `W` for week, `M` for month and `A` for year. Defaults to `1M`\n- `timeframe` - The resolution of time window. `1Min`, `5Min`, `15Min`, `1H`, or `1D`. If omitted, `1Min` for less than 7 days period, `15Min` for less than 30 days, or otherwise `1D`\n- `date_end` - The date the data is returned up to, in `YYYY-MM-DD` format or as a Time::Moment object. Defaults to the current market date (rolls over at the market open if `extended_hours` is false, otherwise at 7am ET)\n- `extended_hours` Boolean value; if true, include extended hours in the result. This is effective only for timeframe less than `1D`.\n\nThe returned data is in a hash ref with the following keys:\n\n- `timestamp` - List of Time::Moment objects; the time of each data element, left-labeled (the beginning of the window)\n- `equity` - List of numbers; equity values of the account in dollar amounts as of the end of each time window\n- `profit_loss` - List of numbers; profit/loss in dollar from the base value\n- `profit_loss_pct` - List of numbers; profit/loss in percentage from the base value\n- `base_value` - basis in dollar of the profit loss calculation\n- `timeframe` - time window size of each data element\n\n## `watchlists( )`\n\n    my @watchlists = $camelid-\u003ewatchlists;\n\nReturns the list of watchlists registered under the account as\n[Finance::Alpaca::Struct::Watchlist](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AWatchlist) objects.\n\n## `create_watchlist( ..., [...] )`\n\n    my $new_watchlist = $camelid-\u003ecreate_watchlist( 'Leveraged ETFs' );\n    my $tech_watchlist = $camelid-\u003ecreate_watchlist( 'FAANG', qw[FB AMZN AAPL NFLX GOOG] );\n\nCreate a new watchlist potentially with an initial set of assets. Only the\nfirst parameter is required and is the name of the user-defined new watchlist.\nThis name must be a maximum of `64` characters. To add assets to the watchlist\non create, include a list of ticker symbols.\n\nOn success, the related [Finance::Alpaca::Struct::Watchlist](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AWatchlist) object is\nreturned.\n\n## `delete_watchlist( ... )`\n\n    $camelid-\u003edelete_watchlist( '88f0c1e1-58d4-42c5-b85b-864839045678' );\n\nDelete a watchlist identified by the ID. This is a permanent deletion.\n\n## `watchlist( ... )`\n\n    $camelid-\u003ewatchlist( '88f0c1e1-58d4-42c5-b85b-864839045678' );\n\nReturns a watchlist identified by the ID.\n\n## `update_watchlist( ... )`\n\n    $camelid-\u003eupdate_watchlist( '88f0c1e1-58d4-42c5-b85b-864839045678', name =\u003e 'Low priority' );\n    $camelid-\u003eupdate_watchlist( '29d85812-b4a2-45da-ac6c-dcc0ad9c1cd3', symbols =\u003e [qw[MA V]] );\n\nUpdate the name and/or content of watchlist. On success, a\n[Finance::Alpaca::Struct::Watchlist](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AWatchlist) object is returned.\n\n## `add_to_watchlist( ... )`\n\n    $camelid-\u003eadd_to_watchlist( '88f0c1e1-58d4-42c5-b85b-864839045678', 'TSLA');\n\nAppend an asset for the symbol to the end of watchlist asset list. On success,\na [Finance::Alpaca::Struct::Watchlist](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AWatchlist) object is returned.\n\n## `remove_from_watchlist( ... )`\n\n    $camelid-\u003eremove_from_watchlist( '88f0c1e1-58d4-42c5-b85b-864839045678', 'F');\n\nDelete one entry for an asset by symbol name. On success, a\n[Finance::Alpaca::Struct::Watchlist](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AWatchlist) object is returned.\n\n## `configuration( )`\n\n    my $confs = $camelid-\u003econfiguration( );\n\nReturns the current account configuration values.\n\n## `modify_configuration( )`\n\n    $confs = $camelid-\u003emodify_configuration(\n        trade_confirm_email=\u003e 'all'\n    );\n\nUpdates the account configuration values. On success, the modified\nconfiguration is returned.\n\n## `activities( [...] )`\n\n    my @activities = $camelid-\u003eactivities();\n\nReturns account activity entries for many types of activities.\n\n    @activities = $camelid-\u003eactivities(activity_types =\u003e [qw[ACATC ACATS]]);\n\nReturns account activity entries for a set of specific types of activity. See\n[Finance::Alpaca::Struct::Activity](https://metacpan.org/pod/Finance%3A%3AAlpaca%3A%3AStruct%3A%3AActivity) for a list of activity types.\n\nThis method expects a combination of the following optional parameters:\n\n- `activity_types` - A list of the activity types to include in the response. If unspecified, activities of all types will be returned.\n- `date` - The date for which you want to see activities as string or Time::Moment object\n- `until` - The response will contain only activities submitted before this date. (Cannot be used with `date`.)\n- `after` - The response will contain only activities submitted after this date. (Cannot be used with `date`.)\n- `direction` - `asc` or `desc` (default is `desc` if unspecified.)\n- `page_size` - The maximum number of entries to return in the response\n- `page_token` - The ID of the end of your current page of results\n\n# Paging of Results\n\nWhen required, pagination is handled using the `page_token` and `page_size`\nparameters. `page_token` represents the ID of the end of your current page of\nresults. If specified with a direction of `desc`, for example, the results\nwill end before the activity with the specified ID. If specified with a\ndirection of `asc`, results will begin with the activity immediately after the\none specified. `page_size` is the maximum number of entries to return in the\nresponse. If `date` is not specified, the default and maximum value is `100`.\nIf `date` is specified, the default behavior is to return all results, and\nthere is no maximum page size.\n\n# See Also\n\n[https://alpaca.markets/docs/api-documentation/api-v2/](https://alpaca.markets/docs/api-documentation/api-v2/)\n\n# Note\n\nI do not have a live trading account with Alpaca but this package has worked\nwell with paper trading. YMMV.\n\n# LEGAL\n\nThis is a simple wrapper around the API as described in documentation. The\nauthor provides no investment, legal, or tax advice and is not responsible for\nany damages incurred while using this software. This software is not affiliated\nwith Alpaca Securities LLC in any way.\n\nFor Alpaca's terms and disclosures, please see their website at\nhttps://alpaca.markets/disclosures\n\n# LICENSE\n\nCopyright (C) Sanko Robinson.\n\nThis library is free software; you can redistribute it and/or modify it under\nthe terms found in the Artistic License 2. Other copyrights, terms, and\nconditions may apply to data transmitted through this module.\n\n# AUTHOR\n\nSanko Robinson \u003csanko@cpan.org\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanko%2Ffinance-alpaca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanko%2Ffinance-alpaca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanko%2Ffinance-alpaca/lists"}