CAFECA-IO / BAIFA

https://baifa.vercel.app
GNU General Public License v3.0
0 stars 0 forks source link

修改現金流量表的API需求 #183

Closed TzuHanLiang closed 10 months ago

TzuHanLiang commented 1 year ago

以一個提供入金、出金、現貨交易、CFD交易等的加密貨幣交易所來說,現金流量表會有以下必要的資料:

  1. 營運活動

    • 法幣客戶入金:客戶將法定貨幣存入交易所的金額。
    • 加密貨幣客戶入金:客戶將加密貨幣存入交易所的金額。
    • 法幣客戶出金:客戶從交易所提取法定貨幣的金額。
    • 加密貨幣客戶出金:客戶從交易所提取加密貨幣的金額。
    • 交易手續費收入:交易所從現貨交易和CFD交易中賺取的手續費。
    • 交易收入:給用戶提供的價差跟每筆交易收的費用。
    • 交易費用:支付為了交易服務產生的費用。
    • 利息費用:利息的支付。
    • 持有的加密貨幣:交易所持有的其他加密貨幣。
    • 用法幣購買加密貨幣:交易所購買的加密貨幣。
    • 賣掉加密貨幣獲得法幣:交易所賣出的加密貨幣。
  2. 投資活動

  3. 籌資活動

    • 從發行普通股所得的資金(xProceeds from issuance of common stockx or xCash received from issuing common stockx)
    • 增資:交易所從股東或投資者處獲得的資金。
    • 償還債務:交易所償還的貸款或其他債務。
    • 股利的支付:支付給股東的股利。
    • 庫藏股:交易所購買或出售的自家股票。

回傳的資料範例:

加密貨幣交易所現金流量表 (Cryptocurrency Exchange Cash Flow Statement)

營運活動 (Operating Activities):
法幣由客戶存入 (Fiat Deposited by Customers):+5,000,000元
加密貨幣由客戶存入 (Crypto Deposited by Customers):+5,000,000元 (等值於USD)
法幣由客戶提取 (Fiat Withdrawn by Customers):-4,000,000元
加密貨幣由客戶提取 (Crypto Withdrawn by Customers):-4,000,000元 (等值於USD)
交易手續費收入 (Transaction Fee Income):+500,000元
交易收入 (Trading Income):+300,000元
交易費用 (Trading Expenses):-100,000元
利息費用 (Interest Expense):-50,000元

投資活動 (Investing Activities):
(此部分暫無資料 No data available)

籌資活動 (Financing Activities):
增資 (Capital Increase):+5,000,000元
償還債務 (Debt Repayment):-3,000,000元
股利的支付 (Dividend Payments):-500,000元

API回傳的資料範例:

{
  "title": "加密貨幣交易所現金流量表 (Cryptocurrency Exchange Cash Flow Statement)",
  "operatingActivities": {
    "fiatCustomerDeposits": {
      "totalDepositAmountInUSD": 5000000,
      "details": [
        {
          "amount": 5000000,
          "currency": "USD",
          "amountInUSD": 5000000
        }
      ]
    },
    "cryptoCustomerDeposits": {
      "totalDepositAmountInUSD": 5500000,
      "details": [
        {
          "amount": 10,
          "currency": "BTC",
          "amountInUSD": 450000
        },
        {
          "amount": 500,
          "currency": "ETH",
          "amountInUSD": 1500000
        },
        {
          "amount": 1000000,
          "currency": "USDT",
          "amountInUSD": 1000000
        }
      ]
    },
    "customerWithdrawals": {
      "totalWithdrawalAmountInUSD": 450000,
      "details": [
        {
          "amount": 10,
          "currency": "BTC",
          "amountInUSD": 450000
        }
      ]
    },
    "transactionFeeIncome": {
      "totalFeeAmountInUSD": 1500000,
      "details": [
        {
          "amount": 500,
          "currency": "ETH",
          "amountInUSD": 1500000
        }
      ]
    },
    "paymentsToSuppliersAndEmployees": {
      "totalPaymentAmountInUSD": 1000000,
      "details": [
        {
          "amount": 1000000,
          "currency": "USDT",
          "amountInUSD": 1000000
        }
      ]
    },
    "tradingIncome": {
      "totalIncomeAmountInUSD": 300000,
      "details": [
        {
          "amount": 300000,
          "currency": "USD",
          "amountInUSD": 300000
        }
      ]
    },
    "tradingExpenses": {
      "totalExpenseAmountInUSD": 300000,
      "details": [
        {
          "amount": 100,
          "currency": "ETH",
          "amountInUSD": 300000
        }
      ]
    },
    "interestExpense": {
      "totalInterestAmountInUSD": 450000,
      "details": [
        {
          "amount": 50,
          "currency": "BTC",
          "amountInUSD": 450000
        }
      ]
    }
  },
  "investingActivities": {
    "data": "此部分暫無資料"
  },
  "financingActivities": {
    "capitalIncrease": {
      "totalCapitalAmountInUSD": 5000000,
      "details": [
        {
          "amount": 5000000,
          "currency": "USD",
          "amountInUSD": 5000000
        }
      ]
    },
    "debtRepayment": {
      "totalDebtAmountInUSD": 135000,
      "details": [
        {
          "amount": 3,
          "currency": "BTC",
          "amountInUSD": 135000
        }
      ]
    },
    "dividendPayments": {
      "totalDividendAmountInUSD": 1500000,
      "details": [
        {
          "amount": 500,
          "currency": "ETH",
          "amountInUSD": 1500000
        }
      ]
    }
  }
}
TzuHanLiang commented 1 year ago

take 2hrs,整理上述資料,再麻煩 @arealclimber 補充及提出需要調整的部份

TzuHanLiang commented 1 year ago

API回傳的資料範例修改成如下格式:

