public CryptsyMarketTrade(TradeId tradeId, OrderType tradeType,
     DateTime dateTime, decimal price,
     decimal quantity, decimal fee,
     MarketId marketId)
     : base(tradeId, dateTime, price, quantity, marketId)
 {
     this.TradeType = tradeType;
     this.Fee = fee;
 }
Esempio n. 2
0
 public MyTrade(TradeId tradeId, OrderType tradeType,
     DateTime dateTime, decimal price, decimal? fee,
     decimal quantity,
     MarketId marketId, OrderId orderId)
     : base(tradeId, dateTime, price, quantity, marketId)
 {
     this.Fee = fee;
     this.OrderId = orderId;
     this.TradeType = tradeType;
 }
 public CoinsEMarketTrade(TradeId tradeId,
     DateTime dateTime, decimal price,
     decimal quantity, CoinsEMarketId marketId,
     CoinsEOrderNumber buyOrderId, CoinsEOrderNumber sellOrderId,
     string status)
     : base(tradeId, dateTime, price, quantity, marketId)
 {
     this.BuyOrderId = buyOrderId;
     this.SellOrderId = sellOrderId;
     this.Status = status;
 }
Esempio n. 4
0
 public Trade(TradeId tradeId,
     DateTime dateTime, decimal price,
     decimal quantity,
     MarketId marketId)
 {
     this.Price = price;
     this.Quantity = quantity;
     this.TradeId = tradeId;
     this.DateTime = dateTime;
     this.MarketId = marketId;
 }
        private async Task <int> GetHiValueFromEventStore()
        {
            TradeId tradeId;

            try
            {
                tradeId = await _repository.GetById <TradeId>(null);
            }
            catch (AggregateNotFoundException)
            {
                tradeId = new TradeId();
            }

            tradeId.IncrementId();

            await _repository.SaveAsync(tradeId);

            return(tradeId.Version);
        }
Esempio n. 6
0
        public async Task<IEnumerable<Trade>> TradeHistory(SymbolPair pair, TradeId? tradeId = null, CancellationToken? cancelToken = null)
        {
            const string basePath = "/trade_history";
            var path = string.Format("{0}/{1}/{2}", basePath, pair.From, pair.To);
            if (tradeId != null)
                path += string.Format("/?since={0}", tradeId.Value);

            try
            {
                return await this.GetFromService(
                    path,
                    Trade.FromDynamic,
                    cancelToken
                    );
            }
            catch (AggregateException ae)
            {
                throw ae.Flatten();
            }
        }
Esempio n. 7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TradeId.Length != 0)
            {
                hash ^= TradeId.GetHashCode();
            }
            if (OtherPartyUuid.Length != 0)
            {
                hash ^= OtherPartyUuid.GetHashCode();
            }
            if (Success != false)
            {
                hash ^= Success.GetHashCode();
            }
            hash ^= items_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 8
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (SessionId.Length != 0)
            {
                hash ^= SessionId.GetHashCode();
            }
            if (Uuid.Length != 0)
            {
                hash ^= Uuid.GetHashCode();
            }
            if (TradeId.Length != 0)
            {
                hash ^= TradeId.GetHashCode();
            }
            if (Token.Length != 0)
            {
                hash ^= Token.GetHashCode();
            }
            hash ^= items_.GetHashCode();
            hash ^= otherPartyItems_.GetHashCode();
            return(hash);
        }
Esempio n. 9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TradeId.Length != 0)
            {
                hash ^= TradeId.GetHashCode();
            }
            if (OtherPartyUuid.Length != 0)
            {
                hash ^= OtherPartyUuid.GetHashCode();
            }
            hash ^= items_.GetHashCode();
            hash ^= otherPartyItems_.GetHashCode();
            if (Accepted != false)
            {
                hash ^= Accepted.GetHashCode();
            }
            if (OtherPartyAccepted != false)
            {
                hash ^= OtherPartyAccepted.GetHashCode();
            }
            return(hash);
        }
