{"id":16443688,"url":"https://github.com/mohabmes/pystocklib","last_synced_at":"2025-03-23T08:32:03.985Z","repository":{"id":149922643,"uuid":"123333900","full_name":"mohabmes/pystocklib","owner":"mohabmes","description":"Python library to Fetch \u0026 Analyze Stock Market data.","archived":false,"fork":false,"pushed_at":"2018-07-04T18:12:15.000Z","size":172,"stargazers_count":32,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T19:27:59.962Z","etag":null,"topics":["empirical-mode-decomposition","historical-data","news-extraction","sentiment-analysis","stock-market","stock-market-analysis","trend-analysis"],"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/mohabmes.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}},"created_at":"2018-02-28T19:45:48.000Z","updated_at":"2025-01-15T17:13:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc65c974-75b1-4baf-a062-bda51971b3e2","html_url":"https://github.com/mohabmes/pystocklib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohabmes%2Fpystocklib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohabmes%2Fpystocklib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohabmes%2Fpystocklib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohabmes%2Fpystocklib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohabmes","download_url":"https://codeload.github.com/mohabmes/pystocklib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245078067,"owners_count":20557274,"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":["empirical-mode-decomposition","historical-data","news-extraction","sentiment-analysis","stock-market","stock-market-analysis","trend-analysis"],"created_at":"2024-10-11T09:21:53.137Z","updated_at":"2025-03-23T08:32:03.545Z","avatar_url":"https://github.com/mohabmes.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pystocklib\nPython package for Stock Market analysis. (Historical Data, News analysis, visual, Empirical Mode Decomposition)\n\n# Features\n- Historical Data\n\t- load_csv\n\t- get_date, get_open, get_high, get_low, get_close, get_adj, get_volume\n\t- retrieve_col_data\n\t- create_csv\n\t- moving_average\n\t- high_minus_low\n\t- standard_deviation\n\t- info_plot\n- News analysis\n\t- extract_news\n\t- get_sentiment\n\t- get_news\n\t- get_result\n- visual\n\t- plot_fig\n\t- save_fig\n- Empirical Mode Decomposition (EMD)\n\t- get_trend\n\t- get_modes\n\t- save_figure\n\n# How to use\n\n#### Get the historical data\n```\n\nhist = HistoricalData('AAPL', from_date=[2005, 1, 1], to_date=[2018, 3, 1])\n\nprice = hist.get_high()\n\n# or use: hist.retrieve_col_data('Open') 'Date', 'Open', 'High', 'Low', 'Adj', 'Close', 'Volume'\n\n```\n###### Output\n```\n            Date        Open        High         Low       Close   Adj Close      Volume\n0     2007-01-03   12.327143   12.368571   11.700000   10.812462   11.971429   309579900\n1     2007-01-04   12.007143   12.278571   11.974286   11.052453   12.237143   211815100\n2     2007-01-05   12.252857   12.314285   12.057143   10.973743   12.150000   208685400\n3     2007-01-08   12.280000   12.361428   12.182858   11.027935   12.210000   199276700\n4     2007-01-09   12.350000   13.282857   12.164286   11.944029   13.224286   837324600\n5     2007-01-10   13.535714   13.971429   13.350000   12.515617   13.857142   738220000\n6     2007-01-11   13.705714   13.825714   13.585714   12.360788   13.685715   360063200\n7     2007-01-12   13.512857   13.580000   13.318571   12.208535   13.517143   328172600\n```\n\u003cbr /\u003e\u003cbr /\u003e\n\n#### Plot \u0026 Generate CSV file\n```\n\nhist.create_csv()\n\nplot(price)\n\n```\n###### Output\n[CSV File](https://github.com/mohabmes/pystocklib/blob/master/data/AAPL.csv)\u003cbr\u003e\n![AAPL-data.png](./data/AAPL-data.png)\n\u003cbr /\u003e\u003cbr /\u003e\n\n\n#### Load data from csv file\n```\n\nhist = HistoricalData()\n\nhist.load_csv('AAPL')\n\nhist.info_plot('Close')\n\n```\n###### Output\n![AAPL info](./data/AAPL-info.png)\n\u003cbr /\u003e\u003cbr /\u003e\n\n#### Apply EMD \u0026 show the figure\n```\n\nemd = EMD(price)\n\nemd.save_figure('AAPL-trend', type='trend') # type =\u003e trend, all, modes, ds\n\n```\n###### Output\n![AAPL-trend](./data/AAPL-trend.png)\n![AAPL-trend](./data/AAPL-trend-data.png)\n\u003cbr /\u003e\u003cbr /\u003e\n\n#### Calc The SD\n```\n\nsdv = hist.standard_deviation('Open')\n\nprint(sdv)\n\n```\n###### Output\n```\nif 0 \u003c sdv \u003c 25\n\tthen it will be considered as 'SAFE'\nOtherwise\n\tit's 'RISKY'\n\n```\n\u003cbr /\u003e\u003cbr /\u003e\n\n#### Gather News \u0026 analysis it\n```\n\nnews = News('Apple')\n\nresult = news.get_result()\n\n```\n###### Output\n```\n{\n\t'news': [\n\t\t{\n\t\t\t'text': 'Apple May Be Working on High-End Headphones and a Cheaper MacBook Air',\n\t\t\t'a': 'http://fortune.com/2018/03/10/apple-headphones-macbook-air/',\n\t\t\t'website': 'fortune.com',\n\t\t\t'sentiment': 0.6\n\t\t},\n\t\t{\n\t\t\t'text': \"Apple's December 2016 Quarter Seems To Have Confused A Lot Of People\",\n\t\t\t'a': 'https://www.forbes.com/sites/chuckjones/2018/apples-14-week-december-2016/',\n\t\t\t'website': 'forbes.com',\n\t\t\t'sentiment': -0.4\n\t\t}\n\t\t...\n\t\t...\n\t\t...\n\t],\n\t'sentiment': 77.4\n}\n\n```\n\n# Credit\n- [AndrewRPorter](https://github.com/AndrewRPorter)\n- [parkus](https://github.com/parkus)\n\n# License\n[MIT License](https://github.com/mohabmes/pystocklib/blob/master/LICENSE) Copyright (c) 2018 mohabmes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohabmes%2Fpystocklib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohabmes%2Fpystocklib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohabmes%2Fpystocklib/lists"}