reorganize the directory structure

main
Guofu Li 2 years ago
parent 95de99046a
commit 85522c064c

2
.gitignore vendored

@ -2,6 +2,8 @@
*.csv *.csv
*.swp *.swp
*.swo *.swo
.DS_Store
*.DS_Store
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/

@ -0,0 +1,16 @@
Project,test2,/Users/guofu/Workspaces/dolphindb/test2
Open,/Users/guofu/Workspaces/dolphindb/test2/scripts/test1.dos
Open,/Users/guofu/Workspaces/dolphindb/test2/scripts/pit2.dos
Open,/Users/guofu/Workspaces/dolphindb/test2/scripts/tail_vol_ratio.dos
Open,/Users/guofu/Workspaces/dolphindb/test2/scripts/pit.dos
Open,/Users/guofu/Workspaces/dolphindb/test2/scripts/test2.dos
Open,/Users/guofu/Workspaces/dolphindb/test2/scripts/pit3.dos
Open,/Users/guofu/Workspaces/dolphindb/test2/scripts/pit4.dos
Open,/Users/guofu/Workspaces/dolphindb/test2/scripts/pit_report_period_at_date.dos
Open,/Users/guofu/Workspaces/dolphindb/test2/scripts/pit6.dos
Open,/Users/guofu/Workspaces/dolphindb/test2/scripts/pit_series_report_period_at_date.dos
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

@ -0,0 +1,5 @@
login('admin', '123456')
// init backup
backup('/data/dolphindb/backup/', ,<select * from loadTable("dfs://hft_stock_ts","KLinePartitioned")>,true, true)
// incremental backup
//backup('/data/dolphindb/backup/', ,<select * from loadTable("dfs://compoDB","pt")>,false, true)

@ -0,0 +1,7 @@
tbl = loadTable("dfs://hft_stock_ts", 'KLinePartitioned')
// calculate the minute return
// `eachPre` applies the binary function (the 1st arg) to this row and its previous row
// TODO: m_nDate filter condition should be replaced by groupby
ret = select code, m_nDate, m_nTime, eachPre(\, m_nClose) - 1.0 as ret from tbl where m_nDate=2015.01.05 context by code limit 10;
kurto = select code, m_nDate, sqrt(239) * sum(pow(ret, 3)) / pow(sum(pow(ret, 2)), 1.5) as kurtosis from ret where group by code;

@ -0,0 +1,8 @@
is_common_ori = loadTable("dfs://pit_stock_ts", "cfs_common_adj")
divident = loadTable("dfs://pit_stock_ts", "divident")
//schema(is_common_ori)
//sql1 = select code, report_period, year(report_period) as year, quarterOfYear(report_period) + 1 as base_for_quarter_accum, appear_at_date from is_common_ori where partition(code, 0)
select top 100 * from divident

@ -0,0 +1,36 @@
is_common_adj = loadTable("dfs://pit_stock_ts", "is_common_adj")
is_common_ori = loadTable("dfs://pit_stock_ts", "is_common_ori")
// schema(is_common_ori)
/**
* 单季处理
*/
// 每年第一个季度
tbl_quarter1 = select code, report_period, year(report_period) as year, quarterOfYear(report_period) as current_quarter_accum, appear_at_date from is_common_ori where partition(code, 0), quarterOfYear(report_period) == 1
// 当季累计数据,作为下一季基准
tbl_quarter_accum_base = select code, report_period, year(report_period) as year, quarterOfYear(report_period) + 1 as base_for_quarter_accum, appear_at_date from is_common_ori where partition(code, 0), quarterOfYear(report_period) < 4
// 从第二季开始,去匹配前一季累计基数
tbl_quarter_accum = select code, report_period, year(report_period) as year, quarterOfYear(report_period) as current_quarter_accum, appear_at_date from is_common_ori where partition(code, 0), quarterOfYear(report_period) > 1
tbl_quarter_flux = select tbl_quarter_accum.* from ej(tbl_quarter_accum_base, tbl_quarter_accum, `code`year`base_for_quarter_accum, `code`year`current_quarter_accum)
tbl_quarter_flux = unionAll(tbl_quarter1, tbl_quarter_flux).sortBy!(`code`report_period)
tbl_quarter_flux
/**
* 同比计算
*/
/*
sql1 = select code, report_period, year(report_period) - 1 as last_year, quarterOfYear(report_period) as quarter_of_year from bs_common_ori where code='000001.SZ'
//sql1
sql2 = select code, report_period, year(report_period) as this_year, quarterOfYear(report_period) as quarter_of_year from bs_common_ori where code='000001.SZ'
sql = select sql1.*, sql2.* from ej(sql1, sql2, `code`last_year`quarter_of_year, `code`this_year`quarter_of_year)
sql
*/

