public static Portfolio Open(PortfolioId id, AccountType accountType, Money initialDeposit)
        {
            if (initialDeposit < MinimumPortfolioBalance)
            {
                throw new InvalidOperationException(String.Format("The intial deposit of {0} is lower than the require a minimum of {1}", initialDeposit, MinimumPortfolioBalance));
            }

            var portfolio = new Portfolio(id);
            portfolio.OpenAccount(accountType);
            portfolio.CreditAccount(accountType, initialDeposit);

            return portfolio;
        }
예제 #2
0
        }                                      // this is very vague by intention - we won't execute any roles

        public int Compare(StreamRule other)
        {
            int ret = 0;

            ret = Id.CompareTo(other.Id);
            if (ret != 0)
            {
                return(ret);
            }
            ret = PortfolioId.CompareTo(other.PortfolioId);
            if (ret != 0)
            {
                return(ret);
            }
            ret = Expression.CompareTo(other.Expression);
            return(ret);
        }
        public int Compare(StreamTrade other)
        {
            int ret = 0;

            ret = Id.CompareTo(other.Id);
            if (ret != 0)
            {
                return(ret);
            }
            ret = PortfolioId.CompareTo(other.PortfolioId);
            if (ret != 0)
            {
                return(ret);
            }
            ret = InstrumentId.CompareTo(other.InstrumentId);
            if (ret != 0)
            {
                return(ret);
            }
            ret = (Bid != other.Bid ? Bid ? 1 : -1 : 0);
            if (ret != 0)
            {
                return(ret);
            }
            ret = (Price != other.Price ? Price > other.Price ? 1 : -1 : 0);
            if (ret != 0)
            {
                return(ret);
            }
            ret = (Volume != other.Volume ? Volume > other.Volume ? 1 : -1 : 0);
            if (ret != 0)
            {
                return(ret);
            }
            ret = Buyer.CompareTo(other.Buyer);
            if (ret != 0)
            {
                return(ret);
            }
            ret = Seller.CompareTo(other.Seller);
            return(ret);
        }
        public int Compare(StreamPosition other)
        {
            int ret = 0;

            ret = PortfolioId.CompareTo(other.PortfolioId);
            if (ret != 0)
            {
                return(ret);
            }
            ret = InstrumentId.CompareTo(other.InstrumentId);
            if (ret != 0)
            {
                return(ret);
            }
            ret = (Price != other.Price ? Price > other.Price ? 1 : -1 : 0);
            if (ret != 0)
            {
                return(ret);
            }
            ret = (Volume != other.Volume ? Volume > other.Volume ? 1 : -1 : 0);
            return(ret);
        }
예제 #5
0
 public override string ToString()
 {
     return($"{Duration},{PortfolioId.ToString()},{Value.ToString()}");
 }
예제 #6
0
 // add your base constructor call
 public ExampleEvent(PortfolioId portfolio, EntityId entity, UserId creator)
 {
     Creator   = creator;
     Portfolio = portfolio;
     Entity    = entity;
 }
예제 #7
0
 private ExampleEvent()     // for JSON deserializer
 {
     Creator   = new UserId();
     Portfolio = new PortfolioId();
     Entity    = new EntityId();
 }
예제 #8
0
 public PortfolioChanged(SpotCharterId spotId, Login login, int version, PortfolioId portfolioId, string portfolioName)
     : base(spotId, login, version)
 {
     this.PorfolioId    = portfolioId;
     this.PortfolioName = PortfolioName;
 }
 protected Portfolio(PortfolioId id)
     : base(id)
 {
     accounts = new HashSet<Account>();
 }
예제 #10
0
 public override int GetPartitionKey(int partitionCount)
 {
     return(partitionCount > 0 ? Math.Abs(PortfolioId.GetHashCode()) % partitionCount : -1);
 }
예제 #11
0
 public override int GetHashCode()
 {
     return(PortfolioId.GetHashCode() ^ this.CountryCode.GetHashCode());
 }
예제 #12
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TradeId.Length != 0)
            {
                hash ^= TradeId.GetHashCode();
            }
            if (ExchangeOrderId.Length != 0)
            {
                hash ^= ExchangeOrderId.GetHashCode();
            }
            if (System.Length != 0)
            {
                hash ^= System.GetHashCode();
            }
            if (Counterparty.Length != 0)
            {
                hash ^= Counterparty.GetHashCode();
            }
            if (PortfolioId.Length != 0)
            {
                hash ^= PortfolioId.GetHashCode();
            }
            if (Volume != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Volume);
            }
            if (InstrumentId.Length != 0)
            {
                hash ^= InstrumentId.GetHashCode();
            }
            if (Price != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Price);
            }
            if (Currency.Length != 0)
            {
                hash ^= Currency.GetHashCode();
            }
            if (timestamp_ != null)
            {
                hash ^= Timestamp.GetHashCode();
            }
            hash ^= AdditionalData.GetHashCode();
            if (SystemTradeId.Length != 0)
            {
                hash ^= SystemTradeId.GetHashCode();
            }
            if (UniqueTradeId.Length != 0)
            {
                hash ^= UniqueTradeId.GetHashCode();
            }
            if (Desk.Length != 0)
            {
                hash ^= Desk.GetHashCode();
            }
            if (ExchangeTradeId.Length != 0)
            {
                hash ^= ExchangeTradeId.GetHashCode();
            }
            if (MarketTrade != false)
            {
                hash ^= MarketTrade.GetHashCode();
            }
            if (AlgoId.Length != 0)
            {
                hash ^= AlgoId.GetHashCode();
            }
            if (Strategy.Length != 0)
            {
                hash ^= Strategy.GetHashCode();
            }
            if (Owner.Length != 0)
            {
                hash ^= Owner.GetHashCode();
            }
            if (ClearerAccount.Length != 0)
            {
                hash ^= ClearerAccount.GetHashCode();
            }
            if (Depot.Length != 0)
            {
                hash ^= Depot.GetHashCode();
            }
            if (Safekeeping.Length != 0)
            {
                hash ^= Safekeeping.GetHashCode();
            }
            if (Deleted != false)
            {
                hash ^= Deleted.GetHashCode();
            }
            if (FundingCurrency.Length != 0)
            {
                hash ^= FundingCurrency.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }