Ejemplo n.º 1
0
        public void Add(DateTime datetime, TransactionSide side, double qty, Instrument instrument, double price, string text)
        {
            Side side1;

            switch (side)
            {
            case TransactionSide.Buy:
                side1 = Side.Buy;
                break;

            case TransactionSide.Sell:
                side1 = Side.Sell;
                break;

            default:
                throw new ArgumentException(string.Format("Unknown TransactionSide - {0} ", (object)side));
            }
            FreeQuant.Instruments.Transaction transaction = new FreeQuant.Instruments.Transaction(datetime, side1, qty, instrument.instrument, price);
            transaction.Currency = CurrencyManager.Currencies[instrument.instrument.Currency];
            if (text != null)
            {
                transaction.Text = text;
            }
            this.portfolio.Add(transaction);
        }
Ejemplo n.º 2
0
		public virtual double GetCost(Transaction transaction)
		{
			if (this.commission == 0.0)
				return 0.0;
			switch (this.commType)
			{
				case CommType.PerShare:
					return this.Commission * transaction.Qty;
				case CommType.Percent:
					return this.Commission * transaction.Value;
				case CommType.Absolute:
					return this.Commission;
				default:
					throw new NotSupportedException("" + this.commType);
			}
		}
Ejemplo n.º 3
0
 public ChartColorManagerForm()
 {
     this.InitializeComponent();
     this.colorEditor.Init();
     this.AddProperty("ChartBackColor", "Back Color", this.chart.ChartBackColor);
     this.AddProperty("CanvasColor", "Fore Color", this.chart.CanvasColor);
     this.AddProperty("BorderColor", "Border", this.chart.BorderColor);
     this.AddProperty("SplitterColor", "Splitter", this.chart.SplitterColor);
     this.AddProperty("CandleUpColor", "Candle Up", this.chart.CandleUpColor);
     this.AddProperty("CandleDownColor", "Candle Down", this.chart.CandleDownColor);
     this.AddProperty("DefaultLineColor", "Line", this.chart.DefaultLineColor);
     this.AddProperty("VolumeColor", "Volume", this.chart.VolumeColor);
     this.AddProperty("DateTipRectangleColor", "DateTime Tip Area", this.chart.DateTipRectangleColor);
     this.AddProperty("DateTipTextColor", "DateTime Tip Text", this.chart.DateTipTextColor);
     this.AddProperty("ValTipRectangleColor", "Value Tip Area", this.chart.ValTipRectangleColor);
     this.AddProperty("ValTipTextColor", "Value Text Area", this.chart.ValTipTextColor);
     this.AddProperty("CrossColor", "Cross Color", this.chart.CrossColor);
     this.AddProperty("BottomAxisLabelColor", "Bottom Axis Label", this.chart.BottomAxisLabelColor);
     this.AddProperty("BottomAxisGridColor", "Bottom Axis Grid", this.chart.BottomAxisGridColor);
     this.AddProperty("RightAxisGridColor", "Right Axis Grid", this.chart.RightAxisGridColor);
     this.AddProperty("RightAxisTextColor", "Right Axis Text", this.chart.RightAxisTextColor);
     this.AddProperty("RightAxisMajorTicksColor", "Right Axis Major Ticks", this.chart.RightAxisMajorTicksColor);
     this.AddProperty("RightAxisMinorTicksColor", "Right Axis Minor Ticks", this.chart.RightAxisMinorTicksColor);
     this.AddProperty("ItemTextColor", "Transaction Text", this.chart.ItemTextColor);
     this.AddProperty("SelectedItemTextColor", "Selected Transaction Text", this.chart.SelectedItemTextColor);
     this.AddProperty("SelectedTransactionHighlightColor", "Selected Transaction Highlight", this.chart.SelectedTransactionHighlightColor);
     this.ltvColorProperties.Items[0].Selected = true;
     BarSeries barSeries = this.GenerateSeries();
     this.chart.Reset();
     this.chart.SetMainSeries((DoubleSeries)barSeries, true);
     this.chart.AddPad();
     SMA sma = new SMA((TimeSeries)barSeries, 14);
     sma.Name = "Line";
     this.chart.DrawDefaultColoredSeries((DoubleSeries)sma, 2, (SimpleDSStyle)0, SmoothingMode.AntiAlias);
     Instrument instrument = Activator.CreateInstance(typeof(Instrument), true) as Instrument;
     instrument.Symbol = "Symbol";
     Transaction transaction1 = new Transaction(((TimeSeries)barSeries).GetDateTime(barSeries.Count - 5), Side.Buy, 100.0, instrument, barSeries[barSeries.Count - 5].Low);
     Transaction transaction2 = new Transaction(((TimeSeries)barSeries).GetDateTime(barSeries.Count - 20), Side.Sell, 100.0, instrument, barSeries[barSeries.Count - 20].High);
     this.chart.DrawTransaction(transaction1, 0);
     this.chart.DrawTransaction(transaction2, 0);
     this.chart.EnsureVisible(transaction1);
     foreach (ChartColorTemplate template in Global.ChartManager.ColorTemplates.All.Values)
         this.ltvTemplates.Items.Add((ListViewItem)new ChartColorTemplateViewItem(template));
     if (this.ltvTemplates.Items.Count <= 0)
         return;
     this.ltvTemplates.Items[0].Selected = true;
 }
