Electricity selling customer cost prediction and cost back-testing method and system

By using data interfaces and algorithmic processing within the internet system, the problems of data fragmentation and excessive manual operation in the electricity sales business have been solved. This has enabled the automation and high reliability of cost prediction and cost backtesting for electricity sales customers, improving calculation efficiency and result consistency.

CN121883079APending Publication Date: 2026-04-17SHENZHEN HIGGS TECHNOLOGY SERVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN HIGGS TECHNOLOGY SERVICE CO LTD
Filing Date
2026-01-10
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In the current electricity sales business, customer cost forecasting and cost backtesting rely on spreadsheet tools, resulting in scattered data, many manual operation steps, and difficulty in unifying calculation logic. This makes it difficult to form a reusable, auditable, and traceable technical system. Especially when the number of customers increases and electricity price rules are frequently adjusted, the calculation process is inefficient and the results are inconsistent.

Method used

By constructing a method and system for predicting and backtesting electricity sales costs based on an internet system, and by adopting login authentication, data interface calls, prediction processing and backtesting processing steps, combined with a database and cloud computing platform, centralized data management and algorithmic calculation are achieved, forming a systematic, standardized and automated process.

Benefits of technology

It has achieved automation and high reliability in cost forecasting and cost backtesting for electricity sales customers, improved calculation efficiency, ensured the consistency of results and data security, and reduced the probability of errors introduced by manual operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121883079A_ABST
    Figure CN121883079A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of electricity selling service informatization, and provides an electricity selling customer cost prediction and cost back-testing method and system. A fixed execution process is formed through login authentication, data interface calling, algorithm calculation and result output, power consumption data, electricity price data, transaction data and settlement data are managed in a centralized mode, cost prediction and historical back-test calculation are completed based on a unified algorithm rule, unification of prediction and back-test in the aspects of data sources, calculation logic and result structures is achieved, and the prediction and back-test efficiency is improved. A manual spreadsheet calculation mode is replaced, and the measurement consistency and reproducibility are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electricity market informatization and digital electricity sales technology, specifically to a method and system for predicting and backtesting electricity sales customer costs based on an internet system. In particular, it relates to the centralized management of electricity consumption data, electricity price data, transaction data and settlement data of electricity sales customers, and the automatic calculation of customer profits and losses based on predefined prediction and backtesting algorithms. Background Technology

[0002] In current electricity sales practices, electricity sales companies commonly use spreadsheet tools to predict and backtest customer profits. This method typically involves pre-setting numerous calculation formulas in the spreadsheet, and then manually filling in customer contract information, time-of-use electricity data, electricity transaction data, and settlement results to obtain the prediction or backtesting conclusions.

[0003] When faced with an increase in the number of customers, a longer time span, and frequent adjustments to electricity pricing rules, this method requires repeated copying of tables, manual verification of data sources, and manual prevention of formulas being erroneously modified. Its calculation process is highly dependent on human experience, making it difficult to form a reusable, auditable, and traceable technical system. Summary of the Invention

[0004] The purpose of this invention is to provide a technical solution for cost prediction and cost backtesting for electricity sales customers based on an Internet system. Through systematic data management, algorithmic calculation models and secure communication mechanisms, it realizes the automation, standardization and high reliability of profit and loss calculation for electricity sales customers.

[0005] A method for predicting and backtesting costs for electricity customers includes: The login authentication process involves receiving the user's submitted account and password information, performing JWT-based identity authentication on the account and password information, and returning the user information and permission information corresponding to the user when the authentication is successful, allowing the user to enter the system. The data interface call steps are as follows: After the user enters the system, according to the user's business operation request, the data interface corresponding to the cost prediction or cost backtesting of the electricity sales customer is called to obtain the electricity consumption data, electricity price data, transaction data, settlement data and customer basic information data that match the business operation request from the database. The prediction processing steps are as follows: when a user selects to perform cost prediction, the user enters the cost prediction module, fills in the corresponding prediction parameters according to the business situation of the target customer, and calls the cost prediction algorithm to calculate and process the prediction parameters, electricity consumption data, electricity price data and transaction data to obtain the predicted cost result of the target customer. The backtesting process involves the following steps: When a user selects to perform a cost backtest, the system enters the cost backtesting module, receives the target customer selected by the user and the corresponding query month and year, and calls the cost backtesting algorithm to calculate and process the historical electricity consumption data, electricity price data and transaction data of the target customer in the query month and year to obtain the backtesting profit and loss result of the target customer. The results output step outputs and displays the predicted cost results or the backtesting profit and loss results to the user.

[0006] Furthermore, in the login authentication step, the JWT authentication includes generating a user identity token and verifying user access permissions based on the identity token in subsequent business requests.

[0007] Furthermore, in the data interface call step, electricity consumption data, electricity price data, transaction data, and settlement data corresponding to the target customer are obtained from the database through nested SQL queries.

[0008] Furthermore, in the prediction processing step, the cost prediction algorithm constructs a set of price parameters based on the target customer's filing price, execution price, comprehensive market price, and corresponding proportional parameters, and performs weighted calculations on the set of price parameters to generate benchmark price parameters for subsequent cost calculations.

