Esempio n. 1
0
        private async void processMarketOrder(Button btn, string productId, decimal funds)
        {
            preRequest(btn);
            var req = new OrdersMarketRequest
            {
                Side      = "buy",
                ProductId = productId,
                Funds     = funds.ToString()
            };

            var resp = await _api.Orders.PostOrderMarket(req);

            if (httpSuccess(resp, btn))
            {
                var str = String.Format("Order {0} placed at {1}. Settled: {2}",
                                        resp.Id, resp.CreatedAt, resp.Settled);
                MessageBox.Show(str, productId + " Order Placed");
            }
        }
Esempio n. 2
0
        public static async Task <bool> BuyCurrency(Burden burden)
        {
            var buyPair = burden.BurdenTypeCurrency + "-" + BASE_CURRENCY;
            var req     = new OrdersMarketRequest
            {
                Side      = "buy",
                ProductId = buyPair,
                Funds     = burden.BurdenTypeAmount.ToString()
            };

            var resp = await _api.Orders.PostOrderMarket(req);

            if (httpSuccess(burden, resp))
            {
                var str = String.Format("Order {0} placed at {1}. Settled: {2}",
                                        resp.Id, resp.CreatedAt, resp.Settled);
                taskResult(burden, true, str);
            }

            return(resp.HttpResponse.IsSuccessStatusCode);
        }