Ejemplo n.º 4
0
		public bool Contains(Transaction transaction)
		{
			return this.transactions.Contains(transaction);
		}
Ejemplo n.º 5
0
        public void Add(Transaction transaction)
        {
            lock (this.dataLock)
            {
                bool   posOpened  = false;
                bool   posChanged = true;
                bool   posClosed  = false;
                double local_4    = 0.0;
                double local_5    = 0.0;
                double local_6    = 0.0;

                Position position = this.positions[transaction.Instrument];
                if (position == null)
                {
                    position = new Position(this, transaction);
                    this.positions.Add(position);
                    if (this.monitored)
                    {
                        this.WatchPosition(position);
                    }
                    if (transaction.Margin != 0.0)
                    {
                        local_4         = transaction.Margin;
                        local_6         = 0.0;
                        local_5         = transaction.Debt;
                        position.Margin = transaction.Margin;
                        position.Debt   = transaction.Debt;
                    }
                    posOpened = true;
                }
                else
                {
                    if (transaction.Margin != 0.0)
                    {
                        if (position.Side == PositionSide.Long && transaction.Side == Side.Buy || position.Side == PositionSide.Short && (transaction.Side == Side.Sell || transaction.Side == Side.SellShort))
                        {
                            local_4          = transaction.Margin;
                            local_6          = 0.0;
                            local_5          = transaction.Debt;
                            position.Margin += transaction.Margin;
                            position.Debt   += transaction.Debt;
                        }
                        if (position.Side == PositionSide.Long && (transaction.Side == Side.Sell || transaction.Side == Side.SellShort) || position.Side == PositionSide.Short && transaction.Side == Side.Buy)
                        {
                            if (position.Qty == transaction.Qty)
                            {
                                double temp_152 = position.Margin;
                                local_4         = 0.0;
                                local_6         = position.Debt;
                                local_5         = 0.0;
                                position.Margin = 0.0;
                                position.Debt   = 0.0;
                            }
                            else if (position.Qty > transaction.Qty)
                            {
                                double temp_131 = transaction.Margin;
                                local_4          = 0.0;
                                local_6          = position.Debt * transaction.Qty / position.Qty;
                                local_5          = 0.0;
                                position.Margin -= transaction.Margin;
                                position.Debt   -= local_6;
                            }
                            else
                            {
                                double local_7 = transaction.Qty - position.Qty;
                                double local_8 = local_7 * transaction.Price;
                                if (transaction.Instrument.Factor != 0.0)
                                {
                                    local_8 *= transaction.Instrument.Factor;
                                }
                                double temp_110  = position.Margin;
                                double local_4_1 = transaction.Instrument.Margin * local_7;
                                local_6         = position.Debt;
                                local_5         = local_8 - local_4_1;
                                position.Margin = local_4_1;
                                position.Debt   = local_5;
                            }
                        }
                    }
                    position.Add(transaction);
                    if (position.Qty == 0.0)
                    {
                        this.positions.Remove(position);
                        if (this.monitored)
                        {
                            this.UnWatchPosition(position);
                        }
                        posClosed = true;
                    }
                }
                this.transactions.Add(transaction);
                if (!this.Mk5dJuOhmC && this.persistent)
                {
                    PortfolioManager.Add(this, transaction);
                }
                this.EmitTransactionAdded(transaction);
                if (!this.Mk5dJuOhmC)
                {
                    this.account.Add(transaction.CashFlow + local_5 - local_6, transaction.Currency, transaction.DateTime, transaction.Text);
                }
                if (posOpened)
                {
                    this.EmitPositionOpened(position);
                }
                if (posChanged)
                {
                    this.EmitPositionChanged(position);
                }
                if (posClosed)
                {
                    this.EmitPositionClosed(position);
                }
                this.EmitCompositionChanged();
                if (this.Mk5dJuOhmC)
                {
                    return;
                }
                this.EmitValueChanged(position);
            }
        }