[0009] Furthermore, in the prediction processing step, the cost prediction algorithm divides the target customer's electricity consumption ratio into peak, off-peak, and valley periods, and calculates the corresponding medium- and long-term costs and daily costs for each period based on the medium- and long-term transaction electricity price and the daytime transaction electricity price, respectively. The costs of each period are then integrated to obtain the transaction cost price.

[0010] Furthermore, in the backtesting process, the cost backtesting algorithm calculates the monthly time-period medium-to-long-term curve ratio based on the customer's monthly electricity consumption and monthly time-period electricity consumption, and maps the curve ratio to the corresponding time period to determine the customer's medium-to-long-term electricity distribution in each time period.

[0011] Furthermore, in the backtesting process, the cost backtesting algorithm calculates the profit and loss results of the target customer based on the difference between the predicted execution price and the actual settlement weighted price, combined with the customer's electricity consumption in the corresponding period. In the result output step, the predicted cost results or backtesting profit and loss results are displayed in the user interface in the form of tables or graphs.

[0012] A system for predicting and backtesting costs for electricity customers, comprising: The login authentication module is used to receive the account and password information submitted by the user, and to authenticate the user's identity based on JWT. After successful authentication, it returns user information and permission information to the user. The data management module is used to store electricity consumption data, electricity price data, transaction data, settlement data, and basic customer information data of electricity sales customers; The data interface module, connected to the data management module, is used to provide data matching the user's business operation request to the cost prediction module or cost backtesting module. The cost prediction module, connected to the data interface module, is used to call the cost prediction algorithm based on the prediction parameters of the target customer when the user selects to perform cost prediction, and to calculate and process the electricity consumption data, electricity price data and transaction data to generate the predicted cost result. The cost backtesting module, connected to the data interface module, is used to call the cost backtesting algorithm based on the target customer and query month and year selected by the user when the user selects to perform cost backtesting, calculate and process historical electricity consumption data, electricity price data and transaction data, and generate backtesting profit and loss results. The results output module is connected to the cost prediction module and the cost backtesting module, and is used to output and display the predicted cost results or backtesting profit and loss results to the user.

[0013] Furthermore, the login authentication module uses a combination of Spring Security and JWT to implement user authentication and access control; The data management module includes a relational database for storing electricity consumption data, electricity price data, transaction data, settlement data, and basic customer information data of electricity sales customers; The data management module also includes a non-relational database for caching frequently accessed data; The data interface module provides data retrieval services to the cost prediction module and the cost backtesting module via the HTTP protocol; The data interface module employs SSL or TLS encryption during data transmission.

[0014] Furthermore, the cost prediction module and the cost backtesting module each include an algorithm execution unit, which is configured to aggregate multi-source business data from the data interface module and output calculation results according to predefined algorithm rules; The algorithm execution unit obtains the data parameters required for calculation through the data interface module, and transmits the results to the result output module after completing the algorithm calculation.

[0015] The beneficial effects of this invention are: To address the problems of data fragmentation, numerous manual steps, and inconsistent calculation logic in existing technologies that use spreadsheet tools for predicting and backtesting electricity sales customer costs, this invention provides a holistic solution to these issues from a technical process perspective by constructing a method for predicting and backtesting electricity sales customer costs. Specifically, this invention: By setting up login authentication steps, the cost prediction and cost backtesting methods for electricity customers have clear user identity and access control at the entry stage, technically avoiding the problem of spreadsheet files being arbitrarily modified in scenarios with multiple users. This invention, through setting up data interface call steps, centrally acquires and inputs electricity consumption data, electricity price data, transaction data, settlement data, and customer basic information into a unified calculation process, technically replacing the manual operation of copying and verifying data between multiple spreadsheets.

[0016] By setting up prediction and backtesting steps, cost prediction and cost backtesting are limited to calculation processes executed by cost prediction and cost backtesting algorithms. This transforms the cost prediction and cost backtesting methods for electricity sales customers from manually driven static table calculations to algorithm-driven dynamic calculation processes, thereby ensuring the consistency of calculation logic for different customers and under different time conditions.

[0017] By setting up result output steps, the predicted cost results or backtesting profit and loss results are output in a unified manner, enabling the cost prediction and cost backtesting methods for electricity sales customers to form a complete closed-loop process from data acquisition and algorithm calculation to result output. This solves the problems of fragmented calculation processes, frequent repetitive operations, and difficulty in reproducing calculation results in the background technologies from a technical implementation perspective. Attached Figure Description

[0018] Figure 1 This is a schematic diagram of the prediction process for existing technologies.

[0019] Figure 2 This is a schematic diagram of the backtesting process for existing technologies.

[0020] Figure 3 This is a schematic block diagram illustrating one working process of the present invention.

[0021] Figure 4 This is a schematic flowchart of the method steps of the present invention. Detailed Implementation