@ -0,0 +1,17 @@
is_common_adj = loadTable("dfs://pit_stock_ts", "is_common_adj")
is_common_ori = loadTable("dfs://pit_stock_ts", "is_common_ori")
// select * from is_common_ori where code='000677.SZ' and report_period=2009.12.31
// select * from is_common_ori where report_period=2009.12.31
m_nDate = take(2011.10.01, 3);
report_period = [2008.12.31, 2009.12.31, 2010.12.31]
//code = `000001.SZ`000677.SZ`600001.SH;
tbl_query = table(report_period, m_nDate);
tbl_query_exp = select code, report_period, m_nDate from ej(is_common_ori, tbl_query, `report_period) where partition(code, 0);
is_common_ori_part = select * from ej(is_common_ori, tbl_query, `report_period) where partition(code, 0);
is_common_ori_part
select top 100 * from aj(tbl_query_exp, is_common_ori_part, `code`report_period`m_nDate, `code`report_period`appear_at_date);

@ -0,0 +1,3 @@
login('admin', '123456');
dropFunctionView('pit_report_period_at_date');

@ -0,0 +1,14 @@
select * from pit_report_period_at_date("is_common_ori", 2022.07.12, [2019.12.31], 0) order by code
/*
source_table = loadTable("dfs://pit_stock_ts", "is_common_adj");
m_nDate = [2021.12.12]
report_period = [2019.12.31]
query_table = table(report_period, m_nDate)
query_table_exp = select * from cj(query_table, select code from source_table where partition(code, 0) group by code map)
// query_table_exp
source_table_part = select source_table.* from ej(source_table, query_table_exp, `code`report_period) where partition(code, 0)
select top 100 * from aj(query_table_exp, source_table_part, `code`report_period`m_nDate, `code`report_period`appear_at_date) order by code
*/

@ -0,0 +1,17 @@
//dropFunctionView('pit_report_period_at_date')
def pit_at_date(table_name, date, report_period_list, code_partition_id) {
source_table = loadTable("dfs://pit_stock_ts", table_name);
m_nDate = take(date, size(report_period_list));
report_period = report_period_list;
query_table = table(report_period, m_nDate);
query_table_exp = select * from cj(query_table, select code from source_table where partition(code, code_partition_id) group by code map);
source_table_part = select source_table.* from ej(source_table, query_table_exp, `code`report_period) where partition(code, code_partition_id);
return select * from aj(query_table_exp, source_table_part, `code`report_period`m_nDate, `code`report_period`appear_at_date)
}
addFunctionView(pit_at_date)

