{"id":21835191,"url":"https://github.com/redayzarra/pockettrader","last_synced_at":"2026-02-07T11:02:17.507Z","repository":{"id":159811657,"uuid":"634853754","full_name":"redayzarra/PocketTrader","owner":"redayzarra","description":"PocketTrader is an automated trading bot for Alpaca's commission-free stock brokerage API. The bot enables seamless trade automation, asset checking, order management, technical analysis \u0026 position management, paper trading for strategy testing, and more!","archived":false,"fork":false,"pushed_at":"2023-05-26T21:09:07.000Z","size":884,"stargazers_count":2,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-20T20:04:53.206Z","etag":null,"topics":["algorithmic-trading","gui","tkinter-gui","trading","trading-algorithms","trading-bot","trading-strategies"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redayzarra.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null}},"created_at":"2023-05-01T11:30:03.000Z","updated_at":"2023-11-16T14:48:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b38e81d-57ac-45b3-9b2e-005213c37d8e","html_url":"https://github.com/redayzarra/PocketTrader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/redayzarra/PocketTrader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redayzarra%2FPocketTrader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redayzarra%2FPocketTrader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redayzarra%2FPocketTrader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redayzarra%2FPocketTrader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redayzarra","download_url":"https://codeload.github.com/redayzarra/PocketTrader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redayzarra%2FPocketTrader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29193089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["algorithmic-trading","gui","tkinter-gui","trading","trading-algorithms","trading-bot","trading-strategies"],"created_at":"2024-11-27T20:18:19.889Z","updated_at":"2026-02-07T11:02:17.492Z","avatar_url":"https://github.com/redayzarra.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n \n  \u003cimg src=\"https://github.com/redayzarra/PocketTrader/assets/113388793/fb6d1103-2ba2-4be9-aada-cc5e744374f2\" alt=\"PocketTrader_Logo\"\u003e\n \n\u003c/div\u003e\n\n\n\u003cbr\u003e \u003c!-- This line adds a line break --\u003e\n\nPocketTrader is a trading bot designed to automate trades on [**Alpaca**](https://alpaca.markets/docs/python-sdk/getting_started.html#), a commission-free API-first stock brokerage. It interfaces with Alpaca's API to place trades, cancel orders, and check asset status. It also supports paper trading for testing strategies without risking real money.\n\n\u003cbr\u003e \u003c!-- This line adds a line break --\u003e\n\n\u003cdiv align=\"center\"\u003e\n \n  \u003cimg src=\"https://github.com/redayzarra/PocketTrader/assets/113388793/e53d6b17-b533-49a1-b884-3bcc52f0c4b7\" alt=\"PocketTrader_GUI\"\u003e\n\n\u003c/div\u003e\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Configuration](#configuration)\n3. [Running PocketTrader](#running-pockettrader)\n4. [Features](#features)\n    - [Automated Trading](#automated-trading)\n    - [User Interface](#user-interface)\n    - [Asset Checking](#asset-checking)\n    - [Order Management](#order-management)\n    - [Paper Trading](#paper-trading)\n    - [Trade Execution](#trade-execution)\n5. [Technical Analysis and Position Management](#technical-analysis-and-position-management)\n6. [Disclaimer](#disclaimer)\n7. [Contributing](#contributing)\n8. [License](#license)\n\n## Installation\n\n1. Clone the repository to your local machine.\n2. Install the necessary Python packages:\n\n```bash\npip install -r requirements.txt\n```\n\n## Configuration \n\nPocketTrader requires API keys, normal API and Secret API strings, to interact with Alpaca's API. The keys can be entered through the bot's graphical user interface (or through the config.json file). Other settings, such as sleep times, can only be set in the **[config.json](https://github.com/redayzarra/PocketTrader/blob/master/config.json)** file.\n\n## Running PocketTrader\n\nTo start the bot, use the following command:\n\n```bash\npython main.py\n```\nThe bot will launch a GUI to set API keys. After this, it will check the account status, cancel all open orders, and then ask for a ticker. It will then start trading the provided asset. If a trade fails, the bot will log the failure and sleep for a set period of time before trying again.\n\nPlease **ensure that you have valid Alpaca API keys** and a **stable internet connection** before running the bot. Always remember to carefully review the bot's configurations before live trading. While the bot provides a level of automation, it's crucial to monitor its performance and intervene manually if necessary.\n\n## Features\n\n### Automated Trading\n\nPocketTrader is designed to place trades automatically based on predefined strategies. This ensures consistent execution of the trading strategy, minimizing the potential for human error.\n\n### User Interface\nPocketTrader features an intuitive graphical user interface (GUI) that allows users to easily set their API keys and configure other settings. This makes the bot user-friendly, even for those without extensive technical knowledge.\n\n### Asset Checking\nBefore placing a trade, PocketTrader checks whether the asset is tradable or not. This feature ensures that the bot doesn't attempt to place trades on assets that are not currently available for trading.\n\n### Order Management\nAt the start of every trading session, the bot cancels all open orders. This ensures a clean slate for the new trading session and prevents any conflicts or unexpected trades from previous sessions.\n\n### Paper Trading\nPocketTrader supports paper trading, which enables users to test their trading strategies without risking real money. This feature is particularly useful for beginners and for testing new strategies before using them in a live market.\n\n### Trade Execution\nThe run function is the main trading operation function. It orchestrates the entire trading process by performing trend analysis, confirming the trend, executing the trade, managing the open position, and closing the position when necessary. PocketTrader's functionality is encapsulated in a loop that continues to evaluate and trade as long as the program runs. It includes several checks and safeguards to manage risk and ensure proper trade execution.\n\n## Technical Analysis and Position Management\n\nPocketTrader employs a suite of functions to perform advanced technical analysis and manage open positions.\n\nPocketTrader performs a general trend analysis on an asset's historical data, detecting overall upward or downward trends based on the relative position of three Exponential Moving Averages (EMAs): 9-period, 26-period, and 50-period. It returns **\"long\"** for an upward trend, **\"short\"** for a downward trend, or **\"no trend\"** if no clear trend is detected. To confirm the general trend, the bot performs a similar EMA-based analysis but on a shorter time interval. This ensures that the asset's price movement aligns with the general trend.\n\nThe bot also incorporates popular momentum-based indicators for further trend confirmation. PocketTrader performs Relative Strength Index (RSI) analysis, which can signal potential overbought or oversold conditions, while also using Stochastic Oscillator analysis to help identify potential price reversals. PocketTrade also checks whether the Stochastic Oscillator curves have crossed, a situation often considered a trading signal.\n\nFinally, PocketTrader manages an open position by setting take-profit and stop-loss levels and continuously checking these levels against the asset's current price. It also keeps an eye on Stochastic Oscillator crossings as a potential exit signal.\n\n## Disclaimer\n\nTrading involves significant risk and can result in substantial financial loss. Always conduct your own research and consider your financial situation carefully before trading. The use of this bot is at your own risk and it is recommended to test any trading algorithm thoroughly before live trading.\n\n## Contibuting\n\nIf you find a bug or want to propose a new feature, please open an issue. I really appreciate people willing to help!\n\n## License\n\nThis project is licensed under the MIT license. Please see the [LICENSE](https://github.com/redayzarra/PocketTrader/blob/master/LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredayzarra%2Fpockettrader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredayzarra%2Fpockettrader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredayzarra%2Fpockettrader/lists"}