Example #1
0
        private static void GetOpenOrders()
        {
            var tradeClient = new OrderClient(Config.AccessKey, Config.SecretKey);

            _logger.Start();
            var request = new GetRequest()
                          .AddParam("account-id", Config.AccountId);
            var response = tradeClient.GetOpenOrdersAsync(request).Result;

            _logger.StopAndLog();

            switch (response.status)
            {
            case "ok":
            {
                if (response.data != null)
                {
                    foreach (var o in response.data)
                    {
                        AppLogger.Info($"Order symbol: {o.symbol}, price: {o.price}, amount: {o.amount}");
                    }
                    AppLogger.Info($"There are total {response.data.Length} open orders");
                }
                break;
            }

            case "error":
            {
                AppLogger.Info($"Query open orders fail, error code: {response.errorCode}, error message: {response.errorMessage}");
                break;
            }
            }
        }
Example #2
0
        public async void PostOpenOrders()
        {
            Authenticate authenticate = new Authenticate();
            OrderClient  orderClient  = authenticate.MakeOrderClient();
            ApiResponse <IEnumerable <Order> > response = await orderClient.GetOpenOrdersAsync();


            foreach (var item in response.Value)
            {
                bidsList.Items.Add(item.id);
            }
        }