Esempio n. 10
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (Price != 0F)
        {
            hash ^= Price.GetHashCode();
        }
        if (Date.Length != 0)
        {
            hash ^= Date.GetHashCode();
        }
        if (Datetime.Length != 0)
        {
            hash ^= Datetime.GetHashCode();
        }
        if (SendingTime.Length != 0)
        {
            hash ^= SendingTime.GetHashCode();
        }
        if (TransactTime.Length != 0)
        {
            hash ^= TransactTime.GetHashCode();
        }
        if (Amount != 0F)
        {
            hash ^= Amount.GetHashCode();
        }
        if (Towards != 0L)
        {
            hash ^= Towards.GetHashCode();
        }
        if (Code.Length != 0)
        {
            hash ^= Code.GetHashCode();
        }
        if (User.Length != 0)
        {
            hash ^= User.GetHashCode();
        }
        if (Strategy.Length != 0)
        {
            hash ^= Strategy.GetHashCode();
        }
        if (Type.Length != 0)
        {
            hash ^= Type.GetHashCode();
        }
        if (BidModel.Length != 0)
        {
            hash ^= BidModel.GetHashCode();
        }
        if (AmountModel.Length != 0)
        {
            hash ^= AmountModel.GetHashCode();
        }
        if (OrderId.Length != 0)
        {
            hash ^= OrderId.GetHashCode();
        }
        if (TradeId.Length != 0)
        {
            hash ^= TradeId.GetHashCode();
        }
        if (Status.Length != 0)
        {
            hash ^= Status.GetHashCode();
        }
        return(hash);
    }
 public PreludeMarketTrade(TradeId tradeId, 
     DateTime dateTime, decimal price,
     decimal quantity, MarketId marketId)
     : base(tradeId, dateTime, price, quantity, marketId)
 {
 }
Esempio n. 12
0
        /// <summary>
        /// Returns true if UserTrade instances are equal
        /// </summary>
        /// <param name="other">Instance of UserTrade to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(UserTrade other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Direction == other.Direction ||

                     Direction.Equals(other.Direction)
                     ) &&
                 (
                     FeeCurrency == other.FeeCurrency ||

                     FeeCurrency.Equals(other.FeeCurrency)
                 ) &&
                 (
                     OrderId == other.OrderId ||
                     OrderId != null &&
                     OrderId.Equals(other.OrderId)
                 ) &&
                 (
                     Timestamp == other.Timestamp ||
                     Timestamp != null &&
                     Timestamp.Equals(other.Timestamp)
                 ) &&
                 (
                     Price == other.Price ||
                     Price != null &&
                     Price.Equals(other.Price)
                 ) &&
                 (
                     Iv == other.Iv ||
                     Iv != null &&
                     Iv.Equals(other.Iv)
                 ) &&
                 (
                     TradeId == other.TradeId ||
                     TradeId != null &&
                     TradeId.Equals(other.TradeId)
                 ) &&
                 (
                     Fee == other.Fee ||
                     Fee != null &&
                     Fee.Equals(other.Fee)
                 ) &&
                 (
                     OrderType == other.OrderType ||

                     OrderType.Equals(other.OrderType)
                 ) &&
                 (
                     TradeSeq == other.TradeSeq ||
                     TradeSeq != null &&
                     TradeSeq.Equals(other.TradeSeq)
                 ) &&
                 (
                     SelfTrade == other.SelfTrade ||
                     SelfTrade != null &&
                     SelfTrade.Equals(other.SelfTrade)
                 ) &&
                 (
                     State == other.State ||

                     State.Equals(other.State)
                 ) &&
                 (
                     Label == other.Label ||
                     Label != null &&
                     Label.Equals(other.Label)
                 ) &&
                 (
                     IndexPrice == other.IndexPrice ||
                     IndexPrice != null &&
                     IndexPrice.Equals(other.IndexPrice)
                 ) &&
                 (
                     Amount == other.Amount ||
                     Amount != null &&
                     Amount.Equals(other.Amount)
                 ) &&
                 (
                     InstrumentName == other.InstrumentName ||
                     InstrumentName != null &&
                     InstrumentName.Equals(other.InstrumentName)
                 ) &&
                 (
                     TickDirection == other.TickDirection ||

                     TickDirection.Equals(other.TickDirection)
                 ) &&
                 (
                     MatchingId == other.MatchingId ||
                     MatchingId != null &&
                     MatchingId.Equals(other.MatchingId)
                 ) &&
                 (
                     Liquidity == other.Liquidity ||

                     Liquidity.Equals(other.Liquidity)
                 ));
        }
