Quantum financial operation system and method based on cross-domain language collaboration

By decoupling business logic and algorithms in the interactive mechanism between Java and Python, and combining the task termination strategy of bidirectional signal synchronization, the efficient coordination problem between Java and Python in quantum financial computing is solved, and the real-time and security of the quantum financial operating system is improved.

CN120429033APending Publication Date: 2025-08-05ZHEJIANG UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510505828.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

The existing technology has shortcomings in high performance, low latency and seamless collaboration in the interaction between Java and Python. Especially in quantum financial computing scenarios, frequent cross-language calls affect system efficiency and lack a lightweight and reliable task termination mechanism, which is difficult to meet the real-time control of computing tasks in financial scenarios.

Method used

By decoupling business logic and quantum financial operation algorithms, an interactive mechanism between Java and Python is established, and a task termination strategy of bidirectional signal synchronization is adopted to ensure the deep integration and independent operation of Java and Python, and the cross-language collaborative efficiency is improved, and the isolation and recycling mechanism of quantum computing resources is designed to prevent resource leakage and data loss.

Benefits of technology

It significantly improves the efficiency of cross-language collaborative operation, meets the demand for real-time computing in financial scenarios, ensures that the computing task is safely terminated within millisecond response time, avoids resource leakage and data loss, and improves the security and resource utilization of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120429033A_ABST
    Figure CN120429033A_ABST
Patent Text Reader

Abstract

The invention discloses a quantum finance operation system and method based on cross-domain language collaboration, and belongs to the technical field of quantum computing, and the method comprises the steps: configuring a dependence environment of Java and Python through deploying a back-end service, and defining a Python execution path; a user submits a quantum financial operation request, a Java service layer analyzes parameters and checks resources, a Python algorithm layer is triggered, and a request identification number and a process identification number are recorded in a process state table; after a termination request is submitted, the Java service layer calls the Python algorithm layer based on the process state table, a termination instruction is synchronized, resources are released, and the task state is updated. According to the method, a Java and Python interaction mechanism is established through decoupling service logic and a quantum algorithm, so that the cross-language collaboration efficiency is remarkably improved, a quantum computing resource isolation and recovery mechanism is designed, and the security of quantum financial operation and the resource utilization rate are improved in combination with sandbox management of Java on Python.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software development technology, and in particular to a quantum financial operation system and method with cross-domain language collaboration. Background Art

[0002] With the rapid development of quantum computing technology, the application of quantum algorithms in the financial sector has become a research hotspot, with applications such as portfolio optimization, option pricing, and risk analysis. Currently, some technologies attempt to combine quantum algorithms with traditional financial computing, but existing solutions still have significant shortcomings in system architecture design, cross-language collaborative execution, and dynamic task management.

[0003] In the existing cross-language calling mechanism, the interaction between Java and Python is usually achieved in the following ways:

[0004] (1) JNI (Java Native Interface): Calls the Python interpreter through the native library, but requires a complex C / C++ middle layer, has high development and maintenance costs, and has cross-platform compatibility issues;

[0005] (2) REST API or RPC communication: Encapsulate Python algorithms as services and remotely call them from Java via HTTP or gRPC. Although this approach decouples the language environment, it introduces network latency and requires additional deployment of services, making it difficult to meet the real-time requirements of financial computing scenarios.

[0006] (3) Embedded scripting engines such as Jython: Run Python scripts directly in the Java virtual machine. However, Jython is limited in its support for Python 3.x and cannot call Python libraries that rely on C extensions (such as NumPy, Qiskit, etc.), which limits the development of quantum algorithms.

[0007] Therefore, the above interactions between Java and Python have not effectively solved the needs of Java and Python in terms of high performance, low latency, and seamless collaboration. Especially in quantum financial computing scenarios, frequent cross-language calls will significantly affect the overall efficiency of the system and it is difficult to meet the real-time computing needs of financial scenarios.

[0008] In addition, in traditional multilingual hybrid systems, the dynamic control of tasks has the following problems:

[0009] (1) Single-language task termination: For example, Java terminates its own thread through Thread.interrupt(), but cannot directly control the execution state of the Python process, causing the Python-side algorithm to continue to occupy computing resources. This computing resource occupation is even more significant in quantum financial algorithms;

[0010] (2) Forced process termination: Terminate the Python process through an operating system-level command (such as kill -9), but this will cause the loss of unsaved intermediate data and may cause resource leakage;

[0011] (3) Message queue-based interruption: The termination signal is delivered through shared storage or message queue, but the Python side needs to actively poll the signal status, which has poor real-time performance and adds additional performance overhead.