Ejemplo n.º 6
0
		public void EnsureVisible(Transaction transaction)
		{
			if (transaction.DateTime < this.mainSeries.FirstDateTime)
				return;
			int num1 = Math.Max(this.mainSeries.GetIndex(transaction.DateTime, EIndexOption.Prev), 0);
			int val2 = this.lastIndex - this.firstIndex + 1;
			int num2 = Math.Max(Math.Min(this.mainSeries.Count - 1, num1 + val2 / 5), val2);
			this.SetPadIntervals(num2 - val2 + 1, num2);
			this.pads[0].SetSelectedObject(transaction);
			this.firstDateTime = this.mainSeries.GetDateTime(this.mainSeries.GetIndex(transaction.DateTime, EIndexOption.Prev));
			this.contentUpdated = true;
			this.Invalidate();
		}
Ejemplo n.º 7
0
 protected virtual void OnTransactionAdded(Transaction transaction)
 {
 }
Ejemplo n.º 8
0
        public void Add(Transaction transaction)
        {
            lock (this.dataLock)
            {
                bool posOpened = false;
                bool posChanged = true;
                bool posClosed = false;
                double local_4 = 0.0;
                double local_5 = 0.0;
                double local_6 = 0.0;

                Position position = this.positions[transaction.Instrument];
                if (position == null)
                {
                    position = new Position(this, transaction);
                    this.positions.Add(position);
                    if (this.monitored)
                        this.WatchPosition(position);
                    if (transaction.Margin != 0.0)
                    {
                        local_4 = transaction.Margin;
                        local_6 = 0.0;
                        local_5 = transaction.Debt;
                        position.Margin = transaction.Margin;
                        position.Debt = transaction.Debt;
                    }
                    posOpened = true;
                }
                else
                {
                    if (transaction.Margin != 0.0)
                    {
                        if (position.Side == PositionSide.Long && transaction.Side == Side.Buy || position.Side == PositionSide.Short && (transaction.Side == Side.Sell || transaction.Side == Side.SellShort))
                        {
                            local_4 = transaction.Margin;
                            local_6 = 0.0;
                            local_5 = transaction.Debt;
                            position.Margin += transaction.Margin;
                            position.Debt += transaction.Debt;
                        }
                        if (position.Side == PositionSide.Long && (transaction.Side == Side.Sell || transaction.Side == Side.SellShort) || position.Side == PositionSide.Short && transaction.Side == Side.Buy)
                        {
                            if (position.Qty == transaction.Qty)
                            {
                                double temp_152 = position.Margin;
                                local_4 = 0.0;
                                local_6 = position.Debt;
                                local_5 = 0.0;
                                position.Margin = 0.0;
                                position.Debt = 0.0;
                            }
                            else if (position.Qty > transaction.Qty)
                            {
                                double temp_131 = transaction.Margin;
                                local_4 = 0.0;
                                local_6 = position.Debt * transaction.Qty / position.Qty;
                                local_5 = 0.0;
                                position.Margin -= transaction.Margin;
                                position.Debt -= local_6;
                            }
                            else
                            {
                                double local_7 = transaction.Qty - position.Qty;
                                double local_8 = local_7 * transaction.Price;
                                if (transaction.Instrument.Factor != 0.0)
                                    local_8 *= transaction.Instrument.Factor;
                                double temp_110 = position.Margin;
                                double local_4_1 = transaction.Instrument.Margin * local_7;
                                local_6 = position.Debt;
                                local_5 = local_8 - local_4_1;
                                position.Margin = local_4_1;
                                position.Debt = local_5;
                            }
                        }
                    }
                    position.Add(transaction);
                    if (position.Qty == 0.0)
                    {
                        this.positions.Remove(position);
                        if (this.monitored)
                            this.UnWatchPosition(position);
                        posClosed = true;
                    }
                }
                this.transactions.Add(transaction);
                if (!this.Mk5dJuOhmC && this.persistent)
                    PortfolioManager.Add(this, transaction);
                this.EmitTransactionAdded(transaction);
                if (!this.Mk5dJuOhmC)
                    this.account.Add(transaction.CashFlow + local_5 - local_6, transaction.Currency, transaction.DateTime, transaction.Text);
                if (posOpened)
                    this.EmitPositionOpened(position);
                if (posChanged)
                    this.EmitPositionChanged(position);
                if (posClosed)
                    this.EmitPositionClosed(position);
                this.EmitCompositionChanged();
                if (this.Mk5dJuOhmC)
                    return;
                this.EmitValueChanged(position);
            }
        }
