Пример #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (SecurityCode != null
                                 ? SecurityCode.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (OptionNumber != null
                                 ? OptionNumber.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ (OptionCode != null
                                 ? OptionCode.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ Bid.GetHashCode();
         hashCode = (hashCode * 397) ^ BidVolume.GetHashCode();
         hashCode = (hashCode * 397) ^ Ask.GetHashCode();
         hashCode = (hashCode * 397) ^ AskVolume.GetHashCode();
         hashCode = (hashCode * 397) ^ Volume.GetHashCode();
         hashCode = (hashCode * 397) ^ Bid2.GetHashCode();
         hashCode = (hashCode * 397) ^ BidVolume2.GetHashCode();
         hashCode = (hashCode * 397) ^ Ask2.GetHashCode();
         hashCode = (hashCode * 397) ^ AskVolume2.GetHashCode();
         hashCode = (hashCode * 397) ^ Bid3.GetHashCode();
         hashCode = (hashCode * 397) ^ BidVolume3.GetHashCode();
         hashCode = (hashCode * 397) ^ Ask3.GetHashCode();
         hashCode = (hashCode * 397) ^ AskVolume3.GetHashCode();
         hashCode = (hashCode * 397) ^ Bid4.GetHashCode();
         hashCode = (hashCode * 397) ^ BidVolume4.GetHashCode();
         hashCode = (hashCode * 397) ^ Ask4.GetHashCode();
         hashCode = (hashCode * 397) ^ AskVolume4.GetHashCode();
         hashCode = (hashCode * 397) ^ Bid5.GetHashCode();
         hashCode = (hashCode * 397) ^ BidVolume5.GetHashCode();
         hashCode = (hashCode * 397) ^ Ask5.GetHashCode();
         hashCode = (hashCode * 397) ^ AskVolume5.GetHashCode();
         hashCode = (hashCode * 397) ^ (Greeks != null
                                 ? Greeks.GetHashCode()
                                 : 0);
         hashCode = (hashCode * 397) ^ OpenInterest.GetHashCode();
         hashCode = (hashCode * 397) ^ Turnover.GetHashCode();
         hashCode = (hashCode * 397) ^ UncoveredPositionQuantity.GetHashCode();
         hashCode = (hashCode * 397) ^ PreviousSettlementPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ OpeningPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ AuctionReferencePrice.GetHashCode();
         hashCode = (hashCode * 397) ^ AuctionReferenceQuantity.GetHashCode();
         hashCode = (hashCode * 397) ^ HighestPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ LowestPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ LatestTradedPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ Change.GetHashCode();
         hashCode = (hashCode * 397) ^ ChangePercentage.GetHashCode();
         hashCode = (hashCode * 397) ^ PreviousClose.GetHashCode();
         hashCode = (hashCode * 397) ^ (Name != null
                                 ? Name.GetHashCode()
                                 : 0);
         return(hashCode);
     }
 }
Пример #2
0
 protected bool Equals(OptionViewModel other)
 {
     return(string.Equals(OptionNumber, other.OptionNumber) &&
            Bid.Equals(other.Bid) &&
            BidVolume == other.BidVolume &&
            Ask.Equals(other.Ask) &&
            AskVolume == other.AskVolume &&
            Volume == other.Volume &&
            Bid2.Equals(other.Bid2) &&
            BidVolume2 == other.BidVolume2 &&
            Ask2.Equals(other.Ask2) &&
            AskVolume2 == other.AskVolume2 &&
            Bid3.Equals(other.Bid3) &&
            BidVolume3 == other.BidVolume3 &&
            Ask3.Equals(other.Ask3) &&
            AskVolume3 == other.AskVolume3 &&
            Bid4.Equals(other.Bid4) &&
            BidVolume4 == other.BidVolume4 &&
            Ask4.Equals(other.Ask4) &&
            AskVolume4 == other.AskVolume4 &&
            Bid5.Equals(other.Bid5) &&
            BidVolume5 == other.BidVolume5 &&
            Ask5.Equals(other.Ask5) &&
            AskVolume5 == other.AskVolume5 &&
            Equals(Greeks, other.Greeks) &&
            OpenInterest == other.OpenInterest &&
            Turnover.Equals(other.Turnover) &&
            UncoveredPositionQuantity == other.UncoveredPositionQuantity &&
            PreviousSettlementPrice.Equals(other.PreviousSettlementPrice) &&
            OpeningPrice.Equals(other.OpeningPrice) &&
            AuctionReferencePrice.Equals(other.AuctionReferencePrice) &&
            AuctionReferenceQuantity == other.AuctionReferenceQuantity &&
            HighestPrice.Equals(other.HighestPrice) &&
            LowestPrice.Equals(other.LowestPrice) &&
            LatestTradedPrice.Equals(other.LatestTradedPrice) &&
            Change.Equals(other.Change) &&
            ChangePercentage.Equals(other.ChangePercentage) &&
            PreviousClose.Equals(other.PreviousClose) &&
            string.Equals(Name, other.Name));
 }