Esempio n. 13
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)

                hashCode = hashCode * 59 + Direction.GetHashCode();

                hashCode = hashCode * 59 + FeeCurrency.GetHashCode();
                if (OrderId != null)
                {
                    hashCode = hashCode * 59 + OrderId.GetHashCode();
                }
                if (Timestamp != null)
                {
                    hashCode = hashCode * 59 + Timestamp.GetHashCode();
                }
                if (Price != null)
                {
                    hashCode = hashCode * 59 + Price.GetHashCode();
                }
                if (Iv != null)
                {
                    hashCode = hashCode * 59 + Iv.GetHashCode();
                }
                if (TradeId != null)
                {
                    hashCode = hashCode * 59 + TradeId.GetHashCode();
                }
                if (Fee != null)
                {
                    hashCode = hashCode * 59 + Fee.GetHashCode();
                }

                hashCode = hashCode * 59 + OrderType.GetHashCode();
                if (TradeSeq != null)
                {
                    hashCode = hashCode * 59 + TradeSeq.GetHashCode();
                }
                if (SelfTrade != null)
                {
                    hashCode = hashCode * 59 + SelfTrade.GetHashCode();
                }

                hashCode = hashCode * 59 + State.GetHashCode();
                if (Label != null)
                {
                    hashCode = hashCode * 59 + Label.GetHashCode();
                }
                if (IndexPrice != null)
                {
                    hashCode = hashCode * 59 + IndexPrice.GetHashCode();
                }
                if (Amount != null)
                {
                    hashCode = hashCode * 59 + Amount.GetHashCode();
                }
                if (InstrumentName != null)
                {
                    hashCode = hashCode * 59 + InstrumentName.GetHashCode();
                }

                hashCode = hashCode * 59 + TickDirection.GetHashCode();
                if (MatchingId != null)
                {
                    hashCode = hashCode * 59 + MatchingId.GetHashCode();
                }

                hashCode = hashCode * 59 + Liquidity.GetHashCode();
                return(hashCode);
            }
        }
 public static void TradeIdentifierSetTradeId(TradeIdentifier tradeIdentifier, TradeId tradeId)
 {
     tradeIdentifier.Items = new object[] { tradeId };
 }
Esempio n. 15
0
 public MarketTrade(TradeId tradeId, DateTime dateTime, decimal price,
                    decimal quantity, MarketId marketId) : base(tradeId, dateTime, price, quantity, marketId)
 {
 }
        void ReleaseDesignerOutlets()
        {
            if (CounterCCY != null)
            {
                CounterCCY.Dispose();
                CounterCCY = null;
            }

            if (CurrencyPair != null)
            {
                CurrencyPair.Dispose();
                CurrencyPair = null;
            }

            if (Direction != null)
            {
                Direction.Dispose();
                Direction = null;
            }

            if (DirectionAmount != null)
            {
                DirectionAmount.Dispose();
                DirectionAmount = null;
            }

            if (DirectionCCY != null)
            {
                DirectionCCY.Dispose();
                DirectionCCY = null;
            }

            if (DoneButton != null)
            {
                DoneButton.Dispose();
                DoneButton = null;
            }

            if (Rate != null)
            {
                Rate.Dispose();
                Rate = null;
            }

            if (ValueDate != null)
            {
                ValueDate.Dispose();
                ValueDate = null;
            }

            if (TradeId != null)
            {
                TradeId.Dispose();
                TradeId = null;
            }

            if (TraderId != null)
            {
                TraderId.Dispose();
                TraderId = null;
            }
        }
Esempio n. 17
0
 public GetTradesResponse GetTrades(AccountId accountId, ICollection <TradeId> tradeIds, TradeStateFilter filter, InstrumentName instrument, uint count, TradeId beforeTradeId)
 => Execute <GetTradesResponse>(new GetTradesEndpoint()
 {
     AccountId     = accountId,
     Ids           = tradeIds,
     State         = filter,
     Instrument    = instrument,
     Count         = count,
     BeforeTradeId = beforeTradeId
 });
Esempio n. 18
0
        /// <summary>
        /// Returns true if PublicTrade instances are equal
        /// </summary>
        /// <param name="other">Instance of PublicTrade to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PublicTrade other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Direction == other.Direction ||

                     Direction.Equals(other.Direction)
                     ) &&
                 (
                     TickDirection == other.TickDirection ||

                     TickDirection.Equals(other.TickDirection)
                 ) &&
                 (
                     Timestamp == other.Timestamp ||
                     Timestamp != null &&
                     Timestamp.Equals(other.Timestamp)
                 ) &&
                 (
                     Price == other.Price ||
                     Price != null &&
                     Price.Equals(other.Price)
                 ) &&
                 (
                     TradeSeq == other.TradeSeq ||
                     TradeSeq != null &&
                     TradeSeq.Equals(other.TradeSeq)
                 ) &&
                 (
                     TradeId == other.TradeId ||
                     TradeId != null &&
                     TradeId.Equals(other.TradeId)
                 ) &&
                 (
                     Iv == other.Iv ||
                     Iv != null &&
                     Iv.Equals(other.Iv)
                 ) &&
                 (
                     IndexPrice == other.IndexPrice ||
                     IndexPrice != null &&
                     IndexPrice.Equals(other.IndexPrice)
                 ) &&
                 (
                     Amount == other.Amount ||
                     Amount != null &&
                     Amount.Equals(other.Amount)
                 ) &&
                 (
                     InstrumentName == other.InstrumentName ||
                     InstrumentName != null &&
                     InstrumentName.Equals(other.InstrumentName)
                 ));
        }
Esempio n. 19
0
 public override string ToString()
 {
     return(TradeId.ToString());
 }
Esempio n. 20
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 (OrderRef.Length != 0)
            {
                hash ^= OrderRef.GetHashCode();
            }
            if (UserId.Length != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (TradeId.Length != 0)
            {
                hash ^= TradeId.GetHashCode();
            }
            if (Direction != 0)
            {
                hash ^= Direction.GetHashCode();
            }
            if (OffsetFlag != 0)
            {
                hash ^= OffsetFlag.GetHashCode();
            }
            if (HedgeFlag != 0)
            {
                hash ^= HedgeFlag.GetHashCode();
            }
            if (Price != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Price);
            }
            if (Volume != 0)
            {
                hash ^= Volume.GetHashCode();
            }
            if (TradeDate.Length != 0)
            {
                hash ^= TradeDate.GetHashCode();
            }
            if (TradeTime.Length != 0)
            {
                hash ^= TradeTime.GetHashCode();
            }
            if (OrderLocalId.Length != 0)
            {
                hash ^= OrderLocalId.GetHashCode();
            }
            if (TradingDay.Length != 0)
            {
                hash ^= TradingDay.GetHashCode();
            }
            if (BrokerOrderSeq != 0)
            {
                hash ^= BrokerOrderSeq.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 21
0
        public async Task<bool> CancelOrder(TradeId tradeId, CancellationToken? cancelToken = null)
        {
            const string basePath = "/cancel_order/";

            try
            {
                return await this.PostToService(
                    basePath,
                    () => new[] {this.NewRequestParam("id", tradeId)},
                    x => (bool) x,
                    cancelToken
                    );
            }
            catch (AggregateException ae)
            {
                throw ae.Flatten();
            }
        }
Esempio n. 22
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);
        }