[0012] Therefore, there is a lack of a lightweight, reliable and cross-language task termination mechanism, which cannot ensure that computing tasks are safely terminated within millisecond response time. It is difficult to meet the needs of real-time management and control of computing tasks in financial scenarios, and it is easy to leak resources or lose data.

[0013] In summary, the existing technology has not yet provided an efficient, reliable and cross-language collaborative framework suitable for quantum financial algorithm platforms. In particular, there are obvious technical gaps in the seamless interaction between Java and Python and dynamic task termination. Summary of the Invention

[0014] To solve the above technical problems, the present invention provides a quantum financial operation system and method with cross-domain language collaboration. By decoupling business logic and quantum financial operation algorithms, a Java and Python interaction mechanism is established, which significantly improves the efficiency of cross-language collaboration and also improves the security and resource utilization of quantum financial operations.

[0015] To achieve the above-mentioned purpose of the invention, the embodiment provides a quantum financial operation system with cross-domain language collaboration, including:

[0016] The environment deployment module is used to deploy backend services, configure Java and Python dependency environments, and define the Python script execution path;

[0017] The quantum finance operation startup module is used to execute the quantum finance operation task request after the front-end submits the request. The Java business layer parses the parameters input by the front-end into Python command line parameters through the interface and verifies the resources. It then starts the Python algorithm layer to perform quantum computing. At the same time, it assigns an independent request identification number to each Python process and records the request identification number and process identification number in the process status table.

[0018] The quantum finance operation termination module is used for the front-end input of the quantum finance operation termination request. The Java business layer pre-marks the termination status and calls the predefined Python termination script to pass the request identification number to the Python algorithm layer. The process status table is called to trigger the termination of the Python algorithm layer. The Java business layer updates the quantum finance operation status to terminated.

[0019] In one embodiment, the Java business layer is used to monitor the front-end Hypertext Transfer Protocol requests and manage the tasks input by the front-end, provide the required data according to the tasks, process the data parameters, and then schedule the Python algorithm layer through the library that executes the external process.

[0020] In one embodiment, the Python algorithm layer is used to execute the quantum financial operation algorithm and return the results of the quantum financial operation to the Java business layer, and maintain a synchronous execution status with the Java business layer through a process status table.

[0021] In one embodiment, the Python algorithm layer is used to execute the quantum financial operation algorithm and return the results of the quantum financial operation to the Java business layer, and maintain a synchronous execution status with the Java business layer through a process status table.

[0022] In one embodiment, the Java business layer parses the parameters input by the front end into Python command line parameters through an interface and verifies resources, including: after the Java business layer receives the quantum finance task execution request, it dynamically parses the parameters input by the front end into Python command line parameters through the interface, caches the current task status, calls the Python interpreter through the Apache CommonsExec library to parse the Python command line parameters, and monitors the CPU resource and memory resource load at the same time. If the CPU resource and memory resource load exceed the limit, the task startup is delayed and the concurrency of the Python process is adjusted.

[0023] In one embodiment, an independent request identification number is assigned to each Python algorithm process, and the request identification number and the process identification number are recorded in the process status table, including: when each Python process is started, the request identification number of the Python process is generated by the UUID algorithm, and the mapping relationship between the request identification number and the process identification number is written into the process status table to complete the one-to-one binding of the request identification number and the process identification number.

[0024] In one embodiment, the calling of the predefined Python termination script passes the request identification number to the Python algorithm layer, and the calling of the process status table triggers the termination of the Python algorithm layer, including: when the predefined Python termination script passes the request identification number to the Python algorithm layer, querying the process identification number bound to the request identification number based on the process status table, and sending a termination signal to the process identification number, triggering the termination of the Python algorithm layer.

[0025] In one embodiment, when the predefined Python termination script passes the request identification number to the Python algorithm layer, if the process identification number bound to the request identification number is not found, the Java business layer triggers the termination of the Python algorithm layer by rolling back.

[0026] In one embodiment, the quantum finance operation termination module further includes: when the Java business layer updates the quantum finance operation status to terminated, closing the quantum finance operation simulator and reclaiming GPU resources.

[0027] The present invention also provides a quantum financial operation method with cross-domain language collaboration, which adopts the quantum financial operation system with cross-domain language collaboration and includes the following steps:

[0028] Deploy the backend services for Quantum Finance, configure the Java and Python dependency environments, and define the Python script execution path;

[0029] The user submits a request and parameters for quantum financial operations through the front-end interface. After receiving the request, the Java business layer parses the parameters and verifies the resources, then starts the Python algorithm layer to perform quantum computing and records the request identification number and process identification number in the process status table.

