示例#1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (BrokerId.Length != 0)
            {
                hash ^= BrokerId.GetHashCode();
            }
            if (InvestorId.Length != 0)
            {
                hash ^= InvestorId.GetHashCode();
            }
            if (InstrumentId.Length != 0)
            {
                hash ^= InstrumentId.GetHashCode();
            }
            if (ExchangeId.Length != 0)
            {
                hash ^= ExchangeId.GetHashCode();
            }
            if (HedgeFlag != 0)
            {
                hash ^= HedgeFlag.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#2
0
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
        {
            base.LooseUnmarshal(wireFormat, o, dataIn);

            ConnectionInfo info = (ConnectionInfo)o;

            info.ConnectionId = (ConnectionId)LooseUnmarshalCachedObject(wireFormat, dataIn);
            info.ClientId     = LooseUnmarshalString(dataIn);
            info.Password     = LooseUnmarshalString(dataIn);
            info.UserName     = LooseUnmarshalString(dataIn);

            if (dataIn.ReadBoolean())
            {
                short      size  = dataIn.ReadInt16();
                BrokerId[] value = new BrokerId[size];
                for (int i = 0; i < size; i++)
                {
                    value[i] = (BrokerId)LooseUnmarshalNestedObject(wireFormat, dataIn);
                }
                info.BrokerPath = value;
            }
            else
            {
                info.BrokerPath = null;
            }
            info.BrokerMasterConnector = dataIn.ReadBoolean();
            info.Manageable            = dataIn.ReadBoolean();
            info.ClientMaster          = dataIn.ReadBoolean();
        }
        public async Task Handle(
            DateTimeOffset date, UserId user, BrokerId brokerId, AssetId assetId, int count)
        {
            if (count <= 0)
            {
                throw new InvalidCountException();
            }
            var state  = _stateManager.ReadState(date, user);
            var broker = state.Brokers.FirstOrDefault(b => b.Id == brokerId);

            if (broker == null)
            {
                throw new InvalidBrokerException();
            }
            if (string.IsNullOrWhiteSpace(assetId))
            {
                throw new InvalidAssetException();
            }
            var asset = broker.Inventory.FirstOrDefault(a => a.Id == assetId);

            if (asset == null)
            {
                throw new AssetNotFoundException();
            }
            var remainingCount = asset.Count - count;

            if (remainingCount < 0)
            {
                throw new InvalidCountException();
            }
            await _stateManager.AddCommand(new ReduceAssetCommand(date, user, brokerId, assetId, count));
        }
示例#4
0
        public async Task Handle(
            DateTimeOffset date, UserId user, BrokerId broker, AccountId account,
            decimal amount, ExpenseCategory category, AssetId?asset)
        {
            if (amount == 0)
            {
                throw new InvalidPriceException();
            }
            if (string.IsNullOrWhiteSpace(category.ToString()))
            {
                throw new InvalidCategoryException();
            }
            var state       = _stateManager.ReadState(date, user);
            var brokerState = state.Brokers.FirstOrDefault(b => b.Id == broker);

            if (brokerState == null)
            {
                throw new BrokerNotFoundException();
            }
            if (brokerState.Accounts.All(a => a.Id != account))
            {
                throw new AccountNotFoundException();
            }
            if ((asset != null) && brokerState.Inventory.All(a => a.Id != asset))
            {
                throw new AssetNotFoundException();
            }
            var id = new OperationId(_idGenerator.GenerateNewId());
            await _stateManager.AddCommand(new AddExpenseCommand(
                                               date, user, broker, account, id, amount, category, asset));
        }
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
        {
            base.TightUnmarshal(wireFormat, o, dataIn, bs);

            ProducerInfo info = (ProducerInfo)o;

            info.ProducerId  = (ProducerId)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.Destination = (ActiveMQDestination)TightUnmarshalCachedObject(wireFormat, dataIn, bs);

            if (bs.ReadBoolean())
            {
                short      size  = dataIn.ReadInt16();
                BrokerId[] value = new BrokerId[size];
                for (int i = 0; i < size; i++)
                {
                    value[i] = (BrokerId)TightUnmarshalNestedObject(wireFormat, dataIn, bs);
                }
                info.BrokerPath = value;
            }
            else
            {
                info.BrokerPath = null;
            }
            info.DispatchAsync = bs.ReadBoolean();
        }
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
        {
            base.TightUnmarshal(wireFormat, o, dataIn, bs);

            ConnectionInfo info = (ConnectionInfo)o;

            info.ConnectionId = (ConnectionId)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.ClientId     = TightUnmarshalString(dataIn, bs);
            info.Password     = TightUnmarshalString(dataIn, bs);
            info.UserName     = TightUnmarshalString(dataIn, bs);

            if (bs.ReadBoolean())
            {
                short      size  = dataIn.ReadInt16();
                BrokerId[] value = new BrokerId[size];
                for (int i = 0; i < size; i++)
                {
                    value[i] = (BrokerId)TightUnmarshalNestedObject(wireFormat, dataIn, bs);
                }
                info.BrokerPath = value;
            }
            else
            {
                info.BrokerPath = null;
            }
            info.BrokerMasterConnector = bs.ReadBoolean();
            info.Manageable            = bs.ReadBoolean();
            info.ClientMaster          = bs.ReadBoolean();
            info.FaultTolerant         = bs.ReadBoolean();
            info.FailoverReconnect     = bs.ReadBoolean();
        }
示例#7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (BrokerId.Length != 0)
            {
                hash ^= BrokerId.GetHashCode();
            }
            if (UserId.Length != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (AppId.Length != 0)
            {
                hash ^= AppId.GetHashCode();
            }
            if (AuthCode.Length != 0)
            {
                hash ^= AuthCode.GetHashCode();
            }
            if (UserProductInfo.Length != 0)
            {
                hash ^= UserProductInfo.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#8
0
        //
        // Write a object instance to data output stream
        //
        public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
        {
            BrokerId info = (BrokerId)o;

            base.LooseMarshal(wireFormat, o, dataOut);
            LooseMarshalString(info.Value, dataOut);
        }
 public ReadOnlyBroker(Broker broker)
 {
     Id          = broker.Id;
     DisplayName = broker.DisplayName;
     Accounts    = broker.Accounts.Select(a => new ReadOnlyAccount(a)).ToArray();
     Inventory   = broker.Inventory.Select(a => new ReadOnlyAsset(a)).ToArray();
 }
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
        {
            base.TightUnmarshal(wireFormat, o, dataIn, bs);

            DestinationInfo info = (DestinationInfo)o;

            info.ConnectionId  = (ConnectionId)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.Destination   = (ActiveMQDestination)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.OperationType = dataIn.ReadByte();
            info.Timeout       = TightUnmarshalLong(wireFormat, dataIn, bs);

            if (bs.ReadBoolean())
            {
                short      size  = dataIn.ReadInt16();
                BrokerId[] value = new BrokerId[size];
                for (int i = 0; i < size; i++)
                {
                    value[i] = (BrokerId)TightUnmarshalNestedObject(wireFormat, dataIn, bs);
                }
                info.BrokerPath = value;
            }
            else
            {
                info.BrokerPath = null;
            }
        }
示例#11
0
        public async Task Handle(
            DateTimeOffset date, UserId user, BrokerId broker, CurrencyCode currency, string displayName)
        {
            if (string.IsNullOrWhiteSpace(displayName))
            {
                throw new InvalidAccountException();
            }
            var state = _stateManager.ReadState(date, user);

            if (!_currencyConfig.HasCurrency(currency))
            {
                throw new CurrencyNotFoundException();
            }
            var brokerState = state.Brokers.FirstOrDefault(b => b.Id == broker);

            if (brokerState == null)
            {
                throw new BrokerNotFoundException();
            }
            if (brokerState.Accounts.Any(a => a.DisplayName == displayName))
            {
                throw new DuplicateAccountException();
            }
            var id = new AccountId(_idGenerator.GenerateNewId());
            await _stateManager.AddCommand(new CreateAccountCommand(date, user, broker, id, currency, displayName));
        }
示例#12
0
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
        {
            base.TightUnmarshal(wireFormat, o, dataIn, bs);

            BrokerId info = (BrokerId)o;

            info.Value = TightUnmarshalString(dataIn, bs);
        }
示例#13
0
        //
        // Write a object instance to data output stream
        //
        public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs)
        {
            base.TightMarshal2(wireFormat, o, dataOut, bs);

            BrokerId info = (BrokerId)o;

            TightMarshalString2(info.Value, dataOut, bs);
        }
示例#14
0
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
        {
            base.LooseUnmarshal(wireFormat, o, dataIn);

            BrokerId info = (BrokerId)o;

            info.Value = LooseUnmarshalString(dataIn);
        }
示例#15
0
 protected async Task FillIncomeTransfers(
     UserId user, BrokerId brokerId, IReadOnlyCollection <Transfer> incomeTransfers,
     IReadOnlyCollection <Exchange> exchanges,
     Dictionary <CurrencyCode, AccountId> currencyAccounts,
     Dictionary <AccountId, IReadOnlyCollection <AddIncomeCommand> > incomeAccountCommands)
 {
     foreach (var incomeTransfer in incomeTransfers)
     {
         var accountId = currencyAccounts[new(incomeTransfer.Currency)];
示例#16
0
        public virtual bool Equals(BrokerId that)
        {
            if (!Equals(this.Value, that.Value))
            {
                return(false);
            }

            return(true);
        }
示例#17
0
        public virtual bool Equals(BrokerId that)
        {
            if(!Equals(this.Value, that.Value))
            {
                return false;
            }

            return true;
        }
示例#18
0
        //
        // Write the booleans that this object uses to a BooleanStream
        //
        public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)
        {
            BrokerId info = (BrokerId)o;

            int rc = base.TightMarshal1(wireFormat, o, bs);

            rc += TightMarshalString1(info.Value, bs);

            return(rc + 0);
        }
示例#19
0
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
        {
            base.TightUnmarshal(wireFormat, o, dataIn, bs);

            ConsumerInfo info = (ConsumerInfo)o;

            info.ConsumerId   = (ConsumerId)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.Browser      = bs.ReadBoolean();
            info.Destination  = (ActiveMQDestination)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.PrefetchSize = dataIn.ReadInt32();
            info.MaximumPendingMessageLimit = dataIn.ReadInt32();
            info.DispatchAsync    = bs.ReadBoolean();
            info.Selector         = TightUnmarshalString(dataIn, bs);
            info.ClientId         = TightUnmarshalString(dataIn, bs);
            info.SubscriptionName = TightUnmarshalString(dataIn, bs);
            info.NoLocal          = bs.ReadBoolean();
            info.Exclusive        = bs.ReadBoolean();
            info.Retroactive      = bs.ReadBoolean();
            info.Priority         = dataIn.ReadByte();

            if (bs.ReadBoolean())
            {
                short      size  = dataIn.ReadInt16();
                BrokerId[] value = new BrokerId[size];
                for (int i = 0; i < size; i++)
                {
                    value[i] = (BrokerId)TightUnmarshalNestedObject(wireFormat, dataIn, bs);
                }
                info.BrokerPath = value;
            }
            else
            {
                info.BrokerPath = null;
            }
            info.AdditionalPredicate  = (BooleanExpression)TightUnmarshalNestedObject(wireFormat, dataIn, bs);
            info.NetworkSubscription  = bs.ReadBoolean();
            info.OptimizedAcknowledge = bs.ReadBoolean();
            info.NoRangeAcks          = bs.ReadBoolean();

            if (bs.ReadBoolean())
            {
                short        size  = dataIn.ReadInt16();
                ConsumerId[] value = new ConsumerId[size];
                for (int i = 0; i < size; i++)
                {
                    value[i] = (ConsumerId)TightUnmarshalNestedObject(wireFormat, dataIn, bs);
                }
                info.NetworkConsumerPath = value;
            }
            else
            {
                info.NetworkConsumerPath = null;
            }
        }
示例#20
0
        public async Task Handle(DateTimeOffset date, UserId user, BrokerId brokerId, Stream stream)
        {
            _stateManager.Prepare(user);
            var report                = new XLWorkbook(stream);
            var incomeTransfers       = _moneyMoveParser.ReadIncomeTransfers(report);
            var expenseTransfers      = _moneyMoveParser.ReadExpenseTransfers(report);
            var dividendTransfers     = _moneyMoveParser.ReadDividendTransfers(report);
            var couponTransfers       = _moneyMoveParser.ReadCouponTransfers(report);
            var redemptionTransfers   = _moneyMoveParser.ReadRedemptionTransfers(report);
            var assets                = _assetParser.ReadAssets(report);
            var trades                = _tradeParser.ReadTrades(report, assets);
            var assetStates           = _assetMoveParser.ReadAssetStates(report);
            var splits                = _splitDetector.DetectSplitCases(trades, assetStates);
            var exchanges             = _tradeParser.ReadExchanges(report);
            var requiredCurrencyCodes = GetRequiredCurrencyCodes(
                incomeTransfers.Select(t => t.Currency),
                expenseTransfers.Select(t => t.Currency),
                dividendTransfers.Select(t => t.Currency),
                couponTransfers.Select(t => t.Currency),
                redemptionTransfers.Select(t => t.Currency),
                trades.Select(t => t.Currency),
                exchanges.Select(e => e.FromCurrency),
                exchanges.Select(e => e.ToCurrency),
                new[] { "RUB" })
                                        .Select(s => new CurrencyCode(s))
                                        .ToArray();
            var state  = _stateManager.ReadState(date, user);
            var broker = state.Brokers.FirstOrDefault(b => b.Id == brokerId);

            if (broker == null)
            {
                throw new BrokerNotFoundException();
            }
            var currencyAccounts       = CreateCurrencyAccounts(requiredCurrencyCodes, broker.Accounts);
            var allIncomeCommands      = _stateManager.ReadCommands <AddIncomeCommand>(user, brokerId);
            var incomeAccountCommands  = CreateAccountCommands(currencyAccounts, allIncomeCommands);
            var allExpenseCommands     = _stateManager.ReadCommands <AddExpenseCommand>(user, brokerId);
            var expenseAccountCommands = CreateAccountCommands(currencyAccounts, allExpenseCommands);

            await FillIncomeTransfers(user, brokerId, incomeTransfers, exchanges, currencyAccounts, incomeAccountCommands);
            await FillExpenseTransfers(user, brokerId, expenseTransfers, exchanges, currencyAccounts, expenseAccountCommands);

            var addAssetCommands    = _stateManager.ReadCommands <AddAssetCommand>(user, brokerId).ToArray();
            var reduceAssetCommands = _stateManager.ReadCommands <ReduceAssetCommand>(user, brokerId).ToArray();
            var assetIds            = await FillTrades(user, brokerId, trades, currencyAccounts, addAssetCommands, reduceAssetCommands, splits);

            EnrichAssetsFromState(broker.Inventory, assetIds);
            await FillDividends(user, brokerId, dividendTransfers, currencyAccounts, incomeAccountCommands, assets, assetIds);
            await FillCoupons(user, brokerId, couponTransfers, currencyAccounts, incomeAccountCommands, trades, assetIds, broker.Inventory);
            await FillRedemptions(user, brokerId, redemptionTransfers, currencyAccounts, incomeAccountCommands, trades, assetIds, broker.Inventory);

            await _stateManager.Push();
        }
示例#21
0
 /// <summary>
 /// Copies base Order properties to the specified order
 /// </summary>
 /// <param name="order">The target of the copy</param>
 protected void CopyTo(Order order)
 {
     order.Id           = Id;
     order.Time         = Time;
     order.BrokerId     = BrokerId.ToList();
     order.ContingentId = ContingentId;
     order.Duration     = Duration;
     order.Price        = Price;
     order.Quantity     = Quantity;
     order.Status       = Status;
     order.Symbol       = Symbol;
     order.Tag          = Tag;
 }
示例#22
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (BrokerId.Length != 0)
            {
                hash ^= BrokerId.GetHashCode();
            }
            if (InvestorId.Length != 0)
            {
                hash ^= InvestorId.GetHashCode();
            }
            if (UserId.Length != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (InstrumentId.Length != 0)
            {
                hash ^= InstrumentId.GetHashCode();
            }
            if (ExchangeId.Length != 0)
            {
                hash ^= ExchangeId.GetHashCode();
            }
            if (OrderSysId.Length != 0)
            {
                hash ^= OrderSysId.GetHashCode();
            }
            if (OrderRef.Length != 0)
            {
                hash ^= OrderRef.GetHashCode();
            }
            if (FrontId != 0)
            {
                hash ^= FrontId.GetHashCode();
            }
            if (SessionId != 0)
            {
                hash ^= SessionId.GetHashCode();
            }
            if (ActionFlag != 0)
            {
                hash ^= ActionFlag.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#23
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (InstrumentId.Length != 0)
            {
                hash ^= InstrumentId.GetHashCode();
            }
            if (BrokerId.Length != 0)
            {
                hash ^= BrokerId.GetHashCode();
            }
            if (InvestorId.Length != 0)
            {
                hash ^= InvestorId.GetHashCode();
            }
            if (OpenRatioByMoney != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(OpenRatioByMoney);
            }
            if (OpenRatioByVolume != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(OpenRatioByVolume);
            }
            if (CloseRatioByMoney != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(CloseRatioByMoney);
            }
            if (CloseRatioByVolume != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(CloseRatioByVolume);
            }
            if (CloseTodayRatioByMoney != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(CloseTodayRatioByMoney);
            }
            if (CloseTodayRatioByVolume != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(CloseTodayRatioByVolume);
            }
            if (ExchangeId.Length != 0)
            {
                hash ^= ExchangeId.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public async Task Handle(DateTimeOffset date, UserId user, string displayName)
        {
            if (string.IsNullOrWhiteSpace(displayName))
            {
                throw new InvalidBrokerException();
            }
            var state = _stateManager.ReadState(date, user);

            if (state.Brokers.Any(b => b.DisplayName == displayName))
            {
                throw new DuplicateBrokerException();
            }
            var id = new BrokerId(_idGenerator.GenerateNewId());
            await _stateManager.AddCommand(new CreateBrokerCommand(date, user, id, displayName));
        }
示例#25
0
 /// <summary>
 /// Copies base Order properties to the specified order
 /// </summary>
 /// <param name="order">The target of the copy</param>
 protected void CopyTo(Order order)
 {
     order.Id                  = Id;
     order.Time                = Time;
     order.BrokerId            = BrokerId.ToList();
     order.ContingentId        = ContingentId;
     order.TimeInForce         = TimeInForce;
     order.Price               = Price;
     order.PriceCurrency       = PriceCurrency;
     order.Quantity            = Quantity;
     order.Status              = Status;
     order.Symbol              = Symbol;
     order.Tag                 = Tag;
     order.Properties          = Properties?.Clone();
     order.OrderSubmissionData = OrderSubmissionData?.Clone();
 }
示例#26
0
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
        {
            base.TightUnmarshal(wireFormat, o, dataIn, bs);

            Message info = (Message)o;

            info.ProducerId            = (ProducerId)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.Destination           = (ActiveMQDestination)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.TransactionId         = (TransactionId)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.OriginalDestination   = (ActiveMQDestination)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.MessageId             = (MessageId)TightUnmarshalNestedObject(wireFormat, dataIn, bs);
            info.OriginalTransactionId = (TransactionId)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.GroupID              = TightUnmarshalString(dataIn, bs);
            info.GroupSequence        = dataIn.ReadInt32();
            info.CorrelationId        = TightUnmarshalString(dataIn, bs);
            info.Persistent           = bs.ReadBoolean();
            info.Expiration           = TightUnmarshalLong(wireFormat, dataIn, bs);
            info.Priority             = dataIn.ReadByte();
            info.ReplyTo              = (ActiveMQDestination)TightUnmarshalNestedObject(wireFormat, dataIn, bs);
            info.Timestamp            = TightUnmarshalLong(wireFormat, dataIn, bs);
            info.Type                 = TightUnmarshalString(dataIn, bs);
            info.Content              = ReadBytes(dataIn, bs.ReadBoolean());
            info.MarshalledProperties = ReadBytes(dataIn, bs.ReadBoolean());
            info.DataStructure        = (DataStructure)TightUnmarshalNestedObject(wireFormat, dataIn, bs);
            info.TargetConsumerId     = (ConsumerId)TightUnmarshalCachedObject(wireFormat, dataIn, bs);
            info.Compressed           = bs.ReadBoolean();
            info.RedeliveryCounter    = dataIn.ReadInt32();

            if (bs.ReadBoolean())
            {
                short      size  = dataIn.ReadInt16();
                BrokerId[] value = new BrokerId[size];
                for (int i = 0; i < size; i++)
                {
                    value[i] = (BrokerId)TightUnmarshalNestedObject(wireFormat, dataIn, bs);
                }
                info.BrokerPath = value;
            }
            else
            {
                info.BrokerPath = null;
            }
            info.Arrival            = TightUnmarshalLong(wireFormat, dataIn, bs);
            info.UserID             = TightUnmarshalString(dataIn, bs);
            info.RecievedByDFBridge = bs.ReadBoolean();
            info.Droppable          = bs.ReadBoolean();
        }
示例#27
0
        async Task <Dictionary <string, AssetId> > FillTrades(
            UserId user, BrokerId brokerId, IReadOnlyCollection <Trade> trades,
            Dictionary <CurrencyCode, AccountId> currencyAccounts,
            IReadOnlyCollection <AddAssetCommand> addCommands, IReadOnlyCollection <ReduceAssetCommand> reduceCommands, IReadOnlyCollection <SplitCase> splits)
        {
            var assetIds    = new Dictionary <string, AssetId>();
            var splitsToUse = splits.ToList();

            foreach (var trade in trades)
            {
                var date       = trade.Date;
                var isin       = trade.Isin;
                var count      = trade.Count;
                var price      = trade.Sum;
                var fee        = trade.Fee;
                var buy        = trade.Count > 0;
                var payAccount = currencyAccounts[new(trade.Currency)];
示例#28
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (InstrumentId.Length != 0)
            {
                hash ^= InstrumentId.GetHashCode();
            }
            if (BrokerId.Length != 0)
            {
                hash ^= BrokerId.GetHashCode();
            }
            if (InvestorId.Length != 0)
            {
                hash ^= InvestorId.GetHashCode();
            }
            if (HedgeFlag != 0)
            {
                hash ^= HedgeFlag.GetHashCode();
            }
            if (LongMarginRatioByMoney != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LongMarginRatioByMoney);
            }
            if (LongMarginRatioByVolume != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(LongMarginRatioByVolume);
            }
            if (ShortMarginRatioByMoney != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(ShortMarginRatioByMoney);
            }
            if (ShortMarginRatioByVolume != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(ShortMarginRatioByVolume);
            }
            if (ExchangeId.Length != 0)
            {
                hash ^= ExchangeId.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#29
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (BrokerId.Length != 0)
            {
                hash ^= BrokerId.GetHashCode();
            }
            if (UserId.Length != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#30
0
文件: Order.cs 项目: sbnair/lineage
 /// <summary>
 /// Copies base Order properties to the specified order
 /// </summary>
 /// <param name="order">The target of the copy</param>
 protected void CopyTo(Order order)
 {
     order.Id                  = Id;
     order.Time                = Time;
     order.LastFillTime        = LastFillTime;
     order.LastUpdateTime      = LastUpdateTime;
     order.CanceledTime        = CanceledTime;
     order.BrokerId            = BrokerId.ToList();
     order.ContingentId        = ContingentId;
     order.Price               = Price;
     order.PriceCurrency       = PriceCurrency;
     order.Quantity            = Quantity;
     order.Status              = Status;
     order.Symbol              = Symbol;
     order.ExpiryDate          = ExpiryDate;
     order.Tag                 = Tag;
     order.Reason              = Reason;
     order.Properties          = Properties.Clone();
     order.OrderSubmissionData = OrderSubmissionData?.Clone();
 }
示例#31
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TradingDay.Length != 0)
            {
                hash ^= TradingDay.GetHashCode();
            }
            if (LoginTime.Length != 0)
            {
                hash ^= LoginTime.GetHashCode();
            }
            if (BrokerId.Length != 0)
            {
                hash ^= BrokerId.GetHashCode();
            }
            if (UserId.Length != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (SystemName.Length != 0)
            {
                hash ^= SystemName.GetHashCode();
            }
            if (FrontId != 0)
            {
                hash ^= FrontId.GetHashCode();
            }
            if (SessionId != 0)
            {
                hash ^= SessionId.GetHashCode();
            }
            if (MaxOrderRef.Length != 0)
            {
                hash ^= MaxOrderRef.GetHashCode();
            }
            if (ShfeTime.Length != 0)
            {
                hash ^= ShfeTime.GetHashCode();
            }
            if (DceTime.Length != 0)
            {
                hash ^= DceTime.GetHashCode();
            }
            if (CzceTime.Length != 0)
            {
                hash ^= CzceTime.GetHashCode();
            }
            if (FfexTime.Length != 0)
            {
                hash ^= FfexTime.GetHashCode();
            }
            if (IneTime.Length != 0)
            {
                hash ^= IneTime.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }