From 6cc78f9b049449acb4e8c6ec46e9a95adc879449 Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Thu, 28 Dec 2023 22:06:19 +0800 Subject: [PATCH] 0.1.68 --- PyPI/setup.cfg | 2 +- PyPI/src/guan.egg-info/PKG-INFO | 2 +- PyPI/src/guan/others.py | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index d48f55b..432b1ab 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.67 +version = 0.1.68 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index 2c9ce1d..efd3f23 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: guan -Version: 0.1.67 +Version: 0.1.68 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/others.py b/PyPI/src/guan/others.py index c97d880..5145e81 100644 --- a/PyPI/src/guan/others.py +++ b/PyPI/src/guan/others.py @@ -253,7 +253,7 @@ def stock_symbols_classification(): find_400 = re.findall(r'^400', stock_symbol) if find_82 != [] or find_83 != [] or find_87 != [] or find_88 != [] or find_430 != [] or find_420 != [] or find_400 != []: stock_symbols_8_4.append(stock_symbol) - # 检查其他遗漏的股票代码 + # 检查遗漏的股票代码 stock_symbols_others = [] for stock_symbol in stock_symbols: if stock_symbol not in stock_symbols_60 and stock_symbol not in stock_symbols_00 and stock_symbol not in stock_symbols_30 and stock_symbol not in stock_symbols_68 and stock_symbol not in stock_symbols_8_4: @@ -283,6 +283,22 @@ def find_stock_name_from_symbol(symbol='000002'): stock_name = stock[2] return stock_name +# 市值排序 +@guan.statistics_decorator +def sorted_market_capitalization(num=10): + import numpy as np + import guan + title, stock_data = guan.all_stocks() + list_index = np.argsort(stock_data[:, 17]) + list_index = list_index[::-1] + sorted_array = [] + for i0 in range(num): + stock_symbol = stock_data[list_index[i0], 1] + stock_name = stock_data[list_index[i0], 2] + market_capitalization = stock_data[list_index[i0], 17]/1e8 + sorted_array.append([i0+1, stock_symbol, stock_name, market_capitalization]) + return sorted_array + # 获取单个股票的历史数据 @guan.statistics_decorator def history_data_of_one_stock(symbol='000002', period='daily', start_date="19000101", end_date='21000101'):