Ejemplo n.º 9
0
 public AccountTransaction(Transaction transaction) : this(transaction.CashFlow, transaction.Currency, transaction.DateTime, transaction.Text)
 {
     this.transaction = transaction;
 }
Ejemplo n.º 10
0
 private static void nf3XP7Xf3(SingleOrder obj0, DateTime obj1, double obj2, double obj3)
 {
     if (obj0.LastQty <= 0.0 || obj0.Portfolio == null)
         return;
     Transaction transaction = new Transaction();
     transaction.DateTime = obj1;
     transaction.ClOrdID = obj0.ClOrdID;
     transaction.Instrument = obj0.Instrument;
     transaction.Side = obj0.Side;
     transaction.Price = obj2;
     transaction.Qty = obj3;
     transaction.Strategy = obj0.Strategy;
     transaction.Text = obj0.Text;
     FreeQuant.Instruments.Currency currency = (CurrencyManager.Currencies[obj0.Currency] ?? CurrencyManager.Currencies[obj0.Instrument.Currency]) ?? CurrencyManager.DefaultCurrency;
     transaction.Currency = currency;
     transaction.TransactionCost.Set(CommType.Absolute, obj0.Commission);
     obj0.Portfolio.Add(transaction);
 }
Ejemplo n.º 11
0
        private void DdBEZNiZyZ(Portfolio obj0)
        {
            obj0.LwTsbC870d(true);
            IDbCommand command1 = this.connection.CreateCommand();
//      command1.CommandText = gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7996);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(8138), DbType.Int32, (object) obj0.Id);
            IDataReader dataReader1 = command1.ExecuteReader();
            while (dataReader1.Read())
            {
                int int32_1 = dataReader1.GetInt32(0);
                dataReader1.GetInt32(1);
                string string1 = dataReader1.GetString(2);
                int int32_2 = dataReader1.GetInt32(3);
                DateTime dateTime = dataReader1.GetDateTime(4);
                int int32_3 = dataReader1.GetInt32(5);
                string string2 = dataReader1.GetString(6);
                double double1 = dataReader1.GetDouble(7);
                double double2 = dataReader1.GetDouble(8);
                string string3 = dataReader1.GetString(9);
                string string4 = dataReader1.GetString(10);
                string string5 = dataReader1.GetString(11);
                double double3 = dataReader1.GetDouble(12);
                string string6 = dataReader1.GetString(13);
                Transaction transaction = new Transaction();
                transaction.nx8WA03O1L(int32_1);
                transaction.ClOrdID = string1;
                transaction.ReportId = int32_2;
                transaction.DateTime = dateTime;
                transaction.Instrument = InstrumentManager.Instruments.GetById(int32_3);
                transaction.Side = FIXSide.FromFIX(string2[0]);
                transaction.Price = double1;
                transaction.Qty = double2;
                transaction.Text = string3;
                TransactionCost transactionCost = (TransactionCost)Activator.CreateInstance(Type.GetType(string.Format("s", (object)string5, (object)string4)), true);
                transactionCost.CommType = FIXCommType.FromFIX(string6[0]);
                transactionCost.Commission = double3;
                transaction.TransactionCost = transactionCost;
                if (transaction.Instrument == null)
                    transaction.Instrument = this.xKIEA4RkYI(int32_3);
                obj0.Add(transaction);
            }
            dataReader1.Close();
            command1.Dispose();
            IDbCommand command2 = this.connection.CreateCommand();
//      command2.CommandText = gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(8180);
            FIXDbServer.SetCommandParameter(command2, "sss", DbType.Int32, (object)obj0.Id);
            IDataReader dataReader2 = command2.ExecuteReader();
            while (dataReader2.Read())
            {
                int int32 = dataReader2.GetInt32(0);
                dataReader2.GetInt32(1);
                DateTime dateTime = dataReader2.GetDateTime(2);
                string @string = dataReader2.GetString(3);
                double @double = dataReader2.GetDouble(4);
                string str = dataReader2.IsDBNull(5) ? "" : dataReader2.GetString(5);
                AccountTransaction transaction = new AccountTransaction();
                transaction.G7YBAhR7LA(int32);
                transaction.DateTime = dateTime;
                transaction.Currency = CurrencyManager.Currencies[@string];
                transaction.Value = @double;
                transaction.Text = str;
                obj0.Account.Add(transaction);
            }
            dataReader2.Close();
            command2.Dispose();
            obj0.LwTsbC870d(false);
        }
