/// <summary> /// Check if two amounts are comparable /// </summary> /// <param name="pAmount1"></param> /// <param name="pAmount2"></param> private static void CheckCompare(CAmount pAmount1, CAmount pAmount2) { if (pAmount1.Currency != pAmount2.Currency) { throw new ArithmeticException("Cannot compare two amounts associated with different currencies"); } }
/// <summary> /// contructor with /// </summary> /// <param name="pTransactionsExecuted">Transactions executed</param> public CTransactionsInvoice(List<CTransactionExecution> pTransactionsExecuted) { TransactionsExecuted = pTransactionsExecuted; TotalRealMonneyExchanged = new CAmount(0, ECurrencies.REAL_MONNEY); TotalDigicoinsExchanged = new CAmount(0, ECurrencies.DIGICOINS); foreach (CTransactionExecution transaction in pTransactionsExecuted) { TotalRealMonneyExchanged += transaction.RealMonneyExchanged; TotalDigicoinsExchanged += transaction.DigiCoinsExchanged; } }
/// <summary> /// Chack price of a single transactions in a broker /// </summary> /// <param name="pTransaction">Transaction</param> /// <param name="pBroker">Broker</param> /// <returns></returns> private static CTransactionExecution CheckSingleTransaction(CTransaction pTransaction, CBroker pBroker) { CAmount transactionAmount = pBroker.GetTransationAmount(pTransaction); CAmount digicoinsExchanged = new CAmount(pTransaction.Quantity, ECurrencies.DIGICOINS); CTransactionExecution transactionExecuted = new CTransactionExecution(pTransaction, pBroker, transactionAmount, digicoinsExchanged); return transactionExecuted; }