@ -0,0 +1,18 @@
def pit_col_at_date(table_name, col_name, date, report_period_list, code_partition_id){
source_table = loadTable("dfs://pit_stock_ts", table_name);
m_nDate = take(date, size(report_period_list));
report_period = report_period_list;
query_table = table(report_period, m_nDate);
query_table_exp = select code, report_period, m_nDate from ej(source_table, query_table, `report_period) where partition(code, code_partition_id);
col_list = ['code', 'report_period', 'appear_in_period', 'appear_at_date', col_name]
from_tbl = <ej(source_table, query_table_exp, `code`report_period)>
where_conditions = [<partition(code, code_partition_id)>]
source_table_part = sql(select=col_list, from=from_tbl, where=where_conditions);
return select * from aj(query_table_exp, source_table_part, `report_period`m_nDate, `report_period`appear_at_date)
}
addFunctionView(pit_col_at_date)

@ -0,0 +1 @@
migrate('/data/dolphindb/backup/', "dfs://hft_stock_ts", "KLinePartitioned")

@ -0,0 +1,9 @@
login('admin', '123456')
// schema(loadTable("dfs://daily_stock_ts", "kurto_partitioned"))
//listTables("dfs://daily_stock_ts")
//dropTable(database("dfs://daily_stock_ts"), "kurto_partitioned")
//listTables("dfs://daily_stock_ts")
//select max(m_nDate), min(m_nDate) from loadTable("dfs://daily_stock_ts", "hft_daily_factor")
// select count(*) from loadTable("dfs://daily_stock_ts", "daily_kline")
// select top 100 * from loadTable("dfs://daily_stock_ts", "hft_daily_factor") where code='000002.SZ'
select top 100 * from loadTable("dfs://hft_stock_ts", "OrderPartitioned") where code='000002.SZ'

@ -0,0 +1,7 @@
tbl = loadTable("dfs://hft_stock_ts", 'KLinePartitioned')
// TODO: m_nDate filter in where clause need to be replaced by group by
total_vol = select code, m_nDate, sum(m_nVolume) as total_vol from tbl where m_nDate=2015.01.05 group by code
tail_vol = select code, m_nDate, sum(m_nVolume) as tail_vol from tbl where m_nDate=2015.01.05 and m_nTime>=14:30:00 group by code
select code, m_nDate, tail_vol/total_val as tail_vol_ratio from ej(total_val, tail_vol, `code`m_nDate)

@ -0,0 +1,14 @@
login('admin', '123456')
tbl = loadTable("dfs://hft_stock_ts", 'TickPartitioned')
//select * from tbl where code='000666.SZ', m_nDate <= 2013.01.06
// delete from tbl where code = '000666.SZ' //, '000667.SZ', '000668.SZ', '000669.SZ']
for (code in ['000666.SZ' , '000667.SZ', '000668.SZ', '000669.SZ']) {
del_date = 2013.01.01
//end_date = 2013.01.31
do {
//print('Deleting ' + code + ' from ' + start_date + ' to ' + end_date);
print('Deleting ' + code + ' of ' + del_date);
delete from tbl where m_nDate=del_date, code=code;
del_date = temporalAdd(del_date, 1, "d");
} while (del_date <= 2022.12.31)
}

@ -0,0 +1,3 @@
login('admin', '123456')
//select * from getClusterChunksStatus() where chunkId = "0367bcb4-4919-d4ad-5d46-b32a1fa6e724"
temporalAdd(2013.12.31, 2, "y") <= 2014.12.31

@ -1,10 +0,0 @@
login('admin', '123456')
tt = table(100:0, `code`m_nDate`m_nTime`m_nSide`m_nPrice`m_nOrderItems`m_nABItems`m_nABVolume, [SYMBOL, DATE, TIME, INT, FLOAT, INT, INT, INT[]])
share t as gt
share tt as gtt
dropStreamTable(gt)

@ -1,5 +0,0 @@
login("admin","123456")
pt=loadTable("dfs://valuedb","pt")
getTabletsMeta("/valuedb/%", `pt, true);
select top 100 * from pt

@ -847,9 +847,378 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 21,
"id": "b1bd7605-c347-44f2-a90f-bc949cde0ef0", "id": "b1bd7605-c347-44f2-a90f-bc949cde0ef0",
"metadata": {}, "metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>code</th>\n",
" <th>report_period</th>\n",
" <th>appear_in_period</th>\n",
" <th>appear_at_date</th>\n",
" <th>TOT_OPER_REV</th>\n",
" <th>OPER_REV</th>\n",
" <th>INT_INC</th>\n",
" <th>INSUR_PREM_UNEARNED</th>\n",
" <th>HANDLING_CHRG_COMM_INC</th>\n",
" <th>NET_INC_OTHER_OPS</th>\n",
" <th>...</th>\n",
" <th>OTHER_INCOME</th>\n",
" <th>MEMO</th>\n",
" <th>ASSET_DISPOSAL_INCOME</th>\n",
" <th>CONTINUED_NET_PROFIT</th>\n",
" <th>END_NET_PROFIT</th>\n",
" <th>CREDIT_IMPAIRMENT_LOSS</th>\n",
" <th>RD_EXPENSE</th>\n",
" <th>STMNOTE_FINEXP</th>\n",
" <th>FIN_EXP_INT_INC</th>\n",
" <th>TOT_OPER_COST2</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>000677.SZ</td>\n",
" <td>2009-12-31</td>\n",
" <td>2009-12-31</td>\n",
" <td>2010-04-26</td>\n",
" <td>3.514495e+09</td>\n",
" <td>3.514495e+09</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>26392229.68</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>nan</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>3.474455e+09</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>000677.SZ</td>\n",
" <td>2009-12-31</td>\n",
" <td>2009-12-31</td>\n",
" <td>2011-12-10</td>\n",
" <td>3.514495e+09</td>\n",
" <td>3.514495e+09</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>26392229.68</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>nan</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>3.460335e+09</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>2 rows × 69 columns</p>\n",
"</div>"
],
"text/plain": [
" code report_period appear_in_period appear_at_date TOT_OPER_REV \\\n",
"0 000677.SZ 2009-12-31 2009-12-31 2010-04-26 3.514495e+09 \n",
"1 000677.SZ 2009-12-31 2009-12-31 2011-12-10 3.514495e+09 \n",
"\n",
" OPER_REV INT_INC INSUR_PREM_UNEARNED HANDLING_CHRG_COMM_INC \\\n",
"0 3.514495e+09 0.0 0.0 0.0 \n",
"1 3.514495e+09 0.0 0.0 0.0 \n",
"\n",
" NET_INC_OTHER_OPS ... OTHER_INCOME MEMO ASSET_DISPOSAL_INCOME \\\n",
"0 26392229.68 ... 0.0 nan 0.0 \n",
"1 26392229.68 ... 0.0 nan 0.0 \n",
"\n",
" CONTINUED_NET_PROFIT END_NET_PROFIT CREDIT_IMPAIRMENT_LOSS RD_EXPENSE \\\n",
"0 0.0 0.0 0.0 0.0 \n",
"1 0.0 0.0 0.0 0.0 \n",
"\n",
" STMNOTE_FINEXP FIN_EXP_INT_INC TOT_OPER_COST2 \n",
"0 0.0 0.0 3.474455e+09 \n",
"1 0.0 0.0 3.460335e+09 \n",
"\n",
"[2 rows x 69 columns]"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import dolphindb as ddb \n",
"\n",
"sess = ddb.session('192.168.1.167', 8848)\n",
"sess.login('admin', '123456')\n",
"\n",
"sess.run(\"\"\"\n",
" is_common_adj = loadTable(\"dfs://pit_stock_ts\", \"is_common_adj\")\n",
" is_common_ori = loadTable(\"dfs://pit_stock_ts\", \"is_common_ori\")\n",
" select * from is_common_ori where code='000677.SZ' and report_period=2009.12.31\n",
"\"\"\")"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "f0b3928d-c06f-4976-b568-091d98293a6e",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>code</th>\n",
" <th>report_period</th>\n",
" <th>appear_in_period</th>\n",
" <th>appear_at_date</th>\n",
" <th>TOT_OPER_REV</th>\n",
" <th>OPER_REV</th>\n",
" <th>INT_INC</th>\n",
" <th>INSUR_PREM_UNEARNED</th>\n",
" <th>HANDLING_CHRG_COMM_INC</th>\n",
" <th>NET_INC_OTHER_OPS</th>\n",
" <th>...</th>\n",
" <th>OTHER_INCOME</th>\n",
" <th>MEMO</th>\n",
" <th>ASSET_DISPOSAL_INCOME</th>\n",
" <th>CONTINUED_NET_PROFIT</th>\n",
" <th>END_NET_PROFIT</th>\n",
" <th>CREDIT_IMPAIRMENT_LOSS</th>\n",
" <th>RD_EXPENSE</th>\n",
" <th>STMNOTE_FINEXP</th>\n",
" <th>FIN_EXP_INT_INC</th>\n",
" <th>TOT_OPER_COST2</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>000677.SZ</td>\n",
" <td>2009-12-31</td>\n",
" <td>2010-12-31</td>\n",
" <td>2011-04-29</td>\n",
" <td>3.514495e+09</td>\n",
" <td>3.514495e+09</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>26392229.68</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>nan</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>3.474455e+09</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>1 rows × 69 columns</p>\n",
"</div>"
],
"text/plain": [
" code report_period appear_in_period appear_at_date TOT_OPER_REV \\\n",
"0 000677.SZ 2009-12-31 2010-12-31 2011-04-29 3.514495e+09 \n",
"\n",
" OPER_REV INT_INC INSUR_PREM_UNEARNED HANDLING_CHRG_COMM_INC \\\n",
"0 3.514495e+09 0.0 0.0 0.0 \n",
"\n",
" NET_INC_OTHER_OPS ... OTHER_INCOME MEMO ASSET_DISPOSAL_INCOME \\\n",
"0 26392229.68 ... 0.0 nan 0.0 \n",
"\n",
" CONTINUED_NET_PROFIT END_NET_PROFIT CREDIT_IMPAIRMENT_LOSS RD_EXPENSE \\\n",
"0 0.0 0.0 0.0 0.0 \n",
"\n",
" STMNOTE_FINEXP FIN_EXP_INT_INC TOT_OPER_COST2 \n",
"0 0.0 0.0 3.474455e+09 \n",
"\n",
"[1 rows x 69 columns]"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sess.run(\"select * from is_common_adj where code='000677.SZ' and report_period=2009.12.31\")"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "d68ea326-82c3-4a7c-97cf-c04dd8aee56b",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>code</th>\n",
" <th>m_nDate</th>\n",
" <th>m_nTime</th>\n",
" <th>m_nPrice</th>\n",
" <th>m_iVolume</th>\n",
" <th>m_iTurover</th>\n",
" <th>m_nMatchItems</th>\n",
" <th>m_chTradeFlag</th>\n",
" <th>m_chBSFlag</th>\n",
" <th>m_iAccVolume</th>\n",
" <th>...</th>\n",
" <th>m_nOpen</th>\n",
" <th>m_nPreClose</th>\n",
" <th>m_nAskPrice</th>\n",
" <th>m_nAskVolume</th>\n",
" <th>m_nBidPrice</th>\n",
" <th>m_nBidVolume</th>\n",
" <th>m_nAskAvPrice</th>\n",
" <th>m_nBidAvPrice</th>\n",
" <th>m_iTotalAskVolume</th>\n",
" <th>m_iTotalBidVolume</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" </tbody>\n",
"</table>\n",
"<p>0 rows × 23 columns</p>\n",
"</div>"
],
"text/plain": [
"Empty DataFrame\n",
"Columns: [code, m_nDate, m_nTime, m_nPrice, m_iVolume, m_iTurover, m_nMatchItems, m_chTradeFlag, m_chBSFlag, m_iAccVolume, m_iAccTurover, m_nHigh, m_nLow, m_nOpen, m_nPreClose, m_nAskPrice, m_nAskVolume, m_nBidPrice, m_nBidVolume, m_nAskAvPrice, m_nBidAvPrice, m_iTotalAskVolume, m_iTotalBidVolume]\n",
"Index: []\n",
"\n",
"[0 rows x 23 columns]"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sess = ddb.session('192.168.1.7', 8848)\n",
"sess.login('admin', '123456')\n",
"sess.run(\"\"\"\n",
"tbl = loadTable(\"dfs://hft_stock_ts\", 'TickPartitioned');\n",
"select * from tbl where code='000666.SZ', m_nDate <= 2013.02.26;\n",
"\"\"\")"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "0e6e949b-ff25-40eb-a70a-72a3a6639aec",
"metadata": {},
"outputs": [
{
"ename": "RuntimeError",
"evalue": "<Exception> in run: Failed to read response header from the socket with IO error type 13",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
"Input \u001b[0;32mIn [31]\u001b[0m, in \u001b[0;36m<cell line: 15>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m code \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\"\"\u001b[39m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;124mtbl = loadTable(\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdfs://hft_stock_ts\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m, \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mTickPartitioned\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m)\u001b[39m\n\u001b[1;32m 3\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;124m}\u001b[39m\n\u001b[1;32m 14\u001b[0m \u001b[38;5;124m\"\"\"\u001b[39m\n\u001b[0;32m---> 15\u001b[0m \u001b[43msess\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcode\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/.venv/tinysoft/lib/python3.8/site-packages/dolphindb/session.py:161\u001b[0m, in \u001b[0;36msession.run\u001b[0;34m(self, script, *args, **kwargs)\u001b[0m\n\u001b[1;32m 159\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfetchSize\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m kwargs\u001b[38;5;241m.\u001b[39mkeys():\n\u001b[1;32m 160\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m BlockReader(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcpp\u001b[38;5;241m.\u001b[39mrunBlock(script, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs))\n\u001b[0;32m--> 161\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcpp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mscript\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"\u001b[0;31mRuntimeError\u001b[0m: <Exception> in run: Failed to read response header from the socket with IO error type 13"
]
}
],
"source": [
"code = \"\"\"\n",
"tbl = loadTable(\"dfs://hft_stock_ts\", 'TickPartitioned')\n",
"\n",
"for (code in ['000666.SZ' , '000667.SZ', '000668.SZ', '000669.SZ']) {\n",
"\tdel_date = 2013.01.01\n",
"\t//end_date = 2013.01.31\n",
"\tdo {\n",
"\t\t//print('Deleting ' + code + ' from ' + start_date + ' to ' + end_date);\n",
"\t\tprint('Deleting ' + code + ' of ' + del_date);\n",
"\t\tdelete from tbl where m_nDate=del_date, code=code;\n",
"\t\tdel_date = temporalAdd(del_date, 1, \"d\");\n",
"\t} while (del_date <= 2022.12.31)\n",
"}\n",
"\"\"\"\n",
"sess.run(code)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ea0501e7-d416-45ce-add5-e443c55f158c",
"metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []
} }

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save