[0030] After the user submits a quantum finance operation termination request through the front-end interface, the Java business layer calls the Python algorithm layer based on the process status table, synchronously terminates the instruction, releases resources and updates the task status.

[0031] Compared with the prior art, the present invention has the following beneficial effects:

[0032] (1) In the operation of quantum finance, Java, which is responsible for high-concurrency business logic, is decoupled from Python, which executes quantum algorithm calculations, to ensure their independent development. Java and Python are then deeply integrated through a unified interface, avoiding the problems of network latency and poor version compatibility, significantly improving the efficiency of cross-language collaborative operation, and meeting the real-time computing needs of financial scenarios.

[0033] (2) The quantum financial operation termination module adopts a task termination strategy with two-way signal synchronization, so that the front-end stop instruction can synchronously trigger the interruption of the Java business layer and the exit of the Python algorithm process, ensuring the complete preservation of the intermediate state data of the quantum financial calculation and avoiding resource leakage or data loss caused by forced termination.

[0034] (3) When the quantum financial operation is terminated, the occupied quantum computing resources will be automatically released and the security risks caused by malicious code injection during the algorithm execution will be prevented. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for describing the embodiments or the prior art.

[0036] Figure 1 This is a schematic diagram of the structure of the quantum financial operation system for cross-domain language collaboration provided by the present invention;

[0037] Figure 2 This is a schematic diagram of the quantum finance operation startup process provided by the present invention;

[0038] Figure 3 A schematic diagram of the quantum finance operation termination process provided by the present invention;

[0039] Figure 4 A schematic flow chart of the cross-domain language collaborative quantum finance operation method provided by the present invention. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.

[0041] In order to achieve the interaction and dynamics between Java and Python and meet the demand for real-time control of computing tasks in financial scenarios, the embodiment provides a quantum financial operation system with cross-domain language collaboration, such as Figure 1 As shown, it includes: environment deployment module, quantum financial operation startup module and quantum financial operation termination module.

[0042] Environment Deployment Module: In this example, we first prepare the environment for Quantum Finance, including Java and Python environments. We deploy the Java environment by deploying Spring Boot backend services, configuring the org.apache.commons:commons-exec:1.3 dependency, and defining the Python script path. We then install Python and its dependent libraries, such as Qiskit, Pandas, and NumPy.

[0043] Next, we designed the Java business layer and Python algorithm layer respectively. The Java business layer is used to listen to the Hypertext Transfer Protocol requests (HTTP requests) from the front end and manage the tasks input by the front end. It provides the required data according to the tasks, processes the data parameters, and then schedules the Python algorithm layer through the library that executes external processes.

[0044] The Python algorithm layer is used to execute quantum financial operation algorithms (such as quantum portfolio optimization and quantum European option pricing), and return the results of quantum financial operation to the Java business layer, maintaining a synchronized execution status with the Java business layer through the process status table.

[0045] This decoupling of business logic and algorithms addresses the problem of highly coupled business logic and quantum algorithms in traditional single-language platforms (such as an all-Python architecture). By completely separating business logic from the core algorithms through a layered design of Java and Python, the advantages of each language are fully leveraged, allowing them to be independently upgraded and expanded, reducing system complexity and enhancing maintainability. For example, adding a new quantum algorithm eliminates the need to modify Java business code, shortening the development cycle and significantly reducing system maintenance costs.

[0046] Quantum finance operation startup module: After the quantum finance operation environment is deployed, Figure 2 As shown, the front-end user enters the quantum finance runtime parameters and submits a run request. Upon receiving the request, the Java business layer uses the Apache Commons Exec library's org.apache.commons:commons-exec:1.3 dependency as the underlying execution engine. This dependency directly calls the system-level Python interpreter through the CommandLine class, circumventing Jython's version and dependency restrictions. paramsArr dynamically parses the param parameter input from the front-end to generate the input parameters required for the quantum algorithm. fileName is mapped to a specific Python algorithm file based on the business scenario. The Python algorithm layer's Python process is launched asynchronously to avoid blocking the Java business layer's main thread.

[0047] Through this Java and Python interaction mechanism, the Java backend can directly call the Python algorithm layer, while avoiding the network delay and version compatibility issues of traditional REST API or Jython solutions, improving the concurrency capability of the quantum financial operating system, and meeting the real-time computing needs of financial scenarios.