Ejemplo n.º 12
0
        public void Add(Portfolio portfolio, Transaction transaction)
        {
            IDbCommand command1 = this.connection.CreateCommand();
            command1.CommandText = "commandtext";
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7290), DbType.Int32, (object) portfolio.Id);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7312), DbType.String, (object) transaction.ClOrdID);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7332), DbType.Int32, (object) transaction.ReportId);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7354), DbType.DateTime, (object) transaction.DateTime);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7376), DbType.Int32, (object) transaction.Instrument.Id);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7406), DbType.StringFixedLength, (object) FIXSide.ToFIX(transaction.Side));
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7420), DbType.Double, (object) transaction.Price);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7436), DbType.Double, (object) transaction.Qty);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7448), DbType.String, (object) transaction.Text);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7462), DbType.String, (object) transaction.TransactionCost.GetType().Assembly.FullName);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7492), DbType.String, (object) transaction.TransactionCost.GetType().FullName);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7514), DbType.Double, (object) transaction.TransactionCost.Commission);
//      FIXDbServer.SetCommandParameter(command1, gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7540), DbType.StringFixedLength, (object) FIXCommType.ToFIX(transaction.TransactionCost.CommType));
//      command1.ExecuteNonQuery();
//      command1.Dispose();
//      IDbCommand command2 = this.connection.CreateCommand();
//      command2.CommandText = gUqQbWj9pYGI8tO6Z8.iW3dklQ6Dr(7562);
//      transaction.nx8WA03O1L(Convert.ToInt32(command2.ExecuteScalar()));
//      command2.Dispose();
        }
Ejemplo n.º 13
0
		internal Transaction(FreeQuant.Instruments.Transaction transaction)
		{
			this.transaction = transaction;
		}
Ejemplo n.º 14
0
		public TransactionView(Transaction transaction, Pad pad) : base()
    {
      this.aPewsePQDS = Color.Blue;
      this.lZ5wLD8PkC = Color.Red;
      this.xEkwqNT82W = Color.Yellow;
      this.T1lwVYQLqj = true;
      this.toolTipEnabled = true;
      this.toolTipFormat = "";
      this.AMKwObevl9 = transaction;
      this.pad = pad;
      this.toolTipEnabled = true;
			this.toolTipFormat = "";
    }
Ejemplo n.º 15
0
		public void Add(Transaction transaction)
		{
			this.Add(transaction, true);
		}
Ejemplo n.º 16
0
		public void Add(Transaction transaction)
		{
			this.Add(new AccountTransaction(transaction));
		}
Ejemplo n.º 17
0
		public void Add(Transaction transaction, bool sort)
		{
			this.transactions.Add(transaction);
			if (!sort || this.transactions.Count == 1 || !(transaction.DateTime < this[this.transactions.Count - 2].DateTime))
				return;
			this.transactions.Sort();
		}
Ejemplo n.º 18
0
		internal static void Add(Portfolio portfolio, Transaction transaction)
		{
			PortfolioManager.server.Add(portfolio, transaction);
		}
Ejemplo n.º 19
0
 internal Transaction(FreeQuant.Instruments.Transaction transaction)
 {
     this.transaction = transaction;
 }
Ejemplo n.º 20
0
 public void Add(DateTime datetime, TransactionSide side, double qty, Instrument instrument, double price, string text)
 {
   Side side1;
   switch (side)
   {
     case TransactionSide.Buy:
       side1 = Side.Buy;
       break;
     case TransactionSide.Sell:
       side1 = Side.Sell;
       break;
     default:
       throw new ArgumentException(string.Format("Unknown TransactionSide - {0} ", (object) side));
   }
   FreeQuant.Instruments.Transaction transaction = new FreeQuant.Instruments.Transaction(datetime, side1, qty, instrument.instrument, price);
   transaction.Currency = CurrencyManager.Currencies[instrument.instrument.Currency];
   if (text != null)
     transaction.Text = text;
   this.portfolio.Add(transaction);
 }
