From 0ca31dcd47ad80da3ff6884295f4d247f3855821 Mon Sep 17 00:00:00 2001
From: Guofu Li
Date: Wed, 24 Aug 2022 14:40:33 +0800
Subject: [PATCH] 1. Re-organize the directory structure, creating sub-packages
for `DDBLoader`. 2. Update `DDBHFTLoader` to better handle the journal file.
3. Move the entrance scripts to `src/run.py`.
---
dolphindb/.workspace | 4 +-
ipynb/ddb.ipynb | 657 +++++++++++-
ipynb/ddb_pe.ipynb | 333 ++++++
ipynb/mssql.ipynb | 8 +-
src/DDBBase.py | 2 +-
src/DDBLoader.py | 950 ------------------
src/__init__.py | 3 +
src/{ => expr}/DDBExpression.py | 0
src/{ => factor}/DDBFactor.py | 0
src/loader/DDBBasicInfoLoader.py | 159 +++
src/loader/DDBDailyLoader.py | 160 +++
src/loader/DDBHFTLoader.py | 484 +++++++++
src/loader/DDBLoader.py | 100 ++
src/loader/DDBPITLoader.py | 287 ++++++
.../HFDataTableMessage_pb2.py | 0
.../IndexFutureKLineMessage_pb2.py | 0
.../IndexFutureL1TickMessage_pb2.py | 0
.../ProtoBuffEntitys/IndexKLineMessage_pb2.py | 0
.../ProtoBuffEntitys/IndexTickMessage_pb2.py | 0
.../ProtoBuffEntitys/KLineMessage_pb2.py | 0
.../ProtoBuffEntitys/OrderMessage_pb2.py | 0
.../ProtoBuffEntitys/TickMessage_pb2.py | 0
.../ProtoBuffEntitys/TickQueueMessage_pb2.py | 0
.../ProtoBuffEntitys/TranseMessage_pb2.py | 0
src/loader/ProtoBuffEntitys/__init__.py | 4 +
src/{ => loader}/make_hft.py | 0
src/run.py | 31 +
27 files changed, 2200 insertions(+), 982 deletions(-)
create mode 100644 ipynb/ddb_pe.ipynb
delete mode 100644 src/DDBLoader.py
create mode 100644 src/__init__.py
rename src/{ => expr}/DDBExpression.py (100%)
rename src/{ => factor}/DDBFactor.py (100%)
create mode 100644 src/loader/DDBBasicInfoLoader.py
create mode 100644 src/loader/DDBDailyLoader.py
create mode 100644 src/loader/DDBHFTLoader.py
create mode 100644 src/loader/DDBLoader.py
create mode 100644 src/loader/DDBPITLoader.py
rename src/{ => loader}/ProtoBuffEntitys/HFDataTableMessage_pb2.py (100%)
rename src/{ => loader}/ProtoBuffEntitys/IndexFutureKLineMessage_pb2.py (100%)
rename src/{ => loader}/ProtoBuffEntitys/IndexFutureL1TickMessage_pb2.py (100%)
rename src/{ => loader}/ProtoBuffEntitys/IndexKLineMessage_pb2.py (100%)
rename src/{ => loader}/ProtoBuffEntitys/IndexTickMessage_pb2.py (100%)
rename src/{ => loader}/ProtoBuffEntitys/KLineMessage_pb2.py (100%)
rename src/{ => loader}/ProtoBuffEntitys/OrderMessage_pb2.py (100%)
rename src/{ => loader}/ProtoBuffEntitys/TickMessage_pb2.py (100%)
rename src/{ => loader}/ProtoBuffEntitys/TickQueueMessage_pb2.py (100%)
rename src/{ => loader}/ProtoBuffEntitys/TranseMessage_pb2.py (100%)
create mode 100644 src/loader/ProtoBuffEntitys/__init__.py
rename src/{ => loader}/make_hft.py (100%)
create mode 100644 src/run.py
diff --git a/dolphindb/.workspace b/dolphindb/.workspace
index f205732..d24ffac 100755
--- a/dolphindb/.workspace
+++ b/dolphindb/.workspace
@@ -12,5 +12,5 @@ Open,/Users/guofu/Workspaces/dolphindb/test2/scripts/pit_series_report_period_at
Server,.167,192.168.1.167,8848,,admin,123456
Server,.7,192.168.1.7,8848,,admin,123456
Server,local8848,localhost,8848,,,
-ActiveFile,/Users/guofu/Workspaces/dolphindb/test2/scripts/pit6.dos
-ActiveServer,.167
+ActiveFile,/Users/guofu/Workspaces/dolphindb/test2/scripts/test2.dos
+ActiveServer,.7
diff --git a/ipynb/ddb.ipynb b/ipynb/ddb.ipynb
index e04a63e..e7669e7 100644
--- a/ipynb/ddb.ipynb
+++ b/ipynb/ddb.ipynb
@@ -48,25 +48,130 @@
},
{
"cell_type": "code",
- "execution_count": 68,
- "id": "8b7dae3d-aef1-4c50-92b2-460d4fea0a96",
+ "execution_count": 32,
+ "id": "c8d07fc8-d80c-490f-9220-0d3e8e4c72a4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "114350"
+ "50"
]
},
- "execution_count": 68,
+ "execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
+ "sess = ddb.session('localhost', 8848)\n",
+ "sess.login('admin', '123456')\n",
+ "\n",
+ "# backup(backup_path, sql_obj, force, parallel)\n",
+ "code = \"\"\"\n",
+ " backup('/data/dolphindb/backup/',