Exemple #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="id"></param>
        /// <param name="orderId"></param>
        /// <param name="price"></param>
        /// <param name="quantity"></param>
        /// <param name="commission"></param>
        /// <param name="commissionAsset"></param>
        /// <param name="timestamp"></param>
        /// <param name="isBuyer"></param>
        /// <param name="isMaker"></param>
        /// <param name="isBestPriceMatch"></param>
        public AccountTrade(
            string symbol,
            long id,
            long orderId,
            decimal price,
            decimal quantity,
            decimal commission,
            string commissionAsset,
            long timestamp,
            bool isBuyer,
            bool isMaker,
            bool isBestPriceMatch)
            : base(symbol, id, price, quantity, BinanceApi.NullId, BinanceApi.NullId, timestamp, !(isBuyer ^ isMaker), isBestPriceMatch)
        {
            if (orderId < 0)
            {
                throw new ArgumentException($"{nameof(Trade)}: ID must not be less than 0.", nameof(orderId));
            }

            AccountCommissions.ThrowIfCommissionIsInvalid(commission, nameof(commission));

            OrderId         = orderId;
            Commission      = commission;
            CommissionAsset = commissionAsset;
            IsBuyer         = isBuyer;
            IsMaker         = isMaker;
        }
Exemple #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="commissions">The account commissions.</param>
        /// <param name="status">The account status.</param>
        /// <param name="time">The update time.</param>
        /// <param name="balances">The account balances.</param>
        public AccountInfo(IBinanceApiUser user, AccountCommissions commissions, AccountStatus status, DateTime time, IEnumerable <AccountBalance> balances = null)
        {
            Throw.IfNull(user, nameof(user));
            Throw.IfNull(commissions, nameof(commissions));
            Throw.IfNull(status, nameof(status));

            User        = user;
            Commissions = commissions;
            Status      = status;
            Time        = time;

            Balances = balances ?? new AccountBalance[] { };
        }
Exemple #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="commissions">The account commissions.</param>
        /// <param name="status">The account status.</param>
        /// <param name="updateTime">The update time.</param>
        /// <param name="balances">The account balances.</param>
        public AccountInfo(IBinanceApiUser user, AccountCommissions commissions, AccountStatus status, long updateTime, IEnumerable <AccountBalance> balances = null)
        {
            Throw.IfNull(user, nameof(user));
            Throw.IfNull(commissions, nameof(commissions));
            Throw.IfNull(status, nameof(status));

            if (updateTime <= 0)
            {
                throw new ArgumentException($"{nameof(AccountInfo)}: timestamp must be greater than 0.", nameof(updateTime));
            }

            User        = user;
            Commissions = commissions;
            Status      = status;
            Timestamp   = updateTime;

            Balances = balances ?? new AccountBalance[] { };
        }