Ejemplo n.º 1
0
 private static FinamTransaction CreateFeeTransaction(TradingMovementsOfSecuritiesRow row)
 {
     return(new FinamTransaction(
                transactionType: TransactionType.OtherExpense,
                date: GetTransactionDateTime(row),
                price: new FinamPrice(row.Fee, FinamCurrency.Parse(row.FeeCurrency)),
                description: row.Comment));
 }
Ejemplo n.º 2
0
 private static long GetTransactionDateTime(TradingMovementsOfSecuritiesRow row)
 {
     return(TimeZoneInfo.ConvertTime(
                DateTime
                .ParseExact(row.TradeDate, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture)
                .Add(row.TradeTime.TimeOfDay),
                RussianStandardTime,
                TimeZoneInfo.Utc).Ticks);
 }
Ejemplo n.º 3
0
 private static FinamTransaction CreateBuyOrSellTransaction(TradingMovementsOfSecuritiesRow row)
 {
     return(new FinamTransaction(
                transactionType: (row.TradeType == BuyTransaction) ? TransactionType.Buy : TransactionType.Sell,
                date: GetTransactionDateTime(row),
                security: new FinamSecurity(row.ISIN, row.ShortName, row.Security),
                units: (int)row.Quantity,
                price: new FinamPrice(row.Price, FinamCurrency.Parse(row.Currency)),
                description: row.Comment));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a new instance of the <see cref="FinamTransaction"/> class based on the type of transaction.
        /// </summary>
        /// <param name="row">The trading movements row.</param>
        /// <returns>A new instance of the <see cref="FinamTransaction"/> class.</returns>
        public static FinamTransaction CreateTransaction(TradingMovementsOfSecuritiesRow row)
        {
            switch (row.TradeType)
            {
            case BuyTransaction:
            case SellTransaction:
                return(CreateBuyOrSellTransaction(row));

            case BrokerageFree:
            case DepositoryFee:
                return(CreateFeeTransaction(row));

            default:
                return(null);
            }
        }
 private FinamTransaction GetTradingMovementsTransaction(TradingMovementsOfSecuritiesRow row)
 {
     return(FinamTransactionFactory.CreateTransaction(row));
 }