Пример #3
0
        public string EditQuery()
        {
            roundParams();
            int iTradeClosed = 0;

            if (TradeClosed == false)
            {
                iTradeClosed = 0;
                ClosingPrice = 0;
                Comission    = 0;
                Taxes        = 0;
                Profit       = 0;
            }
            else
            {
                iTradeClosed = 1;
            }

            int iTradeType      = 0;
            int iInstrumentType = 0;

            switch (InstrumentType.ToString())
            {
            case "Валюта":
                iInstrumentType = 0;
                break;

            case "Акция":
                iInstrumentType = 1;
                break;

            case "Фьючерс":
                iInstrumentType = 2;
                break;
            }
            switch (TradeType.ToString())
            {
            case "Long":
                iTradeType = 0;
                break;

            case "Short":
                iTradeType = 1;
                break;
            }

            //UPDATE `tradesassistant`.`trades` SET `trade_type`='0', `trade_sum`='2120.00' WHERE `id`='6';
            string query = "UPDATE `" + Schema + "`.`" + Table + "` SET " +
                           "`instrument_name`='" + InstrumentName + "', " +
                           "`instrument_class`='" + iInstrumentType.ToString() + "', " +
                           "`instrument_ticker`='" + Ticker + "', " +
                           "`trade_type`='" + iTradeType.ToString() + "', " +
                           "`opening_price`='" + OpeningPrice.ToString().Replace(",", ".") + "', " +
                           "`trade_volume`='" + TradeSize.ToString() + "', " +
                           "`trade_sum`='" + TradeSum.ToString().Replace(",", ".") + "', " +
                           "`trade_closed`='" + iTradeClosed.ToString() + "', " +
                           "`closing_price`='" + ClosingPrice.ToString().Replace(",", ".") + "', " +
                           "`comissions`='" + Comission.ToString().Replace(",", ".") + "', " +
                           "`taxes`='" + Taxes.ToString().Replace(",", ".") + "', " +
                           "`profit`='" + Profit.ToString().Replace(",", ".") + "' " +
                           "WHERE `id`='" + TradeId + "';";

            return(query);
        }
Пример #4
0
        //метод формирования строки удаления записи
        public string AddQuery()
        {
            roundParams();
            int iTradeClosed = 0;

            if (TradeClosed == false)
            {
                iTradeClosed = 0;
            }
            else
            {
                iTradeClosed = 1;
            }

            int iTradeType      = 0;
            int iInstrumentType = 0;

            switch (InstrumentType.ToString())
            {
            case "Валюта":
                iInstrumentType = 0;
                break;

            case "Акция":
                iInstrumentType = 1;
                break;

            case "Фьючерс":
                iInstrumentType = 2;
                break;
            }
            switch (TradeType.ToString())
            {
            case "Long":
                iTradeType = 0;
                break;

            case "Short":
                iTradeType = 1;
                break;
            }

            string query = "INSERT INTO `" + Schema + "`.`" + Table + "` " +
                           "(`instrument_name`, " +
                           "`instrument_class`, " +
                           "`instrument_ticker`, " +
                           "`trade_type`, " +
                           "`opening_price`, " +
                           "`trade_volume`, " +
                           "`trade_sum`, " +
                           "`trade_closed`, " +
                           "`closing_price`, " +
                           "`comissions`, " +
                           "`taxes`, " +
                           "`profit`) " +
                           "VALUES ('" +
                           InstrumentName + "', '"
                           + iInstrumentType.ToString() + "', '"
                           + Ticker + "', '"
                           + iTradeType.ToString() + "', '"
                           + OpeningPrice.ToString().Replace(",", ".") + "', '"
                           + TradeSize.ToString() + "', '"
                           + TradeSum.ToString().Replace(",", ".") + "', '"
                           + iTradeClosed.ToString() + "', '"
                           + ClosingPrice.ToString().Replace(",", ".") + "', '"
                           + Comission.ToString().Replace(",", ".") + "', '"
                           + Taxes.ToString().Replace(",", ".") + "', '"
                           + Profit.ToString().Replace(",", ".") + "');";

            return(query);
        }