public async Task <IList <BalanceInfo> > GetBalancesAsync() { Requires.NotNull(Settings, nameof(Settings)); var endpoint = ApiEndpoints.GetBalances_Endpoint(); var strategy = new TradeSatoshiRequestCreationStrategy(); var result = await _client.PostAsync <TradeSatoshiResponse <IList <BalanceInfo> > >(endpoint.Uri, strategy); ValidateResponse(result); return(result.Data); }
/// <summary> /// Generates an deposit address for the given <paramref name="symbol"/> /// </summary> /// <param name="symbol">The currency symbol (e.g. BTC)</param> /// <returns></returns> public async Task <GenerateAddressInfo> GenerateAddressAsync(string symbol) { Requires.NotNull(Settings, nameof(Settings)); var endpoint = ApiEndpoints.GenerateAddress_Endpoint(); var jsonObj = new JObject(); jsonObj.Add("Currency", symbol); var strategy = new TradeSatoshiRequestCreationStrategy(); var result = await _client.PostAsync <TradeSatoshiResponse <GenerateAddressInfo> >(endpoint.Uri, strategy, JsonConvert.SerializeObject(jsonObj)); ValidateResponse(result); return(result.Data); }
/// <summary> /// Gets a placed order using the given <paramref name="orderId"/>. /// </summary> /// <param name="orderId"></param> /// <returns></returns> public async Task <OrderInfo> GetOrderAsync(int orderId) { Requires.NotNull(Settings, nameof(Settings)); var endpoint = ApiEndpoints.GetOrder_Endpoint(); var strategy = new TradeSatoshiRequestCreationStrategy(); var jsonObj = new JObject(); jsonObj.Add("OrderId", orderId); var result = await _client.PostAsync <TradeSatoshiResponse <OrderInfo> >(endpoint.Uri, strategy, JsonConvert.SerializeObject(jsonObj)); ValidateResponse(result); return(result.Data); }
/// <summary> /// Gets the orders for the given <paramref name="market"/>. /// </summary> /// <param name="market">The name of the currency market (e.g. LTC_BTC)</param> /// <param name="count">The maximum number of orders to return (default 20).</param> /// <returns></returns> public async Task <IList <OrderInfo> > GetOrdersAsync(string market, int count = 20) { Requires.NotNull(Settings, nameof(Settings)); var endpoint = ApiEndpoints.GetOrders_Endpoint(); var strategy = new TradeSatoshiRequestCreationStrategy(); var jsonObj = new JObject(); jsonObj.Add("Market", market); jsonObj.Add("Count", count); var result = await _client.PostAsync <TradeSatoshiResponse <IList <OrderInfo> > >(endpoint.Uri, strategy, JsonConvert.SerializeObject(jsonObj)); ValidateResponse(result); return(result.Data); }
public async Task <SubmitOrderInfo> SubmitOrderAsync(string market, OrderType orderType, decimal amount, decimal price) { Requires.NotNull(Settings, nameof(Settings)); var endpoint = ApiEndpoints.SubmitOrder_Endpoint(); var strategy = new TradeSatoshiRequestCreationStrategy(); var jsonObj = new JObject(); jsonObj.Add("Market", market); jsonObj.Add("OrderType", Enum.GetName(typeof(OrderType), orderType)); jsonObj.Add("Amount", amount); jsonObj.Add("Price", price); var result = await _client.PostAsync <TradeSatoshiResponse <SubmitOrderInfo> >(endpoint.Uri, strategy, JsonConvert.SerializeObject(jsonObj)); ValidateResponse(result); return(result.Data); }
/// <summary> /// Cancels a submitted order /// </summary> /// <param name="cancelType">The cancel type, options: 'Single','Market','MarketBuys','MarketSells','AllBuys','AllSells','All'(required)</param> /// <param name="orderId">The order to cancel(required if cancel type 'Single')</param> /// <param name="market">The order to cancel(required if cancel type 'Market','MarketBuys','MarketSells')</param> /// <returns></returns> public async Task <CancelOrderInfo> CancelOrderAsync(CancelType cancelType, int?orderId, string market = null) { Requires.NotNull(Settings, nameof(Settings)); var endpoint = ApiEndpoints.SubmitOrder_Endpoint(); var strategy = new TradeSatoshiRequestCreationStrategy(); var jsonObj = new JObject(); jsonObj.Add("Type", Enum.GetName(typeof(CancelType), cancelType)); if (orderId.HasValue) { jsonObj.Add("OrderId", orderId); } if (!string.IsNullOrWhiteSpace(market)) { jsonObj.Add("Market", market); } var result = await _client.PostAsync <TradeSatoshiResponse <CancelOrderInfo> >(endpoint.Uri, strategy, JsonConvert.SerializeObject(jsonObj)); ValidateResponse(result); return(result.Data); }