{"id":13875932,"url":"https://github.com/d-e-s-o/apcacli","last_synced_at":"2025-04-05T17:04:09.055Z","repository":{"id":39671314,"uuid":"263525388","full_name":"d-e-s-o/apcacli","owner":"d-e-s-o","description":"A command line tool for trading stocks on Alpaca (alpaca.markets).","archived":false,"fork":false,"pushed_at":"2024-12-29T19:24:53.000Z","size":349,"stargazers_count":42,"open_issues_count":3,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T16:03:49.851Z","etag":null,"topics":["alpaca","alpaca-api","alpaca-markets","alpaca-trading-api","rust","rust-cli"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d-e-s-o.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-13T04:29:00.000Z","updated_at":"2025-03-06T15:02:05.000Z","dependencies_parsed_at":"2023-02-08T07:46:11.472Z","dependency_job_id":"8cc59058-1f54-407e-975d-b442f7c1e2d2","html_url":"https://github.com/d-e-s-o/apcacli","commit_stats":{"total_commits":155,"total_committers":3,"mean_commits":"51.666666666666664","dds":0.01935483870967747,"last_synced_commit":"e3759551661e99937b4af958596b916808b68173"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-e-s-o%2Fapcacli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-e-s-o%2Fapcacli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-e-s-o%2Fapcacli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-e-s-o%2Fapcacli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d-e-s-o","download_url":"https://codeload.github.com/d-e-s-o/apcacli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369953,"owners_count":20927928,"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":["alpaca","alpaca-api","alpaca-markets","alpaca-trading-api","rust","rust-cli"],"created_at":"2024-08-06T06:00:50.903Z","updated_at":"2025-04-05T17:04:09.028Z","avatar_url":"https://github.com/d-e-s-o.png","language":"Rust","funding_links":[],"categories":["Rust","rust"],"sub_categories":[],"readme":"[![pipeline](https://github.com/d-e-s-o/apcacli/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/d-e-s-o/apcacli/actions/workflows/test.yml)\n[![crates.io](https://img.shields.io/crates/v/apcacli.svg)](https://crates.io/crates/apcacli)\n[![rustc](https://img.shields.io/badge/rustc-1.71+-blue.svg)](https://blog.rust-lang.org/2023/07/13/Rust-1.71.0.html)\n\napcacli\n=======\n\n- [Changelog](CHANGELOG.md)\n\n**apcacli** is a command line application for interacting with the\nAlpaca API at [alpaca.markets][]. It provides access to the majority of\nAlpaca's functionality, including but not limited to:\n- inquiring account information\n- changing account configuration\n- retrieving account activity\n- accessing the market clock\n- submitting, changing, listing, and canceling orders\n- listing and closing open positions\n- listing and retrieving general asset information\n- streaming of account and trade events\n\nIt supports both the paper trading as well as the live API endpoints.\n\n\nUsage\n-----\n\nThe program assumes environment variables representing the Alpaca key ID\n(`APCA_API_KEY_ID`) and secret (`APCA_API_SECRET_KEY`), so make sure\nthat they are present. The program defaults to using the paper trading\nAPI. For live trading you will also need to change the URL to the API\nendpoint to use (`APCA_API_BASE_URL`).\n\n```bash\nexport APCA_API_BASE_URL='https://api.alpaca.markets'; # We trade live\nexport APCA_API_KEY_ID='XXXXXXXXXXXXXXXXXXXX';\nexport APCA_API_SECRET_KEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';\n```\n\nWith this setup, you can trade from the command line.\n##### Submit an Order\n```bash\n$ apcacli order submit buy SPY --value 1000 --limit-price 200\n\u003e 40c13937-5969-48f0-92f8-2f1ef673517a\n```\n\n##### Lookup an Order\n```bash\n$ apcacli order get 40c13937-5969-48f0-92f8-2f1ef673517a\nSPY:\n  order id:         40c13937-5969-48f0-92f8-2f1ef673517a\n  status:           accepted\n  created at:       Sun, 10 May 2020 10:15:34 -0700\n  submitted at:     Sun, 10 May 2020 10:15:34 -0700\n  updated at:       Sun, 10 May 2020 10:15:34 -0700\n  filled at:        N/A\n  expired at:       N/A\n  canceled at:      N/A\n  quantity:         5\n  filled quantity:  0\n  type:             limit\n  side:             buy\n  good until:       canceled\n  limit:            200.00 USD\n  stop:             N/A\n  extended hours:   false\n```\n\n##### List All Open Positions\n```\n$ apcacli position list\n                                   |  Avg Entry  |     Today P/L      |      Total P/L\n1 AAPL @  274.02 USD =  274.02 USD |  281.59 USD |  5.65 USD ( 2.11%) |  -7.57 USD (-2.69%)\n1 AMZN @ 2359.86 USD = 2359.86 USD | 2426.79 USD | 31.74 USD ( 1.36%) | -66.93 USD (-2.76%)\n1 BIDU @  101.75 USD =  101.75 USD |  107.33 USD |  0.34 USD ( 0.34%) |  -5.58 USD (-5.20%)\n1 CTSO @    8.90 USD =    8.90 USD |    7.98 USD |  0.50 USD ( 5.95%) |   0.92 USD (11.53%)\n1 EA   @  113.00 USD =  113.00 USD |  116.76 USD | -0.27 USD (-0.24%) |  -3.76 USD (-3.22%)\n1 SPWR @    6.35 USD =    6.35 USD |    6.66 USD |  0.20 USD ( 3.25%) |  -0.31 USD (-4.65%)\n3 XLK  @   87.00 USD =  261.00 USD |   80.10 USD |  8.55 USD ( 3.39%) |  20.70 USD ( 8.61%)\n----------------------------------- ------------- -------------------- --------------------\n                       3124.88 USD   3187.41 USD   46.71 USD ( 1.47%)   -62.53 USD (-1.96%)\n```\n\nMore commands are available and can be discovered using the help.\n\nThe program is powered by the [`apca`][apca] crate and written in Rust.\nIt comes with shell completion support and automatic coloring of\nprofit/losses.\n\n\n### Shell Completion\nAs mentioned earlier, **apcacli** comes with shell completion support\n(for various shells). A completion script can be generated via the\n`shell-complete` utility program and then only needs to be sourced to\nmake the current shell provide context-sensitive tab completion support.\nE.g.,\n```bash\n$ cargo run --bin=shell-complete \u003e apcacli.bash\n$ source apcacli.bash\n```\n\nThe generated completion script can be installed system-wide as usual\nand sourced through initialization files, such as `~/.bashrc`.\n\nCompletion scripts for other shells work in a similar manner. Please\nrefer to the help text (`--help`) of the `shell-complete` program for\nthe list of supported shells.\n\n[alpaca.markets]: https://alpaca.markets\n[apca]: https://crates.io/crates/apca\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-e-s-o%2Fapcacli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd-e-s-o%2Fapcacli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-e-s-o%2Fapcacli/lists"}