Пример #1
0
        public void AddItem(string requestString, Action <RequestItem> ProcessResultAction, RequestParams reqparam = null)
        {
            RequestItem reqitem = new RequestItem();

            reqitem.reqparam            = reqparam;
            reqitem.requestString       = requestString;
            reqitem.ProcessResultAction = ProcessResultAction;
            items.Add(reqitem);
        }
Пример #2
0
        public void HandleError(RequestItem request, Exception ex)
        {
            request.result.error     = "Request:" + request.requestString;
            request.result.exception = ex;
            if (ex == null)
            {
                request.result.errorLevel = ResultErrorLevel.ERROR;
                Logman.Log(ex, request.result.error);
                return;
            }
            if (ex.Message == null)
            {
                request.result.errorLevel = ResultErrorLevel.ERROR;
                Logman.Log(ex, request.result.error);
                return;
            }

            if
            (
                (
                    ex.Message.Contains("422") ||
                    ex.Message.Contains("503") ||
                    ex.Message.Contains("502") ||
                    ex.Message.Contains("500")
                ) ||
                (ex.Message.Contains("Ddos") && ex.Message.Contains("20-50 mins")) ||
                ex.Message.Contains("DataResult=Null")
            )
            {
                request.result.errorLevel = ResultErrorLevel.IGNORE;
                Logman.Log(request.result.error + " -> " + ex.Message);
            }
            else
            {
                request.result.errorLevel = ResultErrorLevel.ERROR;
                Logman.Log(ex, request.result.error);
            }
        }
Пример #3
0
 public void OrderSellLimit_RequestHandler(RequestItem request)
 {
     try { request.result.resultData = market.OrderSellLimitEnd(request.requestString); } catch (Exception ex) { HandleError(request, ex); }
 }
Пример #4
0
 public void GetTradePairs_RequestHandler(RequestItem request)
 {
     try { request.result.resultData = market.GetTradePairsEnd(request.requestString); } catch (Exception ex) { HandleError(request, ex); }
 }
Пример #5
0
 public void GetOpenOrders_RequestHandler(RequestItem request)
 {
     try { request.result.resultData = market.GetOpenOrdersEnd(request.requestString, request.reqparam.ticker); } catch (Exception ex) { HandleError(request, ex); }
 }
Пример #6
0
 public void GetMarketCurrent_RequestHandler(RequestItem request)
 {
     try { request.result.resultData = market.GetMarketCurrentEnd(request.requestString); } catch (Exception ex) { HandleError(request, ex); }
 }
Пример #7
0
 public void GetPriceHistoryByPeriod_RequestHandler(RequestItem request)
 {
     try { request.result.resultData = market.GetPriceHistoryByPeriodEnd(request.requestString); } catch (Exception ex) { HandleError(request, ex); }
 }
Пример #8
0
 public void HandleError(RequestItem request, Exception ex)
 {
     request.result.error     = "Request:" + request.requestString;
     request.result.exception = ex;
     Helper.logger.Error(ex, request.result.error);
 }