{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import dolphindb as ddb\n", "import dolphindb.settings as keys\n", "import numpy as np\n", "import pandas as pd\n", "\n", "\n", "sess = ddb.session('192.168.1.7',8848)\n", "sess.login('admin','123456')\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'/hft_futuremarket_ts': 'TickPartitioned:3:0:TickPartitioned_3; MinKlinePartitioned:2:0:MinKlinePartitioned_2; ',\n", " '/daily_stock_ts': 'idx_daily_kline:11:0:idx_daily_kline_11; idx_daily_concept:6:0:idx_daily_concept_6; hft_daily_factor:16:0:hft_daily_factor_16; daily_kline:2:0:daily_kline_2; ',\n", " '/hft_stock_ts': 'Calendar:2:0:Calendar_2; KLinePartitioned:3:0:KLinePartitioned_3; OrderPartitioned:4:0:OrderPartitioned_4; TickPartitioned:5:0:TickPartitioned_5; TickQueuePartitioned:6:0:TickQueuePartitioned_6; TransePartitioned:7:0:TransePartitioned_7; '}" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run('getAllDBs()')" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "ddb_hft_dbPath=\"dfs://hft_futuremarket_ts\"\n", "tbName=\"TickPartitioned\" # MinKlinePartitioned\n", "code_list=['AP2211']\n", "df = sess.run(f\"\"\"pt=loadTable(\"{ddb_hft_dbPath}\",\"{tbName}\");\n", " select * from pt where m_nDatetime.date()=2022.06.01d and code in ({\" \".join([\"`\"+c for c in code_list])});\n", " \"\"\")" ] }, { "cell_type": "code", "execution_count": 7, "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", "
codem_nDatetimem_nPricem_nOpenm_nHighm_nLowm_nClosem_nAccHighm_nAccLowm_iVolume...m_nActAskTurnoverm_nAccActAskTurnoverm_nBidOrderm_nAccBidOrderm_nAskOrderm_nAccAskOrderm_nABOrderRatem_nAccABOrderRatem_nMItemsVolRatecode_init
0AP22112022-06-01 08:55:008701.08701.08701.08701.08701.00.00.00...0.00.00.00.00.00.00.0000000.0000000.0AP
1AP22112022-06-01 08:59:008623.08623.08623.08623.08623.08623.08623.0505...2177307.52177307.52.02.01.01.02.0000002.0000000.0AP
2AP22112022-06-01 09:00:018691.08691.08691.08691.08691.08691.08623.04...0.02177307.51.03.02.03.00.5000001.0000000.0AP
3AP22112022-06-01 09:00:028691.08691.08691.08691.08691.08691.08623.00...0.02177307.51.04.01.04.01.0000001.0000000.0AP
4AP22112022-06-01 09:00:038691.08691.08691.08691.08691.08691.08623.00...0.02177307.51.05.03.07.00.3333330.7142860.0AP
\n", "

5 rows × 38 columns

\n", "
" ], "text/plain": [ " code m_nDatetime m_nPrice m_nOpen m_nHigh m_nLow m_nClose \\\n", "0 AP2211 2022-06-01 08:55:00 8701.0 8701.0 8701.0 8701.0 8701.0 \n", "1 AP2211 2022-06-01 08:59:00 8623.0 8623.0 8623.0 8623.0 8623.0 \n", "2 AP2211 2022-06-01 09:00:01 8691.0 8691.0 8691.0 8691.0 8691.0 \n", "3 AP2211 2022-06-01 09:00:02 8691.0 8691.0 8691.0 8691.0 8691.0 \n", "4 AP2211 2022-06-01 09:00:03 8691.0 8691.0 8691.0 8691.0 8691.0 \n", "\n", " m_nAccHigh m_nAccLow m_iVolume ... m_nActAskTurnover \\\n", "0 0.0 0.0 0 ... 0.0 \n", "1 8623.0 8623.0 505 ... 2177307.5 \n", "2 8691.0 8623.0 4 ... 0.0 \n", "3 8691.0 8623.0 0 ... 0.0 \n", "4 8691.0 8623.0 0 ... 0.0 \n", "\n", " m_nAccActAskTurnover m_nBidOrder m_nAccBidOrder m_nAskOrder \\\n", "0 0.0 0.0 0.0 0.0 \n", "1 2177307.5 2.0 2.0 1.0 \n", "2 2177307.5 1.0 3.0 2.0 \n", "3 2177307.5 1.0 4.0 1.0 \n", "4 2177307.5 1.0 5.0 3.0 \n", "\n", " m_nAccAskOrder m_nABOrderRate m_nAccABOrderRate m_nMItemsVolRate \\\n", "0 0.0 0.000000 0.000000 0.0 \n", "1 1.0 2.000000 2.000000 0.0 \n", "2 3.0 0.500000 1.000000 0.0 \n", "3 4.0 1.000000 1.000000 0.0 \n", "4 7.0 0.333333 0.714286 0.0 \n", "\n", " code_init \n", "0 AP \n", "1 AP \n", "2 AP \n", "3 AP \n", "4 AP \n", "\n", "[5 rows x 38 columns]" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'partitionType': array([1, 1], dtype=int32),\n", " 'partitionColumnName': array(['m_nDatetime', 'code_init'], dtype=object),\n", " 'partitionTypeName': array(['VALUE', 'VALUE'], dtype=object),\n", " 'partitionColumnIndex': array([ 1, 37], dtype=int32),\n", " 'colDefs': name typeString typeInt comment\n", " 0 code STRING 18 \n", " 1 m_nDatetime NANOTIMESTAMP 14 \n", " 2 m_nPrice DOUBLE 16 \n", " 3 m_nOpen DOUBLE 16 \n", " 4 m_nHigh DOUBLE 16 \n", " 5 m_nLow DOUBLE 16 \n", " 6 m_nClose DOUBLE 16 \n", " 7 m_nAccHigh DOUBLE 16 \n", " 8 m_nAccLow DOUBLE 16 \n", " 9 m_iVolume SHORT 3 \n", " 10 m_iAccVolume SHORT 3 \n", " 11 m_nMatchItems SHORT 3 \n", " 12 m_nAccMatchItems SHORT 3 \n", " 13 m_iTurnover DOUBLE 16 \n", " 14 m_iAccTurnover DOUBLE 16 \n", " 15 m_nPreClose DOUBLE 16 \n", " 16 m_nAccPreClose DOUBLE 16 \n", " 17 m_nBidPrice DOUBLE 16 \n", " 18 m_nBidVolume SHORT 3 \n", " 19 m_nAskPrice DOUBLE 16 \n", " 20 m_nAskVolume SHORT 3 \n", " 21 m_iABFlag CHAR 2 \n", " 22 m_nActBidVolume SHORT 3 \n", " 23 m_nAccActBidVolume SHORT 3 \n", " 24 m_nActBidTurnover DOUBLE 16 \n", " 25 m_nAccActBidTurnover DOUBLE 16 \n", " 26 m_nActAskVolume SHORT 3 \n", " 27 m_nAccActAskVolume SHORT 3 \n", " 28 m_nActAskTurnover DOUBLE 16 \n", " 29 m_nAccActAskTurnover DOUBLE 16 \n", " 30 m_nBidOrder DOUBLE 16 \n", " 31 m_nAccBidOrder DOUBLE 16 \n", " 32 m_nAskOrder DOUBLE 16 \n", " 33 m_nAccAskOrder DOUBLE 16 \n", " 34 m_nABOrderRate DOUBLE 16 \n", " 35 m_nAccABOrderRate DOUBLE 16 \n", " 36 m_nMItemsVolRate DOUBLE 16 \n", " 37 code_init STRING 18 ,\n", " 'chunkGranularity': 'TABLE',\n", " 'engineType': 'TSDB',\n", " 'keepDuplicates': 'ALL',\n", " 'partitionSchema': [array(['2050-11', '2050-10', '2050-09', '2050-08', '2050-07', '2050-06',\n", " '2050-05', '2050-04', '2050-03', '2050-02', '2050-01', '2049-12',\n", " '2049-11', '2049-10', '2049-09', '2049-08', '2049-07', '2049-06',\n", " '2049-05', '2049-04', '2049-03', '2049-02', '2049-01', '2048-12',\n", " '2048-11', '2048-10', '2048-09', '2048-08', '2048-07', '2048-06',\n", " '2048-05', '2048-04', '2048-03', '2048-02', '2048-01', '2047-12',\n", " '2047-11', '2047-10', '2047-09', '2047-08', '2047-07', '2047-06',\n", " '2047-05', '2047-04', '2047-03', '2047-02', '2047-01', '2046-12',\n", " '2046-11', '2046-10', '2046-09', '2046-08', '2046-07', '2046-06',\n", " '2046-05', '2046-04', '2046-03', '2046-02', '2046-01', '2045-12',\n", " '2045-11', '2045-10', '2045-09', '2045-08', '2045-07', '2045-06',\n", " '2045-05', '2045-04', '2045-03', '2045-02', '2045-01', '2044-12',\n", " '2044-11', '2044-10', '2044-09', '2044-08', '2044-07', '2044-06',\n", " '2044-05', '2044-04', '2044-03', '2044-02', '2044-01', '2043-12',\n", " '2043-11', '2043-10', '2043-09', '2043-08', '2043-07', '2043-06',\n", " '2043-05', '2043-04', '2043-03', '2043-02', '2043-01', '2042-12',\n", " '2042-11', '2042-10', '2042-09', '2042-08', '2042-07', '2042-06',\n", " '2042-05', '2042-04', '2042-03', '2042-02', '2042-01', '2041-12',\n", " '2041-11', '2041-10', '2041-09', '2041-08', '2041-07', '2041-06',\n", " '2041-05', '2041-04', '2041-03', '2041-02', '2041-01', '2040-12',\n", " '2040-11', '2040-10', '2040-09', '2040-08', '2040-07', '2040-06',\n", " '2040-05', '2040-04', '2040-03', '2040-02', '2040-01', '2039-12',\n", " '2039-11', '2039-10', '2039-09', '2039-08', '2039-07', '2039-06',\n", " '2039-05', '2039-04', '2039-03', '2039-02', '2039-01', '2038-12',\n", " '2038-11', '2038-10', '2038-09', '2038-08', '2038-07', '2038-06',\n", " '2038-05', '2038-04', '2038-03', '2038-02', '2038-01', '2037-12',\n", " '2037-11', '2037-10', '2037-09', '2037-08', '2037-07', '2037-06',\n", " '2037-05', '2037-04', '2037-03', '2037-02', '2037-01', '2036-12',\n", " '2036-11', '2036-10', '2036-09', '2036-08', '2036-07', '2036-06',\n", " '2036-05', '2036-04', '2036-03', '2036-02', '2036-01', '2035-12',\n", " '2035-11', '2035-10', '2035-09', '2035-08', '2035-07', '2035-06',\n", " '2035-05', '2035-04', '2035-03', '2035-02', '2035-01', '2034-12',\n", " '2034-11', '2034-10', '2034-09', '2034-08', '2034-07', '2034-06',\n", " '2034-05', '2034-04', '2034-03', '2034-02', '2034-01', '2033-12',\n", " '2033-11', '2033-10', '2033-09', '2033-08', '2033-07', '2033-06',\n", " '2033-05', '2033-04', '2033-03', '2033-02', '2033-01', '2032-12',\n", " '2032-11', '2032-10', '2032-09', '2032-08', '2032-07', '2032-06',\n", " '2032-05', '2032-04', '2032-03', '2032-02', '2032-01', '2031-12',\n", " '2031-11', '2031-10', '2031-09', '2031-08', '2031-07', '2031-06',\n", " '2031-05', '2031-04', '2031-03', '2031-02', '2031-01', '2030-12',\n", " '2030-11', '2030-10', '2030-09', '2030-08', '2030-07', '2030-06',\n", " '2030-05', '2030-04', '2030-03', '2030-02', '2030-01', '2029-12',\n", " '2029-11', '2029-10', '2029-09', '2029-08', '2029-07', '2029-06',\n", " '2029-05', '2029-04', '2029-03', '2029-02', '2029-01', '2028-12',\n", " '2028-11', '2028-10', '2028-09', '2028-08', '2028-07', '2028-06',\n", " '2028-05', '2028-04', '2028-03', '2028-02', '2028-01', '2027-12',\n", " '2027-11', '2027-10', '2027-09', '2027-08', '2027-07', '2027-06',\n", " '2027-05', '2027-04', '2027-03', '2027-02', '2027-01', '2026-12',\n", " '2026-11', '2026-10', '2026-09', '2026-08', '2026-07', '2026-06',\n", " '2026-05', '2026-04', '2026-03', '2026-02', '2026-01', '2025-12',\n", " '2025-11', '2025-10', '2025-09', '2025-08', '2025-07', '2025-06',\n", " '2025-05', '2025-04', '2025-03', '2025-02', '2025-01', '2024-12',\n", " '2024-11', '2024-10', '2024-09', '2024-08', '2024-07', '2024-06',\n", " '2024-05', '2024-04', '2024-03', '2024-02', '2024-01', '2023-12',\n", " '2023-11', '2023-10', '2023-09', '2023-08', '2023-07', '2023-06',\n", " '2023-05', '2023-04', '2023-03', '2023-02', '2023-01', '2022-12',\n", " '2022-11', '2022-10', '2022-09', '2022-08', '2022-07', '2022-06',\n", " '2022-05', '2022-04', '2022-03', '2022-02', '2022-01', '2021-12',\n", " '2021-11', '2021-10', '2021-09', '2021-08', '2021-07', '2021-06',\n", " '2021-05', '2021-04', '2021-03', '2021-02', '2021-01', '2020-12',\n", " '2020-11', '2020-10', '2020-09', '2020-08', '2020-07', '2020-06',\n", " '2020-05', '2020-04', '2020-03', '2020-02', '2020-01', '2019-12',\n", " '2019-11', '2019-10', '2019-09', '2019-08', '2019-07', '2019-06',\n", " '2019-05', '2019-04', '2019-03', '2019-02', '2019-01', '2018-12',\n", " '2018-11', '2018-10', '2018-09', '2018-08', '2018-07', '2018-06',\n", " '2018-05', '2018-04', '2018-03', '2018-02', '2018-01', '2017-12',\n", " '2017-11', '2017-10', '2017-09', '2017-08', '2017-07', '2017-06',\n", " '2017-05', '2017-04', '2017-03', '2017-02', '2017-01', '2016-12',\n", " '2016-11', '2016-10', '2016-09', '2016-08', '2016-07', '2016-06',\n", " '2016-05', '2016-04', '2016-03', '2016-02', '2016-01', '2015-12',\n", " '2015-11', '2015-10', '2015-09', '2015-08', '2015-07', '2015-06',\n", " '2015-05', '2015-04', '2015-03', '2015-02', '2015-01', '2014-12',\n", " '2014-11', '2014-10', '2014-09', '2014-08', '2014-07', '2014-06',\n", " '2014-05', '2014-04', '2014-03', '2014-02', '2014-01', '2013-12',\n", " '2013-11', '2013-10', '2013-09', '2013-08', '2013-07', '2013-06',\n", " '2013-05', '2013-04', '2013-03', '2013-02', '2013-01', '2012-12',\n", " '2012-11', '2012-10', '2012-09', '2012-08', '2012-07', '2012-06',\n", " '2012-05', '2012-04', '2012-03', '2012-02', '2012-01', '2011-12',\n", " '2011-11', '2011-10', '2011-09', '2011-08', '2011-07', '2011-06',\n", " '2011-05', '2011-04', '2011-03', '2011-02', '2011-01', '2010-12',\n", " '2010-11', '2010-10', '2010-09', '2010-08', '2010-07', '2010-06',\n", " '2010-05', '2010-04', '2010-03', '2010-02', '2010-01', '2009-12',\n", " '2009-11', '2009-10', '2009-09', '2009-08', '2009-07', '2009-06',\n", " '2009-05', '2009-04', '2009-03', '2009-02', '2009-01', '2008-12',\n", " '2008-11', '2008-10', '2008-09', '2008-08', '2008-07', '2008-06',\n", " '2008-05', '2008-04', '2008-03', '2008-02', '2008-01', '2007-12',\n", " '2007-11', '2007-10', '2007-09', '2007-08', '2007-07', '2007-06',\n", " '2007-05', '2007-04', '2007-03', '2007-02', '2007-01', '2006-12',\n", " '2006-11', '2006-10', '2006-09', '2006-08', '2006-07', '2006-06',\n", " '2006-05', '2006-04', '2006-03', '2006-02', '2006-01', '2005-12',\n", " '2005-11', '2005-10', '2005-09', '2005-08', '2005-07', '2005-06',\n", " '2005-05', '2005-04', '2005-03', '2005-02', '2005-01', '2004-12',\n", " '2004-11', '2004-10', '2004-09', '2004-08', '2004-07', '2004-06',\n", " '2004-05', '2004-04', '2004-03', '2004-02', '2004-01', '2003-12',\n", " '2003-11', '2003-10', '2003-09', '2003-08', '2003-07', '2003-06',\n", " '2003-05', '2003-04', '2003-03', '2003-02', '2003-01', '2002-12',\n", " '2002-11', '2002-10', '2002-09', '2002-08', '2002-07', '2002-06',\n", " '2002-05', '2002-04', '2002-03', '2002-02', '2002-01', '2001-12',\n", " '2001-11', '2001-10', '2001-09', '2001-08', '2001-07', '2001-06',\n", " '2001-05', '2001-04', '2001-03', '2001-02', '2001-01', '2000-12',\n", " '2000-11', '2000-10', '2000-09', '2000-08', '2000-07', '2000-06',\n", " '2000-05', '2000-04', '2000-03', '2000-02', '2000-01'],\n", " dtype='datetime64[M]'),\n", " array(['zn', 'y', 'wr', 'v', 'ss', 'sp', 'sn', 'sc', 'ru', 'rr', 'rb',\n", " 'pp', 'pg', 'pb', 'p', 'nr', 'ni', 'm', 'lu', 'lh', 'l', 'jm',\n", " 'jd', 'j', 'i', 'hc', 'fu', 'fb', 'eg', 'eb', 'cu', 'cs', 'c',\n", " 'bu', 'bc', 'bb', 'b', 'au', 'al', 'ag', 'a', 'ZC', 'WH', 'UR',\n", " 'TS', 'TF', 'TA', 'T', 'SR', 'SM', 'SF', 'SA', 'RS', 'RM', 'RI',\n", " 'PM', 'PK', 'PF', 'OI', 'MA', 'LR', 'JR', 'IM', 'IH', 'IF', 'IC',\n", " 'FG', 'CY', 'CJ', 'CF', 'AP'], dtype=object)],\n", " 'partitionColumnType': array([ 7, 17], dtype=int32),\n", " 'chunkPath': None,\n", " 'sortColumns': array(['code', 'm_nDatetime'], dtype=object),\n", " 'partitionSites': None}" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sess.run(f\"\"\"schema(pt)\"\"\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```python\n", "def get_trade_tick(self, start_date, end_date, code_list):\n", "\"\"\"\n", "(source: 天软数据字典 ver 2022-05-25)\n", "vol: 周期内的成交量。如果周期为分钟,则表示这分钟的成 交量,并非从开盘累计.\n", " 对于期货,高频和日线的单位都是合约数量,如果要建立成交量和成交金额之间的关系,还需考虑合约乘数。\n", "amount: 周期内的成交金额。如果周期为分钟,则表示这分钟的成交金额,并非从开盘累计。\n", "cjbs: 对于期货/期权而言,是周期内的持仓的变动量,日线的话表示当日持仓量,单位为:手。\n", "wb: 公式:委买/委卖(w_buy/w_sale)\n", "lb: 由天软计算:\n", " 1、对于交易明细:\n", " 量比=现成交总手/[(过去 5 个交易日平均每分钟成交 量)×当日累计开市时间(分)]\n", " 2、对于秒线/1 分钟线: 量比取周期内最后一条交易明细的数据。\n", "\n", "zmm: 对 tradetable 公式:按下面的前后逻辑优先判定\n", " 没有成交 -> 0\n", " 当前成交价>上一笔买一价 ->主买 1 \n", " 当前成交价<上一笔卖一价 ->主卖 2 \n", " 否则->3(一般是集合竞价、涨停、跌停) \n", " 对于非交易明细(秒线或分钟线等):没有意义\n", "buy_vol: 主动性买盘成交量:周期内买卖标识为 1 的成交量+买 卖标识为 3 的成交量/2\n", "buy_amount: 主动性买盘成交金额:周期内买卖标识为 1 的成交金额 +买卖标识为 3 的成交金额/2\n", "sale_vol: 主动性卖盘成交量:周期内买卖标识为 2 的成交量之和 +买卖标识为 3 的成交量/2\n", "sale_amount: 主动性卖盘成交金额:周期内买卖标识为 2 的成交金额 +买卖标识为 3 的成交金额/2\n", "w_buy: 一个周期内的委买量\n", "sectional: 从开盘到当前时间的\n", "sectional_yclose: 上一交易日(周期是日)的收盘价,与‘上次价’不一 样。‘上次价’表示前一个周期的收盘价。\n", "sectional_vol: 从开盘到当前时间的成交量之和(主买+主卖)\n", "sectional_amount: 从开盘到当前时间的成交金额之和(主买+主卖)\n", "sectional_cjbs: 股指期货/期权:市场现有持仓量\n", "sectional_wb: 当日累计委买/当日累计委卖\n", "\n", "['sectional_open'] as 'm_nAccOpen', //时点当日开盘, 没必要存, 取上日2059的即可\n", "\n", "\"\"\"\n", "\n", "code_list_input = ', '.join(['\\'%s\\'' % code_id for code_id in code_list])\n", "scpt = \"\"\"\n", " stock_list := Array({code_list_input});\n", " r := select \n", " ['StockID'] as 'code',\n", " DateTimeToStr(['date']) as 'm_nDatetime',\n", "\n", " ['price'] as 'm_nPrice',\n", " ['open'] as 'm_nOpen',\n", " ['high'] as 'm_nHigh',\n", " ['low'] as 'm_nLow',\n", " ['close'] as 'm_nClose',\n", "\n", " ['sectional_high'] as 'm_nAccHigh',\n", " ['sectional_low'] as 'm_nAccLow',\n", "\n", " ['vol'] as 'm_iVolume', //成交量\n", " ['sectional_vol'] as 'm_iAccVolume', //时点当日累计成交量\n", "\n", " ['cjbs'] as 'm_nMatchItems', // 成交笔数 周期内的持仓的变动量\n", " ['sectional_cjbs'] as 'm_nAccMatchItems',\n", "\n", " ['amount'] as 'm_iTurnover', //成交金额\n", " ['sectional_amount'] as 'm_iAccTurnover', \n", "\n", " ['yclose'] as 'm_nPreClose', //上一周期的收盘价\n", " ['sectional_yclose'] as 'm_nAccPreClose', // 前日收盘\n", " \n", " ['buy1'] as 'm_nBidPrice', //买一价?叫卖价?\n", " ['bc1'] as 'm_nBidVolume', //买一量 当前以买一价出价的委买量\n", " ['sale1'] as 'm_nAskPrice', \n", " ['sc1'] as 'm_nAskVolume', \n", "\n", " ['zmm'] as 'm_iABFlag', //买卖标识\n", "\n", " ['buy_vol'] as 'm_nActBidVolume', //主买量\n", " ['sectional_buy_vol'] as 'm_nAccActBidVolume', //时点当日累计主买量\n", " ['buy_amount'] as 'm_nActBidTurnover', //主买金额\n", " ['sectional_buy_amount'] as 'm_nAccActBidTurnover', \n", "\n", " ['sale_vol'] as 'm_nActAskVolume', \n", " ['sectional_sale_vol'] as 'm_nAccActAskVolume', \n", " ['sale_amount'] as 'm_nActAskTurnover',\n", " ['sectional_sale_amount'] as 'm_nAccActAskTurnover', \n", "\n", " ['w_buy'] as 'm_nBidOrder', //委买\n", " ['sectional_w_buy'] as 'm_nAccBidOrder', \n", " ['w_sale'] as 'm_nAskOrder',\n", " ['sectional_w_sale'] as 'm_nAccAskOrder',\n", "\n", " ['wb'] as 'm_nABOrderRate', //委比\n", " ['sectional_wb'] as 'm_nAccABOrderRate', //时点当日累计委比\n", " ['lb'] as 'm_nMItemsVolRate'//量比\n", "\n", " from tradetable\n", " datekey {start_date}T to {end_date}T+0.999 \n", " of stock_list\n", " end;\n", " \n", " return r; \n", "\"\"\".format(\n", " code_list_input=code_list_input,\n", " start_date=start_date,\n", " end_date=end_date\n", ")\n", "logger.debug(scpt)\n", "r = self.c.exec(scpt,timeout=self.timeout_default)\n", "return r\n", "```" ] }, { "cell_type": "code", "execution_count": 10, "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
codem_nDatetimem_nPricem_nOpenm_nHighm_nLowm_nClosem_nAccHighm_nAccLowm_iVolume...m_nActAskTurnoverm_nAccActAskTurnoverm_nBidOrderm_nAccBidOrderm_nAskOrderm_nAccAskOrderm_nABOrderRatem_nAccABOrderRatem_nMItemsVolRatecode_init
0AP22112022-02-11 08:55:007776.07776.07776.07776.07776.00.00.00...0.00.00.00.00.00.00.00.0000000.0AP
1AP22112022-02-11 08:59:007761.07761.07761.07761.07761.07761.07761.02705...10496752.510496752.51.01.01.01.01.01.0000000.0AP
2AP22112022-02-11 09:00:007761.07761.07761.07761.07761.07761.07761.00...0.010496752.51.02.01.02.01.01.0000000.0AP
3AP22112022-02-11 09:00:007759.07759.07759.07759.07759.07761.07759.01...7761.010504513.51.03.01.03.01.01.0000000.0AP
4AP22112022-02-11 09:00:017759.07759.07759.07759.07759.07761.07759.00...0.010504513.51.04.01.04.01.01.0000000.0AP
5AP22112022-02-11 09:00:027759.07759.07759.07759.07759.07761.07759.00...0.010504513.51.05.01.05.01.01.0000000.0AP
6AP22112022-02-11 09:00:037759.07759.07759.07759.07759.07761.07759.00...0.010504513.51.06.01.06.01.01.0000000.0AP
7AP22112022-02-11 09:00:047759.07759.07759.07759.07759.07761.07759.01...7761.010512274.51.07.01.07.01.01.0000000.0AP
8AP22112022-02-11 09:00:057759.07759.07759.07759.07759.07761.07759.00...0.010512274.51.08.01.08.01.01.0000000.0AP
9AP22112022-02-11 09:00:057757.07757.07757.07757.07757.07761.07757.01...7761.010520035.51.09.01.09.01.01.0000000.0AP
10AP22112022-02-11 09:00:077757.07757.07757.07757.07757.07761.07757.00...0.010520035.51.010.01.010.01.01.0000000.0AP
11AP22112022-02-11 09:00:087757.07757.07757.07757.07757.07761.07757.00...0.010520035.51.011.01.011.01.01.0000000.0AP
12AP22112022-02-11 09:00:097757.07757.07757.07757.07757.07761.07757.00...0.010520035.51.012.01.012.01.01.0000000.0AP
13AP22112022-02-11 09:00:107757.07757.07757.07757.07757.07761.07757.00...0.010520035.51.013.01.013.01.01.0000000.0AP
14AP22112022-02-11 09:00:127757.07757.07757.07757.07757.07761.07757.00...0.010520035.51.014.01.014.01.01.0000000.0AP
15AP22112022-02-11 09:00:137757.07757.07757.07757.07757.07761.07757.00...0.010520035.51.015.01.015.01.01.0000000.0AP
16AP22112022-02-11 09:00:137751.07751.07751.07751.07751.07761.07751.01...7761.010527796.51.016.01.016.01.01.0000000.0AP
17AP22112022-02-11 09:00:147751.07751.07751.07751.07751.07761.07751.00...0.010527796.51.017.01.017.01.01.0000000.0AP
18AP22112022-02-11 09:00:157751.07751.07751.07751.07751.07761.07751.00...0.010527796.52.019.01.018.02.01.0555560.0AP
19AP22112022-02-11 09:00:167751.07751.07751.07751.07751.07761.07751.00...0.010527796.510.029.01.019.010.01.5263160.0AP
20AP22112022-02-11 09:00:167738.07738.07738.07738.07738.07761.07738.01...7761.010535557.59.038.01.020.09.01.9000000.0AP
21AP22112022-02-11 09:00:177730.07730.07730.07730.07730.07761.07730.011...85371.010620928.51.039.01.021.01.01.8571430.0AP
22AP22112022-02-11 09:00:187730.07730.07730.07730.07730.07761.07730.00...0.010620928.51.040.01.022.01.01.8181820.0AP
23AP22112022-02-11 09:00:197730.07730.07730.07730.07730.07761.07730.00...0.010620928.51.041.01.023.01.01.7826090.0AP
24AP22112022-02-11 09:00:207730.07730.07730.07730.07730.07761.07730.00...0.010620928.51.042.01.024.01.01.7500000.0AP
25AP22112022-02-11 09:00:217731.07731.07731.07731.07731.07761.07730.01...7761.010628689.51.043.01.025.01.01.7200000.0AP
26AP22112022-02-11 09:00:227731.07731.07731.07731.07731.07761.07730.00...0.010628689.51.044.01.026.01.01.6923080.0AP
27AP22112022-02-11 09:00:227725.07725.07725.07725.07725.07761.07725.01...7761.010636450.51.045.01.027.01.01.6666670.0AP
28AP22112022-02-11 09:00:237725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.046.01.028.01.01.6428570.0AP
29AP22112022-02-11 09:00:247725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.047.01.029.01.01.6206900.0AP
30AP22112022-02-11 09:00:257725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.048.01.030.01.01.6000000.0AP
31AP22112022-02-11 09:00:267725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.049.01.031.01.01.5806450.0AP
32AP22112022-02-11 09:00:277725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.050.01.032.01.01.5625000.0AP
33AP22112022-02-11 09:00:297725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.051.01.033.01.01.5454550.0AP
34AP22112022-02-11 09:00:307725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.052.01.034.01.01.5294120.0AP
35AP22112022-02-11 09:00:317725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.053.01.035.01.01.5142860.0AP
36AP22112022-02-11 09:00:327725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.054.01.036.01.01.5000000.0AP
37AP22112022-02-11 09:00:337725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.055.01.037.01.01.4864860.0AP
38AP22112022-02-11 09:00:347725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.056.01.038.01.01.4736840.0AP
39AP22112022-02-11 09:00:357725.07725.07725.07725.07725.07761.07725.00...0.010636450.51.057.01.039.01.01.4615380.0AP
\n", "

40 rows × 38 columns

\n", "
" ], "text/plain": [ " code m_nDatetime m_nPrice m_nOpen m_nHigh m_nLow m_nClose \\\n", "0 AP2211 2022-02-11 08:55:00 7776.0 7776.0 7776.0 7776.0 7776.0 \n", "1 AP2211 2022-02-11 08:59:00 7761.0 7761.0 7761.0 7761.0 7761.0 \n", "2 AP2211 2022-02-11 09:00:00 7761.0 7761.0 7761.0 7761.0 7761.0 \n", "3 AP2211 2022-02-11 09:00:00 7759.0 7759.0 7759.0 7759.0 7759.0 \n", "4 AP2211 2022-02-11 09:00:01 7759.0 7759.0 7759.0 7759.0 7759.0 \n", "5 AP2211 2022-02-11 09:00:02 7759.0 7759.0 7759.0 7759.0 7759.0 \n", "6 AP2211 2022-02-11 09:00:03 7759.0 7759.0 7759.0 7759.0 7759.0 \n", "7 AP2211 2022-02-11 09:00:04 7759.0 7759.0 7759.0 7759.0 7759.0 \n", "8 AP2211 2022-02-11 09:00:05 7759.0 7759.0 7759.0 7759.0 7759.0 \n", "9 AP2211 2022-02-11 09:00:05 7757.0 7757.0 7757.0 7757.0 7757.0 \n", "10 AP2211 2022-02-11 09:00:07 7757.0 7757.0 7757.0 7757.0 7757.0 \n", "11 AP2211 2022-02-11 09:00:08 7757.0 7757.0 7757.0 7757.0 7757.0 \n", "12 AP2211 2022-02-11 09:00:09 7757.0 7757.0 7757.0 7757.0 7757.0 \n", "13 AP2211 2022-02-11 09:00:10 7757.0 7757.0 7757.0 7757.0 7757.0 \n", "14 AP2211 2022-02-11 09:00:12 7757.0 7757.0 7757.0 7757.0 7757.0 \n", "15 AP2211 2022-02-11 09:00:13 7757.0 7757.0 7757.0 7757.0 7757.0 \n", "16 AP2211 2022-02-11 09:00:13 7751.0 7751.0 7751.0 7751.0 7751.0 \n", "17 AP2211 2022-02-11 09:00:14 7751.0 7751.0 7751.0 7751.0 7751.0 \n", "18 AP2211 2022-02-11 09:00:15 7751.0 7751.0 7751.0 7751.0 7751.0 \n", "19 AP2211 2022-02-11 09:00:16 7751.0 7751.0 7751.0 7751.0 7751.0 \n", "20 AP2211 2022-02-11 09:00:16 7738.0 7738.0 7738.0 7738.0 7738.0 \n", "21 AP2211 2022-02-11 09:00:17 7730.0 7730.0 7730.0 7730.0 7730.0 \n", "22 AP2211 2022-02-11 09:00:18 7730.0 7730.0 7730.0 7730.0 7730.0 \n", "23 AP2211 2022-02-11 09:00:19 7730.0 7730.0 7730.0 7730.0 7730.0 \n", "24 AP2211 2022-02-11 09:00:20 7730.0 7730.0 7730.0 7730.0 7730.0 \n", "25 AP2211 2022-02-11 09:00:21 7731.0 7731.0 7731.0 7731.0 7731.0 \n", "26 AP2211 2022-02-11 09:00:22 7731.0 7731.0 7731.0 7731.0 7731.0 \n", "27 AP2211 2022-02-11 09:00:22 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "28 AP2211 2022-02-11 09:00:23 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "29 AP2211 2022-02-11 09:00:24 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "30 AP2211 2022-02-11 09:00:25 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "31 AP2211 2022-02-11 09:00:26 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "32 AP2211 2022-02-11 09:00:27 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "33 AP2211 2022-02-11 09:00:29 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "34 AP2211 2022-02-11 09:00:30 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "35 AP2211 2022-02-11 09:00:31 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "36 AP2211 2022-02-11 09:00:32 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "37 AP2211 2022-02-11 09:00:33 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "38 AP2211 2022-02-11 09:00:34 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "39 AP2211 2022-02-11 09:00:35 7725.0 7725.0 7725.0 7725.0 7725.0 \n", "\n", " m_nAccHigh m_nAccLow m_iVolume ... m_nActAskTurnover \\\n", "0 0.0 0.0 0 ... 0.0 \n", "1 7761.0 7761.0 2705 ... 10496752.5 \n", "2 7761.0 7761.0 0 ... 0.0 \n", "3 7761.0 7759.0 1 ... 7761.0 \n", "4 7761.0 7759.0 0 ... 0.0 \n", "5 7761.0 7759.0 0 ... 0.0 \n", "6 7761.0 7759.0 0 ... 0.0 \n", "7 7761.0 7759.0 1 ... 7761.0 \n", "8 7761.0 7759.0 0 ... 0.0 \n", "9 7761.0 7757.0 1 ... 7761.0 \n", "10 7761.0 7757.0 0 ... 0.0 \n", "11 7761.0 7757.0 0 ... 0.0 \n", "12 7761.0 7757.0 0 ... 0.0 \n", "13 7761.0 7757.0 0 ... 0.0 \n", "14 7761.0 7757.0 0 ... 0.0 \n", "15 7761.0 7757.0 0 ... 0.0 \n", "16 7761.0 7751.0 1 ... 7761.0 \n", "17 7761.0 7751.0 0 ... 0.0 \n", "18 7761.0 7751.0 0 ... 0.0 \n", "19 7761.0 7751.0 0 ... 0.0 \n", "20 7761.0 7738.0 1 ... 7761.0 \n", "21 7761.0 7730.0 11 ... 85371.0 \n", "22 7761.0 7730.0 0 ... 0.0 \n", "23 7761.0 7730.0 0 ... 0.0 \n", "24 7761.0 7730.0 0 ... 0.0 \n", "25 7761.0 7730.0 1 ... 7761.0 \n", "26 7761.0 7730.0 0 ... 0.0 \n", "27 7761.0 7725.0 1 ... 7761.0 \n", "28 7761.0 7725.0 0 ... 0.0 \n", "29 7761.0 7725.0 0 ... 0.0 \n", "30 7761.0 7725.0 0 ... 0.0 \n", "31 7761.0 7725.0 0 ... 0.0 \n", "32 7761.0 7725.0 0 ... 0.0 \n", "33 7761.0 7725.0 0 ... 0.0 \n", "34 7761.0 7725.0 0 ... 0.0 \n", "35 7761.0 7725.0 0 ... 0.0 \n", "36 7761.0 7725.0 0 ... 0.0 \n", "37 7761.0 7725.0 0 ... 0.0 \n", "38 7761.0 7725.0 0 ... 0.0 \n", "39 7761.0 7725.0 0 ... 0.0 \n", "\n", " m_nAccActAskTurnover m_nBidOrder m_nAccBidOrder m_nAskOrder \\\n", "0 0.0 0.0 0.0 0.0 \n", "1 10496752.5 1.0 1.0 1.0 \n", "2 10496752.5 1.0 2.0 1.0 \n", "3 10504513.5 1.0 3.0 1.0 \n", "4 10504513.5 1.0 4.0 1.0 \n", "5 10504513.5 1.0 5.0 1.0 \n", "6 10504513.5 1.0 6.0 1.0 \n", "7 10512274.5 1.0 7.0 1.0 \n", "8 10512274.5 1.0 8.0 1.0 \n", "9 10520035.5 1.0 9.0 1.0 \n", "10 10520035.5 1.0 10.0 1.0 \n", "11 10520035.5 1.0 11.0 1.0 \n", "12 10520035.5 1.0 12.0 1.0 \n", "13 10520035.5 1.0 13.0 1.0 \n", "14 10520035.5 1.0 14.0 1.0 \n", "15 10520035.5 1.0 15.0 1.0 \n", "16 10527796.5 1.0 16.0 1.0 \n", "17 10527796.5 1.0 17.0 1.0 \n", "18 10527796.5 2.0 19.0 1.0 \n", "19 10527796.5 10.0 29.0 1.0 \n", "20 10535557.5 9.0 38.0 1.0 \n", "21 10620928.5 1.0 39.0 1.0 \n", "22 10620928.5 1.0 40.0 1.0 \n", "23 10620928.5 1.0 41.0 1.0 \n", "24 10620928.5 1.0 42.0 1.0 \n", "25 10628689.5 1.0 43.0 1.0 \n", "26 10628689.5 1.0 44.0 1.0 \n", "27 10636450.5 1.0 45.0 1.0 \n", "28 10636450.5 1.0 46.0 1.0 \n", "29 10636450.5 1.0 47.0 1.0 \n", "30 10636450.5 1.0 48.0 1.0 \n", "31 10636450.5 1.0 49.0 1.0 \n", "32 10636450.5 1.0 50.0 1.0 \n", "33 10636450.5 1.0 51.0 1.0 \n", "34 10636450.5 1.0 52.0 1.0 \n", "35 10636450.5 1.0 53.0 1.0 \n", "36 10636450.5 1.0 54.0 1.0 \n", "37 10636450.5 1.0 55.0 1.0 \n", "38 10636450.5 1.0 56.0 1.0 \n", "39 10636450.5 1.0 57.0 1.0 \n", "\n", " m_nAccAskOrder m_nABOrderRate m_nAccABOrderRate m_nMItemsVolRate \\\n", "0 0.0 0.0 0.000000 0.0 \n", "1 1.0 1.0 1.000000 0.0 \n", "2 2.0 1.0 1.000000 0.0 \n", "3 3.0 1.0 1.000000 0.0 \n", "4 4.0 1.0 1.000000 0.0 \n", "5 5.0 1.0 1.000000 0.0 \n", "6 6.0 1.0 1.000000 0.0 \n", "7 7.0 1.0 1.000000 0.0 \n", "8 8.0 1.0 1.000000 0.0 \n", "9 9.0 1.0 1.000000 0.0 \n", "10 10.0 1.0 1.000000 0.0 \n", "11 11.0 1.0 1.000000 0.0 \n", "12 12.0 1.0 1.000000 0.0 \n", "13 13.0 1.0 1.000000 0.0 \n", "14 14.0 1.0 1.000000 0.0 \n", "15 15.0 1.0 1.000000 0.0 \n", "16 16.0 1.0 1.000000 0.0 \n", "17 17.0 1.0 1.000000 0.0 \n", "18 18.0 2.0 1.055556 0.0 \n", "19 19.0 10.0 1.526316 0.0 \n", "20 20.0 9.0 1.900000 0.0 \n", "21 21.0 1.0 1.857143 0.0 \n", "22 22.0 1.0 1.818182 0.0 \n", "23 23.0 1.0 1.782609 0.0 \n", "24 24.0 1.0 1.750000 0.0 \n", "25 25.0 1.0 1.720000 0.0 \n", "26 26.0 1.0 1.692308 0.0 \n", "27 27.0 1.0 1.666667 0.0 \n", "28 28.0 1.0 1.642857 0.0 \n", "29 29.0 1.0 1.620690 0.0 \n", "30 30.0 1.0 1.600000 0.0 \n", "31 31.0 1.0 1.580645 0.0 \n", "32 32.0 1.0 1.562500 0.0 \n", "33 33.0 1.0 1.545455 0.0 \n", "34 34.0 1.0 1.529412 0.0 \n", "35 35.0 1.0 1.514286 0.0 \n", "36 36.0 1.0 1.500000 0.0 \n", "37 37.0 1.0 1.486486 0.0 \n", "38 38.0 1.0 1.473684 0.0 \n", "39 39.0 1.0 1.461538 0.0 \n", "\n", " code_init \n", "0 AP \n", "1 AP \n", "2 AP \n", "3 AP \n", "4 AP \n", "5 AP \n", "6 AP \n", "7 AP \n", "8 AP \n", "9 AP \n", "10 AP \n", "11 AP \n", "12 AP \n", "13 AP \n", "14 AP \n", "15 AP \n", "16 AP \n", "17 AP \n", "18 AP \n", "19 AP \n", "20 AP \n", "21 AP \n", "22 AP \n", "23 AP \n", "24 AP \n", "25 AP \n", "26 AP \n", "27 AP \n", "28 AP \n", "29 AP \n", "30 AP \n", "31 AP \n", "32 AP \n", "33 AP \n", "34 AP \n", "35 AP \n", "36 AP \n", "37 AP \n", "38 AP \n", "39 AP \n", "\n", "[40 rows x 38 columns]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = sess.run(\"\"\"select top 40 * from pt\"\"\")\n", "df" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3.8.9 64-bit", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.6" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6" } } }, "nbformat": 4, "nbformat_minor": 2 }