diff --git a/Untitled2.ipynb b/.ipynb_checkpoints/account_analysis-checkpoint.ipynb
similarity index 72%
rename from Untitled2.ipynb
rename to .ipynb_checkpoints/account_analysis-checkpoint.ipynb
index 3091d0f..c25b635 100644
--- a/Untitled2.ipynb
+++ b/.ipynb_checkpoints/account_analysis-checkpoint.ipynb
@@ -5,7 +5,12 @@
"execution_count": null,
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "from setting import get_engine\n",
+ "import pandas as pd\n",
+ "engine = get_engine('db_stock')\n",
+ "df = pd.read_sql('tb_delivery_GJ',engine,index_col=u'成交日期')"
+ ]
}
],
"metadata": {
diff --git a/account_analysis.ipynb b/account_analysis.ipynb
new file mode 100644
index 0000000..00d3cc6
--- /dev/null
+++ b/account_analysis.ipynb
@@ -0,0 +1,2811 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from setting import get_engine\n",
+ "import pandas as pd\n",
+ "engine = get_engine('db_stock')\n",
+ "df = pd.read_sql('tb_delivery_GJ',engine,index_col=u'成交日期')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 成交时间 | \n",
+ " 证券代码 | \n",
+ " 证券名称 | \n",
+ " 操作 | \n",
+ " 成交数量 | \n",
+ " 成交均价 | \n",
+ " 成交金额 | \n",
+ " 余额 | \n",
+ " 发生金额 | \n",
+ " 手续费 | \n",
+ " 印花税 | \n",
+ " 过户费 | \n",
+ " 本次金额 | \n",
+ " 其他费用 | \n",
+ " 交易市场 | \n",
+ "
\n",
+ " \n",
+ " 成交日期 | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 2018-02-05 | \n",
+ " 13:29:51 | \n",
+ " 300527 | \n",
+ " 华舟应急 | \n",
+ " 证券卖出 | \n",
+ " -100 | \n",
+ " 24.96 | \n",
+ " 2496.0 | \n",
+ " 105.0 | \n",
+ " 2488.50 | \n",
+ " 5.0 | \n",
+ " 2.50 | \n",
+ " 0.05 | \n",
+ " 2488.50 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-02-07 | \n",
+ " 14:35:30 | \n",
+ " 300527 | \n",
+ " 华舟应急 | \n",
+ " 证券买入 | \n",
+ " 100 | \n",
+ " 23.94 | \n",
+ " 2394.0 | \n",
+ " 205.0 | \n",
+ " -2399.00 | \n",
+ " 5.0 | \n",
+ " 0.00 | \n",
+ " 0.05 | \n",
+ " 0.50 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-02-26 | \n",
+ " 11:22:45 | \n",
+ " 300527 | \n",
+ " 华舟应急 | \n",
+ " 证券卖出 | \n",
+ " -105 | \n",
+ " 23.26 | \n",
+ " 2442.3 | \n",
+ " 100.0 | \n",
+ " 2434.86 | \n",
+ " 5.0 | \n",
+ " 2.44 | \n",
+ " 0.05 | \n",
+ " 2435.36 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-02-27 | \n",
+ " 10:10:03 | \n",
+ " 300527 | \n",
+ " 华舟应急 | \n",
+ " 证券卖出 | \n",
+ " -100 | \n",
+ " 23.05 | \n",
+ " 2305.0 | \n",
+ " 100.0 | \n",
+ " 2297.69 | \n",
+ " 5.0 | \n",
+ " 2.31 | \n",
+ " 0.05 | \n",
+ " 2463.05 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-02-27 | \n",
+ " 10:01:22 | \n",
+ " 300527 | \n",
+ " 华舟应急 | \n",
+ " 证券买入 | \n",
+ " 100 | \n",
+ " 22.65 | \n",
+ " 2265.0 | \n",
+ " 200.0 | \n",
+ " -2270.00 | \n",
+ " 5.0 | \n",
+ " 0.00 | \n",
+ " 0.05 | \n",
+ " 165.36 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 成交时间 证券代码 证券名称 操作 成交数量 成交均价 成交金额 余额 发生金额 \\\n",
+ "成交日期 \n",
+ "2018-02-05 13:29:51 300527 华舟应急 证券卖出 -100 24.96 2496.0 105.0 2488.50 \n",
+ "2018-02-07 14:35:30 300527 华舟应急 证券买入 100 23.94 2394.0 205.0 -2399.00 \n",
+ "2018-02-26 11:22:45 300527 华舟应急 证券卖出 -105 23.26 2442.3 100.0 2434.86 \n",
+ "2018-02-27 10:10:03 300527 华舟应急 证券卖出 -100 23.05 2305.0 100.0 2297.69 \n",
+ "2018-02-27 10:01:22 300527 华舟应急 证券买入 100 22.65 2265.0 200.0 -2270.00 \n",
+ "\n",
+ " 手续费 印花税 过户费 本次金额 其他费用 交易市场 \n",
+ "成交日期 \n",
+ "2018-02-05 5.0 2.50 0.05 2488.50 0.0 深圳A股 \n",
+ "2018-02-07 5.0 0.00 0.05 0.50 0.0 深圳A股 \n",
+ "2018-02-26 5.0 2.44 0.05 2435.36 0.0 深圳A股 \n",
+ "2018-02-27 5.0 2.31 0.05 2463.05 0.0 深圳A股 \n",
+ "2018-02-27 5.0 0.00 0.05 165.36 0.0 深圳A股 "
+ ]
+ },
+ "execution_count": 26,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.head()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "12.43"
+ ]
+ },
+ "execution_count": 33,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[df[u'证券代码']==u'123005'][u'手续费'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "metadata": {
+ "scrolled": true
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 成交时间 | \n",
+ " 证券代码 | \n",
+ " 证券名称 | \n",
+ " 操作 | \n",
+ " 成交数量 | \n",
+ " 成交均价 | \n",
+ " 成交金额 | \n",
+ " 余额 | \n",
+ " 发生金额 | \n",
+ " 手续费 | \n",
+ " 印花税 | \n",
+ " 过户费 | \n",
+ " 本次金额 | \n",
+ " 其他费用 | \n",
+ " 交易市场 | \n",
+ "
\n",
+ " \n",
+ " 成交日期 | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 2018-03-16 | \n",
+ " 14:03:41 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 50 | \n",
+ " 123.680 | \n",
+ " 6184.00 | \n",
+ " 50.0 | \n",
+ " -6184.49 | \n",
+ " 0.49 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 3901.25 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-19 | \n",
+ " 10:59:31 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -50 | \n",
+ " 124.500 | \n",
+ " 6225.00 | \n",
+ " 0.0 | \n",
+ " 6224.50 | \n",
+ " 0.50 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 10148.33 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-23 | \n",
+ " 14:49:25 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -50 | \n",
+ " 120.190 | \n",
+ " 6009.50 | \n",
+ " 0.0 | \n",
+ " 6009.02 | \n",
+ " 0.48 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 9203.43 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-23 | \n",
+ " 13:23:42 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 50 | \n",
+ " 120.789 | \n",
+ " 6039.45 | \n",
+ " 50.0 | \n",
+ " -6039.93 | \n",
+ " 0.48 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 3194.41 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-26 | \n",
+ " 14:30:29 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -50 | \n",
+ " 122.650 | \n",
+ " 6132.50 | \n",
+ " 0.0 | \n",
+ " 6132.01 | \n",
+ " 0.49 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 6132.96 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-26 | \n",
+ " 09:40:35 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 50 | \n",
+ " 120.600 | \n",
+ " 6030.00 | \n",
+ " 50.0 | \n",
+ " -6030.48 | \n",
+ " 0.48 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.95 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-27 | \n",
+ " 10:05:12 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 126.680 | \n",
+ " 5067.20 | \n",
+ " 40.0 | \n",
+ " -5067.61 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -4030.68 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-27 | \n",
+ " 10:32:37 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 126.950 | \n",
+ " 5078.00 | \n",
+ " 0.0 | \n",
+ " 5077.59 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1046.91 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 10:19:53 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.900 | \n",
+ " 3747.00 | \n",
+ " 30.0 | \n",
+ " -3747.30 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1210.87 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 14:00:45 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.600 | \n",
+ " 3738.00 | \n",
+ " 30.0 | \n",
+ " -3738.30 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1257.40 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 10:24:24 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -30 | \n",
+ " 125.500 | \n",
+ " 3765.00 | \n",
+ " 0.0 | \n",
+ " 3764.70 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 4975.57 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 13:16:02 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -30 | \n",
+ " 125.100 | \n",
+ " 3753.00 | \n",
+ " 0.0 | \n",
+ " 3752.70 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 4988.77 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 13:56:59 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.200 | \n",
+ " 3726.00 | \n",
+ " 30.0 | \n",
+ " -3726.30 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1262.47 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 14:45:58 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 10 | \n",
+ " 124.890 | \n",
+ " 1248.90 | \n",
+ " 40.0 | \n",
+ " -1249.00 | \n",
+ " 0.10 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 8.40 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 11:08:49 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.640 | \n",
+ " 3739.20 | \n",
+ " 30.0 | \n",
+ " -3739.50 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1236.07 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 13:58:40 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -30 | \n",
+ " 124.451 | \n",
+ " 3733.53 | \n",
+ " 0.0 | \n",
+ " 3733.23 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 4995.70 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 09:33:44 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 125.000 | \n",
+ " 5000.00 | \n",
+ " 0.0 | \n",
+ " 4999.60 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5008.00 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 13:43:35 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 20 | \n",
+ " 123.370 | \n",
+ " 2467.40 | \n",
+ " 20.0 | \n",
+ " -2467.60 | \n",
+ " 0.20 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 2545.20 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 10:00:40 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 124.360 | \n",
+ " 4974.40 | \n",
+ " 40.0 | \n",
+ " -4974.80 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 33.20 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 10:32:24 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 124.500 | \n",
+ " 4980.00 | \n",
+ " 0.0 | \n",
+ " 4979.60 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5012.80 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 14:13:57 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 123.500 | \n",
+ " 4940.00 | \n",
+ " 40.0 | \n",
+ " -4940.40 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 74.16 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 13:45:53 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 20 | \n",
+ " 123.502 | \n",
+ " 2470.04 | \n",
+ " 40.0 | \n",
+ " -2470.24 | \n",
+ " 0.20 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 74.96 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 13:58:43 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 123.500 | \n",
+ " 4940.00 | \n",
+ " 0.0 | \n",
+ " 4939.60 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5014.56 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:44:14 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 129.250 | \n",
+ " 5170.00 | \n",
+ " 40.0 | \n",
+ " -5170.41 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 29.70 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:44:59 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 129.500 | \n",
+ " 5180.00 | \n",
+ " 0.0 | \n",
+ " 5179.59 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5209.29 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 10:02:53 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 123.550 | \n",
+ " 4942.00 | \n",
+ " 0.0 | \n",
+ " 4941.60 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5015.76 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:23:42 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 128.250 | \n",
+ " 5130.00 | \n",
+ " 40.0 | \n",
+ " -5130.41 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 49.74 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:32:43 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 129.400 | \n",
+ " 5176.00 | \n",
+ " 40.0 | \n",
+ " -5176.41 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 20.52 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:28:44 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 128.690 | \n",
+ " 5147.60 | \n",
+ " 0.0 | \n",
+ " 5147.19 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5196.93 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:15:16 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 127.801 | \n",
+ " 5112.04 | \n",
+ " 0.0 | \n",
+ " 5111.63 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5180.15 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 13:04:57 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 123.671 | \n",
+ " 4946.84 | \n",
+ " 40.0 | \n",
+ " -4947.24 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 68.52 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:41:48 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 129.500 | \n",
+ " 5180.00 | \n",
+ " 0.0 | \n",
+ " 5179.59 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5200.11 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-19 | \n",
+ " 13:39:02 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 130.220 | \n",
+ " 5208.80 | \n",
+ " 40.0 | \n",
+ " -5209.22 | \n",
+ " 0.42 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -4999.98 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 成交时间 证券代码 证券名称 操作 成交数量 成交均价 成交金额 余额 \\\n",
+ "成交日期 \n",
+ "2018-03-16 14:03:41 123005 万信转债 证券买入 50 123.680 6184.00 50.0 \n",
+ "2018-03-19 10:59:31 123005 万信转债 证券卖出 -50 124.500 6225.00 0.0 \n",
+ "2018-03-23 14:49:25 123005 万信转债 证券卖出 -50 120.190 6009.50 0.0 \n",
+ "2018-03-23 13:23:42 123005 万信转债 证券买入 50 120.789 6039.45 50.0 \n",
+ "2018-03-26 14:30:29 123005 万信转债 证券卖出 -50 122.650 6132.50 0.0 \n",
+ "2018-03-26 09:40:35 123005 万信转债 证券买入 50 120.600 6030.00 50.0 \n",
+ "2018-03-27 10:05:12 123005 万信转债 证券买入 40 126.680 5067.20 40.0 \n",
+ "2018-03-27 10:32:37 123005 万信转债 证券卖出 -40 126.950 5078.00 0.0 \n",
+ "2018-04-16 10:19:53 123005 万信转债 证券买入 30 124.900 3747.00 30.0 \n",
+ "2018-04-16 14:00:45 123005 万信转债 证券买入 30 124.600 3738.00 30.0 \n",
+ "2018-04-16 10:24:24 123005 万信转债 证券卖出 -30 125.500 3765.00 0.0 \n",
+ "2018-04-16 13:16:02 123005 万信转债 证券卖出 -30 125.100 3753.00 0.0 \n",
+ "2018-04-16 13:56:59 123005 万信转债 证券买入 30 124.200 3726.00 30.0 \n",
+ "2018-04-16 14:45:58 123005 万信转债 证券买入 10 124.890 1248.90 40.0 \n",
+ "2018-04-16 11:08:49 123005 万信转债 证券买入 30 124.640 3739.20 30.0 \n",
+ "2018-04-16 13:58:40 123005 万信转债 证券卖出 -30 124.451 3733.53 0.0 \n",
+ "2018-04-17 09:33:44 123005 万信转债 证券卖出 -40 125.000 5000.00 0.0 \n",
+ "2018-04-17 13:43:35 123005 万信转债 证券买入 20 123.370 2467.40 20.0 \n",
+ "2018-04-17 10:00:40 123005 万信转债 证券买入 40 124.360 4974.40 40.0 \n",
+ "2018-04-17 10:32:24 123005 万信转债 证券卖出 -40 124.500 4980.00 0.0 \n",
+ "2018-04-17 14:13:57 123005 万信转债 证券买入 40 123.500 4940.00 40.0 \n",
+ "2018-04-17 13:45:53 123005 万信转债 证券买入 20 123.502 2470.04 40.0 \n",
+ "2018-04-17 13:58:43 123005 万信转债 证券卖出 -40 123.500 4940.00 0.0 \n",
+ "2018-04-18 14:44:14 123005 万信转债 证券买入 40 129.250 5170.00 40.0 \n",
+ "2018-04-18 14:44:59 123005 万信转债 证券卖出 -40 129.500 5180.00 0.0 \n",
+ "2018-04-18 10:02:53 123005 万信转债 证券卖出 -40 123.550 4942.00 0.0 \n",
+ "2018-04-18 14:23:42 123005 万信转债 证券买入 40 128.250 5130.00 40.0 \n",
+ "2018-04-18 14:32:43 123005 万信转债 证券买入 40 129.400 5176.00 40.0 \n",
+ "2018-04-18 14:28:44 123005 万信转债 证券卖出 -40 128.690 5147.60 0.0 \n",
+ "2018-04-18 14:15:16 123005 万信转债 证券卖出 -40 127.801 5112.04 0.0 \n",
+ "2018-04-18 13:04:57 123005 万信转债 证券买入 40 123.671 4946.84 40.0 \n",
+ "2018-04-18 14:41:48 123005 万信转债 证券卖出 -40 129.500 5180.00 0.0 \n",
+ "2018-04-19 13:39:02 123005 万信转债 证券买入 40 130.220 5208.80 40.0 \n",
+ "\n",
+ " 发生金额 手续费 印花税 过户费 本次金额 其他费用 交易市场 \n",
+ "成交日期 \n",
+ "2018-03-16 -6184.49 0.49 0.0 0.0 3901.25 0.0 深圳A股 \n",
+ "2018-03-19 6224.50 0.50 0.0 0.0 10148.33 0.0 深圳A股 \n",
+ "2018-03-23 6009.02 0.48 0.0 0.0 9203.43 0.0 深圳A股 \n",
+ "2018-03-23 -6039.93 0.48 0.0 0.0 3194.41 0.0 深圳A股 \n",
+ "2018-03-26 6132.01 0.49 0.0 0.0 6132.96 0.0 深圳A股 \n",
+ "2018-03-26 -6030.48 0.48 0.0 0.0 0.95 0.0 深圳A股 \n",
+ "2018-03-27 -5067.61 0.41 0.0 0.0 -4030.68 0.0 深圳A股 \n",
+ "2018-03-27 5077.59 0.41 0.0 0.0 1046.91 0.0 深圳A股 \n",
+ "2018-04-16 -3747.30 0.30 0.0 0.0 1210.87 0.0 深圳A股 \n",
+ "2018-04-16 -3738.30 0.30 0.0 0.0 1257.40 0.0 深圳A股 \n",
+ "2018-04-16 3764.70 0.30 0.0 0.0 4975.57 0.0 深圳A股 \n",
+ "2018-04-16 3752.70 0.30 0.0 0.0 4988.77 0.0 深圳A股 \n",
+ "2018-04-16 -3726.30 0.30 0.0 0.0 1262.47 0.0 深圳A股 \n",
+ "2018-04-16 -1249.00 0.10 0.0 0.0 8.40 0.0 深圳A股 \n",
+ "2018-04-16 -3739.50 0.30 0.0 0.0 1236.07 0.0 深圳A股 \n",
+ "2018-04-16 3733.23 0.30 0.0 0.0 4995.70 0.0 深圳A股 \n",
+ "2018-04-17 4999.60 0.40 0.0 0.0 5008.00 0.0 深圳A股 \n",
+ "2018-04-17 -2467.60 0.20 0.0 0.0 2545.20 0.0 深圳A股 \n",
+ "2018-04-17 -4974.80 0.40 0.0 0.0 33.20 0.0 深圳A股 \n",
+ "2018-04-17 4979.60 0.40 0.0 0.0 5012.80 0.0 深圳A股 \n",
+ "2018-04-17 -4940.40 0.40 0.0 0.0 74.16 0.0 深圳A股 \n",
+ "2018-04-17 -2470.24 0.20 0.0 0.0 74.96 0.0 深圳A股 \n",
+ "2018-04-17 4939.60 0.40 0.0 0.0 5014.56 0.0 深圳A股 \n",
+ "2018-04-18 -5170.41 0.41 0.0 0.0 29.70 0.0 深圳A股 \n",
+ "2018-04-18 5179.59 0.41 0.0 0.0 5209.29 0.0 深圳A股 \n",
+ "2018-04-18 4941.60 0.40 0.0 0.0 5015.76 0.0 深圳A股 \n",
+ "2018-04-18 -5130.41 0.41 0.0 0.0 49.74 0.0 深圳A股 \n",
+ "2018-04-18 -5176.41 0.41 0.0 0.0 20.52 0.0 深圳A股 \n",
+ "2018-04-18 5147.19 0.41 0.0 0.0 5196.93 0.0 深圳A股 \n",
+ "2018-04-18 5111.63 0.41 0.0 0.0 5180.15 0.0 深圳A股 \n",
+ "2018-04-18 -4947.24 0.40 0.0 0.0 68.52 0.0 深圳A股 \n",
+ "2018-04-18 5179.59 0.41 0.0 0.0 5200.11 0.0 深圳A股 \n",
+ "2018-04-19 -5209.22 0.42 0.0 0.0 -4999.98 0.0 深圳A股 "
+ ]
+ },
+ "execution_count": 34,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[df[u'证券代码']==u'123005'].sort_index()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 成交时间 | \n",
+ " 证券代码 | \n",
+ " 证券名称 | \n",
+ " 操作 | \n",
+ " 成交数量 | \n",
+ " 成交均价 | \n",
+ " 成交金额 | \n",
+ " 余额 | \n",
+ " 发生金额 | \n",
+ " 手续费 | \n",
+ " 印花税 | \n",
+ " 过户费 | \n",
+ " 本次金额 | \n",
+ " 其他费用 | \n",
+ " 交易市场 | \n",
+ "
\n",
+ " \n",
+ " 成交日期 | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 2018-03-16 | \n",
+ " 14:03:41 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 50 | \n",
+ " 123.680 | \n",
+ " 6184.00 | \n",
+ " 50.0 | \n",
+ " -6184.49 | \n",
+ " 0.49 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 3901.25 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-23 | \n",
+ " 13:23:42 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 50 | \n",
+ " 120.789 | \n",
+ " 6039.45 | \n",
+ " 50.0 | \n",
+ " -6039.93 | \n",
+ " 0.48 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 3194.41 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-26 | \n",
+ " 09:40:35 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 50 | \n",
+ " 120.600 | \n",
+ " 6030.00 | \n",
+ " 50.0 | \n",
+ " -6030.48 | \n",
+ " 0.48 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 0.95 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-27 | \n",
+ " 10:05:12 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 126.680 | \n",
+ " 5067.20 | \n",
+ " 40.0 | \n",
+ " -5067.61 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -4030.68 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 10:19:53 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.900 | \n",
+ " 3747.00 | \n",
+ " 30.0 | \n",
+ " -3747.30 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1210.87 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 14:00:45 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.600 | \n",
+ " 3738.00 | \n",
+ " 30.0 | \n",
+ " -3738.30 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1257.40 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 13:56:59 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.200 | \n",
+ " 3726.00 | \n",
+ " 30.0 | \n",
+ " -3726.30 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1262.47 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 14:45:58 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 10 | \n",
+ " 124.890 | \n",
+ " 1248.90 | \n",
+ " 40.0 | \n",
+ " -1249.00 | \n",
+ " 0.10 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 8.40 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 11:08:49 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.640 | \n",
+ " 3739.20 | \n",
+ " 30.0 | \n",
+ " -3739.50 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1236.07 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 13:43:35 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 20 | \n",
+ " 123.370 | \n",
+ " 2467.40 | \n",
+ " 20.0 | \n",
+ " -2467.60 | \n",
+ " 0.20 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 2545.20 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 10:00:40 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 124.360 | \n",
+ " 4974.40 | \n",
+ " 40.0 | \n",
+ " -4974.80 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 33.20 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 14:13:57 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 123.500 | \n",
+ " 4940.00 | \n",
+ " 40.0 | \n",
+ " -4940.40 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 74.16 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 13:45:53 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 20 | \n",
+ " 123.502 | \n",
+ " 2470.04 | \n",
+ " 40.0 | \n",
+ " -2470.24 | \n",
+ " 0.20 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 74.96 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:44:14 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 129.250 | \n",
+ " 5170.00 | \n",
+ " 40.0 | \n",
+ " -5170.41 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 29.70 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:23:42 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 128.250 | \n",
+ " 5130.00 | \n",
+ " 40.0 | \n",
+ " -5130.41 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 49.74 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:32:43 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 129.400 | \n",
+ " 5176.00 | \n",
+ " 40.0 | \n",
+ " -5176.41 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 20.52 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 13:04:57 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 123.671 | \n",
+ " 4946.84 | \n",
+ " 40.0 | \n",
+ " -4947.24 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 68.52 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-19 | \n",
+ " 13:39:02 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 130.220 | \n",
+ " 5208.80 | \n",
+ " 40.0 | \n",
+ " -5209.22 | \n",
+ " 0.42 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -4999.98 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 成交时间 证券代码 证券名称 操作 成交数量 成交均价 成交金额 余额 \\\n",
+ "成交日期 \n",
+ "2018-03-16 14:03:41 123005 万信转债 证券买入 50 123.680 6184.00 50.0 \n",
+ "2018-03-23 13:23:42 123005 万信转债 证券买入 50 120.789 6039.45 50.0 \n",
+ "2018-03-26 09:40:35 123005 万信转债 证券买入 50 120.600 6030.00 50.0 \n",
+ "2018-03-27 10:05:12 123005 万信转债 证券买入 40 126.680 5067.20 40.0 \n",
+ "2018-04-16 10:19:53 123005 万信转债 证券买入 30 124.900 3747.00 30.0 \n",
+ "2018-04-16 14:00:45 123005 万信转债 证券买入 30 124.600 3738.00 30.0 \n",
+ "2018-04-16 13:56:59 123005 万信转债 证券买入 30 124.200 3726.00 30.0 \n",
+ "2018-04-16 14:45:58 123005 万信转债 证券买入 10 124.890 1248.90 40.0 \n",
+ "2018-04-16 11:08:49 123005 万信转债 证券买入 30 124.640 3739.20 30.0 \n",
+ "2018-04-17 13:43:35 123005 万信转债 证券买入 20 123.370 2467.40 20.0 \n",
+ "2018-04-17 10:00:40 123005 万信转债 证券买入 40 124.360 4974.40 40.0 \n",
+ "2018-04-17 14:13:57 123005 万信转债 证券买入 40 123.500 4940.00 40.0 \n",
+ "2018-04-17 13:45:53 123005 万信转债 证券买入 20 123.502 2470.04 40.0 \n",
+ "2018-04-18 14:44:14 123005 万信转债 证券买入 40 129.250 5170.00 40.0 \n",
+ "2018-04-18 14:23:42 123005 万信转债 证券买入 40 128.250 5130.00 40.0 \n",
+ "2018-04-18 14:32:43 123005 万信转债 证券买入 40 129.400 5176.00 40.0 \n",
+ "2018-04-18 13:04:57 123005 万信转债 证券买入 40 123.671 4946.84 40.0 \n",
+ "2018-04-19 13:39:02 123005 万信转债 证券买入 40 130.220 5208.80 40.0 \n",
+ "\n",
+ " 发生金额 手续费 印花税 过户费 本次金额 其他费用 交易市场 \n",
+ "成交日期 \n",
+ "2018-03-16 -6184.49 0.49 0.0 0.0 3901.25 0.0 深圳A股 \n",
+ "2018-03-23 -6039.93 0.48 0.0 0.0 3194.41 0.0 深圳A股 \n",
+ "2018-03-26 -6030.48 0.48 0.0 0.0 0.95 0.0 深圳A股 \n",
+ "2018-03-27 -5067.61 0.41 0.0 0.0 -4030.68 0.0 深圳A股 \n",
+ "2018-04-16 -3747.30 0.30 0.0 0.0 1210.87 0.0 深圳A股 \n",
+ "2018-04-16 -3738.30 0.30 0.0 0.0 1257.40 0.0 深圳A股 \n",
+ "2018-04-16 -3726.30 0.30 0.0 0.0 1262.47 0.0 深圳A股 \n",
+ "2018-04-16 -1249.00 0.10 0.0 0.0 8.40 0.0 深圳A股 \n",
+ "2018-04-16 -3739.50 0.30 0.0 0.0 1236.07 0.0 深圳A股 \n",
+ "2018-04-17 -2467.60 0.20 0.0 0.0 2545.20 0.0 深圳A股 \n",
+ "2018-04-17 -4974.80 0.40 0.0 0.0 33.20 0.0 深圳A股 \n",
+ "2018-04-17 -4940.40 0.40 0.0 0.0 74.16 0.0 深圳A股 \n",
+ "2018-04-17 -2470.24 0.20 0.0 0.0 74.96 0.0 深圳A股 \n",
+ "2018-04-18 -5170.41 0.41 0.0 0.0 29.70 0.0 深圳A股 \n",
+ "2018-04-18 -5130.41 0.41 0.0 0.0 49.74 0.0 深圳A股 \n",
+ "2018-04-18 -5176.41 0.41 0.0 0.0 20.52 0.0 深圳A股 \n",
+ "2018-04-18 -4947.24 0.40 0.0 0.0 68.52 0.0 深圳A股 \n",
+ "2018-04-19 -5209.22 0.42 0.0 0.0 -4999.98 0.0 深圳A股 "
+ ]
+ },
+ "execution_count": 29,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[(df[u'证券代码']==u'123005') & (df[u'操作']==u'证券买入')].sort_index()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "-4585.78"
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "-9795+5209.22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "640"
+ ]
+ },
+ "execution_count": 30,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[(df[u'证券代码']==u'123005') & (df[u'操作']==u'证券买入')][u'成交数量'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "-600"
+ ]
+ },
+ "execution_count": 31,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[(df[u'证券代码']==u'123005') & (df[u'操作']==u'证券卖出')][u'成交数量'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 42,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 成交时间 | \n",
+ " 证券代码 | \n",
+ " 证券名称 | \n",
+ " 操作 | \n",
+ " 成交数量 | \n",
+ " 成交均价 | \n",
+ " 成交金额 | \n",
+ " 余额 | \n",
+ " 发生金额 | \n",
+ " 手续费 | \n",
+ " 印花税 | \n",
+ " 过户费 | \n",
+ " 本次金额 | \n",
+ " 其他费用 | \n",
+ " 交易市场 | \n",
+ "
\n",
+ " \n",
+ " 成交日期 | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 10:19:53 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.900 | \n",
+ " 3747.00 | \n",
+ " 30.0 | \n",
+ " -3747.30 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1210.87 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 14:00:45 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.600 | \n",
+ " 3738.00 | \n",
+ " 30.0 | \n",
+ " -3738.30 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1257.40 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 10:24:24 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -30 | \n",
+ " 125.500 | \n",
+ " 3765.00 | \n",
+ " 0.0 | \n",
+ " 3764.70 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 4975.57 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 13:16:02 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -30 | \n",
+ " 125.100 | \n",
+ " 3753.00 | \n",
+ " 0.0 | \n",
+ " 3752.70 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 4988.77 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 13:56:59 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.200 | \n",
+ " 3726.00 | \n",
+ " 30.0 | \n",
+ " -3726.30 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1262.47 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 14:45:58 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 10 | \n",
+ " 124.890 | \n",
+ " 1248.90 | \n",
+ " 40.0 | \n",
+ " -1249.00 | \n",
+ " 0.10 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 8.40 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 11:08:49 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 30 | \n",
+ " 124.640 | \n",
+ " 3739.20 | \n",
+ " 30.0 | \n",
+ " -3739.50 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 1236.07 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 13:58:40 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -30 | \n",
+ " 124.451 | \n",
+ " 3733.53 | \n",
+ " 0.0 | \n",
+ " 3733.23 | \n",
+ " 0.30 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 4995.70 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 09:33:44 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 125.000 | \n",
+ " 5000.00 | \n",
+ " 0.0 | \n",
+ " 4999.60 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5008.00 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 13:43:35 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 20 | \n",
+ " 123.370 | \n",
+ " 2467.40 | \n",
+ " 20.0 | \n",
+ " -2467.60 | \n",
+ " 0.20 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 2545.20 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 10:00:40 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 124.360 | \n",
+ " 4974.40 | \n",
+ " 40.0 | \n",
+ " -4974.80 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 33.20 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 10:32:24 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 124.500 | \n",
+ " 4980.00 | \n",
+ " 0.0 | \n",
+ " 4979.60 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5012.80 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 14:13:57 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 123.500 | \n",
+ " 4940.00 | \n",
+ " 40.0 | \n",
+ " -4940.40 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 74.16 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 13:45:53 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 20 | \n",
+ " 123.502 | \n",
+ " 2470.04 | \n",
+ " 40.0 | \n",
+ " -2470.24 | \n",
+ " 0.20 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 74.96 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 13:58:43 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 123.500 | \n",
+ " 4940.00 | \n",
+ " 0.0 | \n",
+ " 4939.60 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5014.56 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:44:14 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 129.250 | \n",
+ " 5170.00 | \n",
+ " 40.0 | \n",
+ " -5170.41 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 29.70 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:44:59 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 129.500 | \n",
+ " 5180.00 | \n",
+ " 0.0 | \n",
+ " 5179.59 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5209.29 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 10:02:53 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 123.550 | \n",
+ " 4942.00 | \n",
+ " 0.0 | \n",
+ " 4941.60 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5015.76 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:23:42 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 128.250 | \n",
+ " 5130.00 | \n",
+ " 40.0 | \n",
+ " -5130.41 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 49.74 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:32:43 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 129.400 | \n",
+ " 5176.00 | \n",
+ " 40.0 | \n",
+ " -5176.41 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 20.52 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:28:44 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 128.690 | \n",
+ " 5147.60 | \n",
+ " 0.0 | \n",
+ " 5147.19 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5196.93 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:15:16 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 127.801 | \n",
+ " 5112.04 | \n",
+ " 0.0 | \n",
+ " 5111.63 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5180.15 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 13:04:57 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 123.671 | \n",
+ " 4946.84 | \n",
+ " 40.0 | \n",
+ " -4947.24 | \n",
+ " 0.40 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 68.52 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:41:48 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 129.500 | \n",
+ " 5180.00 | \n",
+ " 0.0 | \n",
+ " 5179.59 | \n",
+ " 0.41 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " 5200.11 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-19 | \n",
+ " 13:39:02 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券买入 | \n",
+ " 40 | \n",
+ " 130.220 | \n",
+ " 5208.80 | \n",
+ " 40.0 | \n",
+ " -5209.22 | \n",
+ " 0.42 | \n",
+ " 0.0 | \n",
+ " 0.0 | \n",
+ " -4999.98 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 成交时间 证券代码 证券名称 操作 成交数量 成交均价 成交金额 余额 \\\n",
+ "成交日期 \n",
+ "2018-04-16 10:19:53 123005 万信转债 证券买入 30 124.900 3747.00 30.0 \n",
+ "2018-04-16 14:00:45 123005 万信转债 证券买入 30 124.600 3738.00 30.0 \n",
+ "2018-04-16 10:24:24 123005 万信转债 证券卖出 -30 125.500 3765.00 0.0 \n",
+ "2018-04-16 13:16:02 123005 万信转债 证券卖出 -30 125.100 3753.00 0.0 \n",
+ "2018-04-16 13:56:59 123005 万信转债 证券买入 30 124.200 3726.00 30.0 \n",
+ "2018-04-16 14:45:58 123005 万信转债 证券买入 10 124.890 1248.90 40.0 \n",
+ "2018-04-16 11:08:49 123005 万信转债 证券买入 30 124.640 3739.20 30.0 \n",
+ "2018-04-16 13:58:40 123005 万信转债 证券卖出 -30 124.451 3733.53 0.0 \n",
+ "2018-04-17 09:33:44 123005 万信转债 证券卖出 -40 125.000 5000.00 0.0 \n",
+ "2018-04-17 13:43:35 123005 万信转债 证券买入 20 123.370 2467.40 20.0 \n",
+ "2018-04-17 10:00:40 123005 万信转债 证券买入 40 124.360 4974.40 40.0 \n",
+ "2018-04-17 10:32:24 123005 万信转债 证券卖出 -40 124.500 4980.00 0.0 \n",
+ "2018-04-17 14:13:57 123005 万信转债 证券买入 40 123.500 4940.00 40.0 \n",
+ "2018-04-17 13:45:53 123005 万信转债 证券买入 20 123.502 2470.04 40.0 \n",
+ "2018-04-17 13:58:43 123005 万信转债 证券卖出 -40 123.500 4940.00 0.0 \n",
+ "2018-04-18 14:44:14 123005 万信转债 证券买入 40 129.250 5170.00 40.0 \n",
+ "2018-04-18 14:44:59 123005 万信转债 证券卖出 -40 129.500 5180.00 0.0 \n",
+ "2018-04-18 10:02:53 123005 万信转债 证券卖出 -40 123.550 4942.00 0.0 \n",
+ "2018-04-18 14:23:42 123005 万信转债 证券买入 40 128.250 5130.00 40.0 \n",
+ "2018-04-18 14:32:43 123005 万信转债 证券买入 40 129.400 5176.00 40.0 \n",
+ "2018-04-18 14:28:44 123005 万信转债 证券卖出 -40 128.690 5147.60 0.0 \n",
+ "2018-04-18 14:15:16 123005 万信转债 证券卖出 -40 127.801 5112.04 0.0 \n",
+ "2018-04-18 13:04:57 123005 万信转债 证券买入 40 123.671 4946.84 40.0 \n",
+ "2018-04-18 14:41:48 123005 万信转债 证券卖出 -40 129.500 5180.00 0.0 \n",
+ "2018-04-19 13:39:02 123005 万信转债 证券买入 40 130.220 5208.80 40.0 \n",
+ "\n",
+ " 发生金额 手续费 印花税 过户费 本次金额 其他费用 交易市场 \n",
+ "成交日期 \n",
+ "2018-04-16 -3747.30 0.30 0.0 0.0 1210.87 0.0 深圳A股 \n",
+ "2018-04-16 -3738.30 0.30 0.0 0.0 1257.40 0.0 深圳A股 \n",
+ "2018-04-16 3764.70 0.30 0.0 0.0 4975.57 0.0 深圳A股 \n",
+ "2018-04-16 3752.70 0.30 0.0 0.0 4988.77 0.0 深圳A股 \n",
+ "2018-04-16 -3726.30 0.30 0.0 0.0 1262.47 0.0 深圳A股 \n",
+ "2018-04-16 -1249.00 0.10 0.0 0.0 8.40 0.0 深圳A股 \n",
+ "2018-04-16 -3739.50 0.30 0.0 0.0 1236.07 0.0 深圳A股 \n",
+ "2018-04-16 3733.23 0.30 0.0 0.0 4995.70 0.0 深圳A股 \n",
+ "2018-04-17 4999.60 0.40 0.0 0.0 5008.00 0.0 深圳A股 \n",
+ "2018-04-17 -2467.60 0.20 0.0 0.0 2545.20 0.0 深圳A股 \n",
+ "2018-04-17 -4974.80 0.40 0.0 0.0 33.20 0.0 深圳A股 \n",
+ "2018-04-17 4979.60 0.40 0.0 0.0 5012.80 0.0 深圳A股 \n",
+ "2018-04-17 -4940.40 0.40 0.0 0.0 74.16 0.0 深圳A股 \n",
+ "2018-04-17 -2470.24 0.20 0.0 0.0 74.96 0.0 深圳A股 \n",
+ "2018-04-17 4939.60 0.40 0.0 0.0 5014.56 0.0 深圳A股 \n",
+ "2018-04-18 -5170.41 0.41 0.0 0.0 29.70 0.0 深圳A股 \n",
+ "2018-04-18 5179.59 0.41 0.0 0.0 5209.29 0.0 深圳A股 \n",
+ "2018-04-18 4941.60 0.40 0.0 0.0 5015.76 0.0 深圳A股 \n",
+ "2018-04-18 -5130.41 0.41 0.0 0.0 49.74 0.0 深圳A股 \n",
+ "2018-04-18 -5176.41 0.41 0.0 0.0 20.52 0.0 深圳A股 \n",
+ "2018-04-18 5147.19 0.41 0.0 0.0 5196.93 0.0 深圳A股 \n",
+ "2018-04-18 5111.63 0.41 0.0 0.0 5180.15 0.0 深圳A股 \n",
+ "2018-04-18 -4947.24 0.40 0.0 0.0 68.52 0.0 深圳A股 \n",
+ "2018-04-18 5179.59 0.41 0.0 0.0 5200.11 0.0 深圳A股 \n",
+ "2018-04-19 -5209.22 0.42 0.0 0.0 -4999.98 0.0 深圳A股 "
+ ]
+ },
+ "execution_count": 42,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[df[u'证券代码']==u'123005']['2018-04']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 45,
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "KeyError",
+ "evalue": "'2018-04-15'",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)",
+ "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdf\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'2018-04-15'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
+ "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\frame.pyc\u001b[0m in \u001b[0;36m__getitem__\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m 2137\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_getitem_multilevel\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2138\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2139\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_getitem_column\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2140\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2141\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_getitem_column\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\frame.pyc\u001b[0m in \u001b[0;36m_getitem_column\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m 2144\u001b[0m \u001b[1;31m# get column\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2145\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mis_unique\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2146\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_get_item_cache\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2147\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2148\u001b[0m \u001b[1;31m# duplicate columns & possible reduce dimensionality\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\generic.pyc\u001b[0m in \u001b[0;36m_get_item_cache\u001b[1;34m(self, item)\u001b[0m\n\u001b[0;32m 1840\u001b[0m \u001b[0mres\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcache\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1841\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mres\u001b[0m \u001b[1;32mis\u001b[0m \u001b[0mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1842\u001b[1;33m \u001b[0mvalues\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_data\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1843\u001b[0m \u001b[0mres\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_box_item_values\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalues\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1844\u001b[0m \u001b[0mcache\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mres\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\internals.pyc\u001b[0m in \u001b[0;36mget\u001b[1;34m(self, item, fastpath)\u001b[0m\n\u001b[0;32m 3841\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3842\u001b[0m \u001b[1;32mif\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0misna\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 3843\u001b[1;33m \u001b[0mloc\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3844\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3845\u001b[0m \u001b[0mindexer\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0marange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0misna\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\indexes\\base.pyc\u001b[0m in \u001b[0;36mget_loc\u001b[1;34m(self, key, method, tolerance)\u001b[0m\n\u001b[0;32m 2525\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2526\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2527\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_maybe_cast_indexer\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2528\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2529\u001b[0m \u001b[0mindexer\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_indexer\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mmethod\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtolerance\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mtolerance\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mpandas\\_libs\\index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[1;34m()\u001b[0m\n",
+ "\u001b[1;32mpandas\\_libs\\index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[1;34m()\u001b[0m\n",
+ "\u001b[1;32mpandas\\_libs\\hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[1;34m()\u001b[0m\n",
+ "\u001b[1;32mpandas\\_libs\\hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[1;34m()\u001b[0m\n",
+ "\u001b[1;31mKeyError\u001b[0m: '2018-04-15'"
+ ]
+ }
+ ],
+ "source": [
+ "df['2018-04-15']"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 49,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "-11.700000000000728"
+ ]
+ },
+ "execution_count": 49,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[df[u'证券代码']==u'110039'][u'发生金额'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 48,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "372.22000000000025"
+ ]
+ },
+ "execution_count": 48,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "-4837+5209.22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 52,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 成交时间 | \n",
+ " 证券代码 | \n",
+ " 证券名称 | \n",
+ " 操作 | \n",
+ " 成交数量 | \n",
+ " 成交均价 | \n",
+ " 成交金额 | \n",
+ " 余额 | \n",
+ " 发生金额 | \n",
+ " 手续费 | \n",
+ " 印花税 | \n",
+ " 过户费 | \n",
+ " 本次金额 | \n",
+ " 其他费用 | \n",
+ " 交易市场 | \n",
+ "
\n",
+ " \n",
+ " 成交日期 | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 2018-02-05 | \n",
+ " 13:29:51 | \n",
+ " 300527 | \n",
+ " 华舟应急 | \n",
+ " 证券卖出 | \n",
+ " -100 | \n",
+ " 24.960 | \n",
+ " 2496.00 | \n",
+ " 105.0 | \n",
+ " 2488.50 | \n",
+ " 5.00 | \n",
+ " 2.50 | \n",
+ " 0.05 | \n",
+ " 2488.50 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-02-26 | \n",
+ " 11:22:45 | \n",
+ " 300527 | \n",
+ " 华舟应急 | \n",
+ " 证券卖出 | \n",
+ " -105 | \n",
+ " 23.260 | \n",
+ " 2442.30 | \n",
+ " 100.0 | \n",
+ " 2434.86 | \n",
+ " 5.00 | \n",
+ " 2.44 | \n",
+ " 0.05 | \n",
+ " 2435.36 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-02-27 | \n",
+ " 10:10:03 | \n",
+ " 300527 | \n",
+ " 华舟应急 | \n",
+ " 证券卖出 | \n",
+ " -100 | \n",
+ " 23.050 | \n",
+ " 2305.00 | \n",
+ " 100.0 | \n",
+ " 2297.69 | \n",
+ " 5.00 | \n",
+ " 2.31 | \n",
+ " 0.05 | \n",
+ " 2463.05 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-01 | \n",
+ " 13:00:06 | \n",
+ " 300527 | \n",
+ " 华舟应急 | \n",
+ " 证券卖出 | \n",
+ " -200 | \n",
+ " 24.350 | \n",
+ " 4870.00 | \n",
+ " 0.0 | \n",
+ " 4860.13 | \n",
+ " 5.00 | \n",
+ " 4.87 | \n",
+ " 0.10 | \n",
+ " 5053.18 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-08 | \n",
+ " 13:00:00 | \n",
+ " 300527 | \n",
+ " 华舟应急 | \n",
+ " 证券卖出 | \n",
+ " -100 | \n",
+ " 24.360 | \n",
+ " 2436.00 | \n",
+ " 0.0 | \n",
+ " 2428.56 | \n",
+ " 5.00 | \n",
+ " 2.44 | \n",
+ " 0.05 | \n",
+ " 4085.74 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-19 | \n",
+ " 11:09:42 | \n",
+ " 110039 | \n",
+ " 宝信转债 | \n",
+ " 证券卖出 | \n",
+ " -20 | \n",
+ " 132.120 | \n",
+ " 2642.40 | \n",
+ " 0.0 | \n",
+ " 2642.39 | \n",
+ " 0.01 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 3923.83 | \n",
+ " 0.0 | \n",
+ " 上海A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-19 | \n",
+ " 10:59:31 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -50 | \n",
+ " 124.500 | \n",
+ " 6225.00 | \n",
+ " 0.0 | \n",
+ " 6224.50 | \n",
+ " 0.50 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 10148.33 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-23 | \n",
+ " 09:51:23 | \n",
+ " 113504 | \n",
+ " N艾华转 | \n",
+ " 证券卖出 | \n",
+ " -10 | \n",
+ " 108.510 | \n",
+ " 1085.10 | \n",
+ " 0.0 | \n",
+ " 1085.09 | \n",
+ " 0.01 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 9234.34 | \n",
+ " 0.0 | \n",
+ " 上海A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-23 | \n",
+ " 14:49:25 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -50 | \n",
+ " 120.190 | \n",
+ " 6009.50 | \n",
+ " 0.0 | \n",
+ " 6009.02 | \n",
+ " 0.48 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 9203.43 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-26 | \n",
+ " 14:30:29 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -50 | \n",
+ " 122.650 | \n",
+ " 6132.50 | \n",
+ " 0.0 | \n",
+ " 6132.01 | \n",
+ " 0.49 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 6132.96 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-27 | \n",
+ " 10:32:37 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 126.950 | \n",
+ " 5078.00 | \n",
+ " 0.0 | \n",
+ " 5077.59 | \n",
+ " 0.41 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 1046.91 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-27 | \n",
+ " 09:25:01 | \n",
+ " 113505 | \n",
+ " N杭电转 | \n",
+ " 证券卖出 | \n",
+ " -10 | \n",
+ " 100.500 | \n",
+ " 1005.00 | \n",
+ " 0.0 | \n",
+ " 1004.99 | \n",
+ " 0.01 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 5137.95 | \n",
+ " 0.0 | \n",
+ " 上海A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-28 | \n",
+ " 10:14:10 | \n",
+ " 110039 | \n",
+ " 宝信转债 | \n",
+ " 证券卖出 | \n",
+ " -30 | \n",
+ " 135.200 | \n",
+ " 4056.00 | \n",
+ " 0.0 | \n",
+ " 4055.98 | \n",
+ " 0.02 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 5102.89 | \n",
+ " 0.0 | \n",
+ " 上海A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-29 | \n",
+ " 10:10:36 | \n",
+ " 603168 | \n",
+ " 莎普爱思 | \n",
+ " 证券卖出 | \n",
+ " -600 | \n",
+ " 14.180 | \n",
+ " 8508.00 | \n",
+ " 0.0 | \n",
+ " 8494.32 | \n",
+ " 5.00 | \n",
+ " 8.51 | \n",
+ " 0.17 | \n",
+ " 9505.99 | \n",
+ " 0.0 | \n",
+ " 上海A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-03-29 | \n",
+ " 14:12:37 | \n",
+ " 113505 | \n",
+ " 杭电转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 102.360 | \n",
+ " 4094.40 | \n",
+ " 0.0 | \n",
+ " 4094.38 | \n",
+ " 0.02 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 13600.37 | \n",
+ " 0.0 | \n",
+ " 上海A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-11 | \n",
+ " 09:32:39 | \n",
+ " 127005 | \n",
+ " 长证转债 | \n",
+ " 证券卖出 | \n",
+ " -10 | \n",
+ " 106.720 | \n",
+ " 1067.20 | \n",
+ " 0.0 | \n",
+ " 1067.10 | \n",
+ " 0.10 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 1067.10 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 10:50:39 | \n",
+ " 110039 | \n",
+ " 宝信转债 | \n",
+ " 证券卖出 | \n",
+ " -30 | \n",
+ " 149.100 | \n",
+ " 4473.00 | \n",
+ " 0.0 | \n",
+ " 4472.98 | \n",
+ " 0.02 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 60.76 | \n",
+ " 0.0 | \n",
+ " 上海A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 10:24:24 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -30 | \n",
+ " 125.500 | \n",
+ " 3765.00 | \n",
+ " 0.0 | \n",
+ " 3764.70 | \n",
+ " 0.30 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 4975.57 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 10:18:43 | \n",
+ " 128036 | \n",
+ " 金农转债 | \n",
+ " 证券卖出 | \n",
+ " -50 | \n",
+ " 97.956 | \n",
+ " 4897.80 | \n",
+ " 0.0 | \n",
+ " 4897.41 | \n",
+ " 0.39 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 4958.17 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 13:16:02 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -30 | \n",
+ " 125.100 | \n",
+ " 3753.00 | \n",
+ " 0.0 | \n",
+ " 3752.70 | \n",
+ " 0.30 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 4988.77 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-16 | \n",
+ " 13:58:40 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -30 | \n",
+ " 124.451 | \n",
+ " 3733.53 | \n",
+ " 0.0 | \n",
+ " 3733.23 | \n",
+ " 0.30 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 4995.70 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 09:33:44 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 125.000 | \n",
+ " 5000.00 | \n",
+ " 0.0 | \n",
+ " 4999.60 | \n",
+ " 0.40 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 5008.00 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 10:32:24 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 124.500 | \n",
+ " 4980.00 | \n",
+ " 0.0 | \n",
+ " 4979.60 | \n",
+ " 0.40 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 5012.80 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-17 | \n",
+ " 13:58:43 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 123.500 | \n",
+ " 4940.00 | \n",
+ " 0.0 | \n",
+ " 4939.60 | \n",
+ " 0.40 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 5014.56 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:44:59 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 129.500 | \n",
+ " 5180.00 | \n",
+ " 0.0 | \n",
+ " 5179.59 | \n",
+ " 0.41 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 5209.29 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 10:02:53 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 123.550 | \n",
+ " 4942.00 | \n",
+ " 0.0 | \n",
+ " 4941.60 | \n",
+ " 0.40 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 5015.76 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:28:44 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 128.690 | \n",
+ " 5147.60 | \n",
+ " 0.0 | \n",
+ " 5147.19 | \n",
+ " 0.41 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 5196.93 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:15:16 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 127.801 | \n",
+ " 5112.04 | \n",
+ " 0.0 | \n",
+ " 5111.63 | \n",
+ " 0.41 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 5180.15 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ " 2018-04-18 | \n",
+ " 14:41:48 | \n",
+ " 123005 | \n",
+ " 万信转债 | \n",
+ " 证券卖出 | \n",
+ " -40 | \n",
+ " 129.500 | \n",
+ " 5180.00 | \n",
+ " 0.0 | \n",
+ " 5179.59 | \n",
+ " 0.41 | \n",
+ " 0.00 | \n",
+ " 0.00 | \n",
+ " 5200.11 | \n",
+ " 0.0 | \n",
+ " 深圳A股 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 成交时间 证券代码 证券名称 操作 成交数量 成交均价 成交金额 余额 \\\n",
+ "成交日期 \n",
+ "2018-02-05 13:29:51 300527 华舟应急 证券卖出 -100 24.960 2496.00 105.0 \n",
+ "2018-02-26 11:22:45 300527 华舟应急 证券卖出 -105 23.260 2442.30 100.0 \n",
+ "2018-02-27 10:10:03 300527 华舟应急 证券卖出 -100 23.050 2305.00 100.0 \n",
+ "2018-03-01 13:00:06 300527 华舟应急 证券卖出 -200 24.350 4870.00 0.0 \n",
+ "2018-03-08 13:00:00 300527 华舟应急 证券卖出 -100 24.360 2436.00 0.0 \n",
+ "2018-03-19 11:09:42 110039 宝信转债 证券卖出 -20 132.120 2642.40 0.0 \n",
+ "2018-03-19 10:59:31 123005 万信转债 证券卖出 -50 124.500 6225.00 0.0 \n",
+ "2018-03-23 09:51:23 113504 N艾华转 证券卖出 -10 108.510 1085.10 0.0 \n",
+ "2018-03-23 14:49:25 123005 万信转债 证券卖出 -50 120.190 6009.50 0.0 \n",
+ "2018-03-26 14:30:29 123005 万信转债 证券卖出 -50 122.650 6132.50 0.0 \n",
+ "2018-03-27 10:32:37 123005 万信转债 证券卖出 -40 126.950 5078.00 0.0 \n",
+ "2018-03-27 09:25:01 113505 N杭电转 证券卖出 -10 100.500 1005.00 0.0 \n",
+ "2018-03-28 10:14:10 110039 宝信转债 证券卖出 -30 135.200 4056.00 0.0 \n",
+ "2018-03-29 10:10:36 603168 莎普爱思 证券卖出 -600 14.180 8508.00 0.0 \n",
+ "2018-03-29 14:12:37 113505 杭电转债 证券卖出 -40 102.360 4094.40 0.0 \n",
+ "2018-04-11 09:32:39 127005 长证转债 证券卖出 -10 106.720 1067.20 0.0 \n",
+ "2018-04-16 10:50:39 110039 宝信转债 证券卖出 -30 149.100 4473.00 0.0 \n",
+ "2018-04-16 10:24:24 123005 万信转债 证券卖出 -30 125.500 3765.00 0.0 \n",
+ "2018-04-16 10:18:43 128036 金农转债 证券卖出 -50 97.956 4897.80 0.0 \n",
+ "2018-04-16 13:16:02 123005 万信转债 证券卖出 -30 125.100 3753.00 0.0 \n",
+ "2018-04-16 13:58:40 123005 万信转债 证券卖出 -30 124.451 3733.53 0.0 \n",
+ "2018-04-17 09:33:44 123005 万信转债 证券卖出 -40 125.000 5000.00 0.0 \n",
+ "2018-04-17 10:32:24 123005 万信转债 证券卖出 -40 124.500 4980.00 0.0 \n",
+ "2018-04-17 13:58:43 123005 万信转债 证券卖出 -40 123.500 4940.00 0.0 \n",
+ "2018-04-18 14:44:59 123005 万信转债 证券卖出 -40 129.500 5180.00 0.0 \n",
+ "2018-04-18 10:02:53 123005 万信转债 证券卖出 -40 123.550 4942.00 0.0 \n",
+ "2018-04-18 14:28:44 123005 万信转债 证券卖出 -40 128.690 5147.60 0.0 \n",
+ "2018-04-18 14:15:16 123005 万信转债 证券卖出 -40 127.801 5112.04 0.0 \n",
+ "2018-04-18 14:41:48 123005 万信转债 证券卖出 -40 129.500 5180.00 0.0 \n",
+ "\n",
+ " 发生金额 手续费 印花税 过户费 本次金额 其他费用 交易市场 \n",
+ "成交日期 \n",
+ "2018-02-05 2488.50 5.00 2.50 0.05 2488.50 0.0 深圳A股 \n",
+ "2018-02-26 2434.86 5.00 2.44 0.05 2435.36 0.0 深圳A股 \n",
+ "2018-02-27 2297.69 5.00 2.31 0.05 2463.05 0.0 深圳A股 \n",
+ "2018-03-01 4860.13 5.00 4.87 0.10 5053.18 0.0 深圳A股 \n",
+ "2018-03-08 2428.56 5.00 2.44 0.05 4085.74 0.0 深圳A股 \n",
+ "2018-03-19 2642.39 0.01 0.00 0.00 3923.83 0.0 上海A股 \n",
+ "2018-03-19 6224.50 0.50 0.00 0.00 10148.33 0.0 深圳A股 \n",
+ "2018-03-23 1085.09 0.01 0.00 0.00 9234.34 0.0 上海A股 \n",
+ "2018-03-23 6009.02 0.48 0.00 0.00 9203.43 0.0 深圳A股 \n",
+ "2018-03-26 6132.01 0.49 0.00 0.00 6132.96 0.0 深圳A股 \n",
+ "2018-03-27 5077.59 0.41 0.00 0.00 1046.91 0.0 深圳A股 \n",
+ "2018-03-27 1004.99 0.01 0.00 0.00 5137.95 0.0 上海A股 \n",
+ "2018-03-28 4055.98 0.02 0.00 0.00 5102.89 0.0 上海A股 \n",
+ "2018-03-29 8494.32 5.00 8.51 0.17 9505.99 0.0 上海A股 \n",
+ "2018-03-29 4094.38 0.02 0.00 0.00 13600.37 0.0 上海A股 \n",
+ "2018-04-11 1067.10 0.10 0.00 0.00 1067.10 0.0 深圳A股 \n",
+ "2018-04-16 4472.98 0.02 0.00 0.00 60.76 0.0 上海A股 \n",
+ "2018-04-16 3764.70 0.30 0.00 0.00 4975.57 0.0 深圳A股 \n",
+ "2018-04-16 4897.41 0.39 0.00 0.00 4958.17 0.0 深圳A股 \n",
+ "2018-04-16 3752.70 0.30 0.00 0.00 4988.77 0.0 深圳A股 \n",
+ "2018-04-16 3733.23 0.30 0.00 0.00 4995.70 0.0 深圳A股 \n",
+ "2018-04-17 4999.60 0.40 0.00 0.00 5008.00 0.0 深圳A股 \n",
+ "2018-04-17 4979.60 0.40 0.00 0.00 5012.80 0.0 深圳A股 \n",
+ "2018-04-17 4939.60 0.40 0.00 0.00 5014.56 0.0 深圳A股 \n",
+ "2018-04-18 5179.59 0.41 0.00 0.00 5209.29 0.0 深圳A股 \n",
+ "2018-04-18 4941.60 0.40 0.00 0.00 5015.76 0.0 深圳A股 \n",
+ "2018-04-18 5147.19 0.41 0.00 0.00 5196.93 0.0 深圳A股 \n",
+ "2018-04-18 5111.63 0.41 0.00 0.00 5180.15 0.0 深圳A股 \n",
+ "2018-04-18 5179.59 0.41 0.00 0.00 5200.11 0.0 深圳A股 "
+ ]
+ },
+ "execution_count": 52,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df[df[u'操作']==u'证券卖出'].sort_index()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.13"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/black_list_sql.py b/black_list_sql.py
index 86926ea..e6024c6 100644
--- a/black_list_sql.py
+++ b/black_list_sql.py
@@ -1,12 +1,11 @@
# -*-coding=utf-8-*-
-import MySQLdb
from setting import get_mysql_conn
import os
-db_name = 'qdm225205669_db'
+db_name = 'db_stock'
-conn = get_mysql_conn(db_name)
+conn = get_mysql_conn(db_name,local=True)
cur = conn.cursor()
diff --git a/.ipynb_checkpoints/Untitled2-checkpoint.ipynb b/daily/.ipynb_checkpoints/fupan-checkpoint.ipynb
similarity index 100%
rename from .ipynb_checkpoints/Untitled2-checkpoint.ipynb
rename to daily/.ipynb_checkpoints/fupan-checkpoint.ipynb
diff --git a/daily/fupan.ipynb b/daily/fupan.ipynb
new file mode 100644
index 0000000..a586bc8
--- /dev/null
+++ b/daily/fupan.ipynb
@@ -0,0 +1,433 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import sys\n",
+ "sys.path.append('../')\n",
+ "from setting import get_engine\n",
+ "import pandas as pd\n",
+ "import datetime"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "engine = get_engine('db_stock')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 证券代码 | \n",
+ " 证券名称 | \n",
+ " 保本价 | \n",
+ " 股票余额 | \n",
+ " 盈亏比例 | \n",
+ " 盈亏 | \n",
+ " 市值 | \n",
+ " 现价 | \n",
+ " 2018-04-12 | \n",
+ " 2018-04-13 | \n",
+ " 2018-04-16 | \n",
+ " 2018-04-17 | \n",
+ " 2018-04-18 | \n",
+ " 2018-04-19 | \n",
+ " 2018-04-20 | \n",
+ " 2018-04-23 | \n",
+ " 2018-04-24 | \n",
+ " 2018-04-25 | \n",
+ " 2018-04-26 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " 600846 | \n",
+ " 同济科技 | \n",
+ " 10.055 | \n",
+ " 600 | \n",
+ " -11.29 | \n",
+ " -681.0 | \n",
+ " 5352.0 | \n",
+ " 8.92 | \n",
+ " -114.0 | \n",
+ " 24.0 | \n",
+ " -84.0 | \n",
+ " -144.0 | \n",
+ " 144.0 | \n",
+ " 132.0 | \n",
+ " 90.0 | \n",
+ " 24.0 | \n",
+ " 60.0 | \n",
+ " 210.0 | \n",
+ " -282.0 | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " 000693 | \n",
+ " *ST华泽 | \n",
+ " 14.443 | \n",
+ " 600 | \n",
+ " -75.91 | \n",
+ " -6577.8 | \n",
+ " 2088.0 | \n",
+ " 3.48 | \n",
+ " -186.0 | \n",
+ " -174.0 | \n",
+ " -168.0 | \n",
+ " -156.0 | \n",
+ " -150.0 | \n",
+ " -144.0 | \n",
+ " -132.0 | \n",
+ " -126.0 | \n",
+ " -120.0 | \n",
+ " -114.0 | \n",
+ " -108.0 | \n",
+ "
\n",
+ " \n",
+ " 2 | \n",
+ " 300102 | \n",
+ " 乾照光电 | \n",
+ " 10.526 | \n",
+ " 300 | \n",
+ " -20.20 | \n",
+ " -637.8 | \n",
+ " 2520.0 | \n",
+ " 8.40 | \n",
+ " 12.0 | \n",
+ " 42.0 | \n",
+ " -15.0 | \n",
+ " -78.0 | \n",
+ " 144.0 | \n",
+ " 6.0 | \n",
+ " 30.0 | \n",
+ " -33.0 | \n",
+ " 69.0 | \n",
+ " -33.0 | \n",
+ " -48.0 | \n",
+ "
\n",
+ " \n",
+ " 3 | \n",
+ " 000572 | \n",
+ " 海马汽车 | \n",
+ " 5.155 | \n",
+ " 900 | \n",
+ " -27.06 | \n",
+ " -1255.5 | \n",
+ " 3384.0 | \n",
+ " 3.76 | \n",
+ " 63.0 | \n",
+ " -198.0 | \n",
+ " 378.0 | \n",
+ " -306.0 | \n",
+ " -117.0 | \n",
+ " -27.0 | \n",
+ " -180.0 | \n",
+ " -72.0 | \n",
+ " 63.0 | \n",
+ " 18.0 | \n",
+ " -126.0 | \n",
+ "
\n",
+ " \n",
+ " 4 | \n",
+ " 002165 | \n",
+ " 红 宝 丽 | \n",
+ " 9.490 | \n",
+ " 500 | \n",
+ " -52.58 | \n",
+ " -2495.0 | \n",
+ " 2250.0 | \n",
+ " 4.50 | \n",
+ " -30.0 | \n",
+ " 5.0 | \n",
+ " -10.0 | \n",
+ " -60.0 | \n",
+ " 0.0 | \n",
+ " -15.0 | \n",
+ " -80.0 | \n",
+ " -45.0 | \n",
+ " 35.0 | \n",
+ " -5.0 | \n",
+ " -65.0 | \n",
+ "
\n",
+ " \n",
+ " 5 | \n",
+ " 300625 | \n",
+ " 三雄极光 | \n",
+ " 48.950 | \n",
+ " 100 | \n",
+ " -51.26 | \n",
+ " -2509.0 | \n",
+ " 2386.0 | \n",
+ " 23.86 | \n",
+ " -41.0 | \n",
+ " 43.0 | \n",
+ " -67.0 | \n",
+ " -87.0 | \n",
+ " 98.0 | \n",
+ " -10.0 | \n",
+ " -58.0 | \n",
+ " 13.0 | \n",
+ " 108.0 | \n",
+ " -1.0 | \n",
+ " -47.0 | \n",
+ "
\n",
+ " \n",
+ " 6 | \n",
+ " 601212 | \n",
+ " 白银有色 | \n",
+ " 17.427 | \n",
+ " 200 | \n",
+ " -68.50 | \n",
+ " -2387.4 | \n",
+ " 1098.0 | \n",
+ " 5.49 | \n",
+ " 20.0 | \n",
+ " -46.0 | \n",
+ " 4.0 | \n",
+ " -52.0 | \n",
+ " -26.0 | \n",
+ " 20.0 | \n",
+ " -52.0 | \n",
+ " -34.0 | \n",
+ " 16.0 | \n",
+ " 0.0 | \n",
+ " -40.0 | \n",
+ "
\n",
+ " \n",
+ " 7 | \n",
+ " 300141 | \n",
+ " 和顺电气 | \n",
+ " 19.967 | \n",
+ " 300 | \n",
+ " -53.27 | \n",
+ " -3191.1 | \n",
+ " 2799.0 | \n",
+ " 9.33 | \n",
+ " 6.0 | \n",
+ " 174.0 | \n",
+ " -87.0 | \n",
+ " -192.0 | \n",
+ " 69.0 | \n",
+ " -33.0 | \n",
+ " -66.0 | \n",
+ " -9.0 | \n",
+ " 87.0 | \n",
+ " 3.0 | \n",
+ " -129.0 | \n",
+ "
\n",
+ " \n",
+ " 8 | \n",
+ " 002316 | \n",
+ " 键桥通讯 | \n",
+ " 45.642 | \n",
+ " 300 | \n",
+ " -77.89 | \n",
+ " -10665.6 | \n",
+ " 3027.0 | \n",
+ " 10.09 | \n",
+ " -51.0 | \n",
+ " -21.0 | \n",
+ " 6.0 | \n",
+ " -84.0 | \n",
+ " 21.0 | \n",
+ " 3.0 | \n",
+ " 57.0 | \n",
+ " -72.0 | \n",
+ " 75.0 | \n",
+ " 57.0 | \n",
+ " -60.0 | \n",
+ "
\n",
+ " \n",
+ " 9 | \n",
+ " 300580 | \n",
+ " 贝斯特 | \n",
+ " 32.568 | \n",
+ " 200 | \n",
+ " -46.11 | \n",
+ " -3003.6 | \n",
+ " 3510.0 | \n",
+ " 17.55 | \n",
+ " -82.0 | \n",
+ " -52.0 | \n",
+ " -76.0 | \n",
+ " -154.0 | \n",
+ " 102.0 | \n",
+ " -2.0 | \n",
+ " -214.0 | \n",
+ " -70.0 | \n",
+ " 114.0 | \n",
+ " 24.0 | \n",
+ " -144.0 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 证券代码 证券名称 保本价 股票余额 盈亏比例 盈亏 市值 现价 2018-04-12 \\\n",
+ "0 600846 同济科技 10.055 600 -11.29 -681.0 5352.0 8.92 -114.0 \n",
+ "1 000693 *ST华泽 14.443 600 -75.91 -6577.8 2088.0 3.48 -186.0 \n",
+ "2 300102 乾照光电 10.526 300 -20.20 -637.8 2520.0 8.40 12.0 \n",
+ "3 000572 海马汽车 5.155 900 -27.06 -1255.5 3384.0 3.76 63.0 \n",
+ "4 002165 红 宝 丽 9.490 500 -52.58 -2495.0 2250.0 4.50 -30.0 \n",
+ "5 300625 三雄极光 48.950 100 -51.26 -2509.0 2386.0 23.86 -41.0 \n",
+ "6 601212 白银有色 17.427 200 -68.50 -2387.4 1098.0 5.49 20.0 \n",
+ "7 300141 和顺电气 19.967 300 -53.27 -3191.1 2799.0 9.33 6.0 \n",
+ "8 002316 键桥通讯 45.642 300 -77.89 -10665.6 3027.0 10.09 -51.0 \n",
+ "9 300580 贝斯特 32.568 200 -46.11 -3003.6 3510.0 17.55 -82.0 \n",
+ "\n",
+ " 2018-04-13 2018-04-16 2018-04-17 2018-04-18 2018-04-19 2018-04-20 \\\n",
+ "0 24.0 -84.0 -144.0 144.0 132.0 90.0 \n",
+ "1 -174.0 -168.0 -156.0 -150.0 -144.0 -132.0 \n",
+ "2 42.0 -15.0 -78.0 144.0 6.0 30.0 \n",
+ "3 -198.0 378.0 -306.0 -117.0 -27.0 -180.0 \n",
+ "4 5.0 -10.0 -60.0 0.0 -15.0 -80.0 \n",
+ "5 43.0 -67.0 -87.0 98.0 -10.0 -58.0 \n",
+ "6 -46.0 4.0 -52.0 -26.0 20.0 -52.0 \n",
+ "7 174.0 -87.0 -192.0 69.0 -33.0 -66.0 \n",
+ "8 -21.0 6.0 -84.0 21.0 3.0 57.0 \n",
+ "9 -52.0 -76.0 -154.0 102.0 -2.0 -214.0 \n",
+ "\n",
+ " 2018-04-23 2018-04-24 2018-04-25 2018-04-26 \n",
+ "0 24.0 60.0 210.0 -282.0 \n",
+ "1 -126.0 -120.0 -114.0 -108.0 \n",
+ "2 -33.0 69.0 -33.0 -48.0 \n",
+ "3 -72.0 63.0 18.0 -126.0 \n",
+ "4 -45.0 35.0 -5.0 -65.0 \n",
+ "5 13.0 108.0 -1.0 -47.0 \n",
+ "6 -34.0 16.0 0.0 -40.0 \n",
+ "7 -9.0 87.0 3.0 -129.0 \n",
+ "8 -72.0 75.0 57.0 -60.0 \n",
+ "9 -70.0 114.0 24.0 -144.0 "
+ ]
+ },
+ "execution_count": 14,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df = pd.read_sql('tb_profit',engine)\n",
+ "df"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "today=datetime.datetime.now().strftime('%Y-%m-%d')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "KeyError",
+ "evalue": "'2018-04-27'",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)",
+ "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdf\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mtoday\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
+ "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\frame.pyc\u001b[0m in \u001b[0;36m__getitem__\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m 2137\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_getitem_multilevel\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2138\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2139\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_getitem_column\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2140\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2141\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_getitem_column\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\frame.pyc\u001b[0m in \u001b[0;36m_getitem_column\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m 2144\u001b[0m \u001b[1;31m# get column\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2145\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mis_unique\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2146\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_get_item_cache\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2147\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2148\u001b[0m \u001b[1;31m# duplicate columns & possible reduce dimensionality\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\generic.pyc\u001b[0m in \u001b[0;36m_get_item_cache\u001b[1;34m(self, item)\u001b[0m\n\u001b[0;32m 1840\u001b[0m \u001b[0mres\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mcache\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1841\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mres\u001b[0m \u001b[1;32mis\u001b[0m \u001b[0mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1842\u001b[1;33m \u001b[0mvalues\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_data\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1843\u001b[0m \u001b[0mres\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_box_item_values\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalues\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1844\u001b[0m \u001b[0mcache\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mres\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\internals.pyc\u001b[0m in \u001b[0;36mget\u001b[1;34m(self, item, fastpath)\u001b[0m\n\u001b[0;32m 3841\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3842\u001b[0m \u001b[1;32mif\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0misna\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 3843\u001b[1;33m \u001b[0mloc\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3844\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3845\u001b[0m \u001b[0mindexer\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0marange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0misna\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mc:\\python27\\lib\\site-packages\\pandas\\core\\indexes\\base.pyc\u001b[0m in \u001b[0;36mget_loc\u001b[1;34m(self, key, method, tolerance)\u001b[0m\n\u001b[0;32m 2525\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2526\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2527\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_maybe_cast_indexer\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2528\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2529\u001b[0m \u001b[0mindexer\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_indexer\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mmethod\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtolerance\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mtolerance\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mpandas\\_libs\\index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[1;34m()\u001b[0m\n",
+ "\u001b[1;32mpandas\\_libs\\index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[1;34m()\u001b[0m\n",
+ "\u001b[1;32mpandas\\_libs\\hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[1;34m()\u001b[0m\n",
+ "\u001b[1;32mpandas\\_libs\\hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[1;34m()\u001b[0m\n",
+ "\u001b[1;31mKeyError\u001b[0m: '2018-04-27'"
+ ]
+ }
+ ],
+ "source": [
+ "df[today]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "-1049.0"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df['2018-04-26'].sum()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.13"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/data/blacklist.csv b/data/blacklist.csv
index 71b2c46..5173deb 100644
--- a/data/blacklist.csv
+++ b/data/blacklist.csv
@@ -14,4 +14,7 @@
002447;晨鑫科技;晨鑫科技实控人等涉嫌操纵证券市场被采取强制措施
300376;易事特;董事长何思模因公司信息披露涉嫌违反证券相关法律法规
600556;ST慧球;因拒不披露股东变动信息、拒不整改而被上交所施以“ST”处理之后,公司治理已陷入乱局的ST慧球居然又玩出了“童话”般的新花样
-000693;华泽钴镍;实控人掏空公司资产,关联交易
\ No newline at end of file
+000693;华泽钴镍;实控人掏空公司资产,关联交易
+002427;ST尤夫;卷入12起民间借贷纠纷,实际控制人颜静刚(不是好鸟,原来这个人的公司)
+600634;富控互动;实际控制人颜静刚(不是好鸟,原来这个人的公司),此人陷入民间纠纷
+600532;宏达矿业;实际控制人颜静刚(不是好鸟,原来这个人的公司),此人陷入民间纠纷, 事发后转移了产权
\ No newline at end of file
diff --git a/delivery_order.py b/delivery_order.py
index d7a16b9..02f4c89 100644
--- a/delivery_order.py
+++ b/delivery_order.py
@@ -12,7 +12,7 @@
import numpy as np
import matplotlib.pyplot as plt
from setting import get_engine
-engine = get_engine('db_stock')
+engine = get_engine('db_stock',local=True)
pd.set_option('display.max_rows',None)
class Delivery_Order():
@@ -30,13 +30,15 @@ def years(self):
# print k
j=[i for i in range(1,13)]
result=[]
- for i in range(1,2):
- filename='HT_2018-04_week1-2.xls'
- # filename='2018-%s.xls' %str(i).zfill(2)
- #print filename
+ for i in range(1,5):
+ # filename='HT_2018-04-week4.csv'
+ filename='2018-%s.xls' %str(i).zfill(2)
+ # filename='HT_2018_%s.xls' %str(i).zfill(2)
+ print filename
try:
t=pd.read_table(filename,encoding='gbk',dtype={u'证券代码':np.str})
- except:
+ except Exception,e:
+ print e
continue
# fee=t[u'手续费'].sum()+t[u'印花税'].sum()+t[u'其他杂费'].sum()
# print i," fee: "
@@ -44,7 +46,8 @@ def years(self):
df_list.append(t)
# result.append(fee)
df=pd.concat(df_list)
- df[u'成交日期']=pd.to_datetime(df[u'成交日期'],format='%Y%m%d')
+ df[u'xxxx']=df[u'成交日期']+df[u'成交时间']
+ df[u'成交日期']=pd.to_datetime(df[u'xxxx'],format='%Y%m%d %H:%M:%S')
# df[u'成交日期']=map(lambda x:datetime.datetime.strptime(str(x),"%Y%m%d"),df[u'成交日期'])
df=df[df[u'摘要']!=u'申购配号']
df=df[df[u'摘要']!=u'质押回购拆出']
@@ -67,9 +70,9 @@ def years(self):
# print df.describe()
# print df[u'手续费'].sum()
# print df[u'印花税'].sum()
- df1=df[[u'证券名称',u'证券代码',u'成交数量', u'成交均价' ,u'成交金额',u'手续费', u'印花税',u'发生金额',u'操作']]
+ # df1=df[[u'证券名称',u'证券代码',u'成交数量', u'成交均价' ,u'成交金额',u'手续费', u'印花税',u'发生金额',u'操作']]
# print df1[u'证券名称'].value_counts()
- print df.groupby(by=[u'证券名称'])[u'发生金额'].sum()
+ # print df.groupby(by=[u'证券名称'])[u'发生金额'].sum()
# df1.to_excel('2017-all.xls')
# print df1.groupby(df1[u'证券名称']).describe()
# print df1['2017-02']
@@ -85,6 +88,70 @@ def caculation(self,df):
def month(self):
pass
+ # 国金账户
+ def years_gj(self):
+ df_list=[]
+ k=[str(i) for i in range(1,13)]
+ # print k
+ j=[i for i in range(1,13)]
+ result=[]
+ for i in range(1,2):
+ filename='GJ_2018_04-week4.csv'
+ # filename='GJ_2018_%s.xls' %str(i).zfill(2)
+ print filename
+ try:
+ t=pd.read_csv(filename,encoding='gbk',dtype={u'证券代码':np.str})
+ print t
+ except Exception,e:
+ print e
+ continue
+ # fee=t[u'手续费'].sum()+t[u'印花税'].sum()+t[u'其他杂费'].sum()
+ # print i," fee: "
+ # print fee
+ df_list.append(t)
+ # result.append(fee)
+ df=pd.concat(df_list)
+ # print df
+ df[u'成交日期']=pd.to_datetime(df[u'成交日期'],format='%Y%m%d')
+ # df[u'成交日期']=map(lambda x:datetime.datetime.strptime(str(x),"%Y%m%d"),df[u'成交日期'])
+ # df=df[df[u'摘要']!=u'申购配号']
+ # df=df[df[u'摘要']!=u'质押回购拆出']
+ # df=df[df[u'摘要']!=u'拆出质押购回']
+ # print df.info()
+ # print df
+ # print df['2017-01']
+ # del df[u'合同编号']
+ # del df[u'备注']
+ del df[u'股东帐户']
+ # del df[u'结算汇率']
+ # del df[u'Unnamed: 17']
+
+ df=df.sort_values(by=u'成交日期')
+ df=df.set_index(u'成交日期')
+ #
+ df.to_sql('tb_delivery_GJ',engine,if_exists='append')
+ # df=df[(df[u'摘要']==u'证券卖出') | (df[u'摘要']==u'证券买入')]
+ # df= df.groupby(df[u'证券名称'])
+ # print df.describe()
+ # print df[u'手续费'].sum()
+ # print df[u'印花税'].sum()
+ # df1=df[[u'证券名称',u'证券代码',u'成交数量', u'成交均价' ,u'成交金额',u'手续费', u'印花税',u'发生金额',u'操作']]
+ # print df1[u'证券名称'].value_counts()
+ # print df.groupby(by=[u'证券名称'])[u'发生金额'].sum()
+ # df1.to_excel('2017-all.xls')
+ # print df1.groupby(df1[u'证券名称']).describe()
+ # print df1['2017-02']
+ #df.to_excel('2016_delivery_order.xls')
+ # self.caculation(df)
+ # plt.plot(j,result)
+ # plt.show()
+
+ def pretty(self):
+ df = pd.read_sql('tb_delivery_GJ',engine,index_col=u'成交日期')
+ # print df
+ # del df[u'Unnamed: 17']
+ del df['index']
+ df.to_sql('tb_delivery_GJ',engine,if_exists='replace')
# 银转证
def bank_account():
folder_path = os.path.join(os.path.dirname(__file__),'private')
@@ -129,10 +196,13 @@ def bank_account():
del df[u'委托时间']
df.to_sql('tb_bank_cash',engine,if_exists='replace')
# print df['2018']
+
def main():
obj=Delivery_Order()
+ # obj.years_gj()
obj.years()
# bank_account()
+ # obj.pretty()
main()
diff --git a/plot_line.py b/plot_line.py
index 529f71b..a312890 100644
--- a/plot_line.py
+++ b/plot_line.py
@@ -26,8 +26,8 @@ def plot_stock_line(code,name,table_name,current,start='2017-10-01',save=False):
title=u'{} {} {} {}'.format(current,code,name,table_name)
if os.path.exists(title+ '.png'):
return
- engine = get_engine('db_stock',local=True)
+ engine = get_engine('db_stock',local=True)
fig = plt.figure(figsize=(10,8))
base_info = pd.read_sql('tb_basic_info',engine,index_col='index')
# fig,(ax,ax2)=plt.subplots(2,1,sharex=True,figsize=(16,10))
@@ -35,7 +35,7 @@ def plot_stock_line(code,name,table_name,current,start='2017-10-01',save=False):
ax2=fig.add_axes([0,0.1,1,0.25])
if code is None and name is not None:
code = base_info[base_info['name']==name]['code'].values[0]
- print code
+ # print code
df = None
for _ in range(4):
api = ts.get_apis()