CN114840569A - Securities trade profit and loss processing method, apparatus, device and medium - Google Patents

Securities trade profit and loss processing method, apparatus, device and medium Download PDF

Info

Publication number
CN114840569A
CN114840569A CN202110136356.8A CN202110136356A CN114840569A CN 114840569 A CN114840569 A CN 114840569A CN 202110136356 A CN202110136356 A CN 202110136356A CN 114840569 A CN114840569 A CN 114840569A
Authority
CN
China
Prior art keywords
profit
date
loss
loss calculation
query
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110136356.8A
Other languages
Chinese (zh)
Inventor
王安全
熊放
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Weibu Information Technology Co ltd
Original Assignee
Hunan Weibu Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Weibu Information Technology Co ltd filed Critical Hunan Weibu Information Technology Co ltd
Priority to CN202110136356.8A priority Critical patent/CN114840569A/en
Publication of CN114840569A publication Critical patent/CN114840569A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2474Sequence data queries, e.g. querying versioned data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/06Asset management; Financial planning or analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Development Economics (AREA)
  • General Physics & Mathematics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Databases & Information Systems (AREA)
  • Game Theory and Decision Science (AREA)
  • Human Resources & Organizations (AREA)
  • Operations Research (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Mathematical Physics (AREA)
  • Fuzzy Systems (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The application discloses a security trade profit and loss processing method, device, equipment and medium. The method comprises the following steps: receiving a profit and loss query request; determining profit-loss calculation results corresponding to the query time based on the target daily profit-loss data table; and sending the profit-loss calculation result to the user terminal corresponding to the user identifier. The problems that the time consumption is long and the user experience is poor due to the fact that profit and loss calculation results are obtained in real time are solved.

Description

Securities trade profit and loss processing method, apparatus, device and medium
Technical Field
The present application relates generally to the field of data processing, and more particularly to a method, apparatus, device and medium for processing profit and loss of securities trading.
Background
In the process of stock exchange, profit or loss is generated in each exchange, and the daily profit or loss or the accumulated profit or loss in a certain period of time in the exchange process are known to be contents which are very concerned by users in time.
After each trading day is finished, the trading system can calculate the day profit and loss of each user and then store the day profit and loss according to the date dimension; however, since the profit and loss of the user are usually calculated by depending on a great amount of business data, the profit and loss calculation results of the previous day and various types of clearing documents given by clearing merchants, if the profit and loss of the current day cannot be calculated due to a failure of a transaction system or a delay in acquiring the clearing documents after a certain transaction day is ended, the profit and loss of subsequent transaction days cannot be calculated, and the profit and loss calculation results of the subsequent transaction days cannot be acquired by the user.
In the related art, in order to prevent the above situation, after each transaction day is finished, the transaction system usually does not calculate the profit and loss of the user on the day, and after receiving the profit and loss query request of the user, calculates the profit and loss calculation result of the query date requested by the user in real time, but once the user needs to query the profit and loss calculation result in a certain period of time and the dates included in the period of time are more, the problems of too large profit and loss calculation amount and long time consumption occur, the user cannot obtain the profit and loss calculation result in time, and even the problem of request failure caused by overtime request occurs, which affects the use experience of the user.
Disclosure of Invention
In view of the above-mentioned deficiencies or inadequacies in the prior art, it is desirable to provide a securities trade profit-loss processing method, apparatus, device, and medium that improve the efficiency of profit-loss calculation result determination.
In a first aspect, the present application provides a method for processing profit and loss of securities trading, comprising:
receiving a profit-loss query request, wherein the profit-loss query request comprises a user identifier and query time;
determining a profit-loss calculation result corresponding to the query time based on a target daily profit-loss data table, wherein the target daily profit-loss data table is a daily profit-loss data table corresponding to the user identification;
sending the profit-loss calculation result to the user terminal corresponding to the user identifier;
in a second aspect, the present application provides a securities trade profit-loss processing apparatus, comprising:
the receiving module is configured to receive a profit and loss query request, and the profit and loss query request comprises a user identifier and a query time;
the determining module is configured to determine a profit-loss calculation result corresponding to the query time based on a target daily profit-loss data table, and the target daily profit-loss data table is a daily profit-loss data table corresponding to the user identifier;
the sending module is configured to send the profit-loss calculation result to the user terminal corresponding to the user identifier;
in a third aspect, the present application provides a computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor being configured to perform the method of the first aspect when executing the program;
in a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program for implementing the method of the first aspect.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
the method, the device, the equipment and the medium for processing the profit and loss of the securities trading provided by the embodiment of the application can receive a profit and loss query request; determining profit-loss calculation results corresponding to the query time based on the target daily profit-loss data table; and sending the profit-loss calculation result to the user terminal corresponding to the user identifier. The method and the device can improve the determination speed of profit and loss calculation results in any date range or any day, improve the response speed of a transaction system and improve the use experience of users.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is a schematic diagram illustrating a system for processing profit and loss of securities trade according to an embodiment of the present application;
FIG. 2 is a schematic flow chart illustrating a method for processing profit and loss of securities trading according to an embodiment of the present application;
FIG. 3 is a schematic flow chart illustrating another exemplary method for processing profit and loss of securities trade according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a security trade profit and loss processing apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a schematic structural diagram of a system for processing profit and loss of securities trading provided by an embodiment of the present application. As shown in fig. 1, the system for processing profit and loss of securities trading comprises: terminal device 110 and user terminal 120. The terminal device may operate a transaction system for processing transaction events for each transaction day, and the terminal device 110 may establish a wired or wireless network connection with the user terminal 120. The terminal device 110 may be a computer, a server, or a server cluster with data processing function, and the user terminal 120 may be a mobile phone, a computer, or a tablet computer.
The service terminal 110 is configured to determine a daily profit-loss calculation result of each user on the current day after each transaction day ends, where the daily profit-loss calculation result may be a profit-loss value and/or a profit-loss rate of each user on the transaction day, and store the profit-loss calculation result in a daily profit-loss data table corresponding to a user identifier of the user, where the daily profit-loss data table stores a transaction date and a profit-loss calculation result corresponding to the transaction date, and the daily profit-loss data table is usually stored in an external database, where the external database stores a daily profit-loss data table corresponding to a user identifier of each registered user, and the external database may be a Mongo database.
It should be noted that, in the embodiment of the present application, for each user identifier, the determination of the daily profit-loss calculation result of each trading day generally depends on the dependency data of the current day, which includes the business data, the clearing document given by the clearing trader, and/or the profit-loss calculation result of the previous day, wherein the business data may be the trading data of various categories on the trading day, and the categories may be stocks, digital currencies, options, funds, and the like; the clearing document can be the dividend or interest of each category on the trading day, etc.
Since a problem of transaction system failure or clearing file acquisition delay may occur in the process of determining the daily profit-loss calculation result of each transaction day, in this embodiment of the present application, the profit-loss calculation result of each transaction day may not be determined and stored on the current day, and the terminal device 110 may determine to acquire the dependent data corresponding to a certain transaction day at any time, and may process the dependent data based on the first processing logic to obtain the profit-loss calculation result of the transaction day, and store the profit-loss calculation result in the day profit-loss data table corresponding to the user identifier. The first processing logic is a method for determining profit and loss calculation results corresponding to the transaction days after all the dependent data corresponding to the transaction days are acquired.
In the embodiment of the present application, when a user needs to query profit-loss calculation results, a profit-loss query request may be sent to a terminal device 110 by using a user terminal 120 at any time, where the profit-loss query request includes a user identifier and a query time, and the terminal device 110 may receive the profit-loss query request; determining a profit-loss calculation result corresponding to the query time based on a target daily profit-loss data table, wherein the target daily profit-loss data table is a daily profit-loss data table corresponding to the user identification; and sends the profit/loss calculation result to the ue 120 corresponding to the ue identity.
The embodiment of the application provides a securities trading profit and loss processing method, which can be applied to a terminal device shown in fig. 1, as shown in fig. 2, and the method comprises the following steps:
step 201, receiving a profit and loss inquiry request.
In this step, the terminal device may receive an profit-loss query request sent by the user terminal, where the profit-loss query request may include a user identifier and a query time, and the query time may include a query date indicating that the user wants to obtain profit-loss calculation results for a transaction day corresponding to the query date; or the query time may include at least two consecutive query dates indicating that the user wants to obtain profit-loss calculation results for a transaction day corresponding to the at least two consecutive query dates. It is understood that the query date in the query time is the date of the completed transaction, i.e. the user may not obtain the profit and loss calculation result corresponding to the date of the non-performed transaction.
And step 202, determining a profit-loss calculation result corresponding to the query time based on the target daily profit-loss data table.
In the embodiment of the present application, a daily profit and loss data table of each user identifier using the transaction system may be stored in the terminal device, and the target daily profit and loss data table is a daily profit and loss data table corresponding to the user identifier in the profit and loss query request, and the target daily profit and loss data table includes at least one transaction date and daily profit and loss data corresponding to each transaction date.
In this step, two optional implementation manners may be provided for the process of determining the profit-loss calculation result corresponding to the query time based on the target daily profit-loss data table;
in an alternative implementation, the query time includes a query date, and the determining of the profit-loss calculation result corresponding to the query time based on the target daily profit-loss data table may include: judging whether at least one transaction date has a transaction date consistent with the query date; if yes, determining the daily profit and loss calculation result corresponding to the transaction date consistent with the query date as the profit and loss calculation result corresponding to the query time; if not, acquiring a daily profit and loss calculation result corresponding to the target transaction date; and determining the profit-loss calculation result corresponding to the query time based on the daily profit-loss calculation result corresponding to the target trading date which is the latest trading date in the at least one trading date.
Wherein determining the profit-loss calculation result corresponding to the query time based on the daily profit-loss calculation result corresponding to the target transaction date comprises: processing the daily profit and loss calculation result corresponding to the target transaction date based on the second processing logic to obtain a daily profit and loss calculation result corresponding to the next day of the target transaction date; judging whether the next day of the target transaction date is the query date or not; if not, determining the next day of the target trading date as the updated target trading date; repeating the above operations until the next day of the target transaction date is the query date; and if so, determining the day profit-loss calculation result corresponding to the next day of the target transaction date as the profit-loss calculation result corresponding to the query time. The second processing logic is a method for determining the profit-loss calculation result corresponding to the trading day after acquiring the profit-loss calculation result corresponding to the trading day on the last day.
It can be understood that, in the embodiment of the present application, if there is no transaction date that is consistent with the query date in at least one transaction date, it indicates that the terminal device has not acquired all the dependency data corresponding to the transaction date that is consistent with the query date, and the daily profit and loss calculation result corresponding to the transaction date that is consistent with the query date is not stored in the daily profit and loss data table. At this time, the profit and loss calculation result corresponding to the query time may be determined based on the method in the above embodiment.
For example, the terminal device receives a profit and loss query request sent by a certain user terminal, where the user identifier in the profit and loss query request is user a, and the query time is the query date 2020, 9, 3.
The terminal device may acquire the daily profit and loss data table corresponding to the user a, determine the daily profit and loss data table as a target daily profit and loss data table, and determine that each transaction date before 9, month and 4 days of 2020 is included in at least one transaction date in the target daily profit and loss data table, may determine that a transaction date that is consistent with 9, month and 3 days of 2020 of the query date exists in the at least one transaction date, may acquire a daily profit and loss calculation result t1 corresponding to 9, month and 3 days of 2020 of the transaction date, and may take the daily profit and loss calculation result t1 as a profit and loss calculation result corresponding to the query time.
Alternatively, the query time in the profit-loss processing request is the query date of 2020, 9, 6, since at least one transaction date in the target day profit-loss data table includes each transaction date before 9, 4, 2020, it may be determined that there is no transaction date in the at least one transaction date that is consistent with query date 2020, 9, 6, obtaining a daily profit-and-loss calculation result t2 corresponding to target transaction date 2020, 9, 4, processing daily profit-and-loss calculation result t2 based on the second processing logic, resulting in a daily profit-and-loss calculation result t3 corresponding to 2020, 9, 5, since day 9/month 5 in 2020 is not the query date, processing continues with day profit/loss calculation result t3 based on the second processing logic, resulting in day profit/loss calculation result t4 corresponding to day 6/9 in 2020, since 6.9.2020 is the query date, the daily profit and loss calculation result t4 may be determined as the profit and loss calculation result corresponding to the query time.
In another alternative implementation, the query time includes at least two consecutive query dates, and the determining, based on the target day profit-loss data table, profit-loss calculation results corresponding to the query time includes: judging whether at least one transaction date contains transaction dates respectively consistent with all the inquiry dates; if yes, determining the sum of the daily profit and loss calculation results corresponding to the transaction date consistent with each query date to obtain the profit and loss calculation results corresponding to the query time; if not, determining the profit-loss calculation result corresponding to the query time based on a preset processing rule.
As shown in fig. 3, the process of determining the profit-loss calculation result corresponding to the query time based on the preset processing rule may include:
step S1, determining whether at least one transaction date includes a transaction date respectively corresponding to the partial query dates.
And step S2, if yes, determining a profit-loss calculation result corresponding to the query time based on at least one first day profit-loss calculation result and a day profit-loss calculation result corresponding to the target transaction date.
In the embodiment of the application, at least one first date profit and loss calculation result is a date profit and loss calculation result corresponding to a transaction date consistent with each query date in partial query dates, and the target transaction date is the latest transaction date in at least one transaction date.
In this step, the process of determining the profit-loss calculation result corresponding to the query time based on at least one first daily profit-loss calculation result and the daily profit-loss calculation result corresponding to the target transaction date may include:
determining second daily profit and loss calculation results respectively corresponding to at least one first inquiry date based on the daily profit and loss calculation results corresponding to the target transaction date; acquiring at least one first daily profit and loss calculation result in a target daily profit and loss data table; and determining the sum of each first daily profit-loss calculation result and each second daily profit-loss calculation result to obtain the profit-loss calculation result corresponding to the query time. The first query date is a query date which is inconsistent with each transaction date in the query time.
Wherein the process of determining the second daily profit and loss calculation results respectively corresponding to the at least one first query date based on the daily profit and loss calculation results corresponding to the target transaction date may include:
processing the daily profit and loss calculation result corresponding to the target transaction date based on the second processing logic to obtain a daily profit and loss calculation result corresponding to the next day of the target transaction date; judging whether the next day of the target transaction date is the latest query date in at least one first query date; if not, determining the next day of the target trading date as the updated target trading date; repeating the above operations until the next day of the target transaction date is the latest query date in the at least one first query date; if yes, determining a first query date consistent with the next day of each target transaction date, and acquiring a second day profit and loss calculation result corresponding to each first query date.
It is understood that, in the embodiment of the present application, the process of obtaining the second day profit and loss calculation result corresponding to each first query date may be: and determining the daily profit and loss calculation result corresponding to the next day of the target trading date consistent with the first query date, and determining the daily profit and loss calculation result corresponding to the next day of the target trading date consistent with the first query date as the second daily profit and loss calculation result corresponding to the first query date.
And step S3, if not, determining the profit-loss calculation result corresponding to the query time based on the daily profit-loss calculation result corresponding to the target transaction date.
In this step, the process of determining the profit-loss calculation result corresponding to the query time based on the daily profit-loss calculation result corresponding to the target transaction date may include:
processing the profit-loss calculation result corresponding to the target transaction date based on the second processing logic to obtain the profit-loss calculation result corresponding to the next day of the target transaction date; judging whether the next day of the target transaction date is the latest query date in the query time; if not, determining the next day of the target trading date as the updated target trading date; repeating the above operations until the next day of the updated target transaction date is the latest query date in the query time; if yes, determining the query date consistent with the next day of each target transaction date, and acquiring the daily profit and loss calculation result corresponding to each query date; and determining the sum of the daily profit and loss calculation results corresponding to each query date to obtain the profit and loss calculation results corresponding to the query time.
It is understood that the process of obtaining the daily profit and loss calculation result corresponding to each query date may be: and determining a day profit and loss calculation result corresponding to the next day of the target transaction date consistent with the query date, and determining a day profit and loss calculation result corresponding to the next day of the target transaction date consistent with the query date as a day profit and loss calculation result corresponding to the query date.
For example, the terminal device receives a profit and loss query request sent by a certain user terminal, the user identifier in the profit and loss processing request is user a, and the query time is from 2020, 9, month 2 to 2020, 9, month 4.
The terminal device may obtain the daily profit and loss data table corresponding to the user a, determine it as the target daily profit and loss data table, and determining that the at least one trade date in the target daily profit-loss data table includes each trade date 9-month-4-day before 2020, it may be determined that there is a transaction date in the at least one transaction date that coincides with each of the query dates 2020, 9/2, 2020, 9/3 and 2020, 9/4, the daily profit and loss calculation result t5, the daily profit and loss calculation result t1 and the daily profit and loss calculation result t2 corresponding to the trading date of 2020, 9/month and 2 days, 2020, 9/month and 3 days and 9/month and 4 days 2020 can be obtained in the target daily profit and loss data table, the sum of the daily profit and loss calculation result t5, the daily profit and loss calculation result t1 and the daily profit and loss calculation result t2 is determined, and the profit and loss calculation results corresponding to the query time of 2020, 9/month and 2 days to 2020, 9/month and 4 days are obtained.
Alternatively, the query time in the profit-loss processing request is from 9/3/2020/9/7/2020/date, and since the at least one transaction date in the target date profit-loss data table includes each transaction date before 9/4/2020/year, it may be determined that at least one of the transaction dates includes transaction dates respectively consistent with 9/3/2020/9/4/2020/date, and a daily profit-loss calculation result t2 corresponding to 9/4/2020/9/target transaction date is obtained, and second daily profit-loss calculation results corresponding to 9/5/2020/9/6/2020/9/7/first query date are determined based on the daily profit-loss calculation result t 2.
The process of determining the second daily profit and loss calculation results respectively corresponding to the first query date 2020, 9 and 5, the first query date 2020, 9 and 6, and the first query date 2020, 9 and 7 may be, based on the daily profit and loss calculation result t 2:
obtaining a daily profit and loss calculation result t2 corresponding to the 9 th and 4 th days of the trade date 2020, processing a daily profit and loss calculation result t2 based on the second processing logic to obtain a daily profit and loss calculation result t3 corresponding to the 9 th and 5 th days of the 2020, processing the daily profit and loss calculation result t3 based on the second processing logic continuously because the 9 th and 5 th days of the 2020 is not the latest query date among the three first query dates to obtain a daily profit and loss calculation result t4 corresponding to the 9 th and 6 th days of the 2020, processing the daily profit and loss calculation result t4 based on the second processing logic continuously to obtain a daily profit and loss calculation result t6 corresponding to the 9 th and 7 th days of the 2020, and obtaining a target profit and loss calculation date t 9 th days of the 9 th and 9 th days of the target trade date after 9 th and 9 th days of the target trade date And a daily profit and loss calculation result t3, a daily profit and loss calculation result t4 and a daily profit and loss calculation result t6 which correspond to the month 7 respectively obtain a second daily profit and loss calculation result t3, a second daily profit and loss calculation result t4 and a second daily profit and loss calculation result t6 which correspond to the first query date 2020, 9 and 5, the first query date 2020, 9 and 6, and the first query date 2020, 9 and 7.
Further, a first profit-and-loss calculation result t1 and a first profit-and-loss calculation result t2, which correspond to the query date of 2020, 9, month and 3 days and the query date of 2020, 9, month and 4 days, are obtained in the target day profit-and-loss data table, and the sum of the first profit-and-loss calculation result t1, the first profit-and-loss calculation result t2, the second profit-and-loss calculation result t3, the second profit-and-loss calculation result t4 and the second profit-and-loss calculation result t6 is determined, so that profit-and-loss calculation results corresponding to the query time of 2020, 9, month and 3 days to 2020, 9, month and 7 days are obtained.
Still alternatively, the query time in the profit-loss processing request is from the query date 2020, 9, 6 to 2020, 9, 7, and since the at least one transaction date in the target day profit-loss data table includes each transaction date before the 9, 4 and 2020 days, it may be determined that the at least one transaction date does not include a transaction date respectively consistent with each query date, and the process of determining the profit-loss calculation result corresponding to the query time based on the daily profit-loss calculation result t2 corresponding to the target transaction date 2020, 9, 4 and may be:
obtaining a daily profit and loss calculation result t3 corresponding to 9, 5 of 2020, based on the second processing logic processing daily profit and loss calculation result t2, obtaining a daily profit and loss calculation result t4 corresponding to 6 of 9, 2020, since 5 of 9, 2020 is not the latest query date in the query time, continuing to process the daily profit and loss calculation result t3 based on the second processing logic processing daily profit and loss calculation result t4, obtaining a daily profit and loss calculation result t6 corresponding to 7 of 9, 2020, since 6 of 2020 is not the latest query date in the query time, continuing to process the daily profit and loss calculation result t4 based on the second processing logic processing daily profit and loss calculation result t4 and loss calculation result 6 corresponding to 6 of 9, 2020 of the target transaction date and 9, 7 of the next year of the target transaction date, respectively, can be obtained since 7 of 9, 2020 is the latest query time, and obtaining a daily profit and loss calculation result t4 and a daily profit and loss calculation result t6 corresponding to the query date of 2020, 9, 6 and 2020, 9, 7, respectively, determining the sum of the daily profit and loss calculation result t4 and the daily profit and loss calculation result t6, and obtaining profit and loss calculation results corresponding to the query time of 2020, 9, 6 and 2020, 9, 7.
And step 203, sending the profit-loss calculation result to the user terminal corresponding to the user identifier.
It should be noted that, in the embodiment of the present application, daily profit and loss calculation results corresponding to the next day of the target transaction date are generally stored in the memory database, and if it is necessary to determine profit and loss calculation results corresponding to the profit and loss query request based on daily profit and loss calculation results corresponding to the next day of the target transaction date, after sending the profit and loss calculation results to the user terminal, it may be possible to empty each determined daily profit and loss calculation result corresponding to the next day of the target transaction date in the profit and loss calculation result determination process, so as to prevent occupation of space of the memory database.
In summary, the method for processing profit and loss of securities trading provided by the application embodiment can receive a profit and loss query request; determining profit-loss calculation results corresponding to the query time based on the target daily profit-loss data table; and sending the profit-loss calculation result to the user terminal corresponding to the user identifier. The method and the device can improve the determination speed of profit and loss calculation results in any date range or any day, improve the response speed of a transaction system and improve the use experience of users.
The embodiment of the present application provides a securities trade profit and loss processing apparatus, as shown in fig. 4, the apparatus 30 includes:
a receiving module 301 configured to receive a profit and loss query request, where the profit and loss query request includes a user identifier and a query time;
a determining module 302 configured to determine a profit-loss calculation result corresponding to the query time based on a target daily profit-loss data table, where the target daily profit-loss data table is a daily profit-loss data table corresponding to the user identifier;
a sending module 303, configured to send the profit-loss calculation result to the user terminal corresponding to the user identifier.
Optionally, the determining module 302 is configured to:
judging whether at least one transaction date has a transaction date consistent with the query date;
if yes, determining the daily profit and loss calculation result corresponding to the transaction date consistent with the query date as the profit and loss calculation result corresponding to the query time;
if not, acquiring a daily profit and loss calculation result corresponding to a target transaction date, wherein the target transaction date is the latest transaction date in at least one transaction date;
and determining the profit-loss calculation result corresponding to the query time based on the daily profit-loss calculation result corresponding to the target transaction date.
Optionally, the determining module 302 is configured to:
processing the daily profit and loss calculation result corresponding to the target trading date to obtain a daily profit and loss calculation result corresponding to the next day of the target trading date;
judging whether the next day of the target transaction date is the query date or not;
if not, determining the next day of the target trading date as the updated target trading date;
repeating the operation until the next day of the target transaction date is the query date;
and if so, determining the day profit-loss calculation result corresponding to the next day of the target transaction date as the profit-loss calculation result corresponding to the query time.
Optionally, the determining module 302 is configured to:
judging whether at least one transaction date contains transaction dates respectively consistent with all the inquiry dates;
if yes, determining the sum of the daily profit and loss calculation results corresponding to the transaction date consistent with each query date to obtain the profit and loss calculation results corresponding to the query time;
if not, determining the profit-loss calculation result corresponding to the query time based on a preset processing rule.
Optionally, the determining module 302 is configured to:
judging whether at least one transaction date contains transaction dates respectively consistent with the partial query dates;
if yes, determining the profit-loss calculation result corresponding to the query time based on at least one first day profit-loss calculation result and the day profit-loss calculation result corresponding to the target transaction date, wherein the at least one first day profit-loss calculation result is a day profit-loss calculation result corresponding to a transaction date which is consistent with each query date in a part of the query dates, and the target transaction date is the latest transaction date in the at least one transaction date;
if not, the profit-loss calculation result corresponding to the query time is determined based on the daily profit-loss calculation result corresponding to the target transaction date.
Optionally, the determining module 302 is configured to:
determining second daily profit and loss calculation results respectively corresponding to at least one first query date based on daily profit and loss calculation results corresponding to the target transaction dates, wherein the first query date is a query date which is inconsistent with each transaction date in the query time;
acquiring at least one first daily profit and loss calculation result in a target daily profit and loss data table;
and determining the sum of each first daily profit-loss calculation result and each second daily profit-loss calculation result to obtain the profit-loss calculation result corresponding to the query time.
Optionally, the determining module 302 is configured to:
processing the daily profit and loss calculation result corresponding to the target trading date to obtain a daily profit and loss calculation result corresponding to the next day of the target trading date;
judging whether the next day of the target transaction date is the latest query date in at least one first query date;
if not, determining the next day of the target trading date as the updated target trading date;
repeating the above operations until the next day of the target transaction date is the latest query date in the at least one first query date;
if yes, determining a first query date consistent with the next day of each target transaction date, and acquiring a second day profit and loss calculation result corresponding to each first query date.
Optionally, the determining module 302 is configured to:
processing the profit-loss calculation result corresponding to the target transaction date to obtain the profit-loss calculation result corresponding to the next day of the target transaction date;
judging whether the next day of the target transaction date is the latest query date in the query time;
if not, determining the next day of the target trading date as the updated target trading date;
repeating the above operations until the next day of the updated target transaction date is the latest query date in the query time;
if yes, determining the query date consistent with the next day of each target transaction date, and acquiring the daily profit and loss calculation result corresponding to each query date;
determining the sum of the daily profit and loss calculation results corresponding to each query date to obtain the profit and loss calculation results corresponding to the query time
In summary, the apparatus for processing profit and loss in securities trading provided by the application embodiment can receive a profit and loss query request; determining profit-loss calculation results corresponding to the query time based on the target daily profit-loss data table; and sending the profit-loss calculation result to the user terminal corresponding to the user identifier. The method and the device can improve the determination speed of profit and loss calculation results in any date range or any day, improve the response speed of a transaction system and improve the use experience of users.
Fig. 5 is a diagram illustrating a computer device according to an exemplary embodiment, which includes a Central Processing Unit (CPU)401 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage section into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for system operation are also stored. The CPU401, ROM402, and RAM403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. Drivers are also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
In particular, the processes described above in fig. 2-3 may be implemented as computer software programs, according to embodiments of the present application. For example, various embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section, and/or installed from a removable medium. The above-described functions defined in the system of the present application are executed when the computer program is executed by a Central Processing Unit (CPU) 401.
It should be noted that the computer readable medium shown in the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of methods, apparatus, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves. The described units or modules may also be provided in a processor, and may be described as: a processor includes a receiving module, a determining module, and a transmitting module. Where the names of such units or modules do not in some cases constitute a limitation of the unit or module itself, for example, a receiving module may also be described as a "receiving module for receiving profit-and-loss query requests".
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to implement the method for processing the profit and loss of the securities trade as described in the above embodiments.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by a person skilled in the art that the scope of the invention as referred to in the present application is not limited to the embodiments with a specific combination of the above-mentioned features, but also covers other embodiments with any combination of the above-mentioned features or their equivalents without departing from the inventive concept. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (11)

1. A method for processing profit and loss of securities trading is characterized by comprising the following steps:
receiving a profit and loss query request, wherein the profit and loss query request comprises a user identifier and query time;
determining a profit-loss calculation result corresponding to the query time based on a target daily profit-loss data table, wherein the target daily profit-loss data table is a daily profit-loss data table corresponding to the user identifier;
and sending the profit-loss calculation result to the user terminal corresponding to the user identifier.
2. The method according to claim 1, wherein the query time includes a query date, the target daily profit-and-loss data table includes at least one transaction date and daily profit-and-loss data respectively corresponding to each of the transaction dates, and the determining the profit-and-loss calculation result corresponding to the query time based on the target daily profit-and-loss data table includes:
judging whether at least one transaction date has the transaction date consistent with the inquiry date;
if yes, determining a daily profit and loss calculation result corresponding to the transaction date consistent with the query date as a profit and loss calculation result corresponding to the query time;
if not, acquiring a daily profit and loss calculation result corresponding to a target transaction date, wherein the target transaction date is the latest transaction date in at least one transaction date;
and determining a profit-loss calculation result corresponding to the query time based on the daily profit-loss calculation result corresponding to the target transaction date.
3. The method of claim 2, wherein determining the profit-loss calculation corresponding to the query time based on the daily profit-loss calculation corresponding to the target transaction date comprises:
processing a daily profit and loss calculation result corresponding to the target transaction date to obtain a daily profit and loss calculation result corresponding to the next day of the target transaction date;
judging whether the next day of the target transaction date is the query date or not;
if not, determining the next day of the target trading date as the updated target trading date;
repeating the above operations until the next day of the target transaction date is the query date;
and if so, determining that the daily profit-loss calculation result corresponding to the next day of the target transaction date is the profit-loss calculation result corresponding to the query time.
4. The method according to claim 1, wherein the query time includes at least two consecutive query dates, the target daily profit-and-loss data table includes at least one transaction date and daily profit-and-loss data respectively corresponding to each transaction date, and the determining the profit-and-loss calculation result corresponding to the query time based on the target daily profit-and-loss data table includes:
judging whether at least one transaction date contains the transaction dates which are respectively consistent with all the inquiry dates;
if so, determining the sum of the daily profit and loss calculation results corresponding to the transaction dates consistent with the query dates to obtain profit and loss calculation results corresponding to the query time;
if not, determining a profit-loss calculation result corresponding to the query time based on a preset processing rule.
5. The method according to claim 4, wherein the determining the profit-loss calculation result corresponding to the query time based on the preset processing rule comprises:
judging whether at least one transaction date contains the transaction dates respectively consistent with part of the query dates;
if yes, determining profit-loss calculation results corresponding to the query time based on at least one first day profit-loss calculation result and day profit-loss calculation results corresponding to target transaction dates, wherein at least one first day profit-loss calculation result is a day profit-loss calculation result corresponding to the transaction date which is consistent with each query date in part of the query dates, and the target transaction dates are latest transaction dates in at least one transaction date;
if not, determining the profit-loss calculation result corresponding to the query time based on the daily profit-loss calculation result corresponding to the target transaction date.
6. The method of claim 5, wherein determining the profit-and-loss calculation corresponding to the query time based on at least one first daily profit-and-loss calculation and a daily profit-and-loss calculation corresponding to a target transaction date comprises:
determining second daily profit and loss calculation results respectively corresponding to at least one first inquiry date based on daily profit and loss calculation results corresponding to the target transaction dates, wherein the first inquiry date is the inquiry date which is inconsistent with each transaction date in the inquiry time;
obtaining at least one first daily profit and loss calculation result in the target daily profit and loss data table;
and determining the sum of each first daily profit-loss calculation result and each second daily profit-loss calculation result to obtain the profit-loss calculation result corresponding to the query time.
7. The method of claim 6, wherein determining second daily profit-loss calculations corresponding to at least one first query date, respectively, based on daily profit-loss calculations corresponding to the target transaction date comprises:
processing the daily profit and loss calculation result corresponding to the target trading date to obtain a daily profit and loss calculation result corresponding to the next day of the target trading date;
judging whether the next day of the target transaction date is the latest query date in at least one first query date;
if not, determining the next day of the target trading date as the updated target trading date;
repeating the above operations until the next day of the target transaction date is the latest query date in at least one first query date;
if yes, determining the first query date consistent with the next day of each target transaction date, and acquiring second day profit and loss calculation results corresponding to each first query date.
8. The method of claim 5, wherein determining the profit-loss calculation corresponding to the query time based on the daily profit-loss calculation corresponding to the target transaction date comprises:
processing the profit-loss calculation result corresponding to the target trading date to obtain the profit-loss calculation result corresponding to the next day of the target trading date;
judging whether the next day of the target transaction date is the latest query date in the query time;
if not, determining the next day of the target trading date as the updated target trading date;
repeating the above operations until the next day of the updated target transaction date is the latest query date in the query time;
if yes, determining the query date consistent with the next day of each target transaction date, and acquiring daily profit and loss calculation results corresponding to each query date;
and determining the sum of the daily profit and loss calculation results corresponding to each query date to obtain the profit and loss calculation results corresponding to the query time.
9. A securities trade profit and loss processing apparatus, comprising:
the receiving module is configured to receive a profit and loss query request, and the profit and loss query request comprises a user identifier and a query time;
a determining module configured to determine a profit-loss calculation result corresponding to the query time based on a target daily profit-loss data table, where the target daily profit-loss data table is a daily profit-loss data table corresponding to the user identifier;
and the sending module is configured to send the profit and loss calculation result to the user terminal corresponding to the user identifier.
10. A computer device, characterized in that the computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, the processor being adapted to perform the method according to any of claims 1-8 when executing the program.
11. A computer-readable storage medium, characterized in that a computer program is stored thereon for implementing the method according to any one of claims 1-8.
CN202110136356.8A 2021-02-01 2021-02-01 Securities trade profit and loss processing method, apparatus, device and medium Pending CN114840569A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110136356.8A CN114840569A (en) 2021-02-01 2021-02-01 Securities trade profit and loss processing method, apparatus, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110136356.8A CN114840569A (en) 2021-02-01 2021-02-01 Securities trade profit and loss processing method, apparatus, device and medium

Publications (1)

Publication Number Publication Date
CN114840569A true CN114840569A (en) 2022-08-02

Family

ID=82561178

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110136356.8A Pending CN114840569A (en) 2021-02-01 2021-02-01 Securities trade profit and loss processing method, apparatus, device and medium

Country Status (1)

Country Link
CN (1) CN114840569A (en)

Similar Documents

Publication Publication Date Title
CN112184154A (en) Business approval method and device
CN112037026A (en) Automatic abnormal transaction work order processing method, device and system
CN112132674A (en) Transaction processing method and device
CN111127214A (en) Method and apparatus for portfolio
CN111881329A (en) Account balance management method and system
CN111105238A (en) Transaction risk control method and device
CN112241866B (en) Service processing method and device, computer readable medium and electronic equipment
CN111798261A (en) Information updating method and device
CN114817347A (en) Business approval method and device, electronic equipment and storage medium
CN111242576A (en) Method and device for processing request
CN114997977B (en) Data processing method, device, electronic equipment and computer readable medium
CN113434754A (en) Method and device for determining recommended API (application program interface) service, electronic equipment and storage medium
CN116228384A (en) Data processing method, device, electronic equipment and computer readable medium
CN115564415A (en) Order payment and settlement method and device
CN114840569A (en) Securities trade profit and loss processing method, apparatus, device and medium
CN114648410A (en) Stock staring method, apparatus, system, device and medium
CN114239519A (en) Credit investigation data processing method and device, electronic equipment and computer readable medium
CN112907223A (en) Method and device for processing service information
CN114092237A (en) Clearing processing method, device, system and equipment based on difference value
CN110874386A (en) Method and device for establishing category mapping relation
CN112862608A (en) Transaction data matching method and device
CN109388785B (en) Text screening method and device
CN116151981A (en) Transaction processing request processing method and device
CN115880048A (en) Method, device, electronic equipment and computer readable medium for processing account data
CN114912008A (en) User portrait construction method, system, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination