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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + "
成交时间证券代码证券名称操作成交数量成交均价成交金额余额发生金额手续费印花税过户费本次金额其他费用交易市场
成交日期
2018-02-0513:29:51300527华舟应急证券卖出-10024.962496.0105.02488.505.02.500.052488.500.0深圳A股
2018-02-0714:35:30300527华舟应急证券买入10023.942394.0205.0-2399.005.00.000.050.500.0深圳A股
2018-02-2611:22:45300527华舟应急证券卖出-10523.262442.3100.02434.865.02.440.052435.360.0深圳A股
2018-02-2710:10:03300527华舟应急证券卖出-10023.052305.0100.02297.695.02.310.052463.050.0深圳A股
2018-02-2710:01:22300527华舟应急证券买入10022.652265.0200.0-2270.005.00.000.05165.360.0深圳A股
\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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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-1614:03:41123005万信转债证券买入50123.6806184.0050.0-6184.490.490.00.03901.250.0深圳A股
2018-03-1910:59:31123005万信转债证券卖出-50124.5006225.000.06224.500.500.00.010148.330.0深圳A股
2018-03-2314:49:25123005万信转债证券卖出-50120.1906009.500.06009.020.480.00.09203.430.0深圳A股
2018-03-2313:23:42123005万信转债证券买入50120.7896039.4550.0-6039.930.480.00.03194.410.0深圳A股
2018-03-2614:30:29123005万信转债证券卖出-50122.6506132.500.06132.010.490.00.06132.960.0深圳A股
2018-03-2609:40:35123005万信转债证券买入50120.6006030.0050.0-6030.480.480.00.00.950.0深圳A股
2018-03-2710:05:12123005万信转债证券买入40126.6805067.2040.0-5067.610.410.00.0-4030.680.0深圳A股
2018-03-2710:32:37123005万信转债证券卖出-40126.9505078.000.05077.590.410.00.01046.910.0深圳A股
2018-04-1610:19:53123005万信转债证券买入30124.9003747.0030.0-3747.300.300.00.01210.870.0深圳A股
2018-04-1614:00:45123005万信转债证券买入30124.6003738.0030.0-3738.300.300.00.01257.400.0深圳A股
2018-04-1610:24:24123005万信转债证券卖出-30125.5003765.000.03764.700.300.00.04975.570.0深圳A股
2018-04-1613:16:02123005万信转债证券卖出-30125.1003753.000.03752.700.300.00.04988.770.0深圳A股
2018-04-1613:56:59123005万信转债证券买入30124.2003726.0030.0-3726.300.300.00.01262.470.0深圳A股
2018-04-1614:45:58123005万信转债证券买入10124.8901248.9040.0-1249.000.100.00.08.400.0深圳A股
2018-04-1611:08:49123005万信转债证券买入30124.6403739.2030.0-3739.500.300.00.01236.070.0深圳A股
2018-04-1613:58:40123005万信转债证券卖出-30124.4513733.530.03733.230.300.00.04995.700.0深圳A股
2018-04-1709:33:44123005万信转债证券卖出-40125.0005000.000.04999.600.400.00.05008.000.0深圳A股
2018-04-1713:43:35123005万信转债证券买入20123.3702467.4020.0-2467.600.200.00.02545.200.0深圳A股
2018-04-1710:00:40123005万信转债证券买入40124.3604974.4040.0-4974.800.400.00.033.200.0深圳A股
2018-04-1710:32:24123005万信转债证券卖出-40124.5004980.000.04979.600.400.00.05012.800.0深圳A股
2018-04-1714:13:57123005万信转债证券买入40123.5004940.0040.0-4940.400.400.00.074.160.0深圳A股
2018-04-1713:45:53123005万信转债证券买入20123.5022470.0440.0-2470.240.200.00.074.960.0深圳A股
2018-04-1713:58:43123005万信转债证券卖出-40123.5004940.000.04939.600.400.00.05014.560.0深圳A股
2018-04-1814:44:14123005万信转债证券买入40129.2505170.0040.0-5170.410.410.00.029.700.0深圳A股
2018-04-1814:44:59123005万信转债证券卖出-40129.5005180.000.05179.590.410.00.05209.290.0深圳A股
2018-04-1810:02:53123005万信转债证券卖出-40123.5504942.000.04941.600.400.00.05015.760.0深圳A股
2018-04-1814:23:42123005万信转债证券买入40128.2505130.0040.0-5130.410.410.00.049.740.0深圳A股
2018-04-1814:32:43123005万信转债证券买入40129.4005176.0040.0-5176.410.410.00.020.520.0深圳A股
2018-04-1814:28:44123005万信转债证券卖出-40128.6905147.600.05147.190.410.00.05196.930.0深圳A股
2018-04-1814:15:16123005万信转债证券卖出-40127.8015112.040.05111.630.410.00.05180.150.0深圳A股
2018-04-1813:04:57123005万信转债证券买入40123.6714946.8440.0-4947.240.400.00.068.520.0深圳A股
2018-04-1814:41:48123005万信转债证券卖出-40129.5005180.000.05179.590.410.00.05200.110.0深圳A股
2018-04-1913:39:02123005万信转债证券买入40130.2205208.8040.0-5209.220.420.00.0-4999.980.0深圳A股
\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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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-1614:03:41123005万信转债证券买入50123.6806184.0050.0-6184.490.490.00.03901.250.0深圳A股
2018-03-2313:23:42123005万信转债证券买入50120.7896039.4550.0-6039.930.480.00.03194.410.0深圳A股
2018-03-2609:40:35123005万信转债证券买入50120.6006030.0050.0-6030.480.480.00.00.950.0深圳A股
2018-03-2710:05:12123005万信转债证券买入40126.6805067.2040.0-5067.610.410.00.0-4030.680.0深圳A股
2018-04-1610:19:53123005万信转债证券买入30124.9003747.0030.0-3747.300.300.00.01210.870.0深圳A股
2018-04-1614:00:45123005万信转债证券买入30124.6003738.0030.0-3738.300.300.00.01257.400.0深圳A股
2018-04-1613:56:59123005万信转债证券买入30124.2003726.0030.0-3726.300.300.00.01262.470.0深圳A股
2018-04-1614:45:58123005万信转债证券买入10124.8901248.9040.0-1249.000.100.00.08.400.0深圳A股
2018-04-1611:08:49123005万信转债证券买入30124.6403739.2030.0-3739.500.300.00.01236.070.0深圳A股
2018-04-1713:43:35123005万信转债证券买入20123.3702467.4020.0-2467.600.200.00.02545.200.0深圳A股
2018-04-1710:00:40123005万信转债证券买入40124.3604974.4040.0-4974.800.400.00.033.200.0深圳A股
2018-04-1714:13:57123005万信转债证券买入40123.5004940.0040.0-4940.400.400.00.074.160.0深圳A股
2018-04-1713:45:53123005万信转债证券买入20123.5022470.0440.0-2470.240.200.00.074.960.0深圳A股
2018-04-1814:44:14123005万信转债证券买入40129.2505170.0040.0-5170.410.410.00.029.700.0深圳A股
2018-04-1814:23:42123005万信转债证券买入40128.2505130.0040.0-5130.410.410.00.049.740.0深圳A股
2018-04-1814:32:43123005万信转债证券买入40129.4005176.0040.0-5176.410.410.00.020.520.0深圳A股
2018-04-1813:04:57123005万信转债证券买入40123.6714946.8440.0-4947.240.400.00.068.520.0深圳A股
2018-04-1913:39:02123005万信转债证券买入40130.2205208.8040.0-5209.220.420.00.0-4999.980.0深圳A股
\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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
成交时间证券代码证券名称操作成交数量成交均价成交金额余额发生金额手续费印花税过户费本次金额其他费用交易市场
成交日期
2018-04-1610:19:53123005万信转债证券买入30124.9003747.0030.0-3747.300.300.00.01210.870.0深圳A股
2018-04-1614:00:45123005万信转债证券买入30124.6003738.0030.0-3738.300.300.00.01257.400.0深圳A股
2018-04-1610:24:24123005万信转债证券卖出-30125.5003765.000.03764.700.300.00.04975.570.0深圳A股
2018-04-1613:16:02123005万信转债证券卖出-30125.1003753.000.03752.700.300.00.04988.770.0深圳A股
2018-04-1613:56:59123005万信转债证券买入30124.2003726.0030.0-3726.300.300.00.01262.470.0深圳A股
2018-04-1614:45:58123005万信转债证券买入10124.8901248.9040.0-1249.000.100.00.08.400.0深圳A股
2018-04-1611:08:49123005万信转债证券买入30124.6403739.2030.0-3739.500.300.00.01236.070.0深圳A股
2018-04-1613:58:40123005万信转债证券卖出-30124.4513733.530.03733.230.300.00.04995.700.0深圳A股
2018-04-1709:33:44123005万信转债证券卖出-40125.0005000.000.04999.600.400.00.05008.000.0深圳A股
2018-04-1713:43:35123005万信转债证券买入20123.3702467.4020.0-2467.600.200.00.02545.200.0深圳A股
2018-04-1710:00:40123005万信转债证券买入40124.3604974.4040.0-4974.800.400.00.033.200.0深圳A股
2018-04-1710:32:24123005万信转债证券卖出-40124.5004980.000.04979.600.400.00.05012.800.0深圳A股
2018-04-1714:13:57123005万信转债证券买入40123.5004940.0040.0-4940.400.400.00.074.160.0深圳A股
2018-04-1713:45:53123005万信转债证券买入20123.5022470.0440.0-2470.240.200.00.074.960.0深圳A股
2018-04-1713:58:43123005万信转债证券卖出-40123.5004940.000.04939.600.400.00.05014.560.0深圳A股
2018-04-1814:44:14123005万信转债证券买入40129.2505170.0040.0-5170.410.410.00.029.700.0深圳A股
2018-04-1814:44:59123005万信转债证券卖出-40129.5005180.000.05179.590.410.00.05209.290.0深圳A股
2018-04-1810:02:53123005万信转债证券卖出-40123.5504942.000.04941.600.400.00.05015.760.0深圳A股
2018-04-1814:23:42123005万信转债证券买入40128.2505130.0040.0-5130.410.410.00.049.740.0深圳A股
2018-04-1814:32:43123005万信转债证券买入40129.4005176.0040.0-5176.410.410.00.020.520.0深圳A股
2018-04-1814:28:44123005万信转债证券卖出-40128.6905147.600.05147.190.410.00.05196.930.0深圳A股
2018-04-1814:15:16123005万信转债证券卖出-40127.8015112.040.05111.630.410.00.05180.150.0深圳A股
2018-04-1813:04:57123005万信转债证券买入40123.6714946.8440.0-4947.240.400.00.068.520.0深圳A股
2018-04-1814:41:48123005万信转债证券卖出-40129.5005180.000.05179.590.410.00.05200.110.0深圳A股
2018-04-1913:39:02123005万信转债证券买入40130.2205208.8040.0-5209.220.420.00.0-4999.980.0深圳A股
\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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
成交时间证券代码证券名称操作成交数量成交均价成交金额余额发生金额手续费印花税过户费本次金额其他费用交易市场
成交日期
2018-02-0513:29:51300527华舟应急证券卖出-10024.9602496.00105.02488.505.002.500.052488.500.0深圳A股
2018-02-2611:22:45300527华舟应急证券卖出-10523.2602442.30100.02434.865.002.440.052435.360.0深圳A股
2018-02-2710:10:03300527华舟应急证券卖出-10023.0502305.00100.02297.695.002.310.052463.050.0深圳A股
2018-03-0113:00:06300527华舟应急证券卖出-20024.3504870.000.04860.135.004.870.105053.180.0深圳A股
2018-03-0813:00:00300527华舟应急证券卖出-10024.3602436.000.02428.565.002.440.054085.740.0深圳A股
2018-03-1911:09:42110039宝信转债证券卖出-20132.1202642.400.02642.390.010.000.003923.830.0上海A股
2018-03-1910:59:31123005万信转债证券卖出-50124.5006225.000.06224.500.500.000.0010148.330.0深圳A股
2018-03-2309:51:23113504N艾华转证券卖出-10108.5101085.100.01085.090.010.000.009234.340.0上海A股
2018-03-2314:49:25123005万信转债证券卖出-50120.1906009.500.06009.020.480.000.009203.430.0深圳A股
2018-03-2614:30:29123005万信转债证券卖出-50122.6506132.500.06132.010.490.000.006132.960.0深圳A股
2018-03-2710:32:37123005万信转债证券卖出-40126.9505078.000.05077.590.410.000.001046.910.0深圳A股
2018-03-2709:25:01113505N杭电转证券卖出-10100.5001005.000.01004.990.010.000.005137.950.0上海A股
2018-03-2810:14:10110039宝信转债证券卖出-30135.2004056.000.04055.980.020.000.005102.890.0上海A股
2018-03-2910:10:36603168莎普爱思证券卖出-60014.1808508.000.08494.325.008.510.179505.990.0上海A股
2018-03-2914:12:37113505杭电转债证券卖出-40102.3604094.400.04094.380.020.000.0013600.370.0上海A股
2018-04-1109:32:39127005长证转债证券卖出-10106.7201067.200.01067.100.100.000.001067.100.0深圳A股
2018-04-1610:50:39110039宝信转债证券卖出-30149.1004473.000.04472.980.020.000.0060.760.0上海A股
2018-04-1610:24:24123005万信转债证券卖出-30125.5003765.000.03764.700.300.000.004975.570.0深圳A股
2018-04-1610:18:43128036金农转债证券卖出-5097.9564897.800.04897.410.390.000.004958.170.0深圳A股
2018-04-1613:16:02123005万信转债证券卖出-30125.1003753.000.03752.700.300.000.004988.770.0深圳A股
2018-04-1613:58:40123005万信转债证券卖出-30124.4513733.530.03733.230.300.000.004995.700.0深圳A股
2018-04-1709:33:44123005万信转债证券卖出-40125.0005000.000.04999.600.400.000.005008.000.0深圳A股
2018-04-1710:32:24123005万信转债证券卖出-40124.5004980.000.04979.600.400.000.005012.800.0深圳A股
2018-04-1713:58:43123005万信转债证券卖出-40123.5004940.000.04939.600.400.000.005014.560.0深圳A股
2018-04-1814:44:59123005万信转债证券卖出-40129.5005180.000.05179.590.410.000.005209.290.0深圳A股
2018-04-1810:02:53123005万信转债证券卖出-40123.5504942.000.04941.600.400.000.005015.760.0深圳A股
2018-04-1814:28:44123005万信转债证券卖出-40128.6905147.600.05147.190.410.000.005196.930.0深圳A股
2018-04-1814:15:16123005万信转债证券卖出-40127.8015112.040.05111.630.410.000.005180.150.0深圳A股
2018-04-1814:41:48123005万信转债证券卖出-40129.5005180.000.05179.590.410.000.005200.110.0深圳A股
\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", + " \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", + " \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", + " \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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
证券代码证券名称保本价股票余额盈亏比例盈亏市值现价2018-04-122018-04-132018-04-162018-04-172018-04-182018-04-192018-04-202018-04-232018-04-242018-04-252018-04-26
0600846同济科技10.055600-11.29-681.05352.08.92-114.024.0-84.0-144.0144.0132.090.024.060.0210.0-282.0
1000693*ST华泽14.443600-75.91-6577.82088.03.48-186.0-174.0-168.0-156.0-150.0-144.0-132.0-126.0-120.0-114.0-108.0
2300102乾照光电10.526300-20.20-637.82520.08.4012.042.0-15.0-78.0144.06.030.0-33.069.0-33.0-48.0
3000572海马汽车5.155900-27.06-1255.53384.03.7663.0-198.0378.0-306.0-117.0-27.0-180.0-72.063.018.0-126.0
4002165红 宝 丽9.490500-52.58-2495.02250.04.50-30.05.0-10.0-60.00.0-15.0-80.0-45.035.0-5.0-65.0
5300625三雄极光48.950100-51.26-2509.02386.023.86-41.043.0-67.0-87.098.0-10.0-58.013.0108.0-1.0-47.0
6601212白银有色17.427200-68.50-2387.41098.05.4920.0-46.04.0-52.0-26.020.0-52.0-34.016.00.0-40.0
7300141和顺电气19.967300-53.27-3191.12799.09.336.0174.0-87.0-192.069.0-33.0-66.0-9.087.03.0-129.0
8002316键桥通讯45.642300-77.89-10665.63027.010.09-51.0-21.06.0-84.021.03.057.0-72.075.057.0-60.0
9300580贝斯特32.568200-46.11-3003.63510.017.55-82.0-52.0-76.0-154.0102.0-2.0-214.0-70.0114.024.0-144.0
\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()