Esempio n. 1
0
 /// <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");
     }
 }
Esempio n. 2
0
 /// <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");
     }
 }
Esempio n. 3
0
 /// <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;
     }
 }
Esempio n. 4
0
        /// <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;
        }