Example #1
0
        private void TradeStatusCallback(
            Int32 mode,
            Double number,
            Double orderNumber,
            [MarshalAs(UnmanagedType.LPStr)] string classCode,
            [MarshalAs(UnmanagedType.LPStr)] string secCode,
            Double price,
            Int32 qty,
            Double value,
            Int32 isSell,
            Int32 tradeDescriptor)
        {
            var trade = new TradeInfo()
            {
                Mode            = (TradeInfoMode)mode,
                Number          = number,
                OrderNumber     = orderNumber,
                ClassCode       = classCode,
                SecCode         = secCode,
                Price           = price,
                Qty             = qty,
                Value           = value,
                Direction       = TypeConverter.GetDirection(isSell),
                TradeDescriptor = tradeDescriptor
            };

            var tradeDetails = TradeInfoDetails.Fetch(trade.TradeDescriptor);

            this.OnTradeStatusChanged(new TradeInfoEventArgs(trade, tradeDetails));
        }
Example #2
0
        internal static TradeInfoDetails Fetch(Int32 tradeDescriptor, TradeInfoTimeType timeType = TradeInfoTimeType.QuikDate)
        {
            var td = new TradeInfoDetails();

            if (tradeDescriptor <= 0)
            {
                return(td);
            }

            // TODO: use async await
            td.Account                 = TradeEntryPoint.Account(tradeDescriptor);
            td.BrokerRef               = TradeEntryPoint.BrokerRef(tradeDescriptor);
            td.ClientCode              = TradeEntryPoint.ClientCode(tradeDescriptor);
            td.Currency                = TradeEntryPoint.Currency(tradeDescriptor);
            td.ExchangeCode            = TradeEntryPoint.ExchangeCode(tradeDescriptor);
            td.FirmId                  = TradeEntryPoint.FirmId(tradeDescriptor);
            td.PartnerFirmId           = TradeEntryPoint.PartnerFirmId(tradeDescriptor);
            td.SettleCode              = TradeEntryPoint.SettleCode(tradeDescriptor);
            td.SettleCurrency          = TradeEntryPoint.SettleCurrency(tradeDescriptor);
            td.StationId               = TradeEntryPoint.StationId(tradeDescriptor);
            td.UserId                  = TradeEntryPoint.UserId(tradeDescriptor);
            td.AccuredInt2             = TradeEntryPoint.AccuredInt2(tradeDescriptor);
            td.AccuredInt              = TradeEntryPoint.AccuredInt(tradeDescriptor);
            td.BlockSecurities         = TypeConverter.GetBool(TradeEntryPoint.BlockSecurities(tradeDescriptor));
            td.ClearingCenterComission = TradeEntryPoint.ClearingCenterComission(tradeDescriptor);
            td.Date                   = TradeEntryPoint.Date(tradeDescriptor);
            td.TradeDateTime          = TradeEntryPoint.DateTime(tradeDescriptor, (int)timeType);
            td.ExchangeComission      = TradeEntryPoint.ExchangeComission(tradeDescriptor);
            td.FileTime               = TypeConverter.GetDateTime(TradeEntryPoint.FileTime(tradeDescriptor));
            td.IsMarginal             = TypeConverter.GetBool(TradeEntryPoint.IsMarginal(tradeDescriptor));
            td.Kind                   = (TradeInfoKind)TradeEntryPoint.Kind(tradeDescriptor);
            td.LowerDiscount          = TradeEntryPoint.LowerDiscount(tradeDescriptor);
            td.Period                 = (TradeInfoPeriod)TradeEntryPoint.Period(tradeDescriptor);
            td.Price2                 = TradeEntryPoint.Price2(tradeDescriptor);
            td.Repo2Value             = TradeEntryPoint.Repo2Value(tradeDescriptor);
            td.RepoRate               = TradeEntryPoint.RepoRate(tradeDescriptor);
            td.RepoTerm               = TradeEntryPoint.RepoTerm(tradeDescriptor);
            td.RepoValue              = TradeEntryPoint.RepoValue(tradeDescriptor);
            td.SettleDate             = TradeEntryPoint.SettleDate(tradeDescriptor);
            td.StartDiscount          = TradeEntryPoint.StartDiscount(tradeDescriptor);
            td.Time                   = TradeEntryPoint.Time(tradeDescriptor);
            td.TradingSystemComission = TradeEntryPoint.TradingSystemComission(tradeDescriptor);
            td.TsComission            = TradeEntryPoint.TsComission(tradeDescriptor);
            td.UpperDiscount          = TradeEntryPoint.UpperDiscount(tradeDescriptor);
            td.Yield                  = TradeEntryPoint.Yield(tradeDescriptor);

            return(td);
        }
 public TradeInfoEventArgs(TradeInfo tradeInfo, TradeInfoDetails tradeInfoDetails)
 {
     this.TradeInfo        = tradeInfo;
     this.TradeInfoDetails = tradeInfoDetails;
 }