{
  "id": "123456789",
  "date": "2023-08-25T00:00:00.000Z",
  "operatingActivities": {
    "fiatDepositedByCustomers": {
      "totalAmountFairValue": 5000000,
      "totalAmountCostValue": 5000000,
      "items": {
        "USD": {
          "amount": 5000000,
          "fairValue": 5000000,
          "costValue": 5000000
        }
      }
    },
    "cryptoDepositedByCustomers": {
      "totalAmountFairValue": 5500000,
      "totalAmountCostValue": 5500000,
      "items": {
        "BTC": {
          "amount": 10,
          "fairValue": 450000,
          "costValue": 450000
        },
        "ETH": {
          "amount": 500,
          "fairValue": 1500000,
          "costValue": 1500000
        },
        "USDT": {
          "amount": 1000000,
          "fairValue": 1000000,
          "costValue": 1000000
        }
      }
    },
    "fiatWithdrawnByCustomers": {
      "totalAmountFairValue": 4000000,
      "totalAmountCostValue": 4000000,
      "items": {
        "USD": {
          "amount": 4000000,
          "fairValue": 4000000,
          "costValue": 4000000
        }
      }
    },
    "cryptoWithdrawnByCustomers": {
      "totalAmountFairValue": 4000000,
      "totalAmountCostValue": 4000000,
      "items": {
        "BTC": {
          "amount": 8,
          "fairValue": 360000,
          "costValue": 360000
        },
        "ETH": {
          "amount": 400,
          "fairValue": 1200000,
          "costValue": 1200000
        },
        "USDT": {
          "amount": 800000,
          "fairValue": 800000,
          "costValue": 800000
        }
      }
    },
    "transactionFeeIncome": {
      "totalAmountFairValue": 1500000,
      "totalAmountCostValue": 1500000,
      "items": {
        "ETH": {
          "amount": 500,
          "fairValue": 1500000,
          "costValue": 1500000
        }
      }
    },
    "tradingIncome": {
      "totalAmountFairValue": 300000,
      "totalAmountCostValue": 300000,
      "items": {
        "USD": {
          "amount": 300000,
          "fairValue": 300000,
          "costValue": 300000
        }
      }
    },
    "tradingExpenses": {
      "totalAmountFairValue": 300000,
      "totalAmountCostValue": 300000,
      "items": {
        "ETH": {
          "amount": 100,
          "fairValue": 300000,
          "costValue": 300000
        }
      }
    },
    "interestExpense": {
      "totalAmountFairValue": 450000,
      "totalAmountCostValue": 450000,
      "items": {
        "BTC": {
          "amount": 50,
          "fairValue": 450000,
          "costValue": 450000
        }
      }
    }
  },
  "investingActivities": {},
  "financingActivities": {
    "capitalIncrease": {
      "totalAmountFairValue": 5000000,
      "totalAmountCostValue": 5000000,
      "items": {
        "USD": {
          "amount": 5000000,
          "fairValue": 5000000,
          "costValue": 5000000
        }
      }
    },
    "debtRepayment": {
      "totalAmountFairValue": 135000,
      "totalAmountCostValue": 135000,
      "items": {
        "BTC": {
          "amount": 3,
          "fairValue": 135000,
          "costValue": 135000
        }
      }
    },
    "dividendPayments": {
      "totalAmountFairValue": 1500000,
      "totalAmountCostValue": 1500000,
      "items": {
        "ETH": {
          "amount": 500,
          "fairValue": 1500000,
          "costValue": 1500000
        }
      }
    },
    "proceedsFromIssuanceOfCommonStock": {
      "totalAmountFairValue": 0,
      "totalAmountCostValue": 0,
      "items": {}
    },
    "treasuryStock": {
      "totalAmountFairValue": 0,
      "totalAmountCostValue": 0,
      "items": {}
    }
  },
  "nonCashOperatingActivities": {}
}
TzuHanLiang commented 1 year ago

export class CashFlowDto { id: string; date: Date; operatingActivities: OperatingActivitiesDto; investingActivities: InvestingActivitiesDto; financingActivities: FinancingActivitiesDto; nonCashOperatingActivities: NonCashOperatingActivitiesDto; }

export class OperatingActivitiesDto { fiatDepositedByCustomers: FinancialItemDto; cryptoDepositedByCustomers: FinancialItemDto; fiatWithdrawnByCustomers: FinancialItemDto; cryptoWithdrawnByCustomers: FinancialItemDto; transactionFeeIncome: FinancialItemDto; tradingIncome: FinancialItemDto; tradingExpenses: FinancialItemDto; interestExpense: FinancialItemDto; }

export class InvestingActivitiesDto { // 暫無資料,可以根據需要添加屬性 }

export class FinancingActivitiesDto { capitalIncrease: FinancialItemDto; debtRepayment: FinancialItemDto; dividendPayments: FinancialItemDto; proceedsFromIssuanceOfCommonStock: FinancialItemDto; // 從發行普通股所得的資金 treasuryStock: FinancialItemDto; // 庫藏股 }

export class NonCashOperatingActivitiesDto { // 暫無資料,可以根據需要添加屬性 }

export class FinancialItemDto { totalAmountFairValue: number; totalAmountCostValue: number; items: {

  amount: number;
  fairValue: number;
  costValue: number;
};

}; }

arealclimber commented 1 year ago

根據上週五討論結果,將會計科目拆得更細,擷取 KM 營運活動對照表

營運活動 (Operating Activities)

Item Definition
User deposit 用戶的法幣存款
User crypto deposit 用戶的加密貨幣存款
User withdrawal 用戶的法幣提款
User crypto withdrawal 用戶的加密貨幣提款
Cryptocurrencies 交易所持有的加密貨幣
Purchase of cryptocurrencies 用法幣購買加密貨幣
Disposal of cryptocurrencies 賣掉加密貨幣獲得法幣
Insurance fund for perpetual contracts 為了保證永續合約正常運作的基金
Cash received from customers as transaction fee 從用戶那邊賺到的交易手續費,以現金形式
Cash received from customers for liquidation in CFD trading 從客戶收到的用於 CFD 交易清算的現金
Cash received from customers for liquidation in perpetual contract 從客戶收到的用於永續合約交易清算的現金
Cash paid to customers as rebates for transaction fees 用現金及約當現金支付給用戶的手續費返傭
Cash paid to customers for perpetual contract profits 用現金及約當現金支付給用戶的永續合約利潤
Cash paid to customers for CFD trading profits 支付給客戶的 CFD 交易利潤現金
Cash paid to customers for funding rates in perpetual contract 用現金及約當現金支付給用戶的永續合約資金費率

投資活動 (Investing Activities)

籌資活動 (Financing Activities)

Item Definition
Proceeds from issuance of common stock 從發行普通股所得的資金
Long-Term Debt 長期債務的增加或減少
Short-Term Borrowings 短期債務的增加或減少
Payments of dividends 股利的支付
Treasury Stock 購買或出售自家股票

非現金的營運活動補充 (Supplemental schedule of non-cash operating activities)

Item Definition
Purchase of cryptocurrencies with non-cash consideration 用穩定幣買加密貨幣,例如用 USDT 買 BTC
Disposal of cryptocurrencies for non-cash consideration 賣加密貨幣得到穩定幣,例如賣掉 BTC 持有 USDT
Insurance fund for perpetual contracts with non-cash consideration 為了保證永續合約正常運作的基金,以加密貨幣形式
Cryptocurrencies received from customers as transaction fees 從用戶那邊賺到的交易手續費,以加密貨幣形式
Cryptocurrencies received from customers for liquidation in perpetual contract 從客戶收到的用於永續合約交易清算的加密貨幣
Cryptocurrencies received from customers for liquidation in CFD trading 從客戶收到的用於 CFD 交易清算的加密貨幣
Cryptocurrencies paid to customers as rebates for transaction fees 用加密貨幣支付給用戶的手續費返傭
Cryptocurrencies paid to customers for perpetual contract profits 用加密貨幣支付給用戶的永續合約利潤
Cryptocurrencies paid to suppliers for expenses 向供應商支付費用的加密貨幣
Cryptocurrencies paid to customers for CFD trading profits 支付給客戶的 CFD 交易利潤加密貨幣
Cryptocurrencies paid to customers for funding rates in perpetual contract 用加密貨幣支付給用戶的永續合約資金費率
Cryptocurrencies paid to customers for profits in perpetual contract 用加密貨幣支付給客戶的永續合約交易利潤
TzuHanLiang commented 1 year ago

@arealclimber 因為 balanceSheet 裡面已經用過 user Deposit ,所以我建議把這裡的 user Depoit 改成動詞的形式,並把幣種類型加上去 Crypto Deposited by Customers、Fiat Deposited by Customers ,以及 user withdrawal 改成 Fiat Withdrawn by Customers、Crypto Withdrawn by Customers

arealclimber commented 1 year ago

@TzuHanLiang 以下為更改後的結果,更動內容為:

  1. 將 Fiat 字詞改成 Cash,以及將 Cryptocurrencies deposited by customers 跟 Cryptocurrencies withdrawn by customers 放到非現金營運活動上
  2. 將原本的 Cryptocurrencies 交易所持有的加密貨幣 拆成 流入跟流出,並歸在非現金營運活動上
  3. 新增其他補充項目,其中有匯率造成的資產升值或貶值、報表一開始及結束時的現金總量、這段期間的現金流量淨增加或淨減少,並區分現金跟加密貨幣

營運活動 (Operating Activities)

Item | Definition -- | -- Cash deposited by customers | 用戶的現金存款 Cash withdrawn by customers | 用戶的現金提款 Purchase of cryptocurrencies | 用法幣購買加密貨幣 Disposal of cryptocurrencies | 賣掉加密貨幣獲得法幣 Cash paid to suppliers for expenses | 向供應商支付費用的現金 Cash received from customers as transaction fee | 從用戶那邊賺到的交易手續費,以現金形式 Cash received from customers for liquidation in CFD trading | 從客戶收到的用於 CFD 交易清算的現金 Cash paid to customers as rebates for transaction fees | 用現金及約當現金支付給用戶的手續費返傭 Cash paid to customers for CFD trading profits | 支付給客戶的 CFD 交易利潤現金 Insurance fund for perpetual contracts | 為了保證永續合約正常運作的基金 Cash paid to customers for funding rates in perpetual contract | 用現金及約當現金支付給用戶的永續合約資金費率 Cash paid to customers for perpetual contract profits | 用現金及約當現金支付給用戶的永續合約利潤 Cash received from customers for liquidation in perpetual contract | 從客戶收到的用於永續合約交易清算的現金

投資活動 (Investing Activities)

籌資活動 (Financing Activities)

Item | Definition -- | -- Proceeds from issuance of common stock | 從發行普通股所得的資金 Long-Term Debt | 長期債務的增加或減少 Short-Term Borrowings | 短期債務的增加或減少 Payments of dividends | 股利的支付 Treasury Stock | 購買或出售自家股票

非現金的營運活動補充 (Supplemental schedule of non-cash operating activities)

Item | Definition -- | -- Cryptocurrencies deposited by customers | 用戶的加密貨幣存款 Cryptocurrencies withdrawn by customers | 用戶的加密貨幣提款 Cryptocurrency inflows | 交易所本身持有的加密貨幣增加 Cryptocurrency outflows | 交易所本身持有的加密貨幣減少 Purchase of cryptocurrencies with non-cash consideration | 用穩定幣買加密貨幣,例如用 USDT 買 BTC Disposal of cryptocurrencies for non-cash consideration | 賣加密貨幣得到穩定幣,例如賣掉 BTC 持有 USDT Cryptocurrencies received from customers as transaction fees | 從用戶那邊賺到的交易手續費,以加密貨幣形式 Cryptocurrencies received from customers for liquidation in CFD trading | 從客戶收到的用於 CFD 交易清算的加密貨幣 Cryptocurrencies paid to customers as rebates for transaction fees | 用加密貨幣支付給用戶的手續費返傭 Cryptocurrencies paid to suppliers for expenses | 向供應商支付費用的加密貨幣 Cryptocurrencies paid to customers for CFD trading profits | 支付給客戶的 CFD 交易利潤加密貨幣 Insurance fund for perpetual contracts with non-cash consideration | 為了保證永續合約正常運作的基金,以加密貨幣形式 Cryptocurrencies received from customers for liquidation in perpetual contract | 從客戶收到的用於永續合約交易清算的加密貨幣 Cryptocurrencies paid to customers for perpetual contract profits | 用加密貨幣支付給用戶的永續合約利潤 Cryptocurrencies paid to customers for funding rates in perpetual contract | 用加密貨幣支付給用戶的永續合約資金費率 Cryptocurrencies paid to customers for profits in perpetual contract | 用加密貨幣支付給客戶的永續合約交易利潤

其他補充項目

Item | Definition -- | -- Effect of exchange rates on cash, cash equivalents, and restricted cash | 交易所本身持有的資產因匯率造成的價值變化 Cash, cash equivalents, and restricted cash, beginning of period | 報表起始日的現金及約當現金 Cash, cash equivalents, and restricted cash, end of period | 報表結束日的現金及約當現金 Net increase(decrease) in cash, cash equivalents, and restricted cash | 現金、現金等價物及受限現金的淨增加(淨減少) Item | Definition -- | -- Valuation adjustment for cryptocurrencies | 交易所本身持有的加密貨幣因匯率造成的價值變化 Cryptocurrencies, beginning of period | 報表起始日的加密貨幣 Cryptocurrencies, end of period | 報表結束日的加密貨幣 Net increase(decrease) in cryptocurrencies | 加密貨幣的淨增加(淨減少)
TzuHanLiang commented 1 year ago

這是根據 @arealclimber 提供的KM 營運活動對照表,生成的 API 回傳範例,請 @arealclimber 檢查是否符合新的現金流量表 API 的需求

{
  "success": true,
  "code": "00000000",
  "reason": "ERROR_MESSAGE.SUCCESS",
  "data": {
    "id": "cash_flow-1234567890",
    "date": "2023-08-25T00:00:00.000Z",
    "operatingActivities": {
      "cashDepositedByCustomers": {
        "totalAmountFairValue": 1000000,
        "items": {
          "USD": {
            "amount": 1000000,
            "fairValue": 1000000
          }
        }
      },
      "cashWithdrawnByCustomers": {
        "totalAmountFairValue": 800000,
        "items": {
          "USD": {
            "amount": 800000,
            "fairValue": 800000
          }
        }
      },
      "purchaseOfCryptocurrencies": {
        "totalAmountFairValue": 500000,
        "items": {
          "BTC": {
            "amount": 10,
            "fairValue": 50000,
            "costValue": 45000
          }
        }
      },
      "disposalOfCryptocurrencies": {
        "totalAmountFairValue": 450000,
        "items": {
          "BTC": {
            "amount": 9,
            "fairValue": 50000,
            "costValue": 45000
          }
        }
      },
      "cashPaidToSuppliersForExpenses": {
        "totalAmountFairValue": 100000,
        "items": {
          "USD": {
            "amount": 100000,
            "fairValue": 100000
          }
        }
      },
      "cashReceivedFromCustomersAsTransactionFee": {
        "totalAmountFairValue": 5000,
        "items": {
          "USD": {
            "amount": 5000,
            "fairValue": 5000
          }
        }
      },
      "cashReceivedFromCustomersForLiquidationInCFDTrading": {
        "totalAmountFairValue": 200000,
        "items": {
          "USD": {
            "amount": 200000,
            "fairValue": 200000
          }
        }
      },
      "cashPaidToCustomersAsRebatesForTransactionFees": {
        "totalAmountFairValue": 1000,
        "items": {
          "USD": {
            "amount": 1000,
            "fairValue": 1000
          }
        }
      },
      "cashPaidToCustomersForCFDTradingProfits": {
        "totalAmountFairValue": 150000,
        "items": {
          "USD": {
            "amount": 150000,
            "fairValue": 150000
          }
        }
      },
      "insuranceFundForPerpetualContracts": {
        "totalAmountFairValue": 50000,
        "items": {
          "USD": {
            "amount": 50000,
            "fairValue": 50000
          }
        }
      },
      "cashPaidToCustomersForFundingRatesInPerpetualContract": {
        "totalAmountFairValue": 10000,
        "items": {
          "USD": {
            "amount": 10000,
            "fairValue": 10000
          }
        }
      },
      "cashPaidToCustomersForPerpetualContractProfits": {
        "totalAmountFairValue": 120000,
        "items": {
          "USD": {
            "amount": 120000,
            "fairValue": 120000
          }
        }
      },
      "cashReceivedFromCustomersForLiquidationInPerpetualContract": {
        "totalAmountFairValue": 130000,
        "items": {
          "USD": {
            "amount": 130000,
            "fairValue": 130000
          }
        }
      }
    },
    "investingActivities": {
      "details": "略"
    },
    "financingActivities": {
      "proceedsFromIssuanceOfCommonStock": {
        "totalAmountFairValue": 500000,
        "items": {
          "USD": {
            "amount": 500000,
            "fairValue": 500000
          }
        }
      },
      "longTermDebt": {
        "totalAmountFairValue": 300000,
        "items": {
          "USD": {
            "amount": 300000,
            "fairValue": 300000
          }
        }
      },
      "shortTermBorrowings": {
        "totalAmountFairValue": 100000,
        "items": {
          "USD": {
            "amount": 100000,
            "fairValue": 100000
          }
        }
      },
      "paymentsOfDividends": {
        "totalAmountFairValue": 50000,
        "items": {
          "USD": {
            "amount": 50000,
            "fairValue": 50000
          }
        }
      },
      "treasuryStock": {
        "totalAmountFairValue": 200000,
        "items": {
          "USD": {
            "amount": 200000,
            "fairValue": 200000
          }
        }
      }
    },
    "supplementalScheduleOfNonCashOperatingActivities": {
      "cryptocurrenciesDepositedByCustomers": {
        "totalAmountFairValue": 10,
        "items": {
          "BTC": {
            "amount": 10,
            "fairValue": 50000,
            "costValue": 48000
          }
        }
      },
      "cryptocurrenciesWithdrawnByCustomers": {
        "totalAmountFairValue": 8,
        "items": {
          "BTC": {
            "amount": 8,
            "fairValue": 40000,
            "costValue": 38000
          }
        }
      },
      "cryptocurrencyInflows": {
        "totalAmountFairValue": 5,
        "items": {
          "BTC": {
            "amount": 5,
            "fairValue": 25000,
            "costValue": 24000
          }
        }
      },
      "cryptocurrencyOutflows": {
        "totalAmountFairValue": 3,
        "items": {
          "BTC": {
            "amount": 3,
            "fairValue": 15000,
            "costValue": 14500
          }
        }
      },
      "purchaseOfCryptocurrenciesWithNonCashConsideration": {
        "totalAmountFairValue": 2,
        "items": {
          "BTC": {
            "amount": 2,
            "fairValue": 10000,
            "costValue": 9800
          }
        }
      },
      "disposalOfCryptocurrenciesForNonCashConsideration": {
        "totalAmountFairValue": 1,
        "items": {
          "BTC": {
            "amount": 1,
            "fairValue": 5000,
            "costValue": 4900
          }
        }
      },
      "cryptocurrenciesReceivedFromCustomersAsTransactionFees": {
        "totalAmountFairValue": 0.5,
        "items": {
          "BTC": {
            "amount": 0.5,
            "fairValue": 2500,
            "costValue": 2400
          }
        }
      },
      "cryptocurrenciesReceivedFromCustomersForLiquidationInCFDTrading": {
        "totalAmountFairValue": 0.3,
        "items": {
          "BTC": {
            "amount": 0.3,
            "fairValue": 1500,
            "costValue": 1450
          }
        }
      },
      "cryptocurrenciesPaidToCustomersAsRebatesForTransactionFees": {
        "totalAmountFairValue": 0.1,
        "items": {
          "BTC": {
            "amount": 0.1,
            "fairValue": 500,
            "costValue": 480
          }
        }
      },
      "cryptocurrenciesPaidToSuppliersForExpenses": {
        "totalAmountFairValue": 0.2,
        "items": {
          "BTC": {
            "amount": 0.2,
            "fairValue": 1000,
            "costValue": 960
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForCFDTradingProfits": {
        "totalAmountFairValue": 0.4,
        "items": {
          "BTC": {
            "amount": 0.4,
            "fairValue": 2000,
            "costValue": 1920
          }
        }
      },
      "insuranceFundForPerpetualContractsWithNonCashConsideration": {
        "totalAmountFairValue": 0.6,
        "items": {
          "BTC": {
            "amount": 0.6,
            "fairValue": 3000,
            "costValue": 2880
          }
        }
      },
      "cryptocurrenciesReceivedFromCustomersForLiquidationInPerpetualContract": {
        "totalAmountFairValue": 0.7,
        "items": {
          "BTC": {
            "amount": 0.7,
            "fairValue": 3500,
            "costValue": 3360
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForPerpetualContractProfits": {
        "totalAmountFairValue": 0.8,
        "items": {
          "BTC": {
            "amount": 0.8,
            "fairValue": 4000,
            "costValue": 3840
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForFundingRatesInPerpetualContract": {
        "totalAmountFairValue": 0.9,
        "items": {
          "BTC": {
            "amount": 0.9,
            "fairValue": 4500,
            "costValue": 4320
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForProfitsInPerpetualContract": {
        "totalAmountFairValue": 1.0,
        "items": {
          "BTC": {
            "amount": 1.0,
            "fairValue": 5000,
            "costValue": 4800
          }
        }
      }
    },
    "otherSupplementaryItems": {
      "relatedToCash": {
        "effectOfExchangeRatesOnCash": {
          "totalAmountFairValue": 500,
          "items": {
            "USD": {
              "amount": 500,
              "fairValue": 500
            }
          }
        },
        "cashCashEquivalentsAndRestrictedCashBeginningOfPeriod": {
          "totalAmountFairValue": 1000000,
          "items": {
            "USD": {
              "amount": 1000000,
              "fairValue": 1000000
            }
          }
        },
        "cashCashEquivalentsAndRestrictedCashEndOfPeriod": {
          "totalAmountFairValue": 1100000,
          "items": {
            "USD": {
              "amount": 1100000,
              "fairValue": 1100000
            }
          }
        },
        "netIncreaseDecreaseInCashCashEquivalentsAndRestrictedCash": {
          "totalAmountFairValue": 100000,
          "items": {
            "USD": {
              "amount": 100000,
              "fairValue": 100000
            }
          }
        }
      },
      "relatedToNonCash": {
        "valuationAdjustmentForCryptocurrencies": {
          "totalAmountFairValue": 5,
          "items": {
            "BTC": {
              "amount": 5,
              "fairValue": 250,
              "costValue": 230
            }
          }
        },
        "cryptocurrenciesBeginningOfPeriod": {
          "totalAmountFairValue": 50,
          "items": {
            "BTC": {
              "amount": 50,
              "fairValue": 2500,
              "costValue": 2400
            }
          }
        },
        "cryptocurrenciesEndOfPeriod": {
          "totalAmountFairValue": 55,
          "items": {
            "BTC": {
              "amount": 55,
              "fairValue": 2750,
              "costValue": 2640
            }
          }
        },
        "netIncreaseDecreaseInCryptocurrencies": {
          "totalAmountFairValue": 5,
          "items": {
            "BTC": {
              "amount": 5,
              "fairValue": 250,
              "costValue": 240
            }
          }
        }
      }
    }
  }
}
TzuHanLiang commented 1 year ago

不把加密貨幣拆成非現金而是當作現金的整合版本

{
  "success": true,
  "code": "00000000",
  "reason": "ERROR_MESSAGE.SUCCESS",
  "data": {
    "id": "cash_flow-1234567890",
    "date": "2023-08-25T00:00:00.000Z",
    "operatingActivities": {
      "depositedByCustomers": {
        "totalAmountFairValue": 1000010,
        "cash": {
          "totalAmountFairValue": 1000000,
          "items": {
            "USD": {
              "amount": 1000000,
              "fairValue": 1000000
            }
          }
        },
        "cryptocurrency": {
          "totalAmountFairValue": 10,
          "items": {
            "BTC": {
              "amount": 10,
              "fairValue": 50000,
              "costValue": 48000
            }
          }
        }
      },
      "withdrawnByCustomers": {
        "totalAmountFairValue": 800008,
        "cash": {
          "totalAmountFairValue": 800000,
          "items": {
            "USD": {
              "amount": 800000,
              "fairValue": 800000
            }
          }
        },
        "cryptocurrency": {
          "totalAmountFairValue": 8,
          "items": {
            "BTC": {
              "amount": 8,
              "fairValue": 40000,
              "costValue": 38000
            }
          }
        }
      },
      // 假設這裡還有其他項目,格式會與上述相同
    },
    "investingActivities": {
      // 假設這裡有其他項目,格式會與上述相同
    },
    "financingActivities": {
      "proceedsFromIssuanceOfCommonStock": {
        "totalAmountFairValue": 500000,
        "items": {
          "USD": {
            "amount": 500000,
            "fairValue": 500000
          }
        }
      },
      // 假設這裡還有其他項目,格式會與上述相同
    },
    "supplementalScheduleOfNonCashOperatingActivities": {
      // 假設這裡有其他項目,格式會與上述相同
    },
    "otherSupplementaryItems": {
      "relatedToCash": {
        "effectOfExchangeRatesOnCash": {
          "totalAmountFairValue": 500,
          "items": {
            "USD": {
              "amount": 500,
              "fairValue": 500
            }
          }
        },
        // 假設這裡還有其他項目,格式會與上述相同
      },
      "relatedToCryptocurrency": {
        // 假設這裡有其他項目,格式會興上述相同
      }
    }
  }
}
arealclimber commented 1 year ago

這是根據 @arealclimber 提供的KM 營運活動對照表,生成的 API 回傳範例,請 @arealclimber 檢查是否符合新的現金流量表 API 的需求

{
  "success": true,
  "code": "00000000",
  "reason": "ERROR_MESSAGE.SUCCESS",
  "data": {
    "id": "cash_flow-1234567890",
    "date": "2023-08-25T00:00:00.000Z",
    "operatingActivities": {
      "cashDepositedByCustomers": {
        "totalAmountFairValue": 1000000,
        "items": {
          "USD": {
            "amount": 1000000,
            "fairValue": 1000000
          }
        }
      },
      "cashWithdrawnByCustomers": {
        "totalAmountFairValue": 800000,
        "items": {
          "USD": {
            "amount": 800000,
            "fairValue": 800000
          }
        }
      },
      "purchaseOfCryptocurrencies": {
        "totalAmountFairValue": 500000,
        "items": {
          "BTC": {
            "amount": 10,
            "fairValue": 50000,
            "costValue": 45000
          }
        }
      },
      "disposalOfCryptocurrencies": {
        "totalAmountFairValue": 450000,
        "items": {
          "BTC": {
            "amount": 9,
            "fairValue": 50000,
            "costValue": 45000
          }
        }
      },
      "cashPaidToSuppliersForExpenses": {
        "totalAmountFairValue": 100000,
        "items": {
          "USD": {
            "amount": 100000,
            "fairValue": 100000
          }
        }
      },
      "cashReceivedFromCustomersAsTransactionFee": {
        "totalAmountFairValue": 5000,
        "items": {
          "USD": {
            "amount": 5000,
            "fairValue": 5000
          }
        }
      },
      "cashReceivedFromCustomersForLiquidationInCFDTrading": {
        "totalAmountFairValue": 200000,
        "items": {
          "USD": {
            "amount": 200000,
            "fairValue": 200000
          }
        }
      },
      "cashPaidToCustomersAsRebatesForTransactionFees": {
        "totalAmountFairValue": 1000,
        "items": {
          "USD": {
            "amount": 1000,
            "fairValue": 1000
          }
        }
      },
      "cashPaidToCustomersForCFDTradingProfits": {
        "totalAmountFairValue": 150000,
        "items": {
          "USD": {
            "amount": 150000,
            "fairValue": 150000
          }
        }
      },
      "insuranceFundForPerpetualContracts": {
        "totalAmountFairValue": 50000,
        "items": {
          "USD": {
            "amount": 50000,
            "fairValue": 50000
          }
        }
      },
      "cashPaidToCustomersForFundingRatesInPerpetualContract": {
        "totalAmountFairValue": 10000,
        "items": {
          "USD": {
            "amount": 10000,
            "fairValue": 10000
          }
        }
      },
      "cashPaidToCustomersForPerpetualContractProfits": {
        "totalAmountFairValue": 120000,
        "items": {
          "USD": {
            "amount": 120000,
            "fairValue": 120000
          }
        }
      },
      "cashReceivedFromCustomersForLiquidationInPerpetualContract": {
        "totalAmountFairValue": 130000,
        "items": {
          "USD": {
            "amount": 130000,
            "fairValue": 130000
          }
        }
      }
    },
    "investingActivities": {
      "details": "略"
    },
    "financingActivities": {
      "proceedsFromIssuanceOfCommonStock": {
        "totalAmountFairValue": 500000,
        "items": {
          "USD": {
            "amount": 500000,
            "fairValue": 500000
          }
        }
      },
      "longTermDebt": {
        "totalAmountFairValue": 300000,
        "items": {
          "USD": {
            "amount": 300000,
            "fairValue": 300000
          }
        }
      },
      "shortTermBorrowings": {
        "totalAmountFairValue": 100000,
        "items": {
          "USD": {
            "amount": 100000,
            "fairValue": 100000
          }
        }
      },
      "paymentsOfDividends": {
        "totalAmountFairValue": 50000,
        "items": {
          "USD": {
            "amount": 50000,
            "fairValue": 50000
          }
        }
      },
      "treasuryStock": {
        "totalAmountFairValue": 200000,
        "items": {
          "USD": {
            "amount": 200000,
            "fairValue": 200000
          }
        }
      }
    },
    "supplementalScheduleOfNonCashOperatingActivities": {
      "cryptocurrenciesDepositedByCustomers": {
        "totalAmountFairValue": 10,
        "items": {
          "BTC": {
            "amount": 10,
            "fairValue": 50000,
            "costValue": 48000
          }
        }
      },
      "cryptocurrenciesWithdrawnByCustomers": {
        "totalAmountFairValue": 8,
        "items": {
          "BTC": {
            "amount": 8,
            "fairValue": 40000,
            "costValue": 38000
          }
        }
      },
      "cryptocurrencyInflows": {
        "totalAmountFairValue": 5,
        "items": {
          "BTC": {
            "amount": 5,
            "fairValue": 25000,
            "costValue": 24000
          }
        }
      },
      "cryptocurrencyOutflows": {
        "totalAmountFairValue": 3,
        "items": {
          "BTC": {
            "amount": 3,
            "fairValue": 15000,
            "costValue": 14500
          }
        }
      },
      "purchaseOfCryptocurrenciesWithNonCashConsideration": {
        "totalAmountFairValue": 2,
        "items": {
          "BTC": {
            "amount": 2,
            "fairValue": 10000,
            "costValue": 9800
          }
        }
      },
      "disposalOfCryptocurrenciesForNonCashConsideration": {
        "totalAmountFairValue": 1,
        "items": {
          "BTC": {
            "amount": 1,
            "fairValue": 5000,
            "costValue": 4900
          }
        }
      },
      "cryptocurrenciesReceivedFromCustomersAsTransactionFees": {
        "totalAmountFairValue": 0.5,
        "items": {
          "BTC": {
            "amount": 0.5,
            "fairValue": 2500,
            "costValue": 2400
          }
        }
      },
      "cryptocurrenciesReceivedFromCustomersForLiquidationInCFDTrading": {
        "totalAmountFairValue": 0.3,
        "items": {
          "BTC": {
            "amount": 0.3,
            "fairValue": 1500,
            "costValue": 1450
          }
        }
      },
      "cryptocurrenciesPaidToCustomersAsRebatesForTransactionFees": {
        "totalAmountFairValue": 0.1,
        "items": {
          "BTC": {
            "amount": 0.1,
            "fairValue": 500,
            "costValue": 480
          }
        }
      },
      "cryptocurrenciesPaidToSuppliersForExpenses": {
        "totalAmountFairValue": 0.2,
        "items": {
          "BTC": {
            "amount": 0.2,
            "fairValue": 1000,
            "costValue": 960
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForCFDTradingProfits": {
        "totalAmountFairValue": 0.4,
        "items": {
          "BTC": {
            "amount": 0.4,
            "fairValue": 2000,
            "costValue": 1920
          }
        }
      },
      "insuranceFundForPerpetualContractsWithNonCashConsideration": {
        "totalAmountFairValue": 0.6,
        "items": {
          "BTC": {
            "amount": 0.6,
            "fairValue": 3000,
            "costValue": 2880
          }
        }
      },
      "cryptocurrenciesReceivedFromCustomersForLiquidationInPerpetualContract": {
        "totalAmountFairValue": 0.7,
        "items": {
          "BTC": {
            "amount": 0.7,
            "fairValue": 3500,
            "costValue": 3360
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForPerpetualContractProfits": {
        "totalAmountFairValue": 0.8,
        "items": {
          "BTC": {
            "amount": 0.8,
            "fairValue": 4000,
            "costValue": 3840
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForFundingRatesInPerpetualContract": {
        "totalAmountFairValue": 0.9,
        "items": {
          "BTC": {
            "amount": 0.9,
            "fairValue": 4500,
            "costValue": 4320
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForProfitsInPerpetualContract": {
        "totalAmountFairValue": 1.0,
        "items": {
          "BTC": {
            "amount": 1.0,
            "fairValue": 5000,
            "costValue": 4800
          }
        }
      }
    },
    "otherSupplementaryItems": {
      "relatedToCash": {
        "effectOfExchangeRatesOnCash": {
          "totalAmountFairValue": 500,
          "items": {
            "USD": {
              "amount": 500,
              "fairValue": 500
            }
          }
        },
        "cashCashEquivalentsAndRestrictedCashBeginningOfPeriod": {
          "totalAmountFairValue": 1000000,
          "items": {
            "USD": {
              "amount": 1000000,
              "fairValue": 1000000
            }
          }
        },
        "cashCashEquivalentsAndRestrictedCashEndOfPeriod": {
          "totalAmountFairValue": 1100000,
          "items": {
            "USD": {
              "amount": 1100000,
              "fairValue": 1100000
            }
          }
        },
        "netIncreaseDecreaseInCashCashEquivalentsAndRestrictedCash": {
          "totalAmountFairValue": 100000,
          "items": {
            "USD": {
              "amount": 100000,
              "fairValue": 100000
            }
          }
        }
      },
      "relatedToNonCash": {
        "valuationAdjustmentForCryptocurrencies": {
          "totalAmountFairValue": 5,
          "items": {
            "BTC": {
              "amount": 5,
              "fairValue": 250,
              "costValue": 230
            }
          }
        },
        "cryptocurrenciesBeginningOfPeriod": {
          "totalAmountFairValue": 50,
          "items": {
            "BTC": {
              "amount": 50,
              "fairValue": 2500,
              "costValue": 2400
            }
          }
        },
        "cryptocurrenciesEndOfPeriod": {
          "totalAmountFairValue": 55,
          "items": {
            "BTC": {
              "amount": 55,
              "fairValue": 2750,
              "costValue": 2640
            }
          }
        },
        "netIncreaseDecreaseInCryptocurrencies": {
          "totalAmountFairValue": 5,
          "items": {
            "BTC": {
              "amount": 5,
              "fairValue": 250,
              "costValue": 240
            }
          }
        }
      }
    }
  }
}

@TzuHanLiang 此 API 回傳格式與需求相符

TzuHanLiang commented 1 year ago

@arealclimber 下列這四個屬性

purchaseOfCryptocurrencies
disposalOfCryptocurrencies
purchaseOfCryptocurrenciesWithNonCashConsideration
disposalOfCryptocurrenciesForNonCashConsideration

這些屬性的回傳值回傳範例中的格式

{
          "totalAmountFairValue": 5,
          "items": {
            "BTC": {
              "amount": 5,
              "fairValue": 250,
              "costValue": 240
            }
          }
        }
      }

你確定與需求相符嗎?

arealclimber commented 1 year ago

@TzuHanLiang

你指的是多了 costValue 的部分嗎?

我認知有誤,現金流量表這邊應該不需要 fairValue,需要的都是當下匯率乘上當下數量的 costValue (成本價值或持有價值),如同損益表需要的數字,所以 totalAmountFairValue 也需要請你改成 totalAmountCostValue

{
  "success": true,
  "code": "00000000",
  "reason": "ERROR_MESSAGE.SUCCESS",
  "data": {
    "id": "cash_flow-1234567890",
    "date": "2023-08-25T00:00:00.000Z",
    "operatingActivities": {
      "cashDepositedByCustomers": {
        "totalAmountCostValue": 1000000,
        "items": {
          "USD": {
            "amount": 1000000,
            "costValue": 1000000
          }
        }
      },
      "cashWithdrawnByCustomers": {
        "totalAmountCostValue": 800000,
        "items": {
          "USD": {
            "amount": 800000,
            "costValue": 800000
          }
        }
      },
      "purchaseOfCryptocurrencies": {
        "totalAmountCostValue": 500000,
        "items": {
          "BTC": {
            "amount": 10,
            "costValue": 50000,
            "costValue": 45000
          }
        }
      },
      "disposalOfCryptocurrencies": {
        "totalAmountCostValue": 450000,
        "items": {
          "BTC": {
            "amount": 9,
            "costValue": 50000,
            "costValue": 45000
          }
        }
      },
      "cashPaidToSuppliersForExpenses": {
        "totalAmountCostValue": 100000,
        "items": {
          "USD": {
            "amount": 100000,
            "costValue": 100000
          }
        }
      },
      "cashReceivedFromCustomersAsTransactionFee": {
        "totalAmountCostValue": 5000,
        "items": {
          "USD": {
            "amount": 5000,
            "costValue": 5000
          }
        }
      },
      "cashReceivedFromCustomersForLiquidationInCFDTrading": {
        "totalAmountCostValue": 200000,
        "items": {
          "USD": {
            "amount": 200000,
            "costValue": 200000
          }
        }
      },
      "cashPaidToCustomersAsRebatesForTransactionFees": {
        "totalAmountCostValue": 1000,
        "items": {
          "USD": {
            "amount": 1000,
            "costValue": 1000
          }
        }
      },
      "cashPaidToCustomersForCFDTradingProfits": {
        "totalAmountCostValue": 150000,
        "items": {
          "USD": {
            "amount": 150000,
            "costValue": 150000
          }
        }
      },
      "insuranceFundForPerpetualContracts": {
        "totalAmountCostValue": 50000,
        "items": {
          "USD": {
            "amount": 50000,
            "costValue": 50000
          }
        }
      },
      "cashPaidToCustomersForFundingRatesInPerpetualContract": {
        "totalAmountCostValue": 10000,
        "items": {
          "USD": {
            "amount": 10000,
            "costValue": 10000
          }
        }
      },
      "cashPaidToCustomersForPerpetualContractProfits": {
        "totalAmountCostValue": 120000,
        "items": {
          "USD": {
            "amount": 120000,
            "costValue": 120000
          }
        }
      },
      "cashReceivedFromCustomersForLiquidationInPerpetualContract": {
        "totalAmountCostValue": 130000,
        "items": {
          "USD": {
            "amount": 130000,
            "costValue": 130000
          }
        }
      }
    },
    "investingActivities": {
      "details": "略"
    },
    "financingActivities": {
      "proceedsFromIssuanceOfCommonStock": {
        "totalAmountCostValue": 500000,
        "items": {
          "USD": {
            "amount": 500000,
            "costValue": 500000
          }
        }
      },
      "longTermDebt": {
        "totalAmountCostValue": 300000,
        "items": {
          "USD": {
            "amount": 300000,
            "costValue": 300000
          }
        }
      },
      "shortTermBorrowings": {
        "totalAmountCostValue": 100000,
        "items": {
          "USD": {
            "amount": 100000,
            "costValue": 100000
          }
        }
      },
      "paymentsOfDividends": {
        "totalAmountCostValue": 50000,
        "items": {
          "USD": {
            "amount": 50000,
            "costValue": 50000
          }
        }
      },
      "treasuryStock": {
        "totalAmountCostValue": 200000,
        "items": {
          "USD": {
            "amount": 200000,
            "costValue": 200000
          }
        }
      }
    },
    "supplementalScheduleOfNonCashOperatingActivities": {
      "cryptocurrenciesDepositedByCustomers": {
        "totalAmountCostValue": 10,
        "items": {
          "BTC": {
            "amount": 10,
            "costValue": 48000
          }
        }
      },
      "cryptocurrenciesWithdrawnByCustomers": {
        "totalAmountCostValue": 8,
        "items": {
          "BTC": {
            "amount": 8,
            "costValue": 38000
          }
        }
      },
      "cryptocurrencyInflows": {
        "totalAmountCostValue": 5,
        "items": {
          "BTC": {
            "amount": 5,
            "costValue": 24000
          }
        }
      },
      "cryptocurrencyOutflows": {
        "totalAmountCostValue": 3,
        "items": {
          "BTC": {
            "amount": 3,
            "costValue": 14500
          }
        }
      },
      "purchaseOfCryptocurrenciesWithNonCashConsideration": {
        "totalAmountCostValue": 2,
        "items": {
          "BTC": {
            "amount": 2,
            "costValue": 9800
          }
        }
      },
      "disposalOfCryptocurrenciesForNonCashConsideration": {
        "totalAmountCostValue": 1,
        "items": {
          "BTC": {
            "amount": 1,
            "costValue": 4900
          }
        }
      }
      ,
      "cryptocurrenciesReceivedFromCustomersAsTransactionFees": {
        "totalAmountCostValue": 0.5,
        "items": {
          "BTC": {
            "amount": 0.5,
            "fairValue": 2500,
            "costValue": 2400
          }
        }
      },
      "cryptocurrenciesReceivedFromCustomersForLiquidationInCFDTrading": {
        "totalAmountCostValue": 0.3,
        "items": {
          "BTC": {
            "amount": 0.3,
            "fairValue": 1500,
            "costValue": 1450
          }
        }
      },
      "cryptocurrenciesPaidToCustomersAsRebatesForTransactionFees": {
        "totalAmountCostValue": 0.1,
        "items": {
          "BTC": {
            "amount": 0.1,
            "fairValue": 500,
            "costValue": 480
          }
        }
      },
      "cryptocurrenciesPaidToSuppliersForExpenses": {
        "totalAmountCostValue": 0.2,
        "items": {
          "BTC": {
            "amount": 0.2,
            "fairValue": 1000,
            "costValue": 960
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForCFDTradingProfits": {
        "totalAmountCostValue": 0.4,
        "items": {
          "BTC": {
            "amount": 0.4,
            "fairValue": 2000,
            "costValue": 1920
          }
        }
      },
      "insuranceFundForPerpetualContractsWithNonCashConsideration": {
        "totalAmountCostValue": 0.6,
        "items": {
          "BTC": {
            "amount": 0.6,
            "fairValue": 3000,
            "costValue": 2880
          }
        }
      },
      "cryptocurrenciesReceivedFromCustomersForLiquidationInPerpetualContract": {
        "totalAmountCostValue": 0.7,
        "items": {
          "BTC": {
            "amount": 0.7,
            "fairValue": 3500,
            "costValue": 3360
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForPerpetualContractProfits": {
        "totalAmountCostValue": 0.8,
        "items": {
          "BTC": {
            "amount": 0.8,
            "fairValue": 4000,
            "costValue": 3840
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForFundingRatesInPerpetualContract": {
        "totalAmountCostValue": 0.9,
        "items": {
          "BTC": {
            "amount": 0.9,
            "fairValue": 4500,
            "costValue": 4320
          }
        }
      },
      "cryptocurrenciesPaidToCustomersForProfitsInPerpetualContract": {
        "totalAmountCostValue": 1.0,
        "items": {
          "BTC": {
            "amount": 1.0,
            "fairValue": 5000,
            "costValue": 4800
          }
        }
      }
    },
    "otherSupplementaryItems": {
      "relatedToCash": {
        "effectOfExchangeRatesOnCash": {
          "totalAmountCostValue": 500,
          "items": {
            "USD": {
              "amount": 500,
              "fairValue": 500
            }
          }
        },
        "cashCashEquivalentsAndRestrictedCashBeginningOfPeriod": {
          "totalAmountCostValue": 1000000,
          "items": {
            "USD": {
              "amount": 1000000,
              "fairValue": 1000000
            }
          }
        },
        "cashCashEquivalentsAndRestrictedCashEndOfPeriod": {
          "totalAmountCostValue": 1100000,
          "items": {
            "USD": {
              "amount": 1100000,
              "fairValue": 1100000
            }
          }
        },
        "netIncreaseDecreaseInCashCashEquivalentsAndRestrictedCash": {
          "totalAmountCostValue": 100000,
          "items": {
            "USD": {
              "amount": 100000,
              "fairValue": 100000
            }
          }
        }
      },
      "relatedToNonCash": {
        "valuationAdjustmentForCryptocurrencies": {
          "totalAmountCostValue": 5,
          "items": {
            "BTC": {
              "amount": 5,
              "fairValue": 250,
              "costValue": 230
            }
          }
        },
        "cryptocurrenciesBeginningOfPeriod": {
          "totalAmountCostValue": 50,
          "items": {
            "BTC": {
              "amount": 50,
              "fairValue": 2500,
              "costValue": 2400
            }
          }
        },
        "cryptocurrenciesEndOfPeriod": {
          "totalAmountCostValue": 55,
          "items": {
            "BTC": {
              "amount": 55,
              "fairValue": 2750,
              "costValue": 2640
            }
          }
        },
        "netIncreaseDecreaseInCryptocurrencies": {
          "totalAmountCostValue": 5,
          "items": {
            "BTC": {
              "amount": 5,
              "fairValue": 250,
              "costValue": 240
            }
          }
        }
      }
    }
  }
}
TzuHanLiang commented 1 year ago

@arealclimber 下列這四個屬性

purchaseOfCryptocurrencies
disposalOfCryptocurrencies
purchaseOfCryptocurrenciesWithNonCashConsideration
disposalOfCryptocurrenciesForNonCashConsideration

這些屬性的回傳值回傳範例中的格式

{
          "totalAmountFairValue": 5,
          "items": {
            "BTC": {
              "amount": 5,
              "fairValue": 250,
              "costValue": 240
            }
          }
        }
      }

你確定與需求相符嗎?

那就根據你確認的,以“賣掉 BTC 持有 USDT”為例 這裡不呈現:多少BTC換多少USDT等相關的資訊,而是直接寫

{
        "totalAmountFairValue": 30000,
         "items": {
            "BTC": {
               "amount": 1,
               "costValue": 30000 // USD
             }
           }
         }
       }
arealclimber commented 1 year ago

@arealclimber 下列這四個屬性

purchaseOfCryptocurrencies
disposalOfCryptocurrencies
purchaseOfCryptocurrenciesWithNonCashConsideration
disposalOfCryptocurrenciesForNonCashConsideration

這些屬性的回傳值回傳範例中的格式

{
          "totalAmountFairValue": 5,
          "items": {
            "BTC": {
              "amount": 5,
              "fairValue": 250,
              "costValue": 240
            }
          }
        }
      }

你確定與需求相符嗎?

那就根據你確認的,以“賣掉 BTC 持有 USDT”為例 這裡不呈現:多少BTC換多少USDT等相關的資訊,而是直接寫

{
        "totalAmountFairValue": 30000,
         "items": {
            "BTC": {
               "amount": 1,
               "costValue": 30000 // USD
             }
           }
         }
       }

是的,totalAmountFairValue 也請改成 totalAmountCostValue

{
        "totalAmountCostValue": 30000,
         "items": {
            "BTC": {
               "amount": 1,
               "costValue": 30000 // USD
             }
           }
         }
       }
TzuHanLiang commented 1 year ago

下列格式可能更為合適

purchaseOfCryptocurrencies: TransactionSummaryDto; 
disposalOfCryptocurrencies: TransactionSummaryDto; 
purchaseOfCryptocurrenciesWithNonCashConsideration: TransactionSummaryDto; 
disposalOfCryptocurrenciesForNonCashConsideration: TransactionSummaryDto; 

// 定義不同的貨幣類型
export enum CurrencyType {
  CRYPTOCURRENCY = 'CRYPTOCURRENCY',
  FIAT = 'FIAT'
}

export enum TransactionType {
  BUY = 'BUY',
  SELL = 'SELL',
}

export class CurrencyDto {
  type: CurrencyType;
  name: string; // e.g., "USDT", "BTC", "USD"
  totalAmount: number; // 總數量
  weightedAverageCost: number; // 加權平均成本
  totalValueAtTransaction: number; // 換到的總價值
}

export class TransactionSummaryDto {
  dateRange: {
    start: Date;
    end: Date;
  };
  type: TransactionType;
  from: CurrencyDto;
  to: CurrencyDto;
}
TzuHanLiang commented 1 year ago
arealclimber commented 1 year ago

下列格式可能更為合適

purchaseOfCryptocurrencies: TransactionSummaryDto; 
disposalOfCryptocurrencies: TransactionSummaryDto; 
purchaseOfCryptocurrenciesWithNonCashConsideration: TransactionSummaryDto; 
disposalOfCryptocurrenciesForNonCashConsideration: TransactionSummaryDto; 

// 定義不同的貨幣類型
export enum CurrencyType {
  CRYPTOCURRENCY = 'CRYPTOCURRENCY',
  FIAT = 'FIAT'
}

export enum TransactionType {
  BUY = 'BUY',
  SELL = 'SELL',
}

export class CurrencyDto {
  type: CurrencyType;
  name: string; // e.g., "USDT", "BTC", "USD"
  totalAmount: number; // 總數量
  weightedAverageCost: number; // 加權平均成本
  totalValueAtTransaction: number; // 換到的總價值
}

export class TransactionSummaryDto {
  dateRange: {
    start: Date;
    end: Date;
  };
  type: TransactionType;
  from: CurrencyDto;
  to: CurrencyDto;
}

好的,那就先用這個格式。

  • @arealclimber 還有一個問題不是不需要區分 stableCoin 跟 Currency 嗎?

我想你是在問

purchaseOfCryptocurrenciesWithNonCashConsideration
disposalOfCryptocurrenciesForNonCashConsideration

這邊特別提到 stable coin 是因為買賣關係是相對的,所以用 stable coin 作為基準點來判斷是買還是賣,舉例,"賣掉BTC持有USDT"也能換句話說是"用BTC買USDT",為了區分這種情況,只要 stable coin 減少就是買 crypto,stable coin 增加就代表賣 crypto

TzuHanLiang commented 1 year ago

@arealclimber 「 cryptocurrenciesReceivedFromCustomersForLiquidationInCFDTrading 從客戶收到的用於 CFD 交易清算的加密貨幣 」 這個是什麼意思,從什麼資料可以得到?

arealclimber commented 1 year ago

@arealclimber 「 cryptocurrenciesReceivedFromCustomersForLiquidationInCFDTrading 從客戶收到的用於 CFD 交易清算的加密貨幣 」 這個是什麼意思,從什麼資料可以得到?

在CFD,用戶被強制平倉時,交易所會沒收他的保證金,那如果保證金是收加密貨幣,那就屬於 "cryptocurrenciesReceivedFromCustomersForLiquidationInCFDTrading ";如果是以 BTC-USDT 做多,用戶被強制平倉時我們會收到他的 USDT

TzuHanLiang commented 1 year ago

「交易所會沒收他的保證金」 是全部嗎?

arealclimber commented 1 year ago

「交易所會沒收他的保證金」 是全部嗎?

目前我們的情況是,發生強制平倉時,幫忙平倉的人可以收到強制平倉手續費對嗎? 在這個情況下,如果用戶保證金是1000 USDT,別人幫忙強制平倉可以拿到 10 USDT,那我們收到的就是 990 USDT; 如果是我們自己平倉,那就是我們拿到 1000 USDT。

TzuHanLiang commented 1 year ago

「交易所會沒收他的保證金」 是全部嗎?

目前我們的情況是,發生強制平倉時,幫忙平倉的人可以收到強制平倉手續費對嗎? 在這個情況下,如果用戶保證金是1000 USDT,別人幫忙強制平倉可以拿到 10 USDT,那我們收到的就是 990 USDT; 如果是我們自己平倉,那就是我們拿到 1000 USDT。

用戶賺錢或是賠錢的話,pnl 歸誰?賠錢的話,怎麼記錄?

arealclimber commented 1 year ago

「交易所會沒收他的保證金」 是全部嗎?

目前我們的情況是,發生強制平倉時,幫忙平倉的人可以收到強制平倉手續費對嗎? 在這個情況下,如果用戶保證金是1000 USDT,別人幫忙強制平倉可以拿到 10 USDT,那我們收到的就是 990 USDT; 如果是我們自己平倉,那就是我們拿到 1000 USDT。

用戶賺錢或是賠錢的話,pnl 歸誰?賠錢的話,怎麼記錄?

在沒收開倉關倉的手續費的情況下,

用戶賺錢的例子 KM 有,這時關倉我們要歸還用戶保證金及他的profit,profit 都是用戶的

用戶賠錢的例子 KM 沒紀錄,用戶賠錢就是損失部分保證金,假設保證金 1000 USDT,帳面損失為 50 USDT,這個情況下用戶關倉,我們會拿到 50 USDT

Supplemental schedule of non-cash operating activities:

Cryptocurrencies received from customers for liquidation in CFD trading: $50

NET CASH FLOW FROM NON-CASH OPERATING ACTIVITIES: $50