[0048] In the embodiment, the PythonCallParamService interface is designed to achieve standardized conversion of front-end parameters to Python command line parameters. For example, the param in JSON format is parsed into command line parameters such as ["--risk=0.05", "--assets=10"] to ensure the data format compatibility between Java and Python. The current task status is cached through the RunStateCache interface. Before calling the Python interpreter to parse the Python command line parameters and start the Python algorithm layer, the CPU and memory load are monitored. If the CPU and memory load exceed the limit, the task start is delayed, and the number of concurrency of the Python process is adjusted to prevent resource overload.

[0049] Based on standardized interface design, it supports flexible adaptation of multiple quantum algorithms and financial business scenarios, reduces the development cost of new algorithms or business modules, and is compatible with Python implementations of different quantum computing frameworks, improving the scalability of the quantum financial operating system.

[0050] The Quantum Finance startup module also uses the UUID algorithm to generate a unique request ID (requestId) for each Python process, achieving task-level resource isolation. When each Python algorithm process starts, the mapping between the requestId and the operating system's process ID (PID) is written into the corresponding process status table. This process status table ensures accurate mapping between the requestId and PID, preventing accidental killing of other processes. Python script output is redirected to a log file, and the log is associated with the task via the requestId, facilitating troubleshooting.

[0051] Quantum Finance Operation Termination Module: Based on Java and Python bidirectional signal synchronization and process status table management, it realizes full-link termination control of cross-language tasks, solves the problem of imperfect task termination mechanism in traditional multi-language systems, and enables the stop instructions triggered by front-end users to be accurately transmitted to the Java business layer and Python algorithm layer at the same time, ensuring that computing tasks are safely terminated within millisecond response time, avoiding resource leakage or data loss.

[0052] like Figure 3As shown, the front-end receives a quantum finance run termination request, and the Java business layer pre-marks the task as "terminating," preventing subsequent modifications to the task. A predefined Python termination script is called, passing the requestId to the Python algorithm layer. Upon receiving the task stop request, the Python algorithm layer searches for and deletes the PID record corresponding to the requestId from the corresponding process status table. Then, via os.killI, it sends a SIGTERM signal to the target process, triggering a graceful exit for the Python algorithm. The SIGTERM signal allows the algorithm to clean up resources, preventing data loss caused by a forced termination (SIGKILL). After the Python algorithm layer terminates, the Java business layer updates the task status to "terminated" and automatically releases any occupied quantum computing resources, including the quantum simulator connection and GPU computing resources. This achieves a near 100% resource recovery rate, preventing resource waste caused by zombie processes. If the Python side fails to find the PID (e.g., the process has terminated naturally), the Java layer rolls back the database state to ensure data consistency.

[0053] Based on a task termination strategy that synchronizes two-way signals, the front-end stop command can simultaneously trigger the interruption of the Java business layer and the graceful exit of the Python algorithm process, ensuring the complete preservation of intermediate state data during algorithm execution and avoiding resource leakage or data loss caused by forced termination. In addition, in response to the high cost of quantum computing resources such as quantum simulators and cloud quantum device connections, a resource isolation and recycling mechanism is designed. When a task terminates, the Java business layer sandboxes the Python process, limiting the scope of the algorithm module's permissions (such as file access and network connections) to prevent security risks such as malicious code injection during algorithm execution.

[0054] The present invention also provides a quantum financial operation method with cross-domain language collaboration, which adopts the quantum financial operation system with cross-domain language collaboration and includes the following steps:

[0055] Deploy the backend services for Quantum Finance, configure the Java and Python dependency environments, and define the Python script execution path;

[0056] The user submits a request and parameters for quantum financial operations through the front-end interface. After receiving the request, the Java business layer parses the parameters and verifies the resources, then starts the Python algorithm layer to perform quantum computing and records the request identification number and process identification number in the process status table.

[0057] After the user submits a quantum finance operation termination request through the front-end interface, the Java business layer calls the Python algorithm layer based on the process status table, synchronously terminates the instruction, releases resources and updates the task status.

[0058] The quantum financial operation system and method for cross-domain language collaboration provided by this invention can be applied to multiple scenarios, such as portfolio quantum optimization, European option pricing, etc. Taking portfolio quantum optimization as an example, the usage process is as follows:

[0059] Step 1: User initiates a computation request

[0060] Front-end operation: The user enters the portfolio parameters on the front-end interface and clicks the "Run" button.

[0061] Backend processing: Java receives the request and calls Python, including parameter mapping (converting JSON into command line parameters), starting an asynchronous thread to execute the quantum algorithm; Python executes the quantum algorithm and returns the result.

[0062] Step 2: Task Termination

[0063] Front-end user termination request: The user finds that the calculation time is too long and clicks the "Stop" button.

[0064] Java-side response: Update the task status and call the Python termination script; Python-side termination logic: Find the PID through the requestID and terminate the process, and update the status table.

