# MarketDatabaseManager
<p align="left">
<img src="https://img.shields.io/badge/python-3.8+-blue.svg">
</p>
MarketDatabaseManager is your complete solution for interacting with financial assets using a Docker-optimized REST API backed by PostgreSQL.
## 🔥 Features
- **Docker-Optimized REST API**: Efficiently interact with a PostgreSQL database stored in the local PostgreSQL app, all via a REST API encapsulated within a Docker container.
- **Comprehensive Asset Categorization**: Features detailed tables designed specifically for various asset classes, such as equity, cryptocurrency, and commodity futures.
- **Asset-Specific Bar Data Tables**: Each asset class has its own dedicated bar data table, allowing for detailed financial tracking and analysis.
- **User-Friendly**: Intuitive methods are at your disposal to add, modify, or delete financial asset data with ease.
- **Integrated Client Library**: The provided client library facilitates seamless interactions with the API. It acts as a bridge to the local PostgreSQL database, ensuring consistency and efficiency in handling data across all supported asset classes.
## 🚀 Installation
#### 1️⃣ Install PostgreSQL
- [PostgreSQL Official Download](https://www.postgresql.org/download/)
#### 2️⃣ Install Docker
- [Docker Desktop Official Download](https://www.docker.com/products/docker-desktop/)
#### 3️⃣ Create Database
```bash
psql -U postgres;
CREATE DATABASE <database_name>;
```
#### 4️⃣ Clone the repository
```bash
git clone https://github.com/anthonyb8/MarketDatabaseManager.git
```
#### 5️⃣ Set up your environment
Create a `.env` file in the `api` directory and insert your database credentials:
```plaintext
DATABASE_URL = "postgresql://<user>:<password>@host.docker.internal/<database_name>"
```
> ⚠️ Note: If Docker isn't running locally, replace `host.docker.internal` with the appropriate host.
#### 6️⃣ Dockerize
From the root `MarketDatabaseManager` directory, run the following commands to build and start the Docker container:
```bash
docker-compose build
docker-compose up -d
```
#### 7️⃣ Install the client library
While in the root directory of your project (not the `MarketDatabaseManager` directory), execute the following commands to set up the virtual environment and install the client library:
```bash
python3.10 -m venv venv
source venv/bin/activate
pip install MarketDataManager
```
## 📌 Examples
#### Create Database Tables
```python
from MarketDataManager import Client
client = Client()
client.create_tables()
```
#### Create Asset
```python
new_asset = {
"ticker" : "AAPL",
"type" : "equity"
}
client.create_asset(asset = new_asset)
```
#### Add Asset Details
```python
asset_details = {
'company_name' : 'Apple Inc.',
'exchange' : 'NASDAQ',
'currency' : 'USD',
'industry' : 'Technology',
'description' : 'Equity for Apple Inc. a technologies producer.',
'market_cap' : 100000,
'shares_outstanding' : 100000
}
client.create_asset_details(ticker="AAPL", asset_type="equity",data=asset_details)
```
#### Add Asset Bardata
```python
asset_bardata = [
{
'date' : '2023-01-01',
'open': 100.0,
'close': 101.0,
'high': 102.0,
'low': 103,
'volume': 109,
'adjusted_close' : 1100.0
},
{
'date' : '2023-01-02',
'open': 100.0,
'close': 101.0,
'high': 102.0,
'low': 103,
'volume': 109,
'adjusted_close' : 1100.0
}
]
client.create_bardata(ticker="AAPL", asset_type="equity", data=asset_bardata)
```
## 📜 License
This project is licensed under the Apache License, Version 2.0. [Get a copy of the License here](http://www.apache.org/licenses/LICENSE-2.0).
Raw data
{
"_id": null,
"home_page": "https://github.com/anthonyb8/MarketData",
"name": "MarketDataManager",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "marketdata,postgresSQL,financial,docker",
"author": "Anthony Baxter",
"author_email": "anthonybaxter819@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b6/c0/2401fa2b94f493a3984e54a681bed36ea6de8d14eea743219d0cd7513dc2/MarketDataManager-0.2.tar.gz",
"platform": null,
"description": "# MarketDatabaseManager\n\n<p align=\"left\">\n <img src=\"https://img.shields.io/badge/python-3.8+-blue.svg\">\n</p>\n\nMarketDatabaseManager is your complete solution for interacting with financial assets using a Docker-optimized REST API backed by PostgreSQL.\n\n## \ud83d\udd25 Features\n\n- **Docker-Optimized REST API**: Efficiently interact with a PostgreSQL database stored in the local PostgreSQL app, all via a REST API encapsulated within a Docker container.\n- **Comprehensive Asset Categorization**: Features detailed tables designed specifically for various asset classes, such as equity, cryptocurrency, and commodity futures.\n- **Asset-Specific Bar Data Tables**: Each asset class has its own dedicated bar data table, allowing for detailed financial tracking and analysis.\n- **User-Friendly**: Intuitive methods are at your disposal to add, modify, or delete financial asset data with ease.\n- **Integrated Client Library**: The provided client library facilitates seamless interactions with the API. It acts as a bridge to the local PostgreSQL database, ensuring consistency and efficiency in handling data across all supported asset classes.\n\n\n## \ud83d\ude80 Installation\n\n#### 1\ufe0f\u20e3 Install PostgreSQL\n- [PostgreSQL Official Download](https://www.postgresql.org/download/)\n\n#### 2\ufe0f\u20e3 Install Docker\n- [Docker Desktop Official Download](https://www.docker.com/products/docker-desktop/)\n\n#### 3\ufe0f\u20e3 Create Database\n```bash\npsql -U postgres;\n\nCREATE DATABASE <database_name>;\n```\n\n#### 4\ufe0f\u20e3 Clone the repository\n```bash\ngit clone https://github.com/anthonyb8/MarketDatabaseManager.git\n```\n\n#### 5\ufe0f\u20e3 Set up your environment\nCreate a `.env` file in the `api` directory and insert your database credentials:\n```plaintext\nDATABASE_URL = \"postgresql://<user>:<password>@host.docker.internal/<database_name>\"\n```\n> \u26a0\ufe0f Note: If Docker isn't running locally, replace `host.docker.internal` with the appropriate host.\n\n#### 6\ufe0f\u20e3 Dockerize\nFrom the root `MarketDatabaseManager` directory, run the following commands to build and start the Docker container:\n```bash\ndocker-compose build\n\ndocker-compose up -d\n```\n\n#### 7\ufe0f\u20e3 Install the client library\nWhile in the root directory of your project (not the `MarketDatabaseManager` directory), execute the following commands to set up the virtual environment and install the client library:\n```bash\npython3.10 -m venv venv\n\nsource venv/bin/activate\n\npip install MarketDataManager\n```\n\n## \ud83d\udccc Examples\n\n#### Create Database Tables\n```python\nfrom MarketDataManager import Client\n\nclient = Client()\nclient.create_tables()\n```\n\n#### Create Asset\n```python\nnew_asset = {\n \"ticker\" : \"AAPL\", \n \"type\" : \"equity\"\n}\nclient.create_asset(asset = new_asset)\n```\n\n#### Add Asset Details\n```python\nasset_details = {\n 'company_name' : 'Apple Inc.',\n 'exchange' : 'NASDAQ',\n 'currency' : 'USD',\n 'industry' : 'Technology',\n 'description' : 'Equity for Apple Inc. a technologies producer.',\n 'market_cap' : 100000,\n 'shares_outstanding' : 100000\n}\nclient.create_asset_details(ticker=\"AAPL\", asset_type=\"equity\",data=asset_details)\n```\n#### Add Asset Bardata\n```python\nasset_bardata = [\n {\n 'date' : '2023-01-01',\n 'open': 100.0,\n 'close': 101.0,\n 'high': 102.0,\n 'low': 103,\n 'volume': 109,\n 'adjusted_close' : 1100.0\n }, \n {\n 'date' : '2023-01-02',\n 'open': 100.0,\n 'close': 101.0,\n 'high': 102.0,\n 'low': 103,\n 'volume': 109,\n 'adjusted_close' : 1100.0\n }\n]\nclient.create_bardata(ticker=\"AAPL\", asset_type=\"equity\", data=asset_bardata)\n```\n\n## \ud83d\udcdc License\n\nThis project is licensed under the Apache License, Version 2.0. [Get a copy of the License here](http://www.apache.org/licenses/LICENSE-2.0).\n\n\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "A client library to manage a postgresSQL database of financial market data, using a docker containerized api.",
"version": "0.2",
"project_urls": {
"Homepage": "https://github.com/anthonyb8/MarketData"
},
"split_keywords": [
"marketdata",
"postgressql",
"financial",
"docker"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ab8b218c76c1a483e3ddfdfbad05189784af838ff4da373d33aa35eebbf45335",
"md5": "73b6d821132671d1d7935f5a7c654da6",
"sha256": "55be58ba5a62fcd0341d63290375bff08f21e486bf9fc878fdf6884f6f667127"
},
"downloads": -1,
"filename": "MarketDataManager-0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "73b6d821132671d1d7935f5a7c654da6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 14051,
"upload_time": "2023-09-22T15:56:50",
"upload_time_iso_8601": "2023-09-22T15:56:50.457702Z",
"url": "https://files.pythonhosted.org/packages/ab/8b/218c76c1a483e3ddfdfbad05189784af838ff4da373d33aa35eebbf45335/MarketDataManager-0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b6c02401fa2b94f493a3984e54a681bed36ea6de8d14eea743219d0cd7513dc2",
"md5": "29cf57eb9c2d2b333859550364c28379",
"sha256": "94d641d26403aa303ea061829d4b096c826d0490d516897fa395c918341275df"
},
"downloads": -1,
"filename": "MarketDataManager-0.2.tar.gz",
"has_sig": false,
"md5_digest": "29cf57eb9c2d2b333859550364c28379",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 9545,
"upload_time": "2023-09-22T15:56:52",
"upload_time_iso_8601": "2023-09-22T15:56:52.080164Z",
"url": "https://files.pythonhosted.org/packages/b6/c0/2401fa2b94f493a3984e54a681bed36ea6de8d14eea743219d0cd7513dc2/MarketDataManager-0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-22 15:56:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "anthonyb8",
"github_project": "MarketData",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "marketdatamanager"
}