Ejemplo n.º 21
0
 private void EmitTransactionAdded(Transaction transaction)
 {
     if (this.TransactionAdded != null)
         this.TransactionAdded(this, new TransactionEventArgs(transaction));
 }
Ejemplo n.º 22
0
        public Position(Portfolio portfolio, Transaction transaction)
        {

            this.rik6WLpoo8 = -1;
            this.transactions = new TransactionList();
            this.GIf68BaEWm = -1;

            this.portfolio = portfolio;
            this.instrument = transaction.Instrument;
            this.Add(transaction);
        }
Ejemplo n.º 23
0
 internal void CpbdZ1YMZ(Transaction obj0)
 {
   if (!this.isActive)
     return;
   this.portfolio.Add(obj0);
   if (!this.statisticsPerInstrumentEnabled)
     return;
   this.portfolios[obj0.Instrument].Add(obj0);
 }
Ejemplo n.º 24
0
 public void Add(Transaction transaction)
 {
     if (this.instrument != transaction.Instrument)
         throw new ArgumentException("dfsf" + transaction.Instrument.Symbol + this.instrument.Symbol);
     double num1 = 0.0;
     double num2 = 0.0;
     int num3 = Math.Sign(transaction.Amount);
     if (this.transactions.Count == 0)
     {
         this.GIf68BaEWm = 0;
         this.WLw6lrSTTe = transaction.Qty;
     }
     else if (this.Side == PositionSide.Long && num3 == -1 || this.Side == PositionSide.Short && num3 == 1)
     {
         int index = this.GIf68BaEWm + 1;
         double qty = transaction.Qty;
         double num4 = 0.0;
         double num5 = Math.Min(qty, this.WLw6lrSTTe);
         double num6 = num4 + this.WLw6lrSTTe;
         num2 += num5 * (transaction.Cost / transaction.Qty + this.transactions[this.GIf68BaEWm].Cost / this.transactions[this.GIf68BaEWm].Qty);
         num1 += (transaction.Price - this.transactions[this.GIf68BaEWm].Price) * num5 * (double)-num3;
         for (; qty > num6 && index < this.transactions.Count; ++index)
         {
             Transaction transaction1 = this.transactions[index];
             if (Math.Sign(transaction1.Amount) != num3)
             {
                 double num7 = Math.Min(qty - num6, transaction1.Qty);
                 num2 += num7 * (transaction.Cost / transaction.Qty + transaction1.Cost / transaction1.Qty);
                 num1 += (transaction.Price - transaction1.Price) * num7 * (double)-num3;
                 num6 += transaction1.Qty;
             }
         }
         this.WLw6lrSTTe = Math.Abs(qty - num6);
         this.GIf68BaEWm = qty == num6 && index == this.transactions.Count || qty > num6 ? this.transactions.Count : index - 1;
     }
     if (this.instrument.Factor != 0.0)
         num1 *= this.instrument.Factor;
     transaction.PnL = num1 - transaction.Cost;
     transaction.RealizedPnL = num1 - num2;
     if ((this.Amount + transaction.Amount) * this.Amount < 0.0)
     {
         if (transaction.Amount < 0.0)
         {
             this.qtySoldShort += this.WLw6lrSTTe;
             this.qtySold += transaction.Qty - this.WLw6lrSTTe;
         }
         else
             this.qtyBought += transaction.Qty;
     }
     else if (transaction.Amount < 0.0)
     {
         if (this.Amount <= 0.0)
             this.qtySoldShort += transaction.Qty;
         else
             this.qtySold += transaction.Qty;
     }
     else
         this.qtyBought += transaction.Qty;
     this.transactions.Add(transaction);
 }
Ejemplo n.º 25
0
 public void Add(Portfolio portfolio, Transaction transaction)
 {
 }
Ejemplo n.º 26
0
		public void Remove(Transaction transaction)
		{
			this.transactions.Remove(transaction);
		}
Ejemplo n.º 27
0
		public void DrawTransaction(Transaction transaction, int padNumber)
		{
			lock (this.dataLock)
			{
				if (!this.volumePadShown && padNumber > 1)
					--padNumber;
				TransactionView view = new TransactionView(transaction, this.pads[padNumber]);
				this.pads[padNumber].AddPrimitive(view);
				view.SetInterval(this.leftDateTime, this.rightDateTime);
			}
		}
Ejemplo n.º 28
0
		public TransactionEventArgs(Transaction transaction) : base()
		{
			this.Transaction = transaction; 
		}