[0065] State synchronization: After the Python process exits, the quantum simulator resources are released, Java updates the database status to "terminated", and the front-end interface shows that the task has terminated.

[0066] This quantum financial algorithm, running in collaboration with Java and Python, provides an efficient, reliable, and suitable platform for running quantum financial algorithms. It has been successfully applied to scenarios such as portfolio optimization and European option pricing, providing financial institutions with a feasible quantum computing solution. The layered design provides a technical template for the migration of traditional financial systems to quantum computing, lowering the threshold for technology upgrades in the industry.

[0067] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A quantum financial operation system with cross-domain language collaboration, characterized by: include: The environment deployment module is used to deploy backend services, configure Java and Python dependency environments, and define the Python script execution path; The quantum finance operation startup module is used to execute the quantum finance operation task request after the front-end submits the request. The Java business layer parses the parameters input by the front-end into Python command line parameters through the interface and verifies the resources. It then starts the Python algorithm layer to perform quantum computing. At the same time, it assigns an independent request identification number to each Python process and records the request identification number and process identification number in the process status table. The quantum finance operation termination module is used for the front-end input of the quantum finance operation termination request. The Java business layer pre-marks the termination status and calls the predefined Python termination script to pass the request identification number to the Python algorithm layer. The process status table is called to trigger the termination of the Python algorithm layer. The Java business layer updates the quantum finance operation status to terminated.

2. The quantum financial operating system according to claim 1, characterized in that: The Java business layer is used to monitor the front-end Hypertext Transfer Protocol requests and manage the front-end input tasks, provide the required data according to the tasks, process the data parameters, and then schedule the Python algorithm layer through the library that executes the external process.

3. The quantum financial operating system according to claim 1, characterized in that: The Python algorithm layer is used to execute the quantum financial operation algorithm and return the results of the quantum financial operation to the Java business layer, and maintain a synchronous execution status with the Java business layer through the process status table.

4. The quantum financial operating system according to claim 1, characterized in that: The Java business layer parses the parameters input by the front end into Python command line parameters and verifies resources through the interface, including: after the Java business layer receives the quantum finance operation task request, it dynamically parses the parameters input by the front end into Python command line parameters through the interface, caches the current task status, calls the Python interpreter through the Apache Commons Exec library to parse the Python command line parameters, and monitors the CPU resource and memory resource load at the same time. If the CPU resource and memory resource load exceed the limit, the task startup is delayed and the concurrency of the Python process is adjusted.

5. The quantum financial operating system according to claim 1, characterized in that: The method of assigning an independent request identification number to each Python algorithm process and recording the request identification number and process identification number in the process status table includes: when each Python process is started, generating the request identification number of the Python process through the UUID algorithm, writing the mapping relationship between the request identification number and the process identification number into the process status table, and completing the one-to-one binding of the request identification number and the process identification number.

6. The quantum financial operating system according to claim 1, characterized in that: The calling of the predefined Python termination script to pass the request identification number to the Python algorithm layer, and calling the process status table to trigger the termination of the Python algorithm layer, includes: when the predefined Python termination script passes the request identification number to the Python algorithm layer, querying the process identification number bound to the request identification number based on the process status table, and sending a termination signal to the process identification number to trigger the termination of the Python algorithm layer.

7. The quantum financial operating system according to claim 6, characterized in that: When the predefined Python termination script passes the request identification number to the Python algorithm layer, if the process identification number bound to the request identification number is not queried, the Java business layer rolls back, triggering the termination of the Python algorithm layer.

8. The quantum financial operating system according to claim 1, characterized in that: The quantum finance operation termination module further includes: when the Java business layer updates the quantum finance operation status to terminated, closing the quantum finance operation simulator and reclaiming GPU resources.

9. A quantum finance operation method with cross-domain language collaboration, characterized by: The quantum financial operation method adopts the cross-domain language collaborative quantum financial operation system according to any one of claims 1 to 8, comprising the following steps: Deploy the backend services for Quantum Finance, configure the Java and Python dependency environments, and define the Python script execution path; The user submits a request and parameters for quantum financial operations through the front-end interface. After receiving the request, the Java business layer parses the parameters and verifies the resources, then starts the Python algorithm layer to perform quantum computing and records the request identification number and process identification number in the process status table. After the user submits a quantum finance operation termination request through the front-end interface, the Java business layer calls the Python algorithm layer based on the process status table, synchronously terminates the instruction, releases resources and updates the task status.

Citation Information

Cited By

  • PLC (Programmable Logic Controller) control method and device integrated with Python algorithm and related product

    CN121300225A