[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. It is understood that the accompanying drawings are provided for reference and illustration only, and are not intended to limit the present invention. The connection relationships shown in the accompanying drawings are only for clear description and do not limit the connection method.

[0023] In related technologies, with the advancement of power market reform, the electricity sales business needs to process electricity consumption data, electricity price data, transaction data, and settlement data, which are characterized by large data volume, multiple sources, and long time spans. In the existing electricity sales business, customer cost forecasting and cost backtesting are mostly completed using spreadsheet tools, and the data is usually stored in different files, lacking a unified data management and computing environment.

[0024] In spreadsheet format, business personnel need to manually compile basic customer information, time-of-use electricity data, electricity price data, and transaction and settlement data, and then complete cost forecasting and historical backtesting by setting calculation formulas in the spreadsheet. This method is usable when the data scale is small, but as the number of customers increases and the data dimensions expand, spreadsheets cannot handle continuous and stable data processing tasks, and the manual operation steps are numerous, making it difficult to ensure data consistency and uniformity of calculation rules.

[0025] With the development of internet data services, centralized management of business data based on database and cloud database services has become a common technical approach for large-scale data processing. By aggregating scattered data resources into a unified database environment and running computing programs in the cloud, high-frequency computing and centralized analysis can be achieved while ensuring data consistency. Simultaneously, cloud computing software and cloud-integrated application runtime support platform software provide a unified operating environment for complex business systems, enabling business logic to be provided externally as a service.

[0026] Furthermore, in the electricity sales business scenario, by performing structured analysis on historical electricity consumption data, electricity price data, and transaction data, it is possible to reconstruct the customer's historical transaction structure and calculate profit and loss results. This process exhibits typical characteristics of data analysis and data mining software applications. By modeling, splitting, and fusing data, meaningful analytical results can be extracted from a large amount of business data, providing support for electricity sales business decisions.

[0027] Therefore, how to build a stable cloud computing software platform in the Internet environment, combining databases and cloud database services, to centrally manage and analyze electricity sales data and achieve systematic processing of customer cost prediction and cost backtesting, has become a technical problem that needs to be solved in the informatization development of electricity sales.

[0028] In detail, such as Figure 1 The diagram illustrates a current-era process for forecasting customer costs or revenues, typically completed manually using spreadsheet tools. The overall process follows a linear, sequential structure. Specifically, the forecasting process begins by manually creating a new spreadsheet file, pre-planning the location and structure of various data tables. Next, pre-defined data items are entered into the spreadsheet, including electricity price parameters, ratio parameters, and basic variables used for subsequent calculations. After filling in the pre-defined data, calculation formulas are written one by one in the corresponding cells to express the logical expression of cost or revenue calculations. Once the formulas are written, the customer's corresponding electricity consumption data, electricity consumption data, and related business data are then manually entered into the spreadsheet. Finally, the spreadsheet automatically calculates and outputs the forecast results using the formulas. Figure 1 As can be seen from the process shown, the prediction process is highly dependent on manual operation. Data positioning, data filling and formula writing are all completed in a spreadsheet environment. Obtaining the prediction result requires completing multiple manual steps in sequence, and there is a strong sequential dependency between the processes.

[0029] The above process constitutes a typical implementation path for predictive calculations based on spreadsheets in the existing technology.

[0030] like Figure 2 The diagram illustrates a backtesting process for customer costs or profits / losses in existing technologies. While also based on spreadsheet tools, this process is more complex than forecasting and typically employs a multi-sub-spreadsheet collaborative calculation approach. Specifically, this backtesting process first requires manually creating a new spreadsheet file and then creating multiple sub-spreadsheets within it to store different types of business data. Some sub-spreadsheets import customer electricity consumption data by year, month, day, and hour; others import monthly wholesale electricity purchase cost data; still others import basic customer information and customer rebate-related data. After importing the data into each sub-spreadsheet, the multi-source data needs to be correlated within the spreadsheet, and calculation formulas need to be written in the corresponding cells according to various business rules. These formulas calculate both the customer's electricity costs and the electricity seller's purchase costs. Finally, based on the difference between electricity costs and purchase costs, the customer's profit / loss result for the corresponding period is obtained. Figure 2As can be seen from the process shown, the backtesting process in the existing technology relies on the data association between multiple sub-tables. The calculation formulas are scattered in different tables and cells. The overall backtesting process requires data import, formula configuration and multiple rounds of manual verification in sequence before the backtesting results can be obtained.

[0031] The above process constitutes a typical implementation path for customer cost backtesting based on spreadsheets in the existing technology.

[0032] Therefore, embodiments of this application provide a method and system for cost prediction and cost backtesting of electricity sales customers based on an Internet environment. This relates to the field of information processing technology for electricity sales business, and belongs to the Internet data service technology direction of using databases and cloud computing platforms to centrally process and analyze business data. It also involves the technical implementation of cloud computing software and cloud-integrated application operation support platform software.

[0033] like Figure 3 and Figure 4 As shown, this case constructs an overall process for cost prediction and cost backtesting for electricity sales customers based on an Internet system. The process takes a unified system login and identity authentication as the entry point, and after successful authentication, it enters the prediction process or backtesting process through interface calls to realize automated calculation under different business scenarios.

[0034] Specifically, the system first provides a login portal, where users initiate a login request using their username and password. After the login request is submitted, the system performs JWT authentication on the user's identity information; if authentication fails, the process returns to the login system for re-verification; if authentication succeeds, the system returns the user's corresponding user information and permission information, and allows the user to access internal system modules.

[0035] After completing identity authentication and entering the system, the system calls either the prediction-related data interface or the backtesting-related data interface according to the user's operation request. When the user selects to perform cost prediction, the system enters the prediction module and obtains the basic data related to the prediction through the data interface; then, according to the customer's specific situation, the corresponding prediction parameters and prediction data are filled into the prediction module; after the prediction data preparation is completed, the system automatically calls the prediction algorithm module to calculate and process the prediction data, and finally outputs the customer's estimated cost result.

[0036] When a user selects to perform cost backtesting, the system enters the backtesting module and obtains historical data related to the backtesting through the data interface. In the backtesting module, the user selects the customer to be backtested and the corresponding query month and year. After completing the selection of the customer and time dimension, the system automatically calls the backtesting algorithm module to calculate and process the actual electricity consumption data, electricity price data and transaction data of the selected customer in the selected month and year, and finally outputs the customer's profit and loss results in the corresponding period.

[0037] from Figure 3 As can be seen from the process shown, this case controls system access through a unified login authentication process, and divides the prediction module and backtesting module in a modular way within the system. Each module works together with the algorithm module through data interfaces, so that the cost prediction and cost backtesting processes can be completed under the same system architecture, forming a clear, controllable and scalable business processing flow.

[0038] The above process constitutes the overall execution path for this case to achieve cost prediction and cost backtesting for electricity sales customers based on a systematic, interface-based, and algorithmic approach.

[0039] In detail: This invention constructs a cost prediction and cost backtesting system for electricity sales. The system uses account and password login and employs a security authentication mechanism combining Spring Security and JWT to verify user identity, preventing unauthorized access and data tampering from the source.

[0040] After login authentication, the system manages customer electricity consumption data, electricity price data, electricity transaction data, electricity settlement data, and customer contract data under the business data management module. This data is imported into the system in spreadsheet format using Poi technology and written to a MySQL relational database. High-frequency access data is cached in a Redis non-relational database to improve query and calculation efficiency.

[0041] Cost prediction and cost backtesting algorithms are predefined in the system backend. These algorithms are not static tabular formulas, but rather executable computational logic that can automatically obtain the required parameters through nested SQL queries and dynamically complete calculations based on the business characteristics of different customers and time periods.

[0042] When the customer enters the cost forecasting interface, the system automatically calls the data interface and, based on the customer's contract information and estimated annual electricity consumption, retrieves the corresponding registered electricity price, market comprehensive price, transaction ratio, and peak-valley electricity consumption ratio parameters through nested SQL queries. The system then calls the cost forecasting algorithm module to perform aggregate calculations on the above parameters and outputs the registered weighted average price, the execution price after rebate, transaction profit and loss, peak-valley arbitrage, and total profit and loss price for the customer's annual period.

[0043] The core calculation formula for detailed cost forecasting is as follows: Satisfying formula (1): ; Satisfying formula (2): ; Satisfying formulas (3) to (8): ; ; ; ; ; ; Satisfying formula (9): ; Satisfying formulas (10) and (11): The computer implementation mechanism of the cost backtesting method is as follows: After entering the customer cost backtesting interface, the system retrieves a list of all electricity sales customers based on the customer query interface. After selecting a specific customer and the corresponding month and year, the system automatically retrieves the backtesting algorithm. This algorithm is based on the customer's actual electricity consumption data and settlement data, and through time period segmentation and proportional mapping, it reconstructs the customer's actual costs and profits / losses under different transaction structures for the current month.

[0044] The key calculation relationships for cost backtesting are as follows: Satisfying formula (12): ; Satisfying formula (13): ; Satisfying formula (14): ; Satisfying formulas (15) to (17): Satisfying formula (15): ; Satisfying formula (16): ; Satisfying formula (17): ; Supplement the profit and loss calculation relationship to satisfy formula (18): Satisfying formula (18): ; Among them, monthly profit and loss This represents the customer's final profit or loss result within a certain settlement period, and the actual settlement weighted average price. The predicted execution price is calculated from the settlement data. The customer's monthly electricity consumption is derived from the prediction algorithm output. .

[0045] Through the above technical solution, the present invention transforms the original process of calculating the profit and loss of electricity sales customers, which relied on manual spreadsheet operations, into a systematic calculation process based on a unified data model and algorithm model. This enables cost prediction and cost backtesting to be completed automatically within a unified platform, significantly improving calculation efficiency, result consistency, and data security, while reducing the probability of errors introduced by manual operation.

[0046] The following detailed description, using specific embodiments, illustrates the method and implementation process of a cost prediction and backtesting system for electricity sales customers. This embodiment is intended to demonstrate the feasibility of the technical solution and is not intended to limit the scope of protection.

[0047] The electricity customer cost forecasting and backtesting system operates in an internet-based computer system environment. This environment includes server equipment and user terminal equipment. The server equipment is used to deploy the backend program, and the user terminal equipment is used to access the backend program through a browser or client.

[0048] A server device internally includes at least a processor, memory, and a network interface. The processor executes program instructions, the memory stores program code and business data, and the network interface is used for data communication with user terminal devices. The user terminal device establishes a communication connection with the server device through the network interface.

[0049] The electricity sales customer cost forecasting and cost backtesting system includes a login authentication module, a data management module, a data interface module, a cost forecasting module, a cost backtesting module, and a results output module.

[0050] The login authentication module receives the account and password information submitted by the user. This information is entered by the user's terminal device and sent to the server device via the network.

[0051] The login authentication module performs JWT-based identity authentication on the account and password information. This JWT-based authentication process includes generating a user identity token. The user identity token contains user identification information and permission identification information. Upon successful authentication, the login authentication module returns user information and permission information, allowing the user to access the electricity customer cost prediction and backtesting system. Upon authentication failure, the login authentication module denies the user access to the electricity customer cost prediction and backtesting system.

[0052] The data management module stores electricity consumption data, electricity price data, transaction data, settlement data, and customer basic information data. The module includes both relational and non-relational databases. The relational database stores structured business data, including customer basic information, electricity price data, transaction data, and settlement data. The non-relational database caches frequently accessed data, including recently queried electricity consumption data and recently queried electricity price data. The relational database can be MySQL, and the non-relational database can be Redis.

[0053] The data interface module retrieves electricity consumption, electricity price, transaction, and settlement data from the data management module based on user-initiated business operation requests. This data is relevant to the electricity customer cost forecasting or cost backtesting business. The data interface module provides data retrieval services to the cost forecasting and cost backtesting modules via the HTTP protocol. During data transmission, the data interface module employs SSL or TLS encryption to ensure data security. When performing data retrieval operations, the data interface module reads the corresponding data records for the target electricity customer from the relational database using nested SQL queries.

[0054] The cost forecasting module is used to call the cost forecasting algorithm based on the forecasting parameters when the user selects to perform the electricity sales customer cost forecasting service. It performs calculations on electricity consumption data, electricity price data, and transaction data to generate the predicted cost results.

[0055] The forecasting parameters include the filing price, the execution price, the comprehensive market price, and proportional parameters. The proportional parameters include peak-period proportional parameters, off-peak proportional parameters, and valley-period proportional parameters. The cost forecasting algorithm first constructs a set of price parameters based on the filing price, the execution price, the comprehensive market price, and the proportional parameters. This set of price parameters is used to uniformly manage price data from different sources. The cost forecasting algorithm performs a weighted calculation on the set of price parameters to generate benchmark price parameters. These benchmark price parameters serve as the basic input for subsequent cost calculations. The cost forecasting algorithm divides electricity consumption into peak, off-peak, and valley periods. Based on medium- and long-term trading electricity prices and daytime trading electricity prices, the algorithm calculates peak-period, off-peak, and valley-period costs, respectively. The algorithm then performs a fusion operation on these costs to obtain the transaction cost price. The cost forecasting module calculates the difference between the transaction cost price and the execution price to obtain the predicted cost result.

[0056] The cost backtesting module is used when a user selects to perform cost backtesting for an electricity sales customer. Based on the target electricity sales customer and the target query month and year, it invokes the cost backtesting algorithm to perform calculations on historical electricity consumption data, electricity price data, and transaction data, generating backtesting profit and loss results. The cost backtesting algorithm calculates the monthly time-period medium-to-long-term curve ratio based on the customer's monthly electricity consumption and monthly time-period electricity consumption. The monthly time-period medium-to-long-term curve ratio describes the customer's electricity consumption distribution across different time periods. The cost backtesting algorithm maps the monthly time-period medium-to-long-term curve ratio to peak, off-peak, and valley periods to determine the medium-to-long-term electricity distribution for each period. Based on the difference between the predicted execution price and the actual settlement weighted price, and combined with the customer's electricity consumption within the target query month and year, the cost backtesting algorithm calculates the profit and loss results for the target electricity sales customer.

[0057] The results output module outputs the predicted cost results or backtesting profit and loss results. The results output module displays the predicted cost results or backtesting profit and loss results through a user interface. The display methods include tables and graphs. Tables are used to display specific numerical values, while graphs are used to display trend changes.

[0058] The method for predicting and backtesting electricity sales customer costs includes login authentication steps, data interface call steps, prediction processing steps, backtesting processing steps, and result output steps.

[0059] During the login authentication process, users enter their account and password information through their user terminal device. The login authentication module performs JWT-based identity authentication processing on the account and password information. Upon successful identity authentication, the user enters the electricity sales customer cost prediction and cost backtesting system.

[0060] In the data interface call step, the user initiates a business operation request. Based on the business operation request, the data interface module retrieves electricity consumption data, electricity price data, transaction data, settlement data, and basic customer information data from the data management module.

[0061] In the forecasting process, the user selects to execute the electricity customer cost forecasting service. The cost forecasting module calls the cost forecasting algorithm based on the forecasting parameters to generate the forecasted cost results.

[0062] In the backtesting process, the user selects to perform a cost backtesting service for electricity sales customers. The cost backtesting module invokes the cost backtesting algorithm based on the target electricity sales customer and the target query month and year to generate backtesting profit and loss results.

[0063] In the results output step, the results output module displays the predicted cost results or the backtesting profit and loss results.

[0064] It should also be noted that in existing technologies, customer profit forecasting and backtesting rely on manual input of customer contract information, time-of-use electricity data, electricity transaction data, and settlement data into spreadsheets, followed by calculations using preset formulas. This method becomes increasingly problematic as the number of customers increases, the time span lengthens, and electricity pricing rules change frequently. It requires constant copying of spreadsheet files and manual verification of data sources, making the calculation process highly dependent on human experience and difficult to guarantee the consistency and reproducibility of the calculation logic.

[0065] To address the technical problems inherent in the widespread use of spreadsheet tools for customer profit forecasting and backtesting in existing electricity sales practices, this invention systematically solves these problems at the technical implementation level by constructing a method and system for electricity customer cost forecasting and backtesting. By setting up a login authentication module and employing JWT-based identity authentication, this invention ensures that access to the electricity customer cost forecasting and backtesting system has clearly defined user identities and permission boundaries. This technically prevents the spreadsheet file from being arbitrarily modified in a multi-user collaborative environment, providing a controllable access point for the cost forecasting and backtesting process.

[0066] This invention sets up a data management module to uniformly store electricity consumption data, electricity price data, transaction data, settlement data, and customer basic information data in a database environment. It also provides data to the cost prediction module and cost backtesting module through an interface call via a data interface module. This technically replaces the manual copying and pasting of spreadsheet data, ensuring consistency and centralization of data sources for cost prediction and cost backtesting.

[0067] In the cost prediction module, this invention constructs a set of price parameters and performs weighted calculations based on the filing price, execution price, market comprehensive price, and proportional parameters to form benchmark price parameters for cost calculation. This transforms the static calculation formulas that were originally scattered in spreadsheet cells into a repeatable algorithmic calculation process, enabling the predicted cost results to maintain consistent calculation logic under different customer and time conditions.

[0068] This invention automates the processing of complex time-of-use pricing structures by introducing peak, flat, and valley periods into the cost prediction module, calculating the cost for each period based on medium- and long-term trading prices and daytime trading prices, and then performing a fusion calculation on the costs of each period to form a transaction cost price. This technical approach avoids the process of manually splitting and verifying peak, flat, and valley formulas item by item in spreadsheets.

[0069] In the cost backtesting module, this invention calculates the proportion of the medium-to-long-term curve for each month's time period based on the customer's monthly electricity consumption and monthly time period electricity consumption, and maps the proportion of the medium-to-long-term curve for each month's time period to peak time period, flat time period and valley time period, in order to determine the medium-to-long-term electricity distribution for each time period, so that the historical electricity consumption structure can be restored by algorithm, thereby solving the problem that the spreadsheet method is difficult to accurately reproduce the historical electricity consumption distribution.

[0070] This invention further calculates profit and loss for electricity sales customers by using the difference between the predicted execution price and the actual settlement weighted price, combined with the customer's electricity consumption in the target query month and year. This allows the profit and loss results of electricity sales customers to be obtained through a unified calculation model, thus avoiding the inconsistency problem caused by manually switching calculation methods between different spreadsheets from a technical perspective.

[0071] Through the above-mentioned technical means, the present invention transforms the cost prediction and cost backtesting process for electricity customers from a spreadsheet calculation method that relies on manual operation to a systematic calculation method based on a unified data model and algorithm model. This enables the cost prediction and cost backtesting process to have the technical characteristics of being repeatable, verifiable, and reproducible, thereby effectively solving the problems of low calculation efficiency, excessive manual operation, and difficulty in unifying calculation logic in the background technology.

[0072] Specifically, the technical solution in this case is based on the structural reconstruction of the cost forecasting and cost backtesting process in the existing electricity sales business. Its core is to transform the original calculation process that relied on manual spreadsheet operations into a fixed process in which the computer system uniformly manages the data and the algorithm module performs the calculations, thereby achieving uniformity in the forecasting and backtesting processes in terms of data sources, calculation rules, and result output.

[0073] In existing technologies, cost forecasting and backtesting for electricity customers are typically accomplished using spreadsheet tools. This method disperses customer contract information, time-of-use electricity data, electricity price data, transaction data, and settlement data across multiple spreadsheet files, with calculation rules embedded as formulas within different cells. This structure suffers from problems in practical use, including fragmented data sources, difficulty in standardizing calculation rules, and numerous manual steps. Furthermore, the overall operational complexity increases exponentially with the number of customers and the time span.

[0074] This case breaks down the aforementioned calculation process into three layers from a technical structure perspective: data management, algorithm calculation, and process control, and reorganizes them in a systematic way. The data management layer is responsible for uniformly storing and providing the basic data required for calculation; the algorithm calculation layer is responsible for completing prediction and backtesting calculations according to predefined calculation rules; and the process control layer is responsible for standardizing and guiding user operations and triggering corresponding calculation processes.

[0075] Within the data management layer, electricity consumption data, electricity price data, transaction data, settlement data, and customer basic information are all stored uniformly in a database environment. The database uses a relational database to store structured business data, which is organized according to customer and time identifiers. This allows for accurate location of data for the same electricity customer across different time dimensions through database query conditions. A non-relational database is used to cache frequently accessed data, ensuring consistency of data parameters used within the same calculation cycle and avoiding data version discrepancies caused by multiple queries.

[0076] The data interface module serves as the connection between the data management layer and the algorithm calculation layer. Based on business operation requests, the data interface module constructs database query conditions and retrieves all data parameters required for prediction or backtesting calculations from the database in one go using nested SQL queries. These parameters are then organized into a parameter set. The parameter set includes electricity consumption data, electricity price data, transaction data, settlement data, and basic customer information. The parameter set is passed to the algorithm calculation layer as a whole to ensure consistency in parameter sources within the same calculation round.

[0077] The login authentication module verifies the identity of business operation requests entering the system. It generates a user identity token by performing JWT-based authentication on account and password information. This token is used to perform access permission checks in every business operation request. This mechanism provides clear identity boundaries for prediction and backtesting operations within the system, technically avoiding common problems in spreadsheet-based systems such as file sharing and accidental formula modification.

[0078] The computer implementation principle of the cost forecasting algorithm is to complete the predicted cost calculation through price parameter modeling, electricity consumption structure breakdown, and multi-source cost fusion. The algorithm first constructs a set of price parameters based on the registered price, the executed price, the comprehensive market price, and proportional parameters, and then performs a weighted calculation on this set to obtain the benchmark price parameter. The benchmark price parameter is used to unify the measurement basis of prices from different sources in the forecast calculation. The benchmark price parameter, combined with the rebate rules, calculates the rebate-paid executed price, which represents the comprehensive executed price under the forecast scope.

[0079] After completing price modeling, the cost forecasting algorithm breaks down the electricity consumption structure into time periods. Electricity consumption is divided into peak, off-peak, and valley periods, while the transaction structure is divided into medium- and long-term transactions and daytime transactions. The medium- and long-term transaction price is used to calculate the costs for the medium- and long-term peak, off-peak, and valley periods, while the average daytime transaction price is used to calculate the costs for the daytime peak, off-peak, and valley periods. These costs are then aggregated to form the transaction cost price. The difference between the transaction cost price and the post-rebate execution price is used to obtain the profit and loss result under the forecast.

[0080] The computer implementation principle of the cost backtesting algorithm is to reconstruct the historical transaction structure using actual transaction data while maintaining consistency in price modeling rules. The cost backtesting algorithm also calculates the weighted average price of the registered price and the execution price after rebates based on the registered price, the execution price, and the comprehensive market price, ensuring consistency between the prediction calculation and the backtesting calculation at the price level. The cost backtesting algorithm calculates the monthly time-period medium-to-long-term curve ratio based on the customer's monthly electricity consumption and monthly time-period electricity consumption. This monthly time-period medium-to-long-term curve ratio is used to describe the customer's electricity consumption distribution characteristics in different time periods.

[0081] The proportion of medium- and long-term electricity curves for each monthly period is mapped to peak, off-peak, and valley periods to determine the medium- and long-term electricity distribution for each period. The difference between the medium- and long-term electricity distribution for each period and the customer's monthly electricity consumption is charged according to the average intraday transaction price, forming the monthly spot electricity fee; the medium- and long-term electricity portion is charged according to the medium- and long-term transaction price, forming the monthly medium- and long-term electricity fee. The monthly spot electricity fee and the monthly medium- and long-term electricity fee are added together to obtain the monthly cost, and the monthly costs for each period are summed to form the transaction electricity fee.

[0082] The transaction electricity fee is calculated by converting the unit electricity volume into a transaction price. This transaction price is then combined with the intraday transaction price difference to obtain the comprehensive transaction price. The difference between the rebate-paid execution price and the comprehensive transaction price is used to calculate the profit and loss results under the backtesting caliber. Through the above calculation process, the cost backtesting algorithm can reconstruct the transaction cost structure of historical months under unified calculation rules and output profit and loss results that are comparable to the prediction caliber.

[0083] From an overall internal logic perspective, this case establishes a consistent computational chain for cost forecasting and cost backtesting by using unified data acquisition methods, unified price modeling rules, unified time period segmentation logic, and unified result output structure, ensuring consistency in entry points, parameters, and algorithms. This computational chain solidifies the previously scattered manual operations in spreadsheets into a fixed execution process within a computer system, thereby systematizing and standardizing the cost forecasting and cost backtesting process for electricity sales customers.

[0084] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for cost forecasting and cost backtesting for electricity sales customers, characterized in that, include: The data interface call steps are as follows: After the user enters the system, according to the user's business operation request, the data interface corresponding to the cost prediction or cost backtesting of the electricity sales customer is called to obtain the electricity consumption data, electricity price data, transaction data, settlement data and customer basic information data that match the business operation request from the database. The prediction processing steps are as follows: when a user selects to perform cost prediction, the user enters the cost prediction module, fills in the corresponding prediction parameters according to the business situation of the target customer, and calls the cost prediction algorithm to calculate and process the prediction parameters, electricity consumption data, electricity price data and transaction data to obtain the predicted cost result of the target customer. The backtesting process involves the following steps: When a user selects to perform a cost backtest, the system enters the cost backtesting module, receives the target customer selected by the user and the corresponding query month and year, and calls the cost backtesting algorithm to calculate and process the historical electricity consumption data, electricity price data and transaction data of the target customer in the query month and year to obtain the backtesting profit and loss result of the target customer. The results output step outputs and displays the predicted cost results and / or the backtesting profit and loss results to the user.

2. The method for cost prediction and cost backtesting for electricity sales customers according to claim 1, characterized in that, The steps preceding the data interface call also include: The login authentication process involves receiving the user's submitted account and password information, performing JWT-based identity authentication on the account and password information, and returning the user's corresponding user information and permission information when the authentication is successful, allowing the user to enter the system.

3. The method for cost prediction and cost backtesting for electricity sales customers according to claim 2, characterized in that, In the login authentication step, the JWT authentication includes generating a user identity token and performing access permission verification based on the user identity token in each business operation request; In the data interface call step, electricity consumption data, electricity price data, transaction data and settlement data corresponding to the target customer are obtained from the database through nested SQL queries.

4. The method for predicting and backtesting electricity sales customer costs according to claim 3, characterized in that, In the prediction processing step, the cost prediction algorithm constructs a set of price parameters based on the target customer's filing price, execution price, comprehensive market price and corresponding proportional parameters, and performs weighted calculation on the set of price parameters to generate benchmark price parameters for subsequent cost calculation.

5. The method for cost forecasting and cost backtesting for electricity sales customers according to claim 4, characterized in that, In the prediction processing step, the cost prediction algorithm divides the target customer's electricity consumption ratio into peak, off-peak and valley periods, and calculates the corresponding medium- and long-term costs and daytime costs for each period based on the medium- and long-term transaction electricity price and the daytime transaction electricity price, respectively. The costs of each period are then merged to obtain the transaction cost price.

6. The method for cost prediction and cost backtesting for electricity sales customers according to claim 5, characterized in that, In the backtesting process, the cost backtesting algorithm calculates the monthly time-period medium-to-long-term curve ratio based on the customer's monthly electricity consumption and monthly time-period electricity consumption, and maps the curve ratio to the corresponding time period to determine the customer's medium-to-long-term electricity distribution in each time period.

7. The method for cost prediction and cost backtesting for electricity sales customers according to claim 6, characterized in that, In the backtesting process, the cost backtesting algorithm calculates the profit and loss results of the target customer based on the difference between the predicted execution price and the actual settlement weighted price, combined with the customer's electricity consumption in the corresponding period. In the result output step, the predicted cost results or backtesting profit and loss results are displayed in the user interface in the form of tables or graphs.

8. A cost prediction and cost backtesting system for electricity sales customers, characterized in that, include: The login authentication module is used to receive the account and password information submitted by the user, and to authenticate the user's identity based on JWT. After successful authentication, it returns user information and permission information to the user. The data management module is used to store electricity consumption data, electricity price data, transaction data, settlement data, and basic customer information data of electricity sales customers; The data interface module, connected to the data management module, is used to provide data matching the user's business operation request to the cost prediction module or cost backtesting module. The cost prediction module, connected to the data interface module, is used to call the cost prediction algorithm based on the prediction parameters of the target customer when the user selects to perform cost prediction, and to calculate and process the electricity consumption data, electricity price data and transaction data to generate the predicted cost result. The cost backtesting module, connected to the data interface module, is used to call the cost backtesting algorithm based on the target customer and query month and year selected by the user when the user selects to perform cost backtesting, calculate and process historical electricity consumption data, electricity price data and transaction data, and generate backtesting profit and loss results. The results output module is connected to the cost prediction module and the cost backtesting module, and is used to output and display the predicted cost results or backtesting profit and loss results to the user.

9. The electricity customer cost prediction and cost backtesting system according to claim 8, characterized in that, The login authentication module uses a combination of Spring Security and JWT to implement user authentication and access control. The data management module includes a relational database for storing electricity consumption data, electricity price data, transaction data, settlement data, and basic customer information data of electricity sales customers; The data management module also includes a non-relational database for caching frequently accessed data; The data interface module provides data retrieval services to the cost prediction module and the cost backtesting module via the HTTP protocol; The data interface module employs SSL or TLS encryption during data transmission.

10. The electricity sales customer cost prediction and cost backtesting system according to claim 1, characterized in that, The cost prediction module and the cost backtesting module each include an algorithm execution unit. The algorithm execution unit is configured to aggregate multi-source business data from the data interface module and output the calculation results according to predefined algorithm rules. The algorithm execution unit obtains the data parameters required for calculation through the data interface module, and transmits the results to the result output module after completing the algorithm calculation.