This article only briefly explains the structure, please see “[earnings website (open source) server ~ detailed article] server (Springboot)” for details.
Mysql, redis, nginx, etc., are not installed locally, directly use virtual machine, virtual machine only simple installation: mysql, Redis, nginx, Tomcat, Python and some matching.
If a cloud server is available, you can use your own cloud server or install VMS by yourself. Do not want to torment can download and install an Orcale VM VirtualBox manager, directly into the system notes of the VIRTUAL machine directly used.
This chapter focuses on some simple functions of SpringBoot. Please see “[Earnings Website (Open Source) Notes iv] Server Virtual Machine” for the server.
The interface provided by the server
The following figure shows the interfaces. Clone server code from Github and run the server at localhost:8082/doc.html to view detailed documentation and debug directly online. See swapper2 for more information.
1. Get listed company details (StockInfoController.java)
Basic Concepts:
— Details: TS code, stock code, stock name, region, industry, listing date, latest earnings date, latest earnings date
— Basic information: stock code, stock name, industry
Q: Why are there “details” and “basic information”?
A: Because the front end displays the dropdown box for all stocks, select the dropdown box for a company to display its details. But the front end pulls back all the stock information, too big. Therefore, the front end only needs to get the basic information of all stocks, and when a company is selected in the drop-down box, it requests the detailed information of the company.
Q: Why are there “last reporting date” and “latest reporting date” in the “details”? (These two times are not available in Python direct PA, but are inserted into the database when Python analyzes the reports of each company. For details, please see “[earnings website (open source) Note 1] Python to obtain the financial statements of A-share listed companies and write them into the database”.
Answer: 1, the oldest financial report ~ because some listed company financial record is not from the listing to the most recent, but the lack of some. Such as:
The stock of Time to market Start time of financial statement Ping an bank 1991-04-03 2004-12-31(2004Q4) China vanke 1991-01-29 2005-12-31(2005Q4) 2. Time of the latest financial report ~ Because the time of the latest quarterly report of each listed company is inconsistent: For example, now (2020/014/17) “Feiyada” company has had 2021Q1 financial report, the company needs to have the option of 2021 on the website page. Most companies haven’t reported Q1 yet and don’t show 2021 options.
1.1, /stock/all(obsolete)
Get all listed company details: the initial version is too large and takes too long. Discarded after reconstruction.
Reconstruction: Python generated a TXT file for the front-end use, including the basic information of all listed companies: stock symbol, name, industry (interface display and request, such as: 000001.sz, Ping an Bank, bank). Note 1: Python to obtain a-share listed companies’ financial statements and write them into the database
(2021/04/17) Continue refactoring points:
1) Python generated TXT files can be removed from the stock symbol, reduce the size of TXT?
2), without TXT files, directly provided by the server interface, support the name of these listed companies, industry. And get the details from the getStockByName interface, okay?
1.2, / stock/getStockByCode
Obtain detailed information of listed companies through stock symbol: the front-end uses stock symbol to obtain detailed information of a single listed company through this interface.
1.3, / stock/getStockByName
Obtain detailed information of listed companies by stock name: The front-end obtains detailed information of a single listed company through this interface using the stock name.
Ii. Project structure and logic
1, structure,
The following figure is the project structure, in which the SQL directory is not required for the operation of the project. Most of the database of the project is created and generated by Python (see the system note “[Earnings Website (Open Source) Note 1] Python obtains the financial statements of A-share listed companies and writes them into the database”). There are not enough SQL statements to build the warehouse, so it is put here.
Generate documents using Swapper2. See main POM.xml for the configuration
Connect to the database using Mybatis. See main POM.xml for the configuration
Mybatis reverse (Github source), can directly use this series of open source code generation, key points:
1. Reverse configuration XML file, each table needs one, but the income statement, balance sheet and cash flow statement each have more than 4000 tables, but the structure of all tables in each library is the same, so each library of these three libraries only needs one table: BalanceGeneratorConfig. XML, cashGeneratorConfig. XML, incomeGeneratorConfig. XML. The tables in each table only need to be linked to any table in the library.
2. Before running the reverse project, you must modify the jdbcConnection content to connect to your own database. If the project structure changes, it needs to be personalized accordingly. Please refer to the source code for details.
To be continued…
1, many stocks PK need to land
Client request multiple stock PK information, section detection login? Detect user level? Decide to return the result.