Ejemplo n.º 1
0
        internal UserTransactions(
            IEnumerable <IExchangeResponseIntermediate <UserTransaction> > transactions,
            TradingPair pair,
            IExchangeConfiguration configuration)
            : base(DateTime.UtcNow, configuration.ExchangeSourceType)
        {
            Pair = pair;

            TransactionsCollection =
                transactions
                .Select(x => x.Convert(pair))
                .Where(x => x != default(UserTransaction))
                .ToList()
                .AsReadOnly();
        }
Ejemplo n.º 2
0
        /*
         * internal Transactions(IEnumerable<Transaction> transactions, TradingPair pair,
         *  ExchangeType sourceExchange)
         *  : base(DateTime.UtcNow, sourceExchange)
         * {
         *  Pair = pair;
         *
         *  TransactionsCollection =
         *      transactions
         *          .Where(x => x != default(Transaction))
         *          .OrderByDescending(x => x.UnixCompletedTimeStamp)
         *          .ToList()
         *          .AsReadOnly();
         * }*/

        internal Transactions(
            IEnumerable <IExchangeResponseIntermediate <Transaction> > transactions,
            TradingPair pair,
            IExchangeConfiguration configuration)
            : base(DateTime.UtcNow, configuration.ExchangeSourceType)
        {
            Pair = pair;

            TransactionsCollection =
                transactions
                .Select(x => x.Convert(pair))
                .Where(x => x != default(Transaction))
                .OrderByDescending(x => x.UnixCompletedTimeStamp)
                .ToList()
                .AsReadOnly();
        }
Ejemplo n.º 3
0
 internal Transaction(
     string amount,
     TradingPair pair,
     long unixTimeStamp,
     int transactionId,
     string price,
     ExchangeType sourceExchange)
     : this()
 {
     Amount = Conversion.ToDecimalInvariant(amount);
     Pair   = pair;
     UnixCompletedTimeStamp = unixTimeStamp;
     CompletedTime          = unixTimeStamp.ToDateTimeUTC();
     ExchangeTimeStampUTC   = CompletedTime;
     LocalTimeStampUTC      = DateTime.UtcNow;
     Price          = Conversion.ToDecimalInvariant(price);
     SourceExchange = sourceExchange;
     TransactionId  = transactionId;
 }
Ejemplo n.º 4
0
Archivo: Order.cs Proyecto: llenroc/BEx
 internal Order(
     decimal amount,
     TradingPair pair,
     string id,
     decimal price,
     OrderType tradeType,
     DateTime exchangeTimeStamp,
     ExchangeType source)
     : this()
 {
     Amount               = amount;
     Pair                 = pair;
     Id                   = id;
     Price                = price;
     TradeType            = tradeType;
     ExchangeTimeStampUTC = exchangeTimeStamp;
     SourceExchange       = source;
     LocalTimeStampUTC    = DateTime.UtcNow;
 }
Ejemplo n.º 5
0
        internal OpenOrders(
            IEnumerable <IExchangeResponseIntermediate <Order> > orders,
            TradingPair pair,
            IExchangeConfiguration configuration)
            : base(DateTime.UtcNow, configuration.ExchangeSourceType)
        {
            var allOrders = orders
                            .Select(x => x.Convert(pair))
                            .Distinct();

            BuyOrders =
                new ReadOnlyDictionary <string, Order>(
                    allOrders
                    .Where(x => x.IsBuyOrder)
                    .ToDictionary(x => x.Id, x => x));

            SellOrders = new ReadOnlyDictionary <string, Order>(
                allOrders
                .Where(x => x.IsSellOrder)
                .ToDictionary(x => x.Id, x => x));
        }
Ejemplo n.º 6
0
        internal Tick(
            decimal ask,
            decimal bid,
            decimal last,
            decimal volume,
            TradingPair pair,
            ExchangeType sourceExchange,
            long timestamp)
            : this()
        {
            Ask = ask;
            Bid = bid;

            Last   = last;
            Volume = volume;
            Pair   = pair;

            SourceExchange       = sourceExchange;
            UnixTimeStamp        = timestamp;
            ExchangeTimeStampUTC = timestamp.ToDateTimeUTC();
            LocalTimeStampUTC    = DateTime.UtcNow;
        }
Ejemplo n.º 7
0
#pragma warning disable RECS0154 // Parameter is never used
        internal AccountBalance(IEnumerable <Balance> balances, TradingPair pair, IExchangeConfiguration configuration)
#pragma warning restore RECS0154 // Parameter is never used
            : base(DateTime.UtcNow, configuration.ExchangeSourceType)
        {
            BalanceByCurrency = CreateDictionary(balances, configuration);
        }
Ejemplo n.º 8
0
 /// <summary>
 ///     Verify that a currency pair (e.g. BTC/USD) is supported by this exchange.
 /// </summary>
 /// <param name="pair">Currency Pair</param>
 /// <returns>True if supported, otherwise false.</returns>
 public bool IsTradingPairSupported(TradingPair pair) => _configuration.SupportedPairs.Contains(pair);
Ejemplo n.º 9
0
 /// <summary>
 ///     Return your last 50 Order Transactions for the Default Trading Pair
 /// </summary>
 /// <returns>UserTransactions, non-null</returns>
 public UserTransactions GetUserTransactions(TradingPair pair)
 => _executor.Execute <UserTransactions>(_commands.UserTransactions, pair);
Ejemplo n.º 10
0
 /// <summary>
 ///     Retrieve the last Tick for the Exchange
 /// </summary>
 /// <param name="pair">Retrieve Tick for this Trading Pair</param>
 /// <returns>BEx.Tick</returns>
 public Tick GetTick(TradingPair pair) => _executor.Execute <Tick>(_commands.Tick, pair);
Ejemplo n.º 11
0
 /// <summary>
 ///     Url the current Order Book for the specified Currency pair.
 /// </summary>
 /// <param name="pair"></param>
 /// <returns></returns>
 public OrderBook GetOrderBook(TradingPair pair) => _executor.Execute <OrderBook>(_commands.OrderBook, pair);
Ejemplo n.º 12
0
 public OpenOrders GetOpenOrders(TradingPair pair) => _executor.Execute <OpenOrders>(_commands.OpenOrders, pair);