Metadata-Version: 2.4
Name: trade_database_manager
Version: 0.1.2
Summary: A wrapper of kdb and sql for convenient trade data management.
Author-email: YQ Cui <qianyun210603@hotmail.com>
License-Expression: MIT
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=2.0.0
Requires-Dist: numpy
Requires-Dist: ruamel.yaml
Requires-Dist: sqlalchemy
Requires-Dist: psycopg>=3.1
Requires-Dist: questdb
Provides-Extra: dev
Requires-Dist: ruff>=0.0.263; extra == "dev"
Requires-Dist: setuptools_scm>=8; extra == "dev"
Requires-Dist: setuptools>=64; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Dynamic: license-file

<table border=1 cellpadding=10>
<tr>
<td style="color: red;">

#### \*\*\* IMPORTANT NOTICE \*\*\*

<p style="color: red">This package is <b>not</b> in a usable stage. It is only uploaded for convenience of developing and testing.</p>

</td></tr></table>



### Postgreslq Initialization

```sql
CREATE DATABASE trade_data;
CREATE USER tradedbadmin WITH PASSWORD 'trade_password';
GRANT ALL PRIVILEGES ON DATABASE trade_data TO tradedbadmin;
\connect trade_data;
GRANT ALL ON SCHEMA public TO tradedbadmin;
```

Add the following lines in the `pg_hba.conf` file to allow password authentication for the `tradedbadmin` role.

```
# trade database
host    all            tradedbadmin     0.0.0.0/0               scram-sha-256
host    all            tradedbadmin     ::/0                    scram-sha-256
```

### MetaData Initialization

Allowed instruments types are given in "Instrument Types" section of [meta_enumerations.md](doc/data_organization/meta_enumerations.md).

### Data Initialization for Instrument Type(s)
```python
from trade_database_manager.manager import MetadataSql

metadatalib = MetadataSql()
metadatalib.initialize(for_inst_types="CB")
```

This will try to create two tables, `instruments` and `instruments_cb` in the database if not yet exists. The `instruments` table will store the common information of all instruments, and the `instruments_cb` table will store the type-specific information of the instruments of type `CB`.

The table fields are listed in the [data_organization.md](doc/data_organization.md) file.




