US 12,014,360 B2
Gain and loss computation for cryptocurrency transactions
Vadim Shteynberg, Ardsley, NY (US); and Alexander Zakharov, Croton on Hudson, NY (US)
Assigned to Lukka, Inc., Naples, FL (US)
Filed by Lukka, Inc., Naples, FL (US)
Filed on Aug. 19, 2019, as Appl. No. 16/544,576.
Claims priority of provisional application 62/782,605, filed on Dec. 20, 2018.
Prior Publication US 2020/0202337 A1, Jun. 25, 2020
This patent is subject to a terminal disclaimer.
Int. Cl. G06Q 20/00 (2012.01); G06N 20/00 (2019.01); G06Q 20/36 (2012.01); G06Q 40/04 (2012.01); G06Q 40/12 (2023.01)
CPC G06Q 20/3678 (2013.01) [G06N 20/00 (2019.01); G06Q 40/04 (2013.01); G06Q 40/123 (2013.12)] 20 Claims
OG exemplary drawing
 
1. A method, comprising:
storing, by a computer system, in an acquisition transaction queue, a plurality of cryptocurrency acquisition transactions in an ascending order of respective transaction timestamps;
storing, in a disposal transaction queue, a plurality of cryptocurrency disposal transactions in an ascending order of respective transaction timestamps;
selecting a cryptocurrency disposal transaction of the plurality of cryptocurrency disposal transactions;
selecting, from the plurality of cryptocurrency acquisition transactions, one or more candidate cryptocurrency acquisition transactions, such that a timestamp of each candidate cryptocurrency acquisition transaction is less than a timestamp of the cryptocurrency disposal transaction;
storing the one or more candidate cryptocurrency acquisition transactions in a double-ended queue that preserves a sorting order of the acquisition transaction queue,
wherein the double-ended queue has a head pointer and a tail pointer;
matching, by traversing the double-ended queue in a direction defined by an applicable accounting rule, the selected cryptocurrency disposal transaction with at least a subset of the one or more candidate cryptocurrency acquisition transactions, wherein the matching further comprises:
selecting a cryptocurrency acquisition transaction from the double-ended queue;
responsive to determining that an amount of the selected cryptocurrency acquisition transaction is less than or equal to a difference between an amount of the selected cryptocurrency disposal transaction and a running total amount of matched cryptocurrency acquisition transactions:
increasing the running total amount of matched cryptocurrency acquisition transactions by the amount of the selected cryptocurrency acquisition transaction;
removing the selected cryptocurrency acquisition transaction from the double-ended queue; and
advancing the head pointer of the double-ended queue to a transaction that follows the selected cryptocurrency acquisition transaction;
responsive to determining that the amount of the selected cryptocurrency acquisition transaction exceeds the difference between the amount of the selected cryptocurrency disposal transaction and the running total amount of matched cryptocurrency acquisition transactions:
modifying the selected cryptocurrency acquisition transaction by reducing the amount of the selected cryptocurrency acquisition transaction by the difference between the amount of the selected cryptocurrency disposal transaction and the running total amount of matched cryptocurrency acquisition transactions;
leaving the modified cryptocurrency acquisition transaction in the double-ended queue; and
advancing the head pointer of the double-ended queue to point to the modified cryptocurrency acquisition transaction;
responsive to determining that the running total amount of matched cryptocurrency acquisition transactions, after performing the matching, is less than the amount of the selected cryptocurrency disposal transaction:
updating a current acquisition transaction pointer in the double-ended queue to point to a next acquisition transaction such that a next matching operation is performed for a next acquisition target;
responsive to determining that the running total amount of matched cryptocurrency acquisition transactions, after performing the matching, is equal to the amount of the selected cryptocurrency disposal transaction:
updating a current transaction pointer in the disposal queue to point to a next disposal transaction such that a next matching operation is performed for the next disposal target;
determining, for each of the matched transactions, a corresponding fiat currency transaction amount;
computing, using the fiat currency transaction amounts, one of: a gain associated with the selected cryptocurrency disposal transaction or a loss associated with the selected cryptocurrency disposal transaction; and
generating a report reflecting one of: the gain associated with the selected cryptocurrency disposal transaction or the loss associated with the selected cryptocurrency disposal transaction.