import json
import pandas as pd


# 导入常用的固定路径(多平台通用)
from kw618._file_path import *
# 本脚本依赖很多 utils_requests的函数和模块, 直接用*  (注意要避免循环导入问题)
from kw618.k_requests.utils_requests import *
from kw618.k_requests.ocr import *
from kw618.k_python.utils_python import *
from kw618.k_pandas.utils_pandas import *

req = myRequest().req
client = pymongo.MongoClient(f'mongodb://kerwin:kw618@{HOST}:27017/')
db_for_quant = client["quant"]




# [tips]: 仅挑选需要的'field'即可
    # [注意]: 这里的 field 对应关系仅用于: 多股列表中获取最新数据 (个股的详细数据中,field的对应关系就不是这样了)
    # 两种change_name_dic:
        # 1. /api/qt/ulist/sse: "多股列表"接口
        # 2. /api/qt/stock/get: "个股详情"接口
ulist_change_name_dict = {
    "f2":"最新股价(分)",
    "f3":"涨跌幅(万分制)",
    "f4":"涨跌额(分)",
    "f5":"成交总手(手)",
    "f6":"成交总额(元)",
    "f7":"振幅(万分制)",
    "f8":"换手率(万分制)",
    "f9":"市盈率(百分制)",
    "f10":"量比(百分制)",
    "f12":"Zqdm",
    "f13":"SecSe", # 0:深市; 1:上市; 116:香港; 105:纳斯达克; 90:板块; 106:NYSE; 119:外汇;
    "f14":"Zqmc",
    "f15":"最高股价(分)",
    "f16":"最低股价(分)",
    "f18":"昨收股价(分)",
    "f22":"涨速(万分制)",
    "f26":"上市日期",
    "f30":"当前手(正负+手)",
    "f31":"买一价(分)",
    "f32":"卖一价(分)",

    "f38":"总股本(股)",
    "f39":"流通股本(股)",
    "f40":"营业收入(元)",
    "f41":"营业收入同比(百分制)",
    "f42":"营业利润(元)",
    "f44":"利润总额(元)",
    "f45":"净利润(元)", # 营业收入>营业利润>利润总额>净利润
    "f46":"净利润同比(百分制)",
    "f49":"毛利率(百分制)",

    "f50":"总资产(元)",
    "f51":"流动资产(元)",
    "f52":"固定资产(元)",
    "f53":"无形资产(元)",
    "f54":"总负债(元)",
    "f55":"流动负债(元)",
    "f56":"长期负债(元)",
    "f57":"资产负债比率(百分制)",

    "f100":"行业板块",
    "f102":"区域板块",
    "f103":"概念板块",
    "f112":"每股收益(元)",
    "f113":"每股净资产(元)",
}





















def main():
    pass


if __name__ == '__main__':
    print("Start test!\n\n")
    main()
    print("\n\n\nIt's over!")
