/// <summary> /// Gets the fee associated to a currency pair /// </summary> /// <param name="pair">The currency pair</param> /// <returns>The fee</returns> public CallResult <Fee> GetFee(CurrencyPair pair) { return(CallProxy(() => BtceApi.GetFee(pair.ToBtcePair()), f => new Fee { BuyFee = f, SellFee = f })); }
/// <summary> /// Places a buy order /// </summary> /// <param name="amount">The amount of units to buy</param> /// <param name="price">The price per unit</param> /// <param name="pair">The currency pair</param> /// <returns>Detaisl about the new order</returns> public CallResult <OrderDetails> PlaceBuyOrder(decimal amount, decimal price, CurrencyPair pair) { return(CallProxy(() => _proxy.Trade(pair.ToBtcePair(), TradeType.Buy, price, amount), o => new OrderDetails { Amount = amount, Price = price, Id = o.OrderId, Type = OrderType.Buy })); }
/// <summary> /// Gets the ticker for a given currency pair /// </summary> /// <param name="pair">The currency pair</param> /// <returns>The ticker</returns> public CallResult <DE.Ticker> GetTicker(CurrencyPair pair) { return(CallProxy(() => BtceApi.GetTicker(pair.ToBtcePair()), t => new DE.Ticker { Ask = t.Buy,//Buy/Sell are opposite in btc-e Bid = t.Sell, High = t.High, Low = t.Low, Last = t.Last })); }
/// <summary> /// Gets all open orders /// </summary> /// <param name="pair">The currency pair</param> /// <returns>A list of open orders</returns> public CallResult <OpenOrders> GetOpenOrders(CurrencyPair pair) { return(CallProxy(() => _proxy.GetOpenOrders(pair.ToBtcePair()), orders => new OpenOrders { List = orders.List.Select(o => new OrderDetails { Amount = o.Value.Amount, Id = o.Key, Price = o.Value.Rate, DateTime = BtcE.Utils.UnixTime.ConvertToDateTime(o.Value.TimestampCreated), Type = o.Value.Type == TradeType.Sell ? OrderType.Sell : OrderType.Buy }).ToList() })); }
/// <summary> /// Gets the order book for a currency pair /// </summary> /// <param name="pair">The currency pair</param> /// <returns>The order book (bids/asks)</returns> public CallResult <OrderBook> GetOrderBook(CurrencyPair pair) { return(CallProxy(() => BtceApi.GetDepth(pair.ToBtcePair()), orderBook => new OrderBook { Asks = orderBook.Asks.Select(a => new DE.SimpleOrderInfo { Amount = a.Amount, Price = a.Price }).ToList(), Bids = orderBook.Bids.Select(b => new DE.SimpleOrderInfo { Amount = b.Amount, Price = b.Price }).ToList() }));; }
/// <summary> /// Gets recent transactions /// </summary> /// <param name="lastMin"></param> /// <param name="pair">The currency pair</param> /// <returns>The most recent transactions</returns> public CallResult <TransactionList> GetTransactions(bool lastMin, CurrencyPair pair) { return(CallProxy( () => BtceApi.GetTrades(pair.ToBtcePair()), trades => { var ret = trades.Select (t => new DE.Transaction { Amount = t.Amount, Price = t.Price, ID = t.Tid, Timestamp = BtcE.Utils.UnixTime.GetFromDateTime(t.Date), Date = t.Date }); var tlist = new TransactionList { Transactions = ret.ToList() }; return tlist; } )); }