Exemplo n.º 1
0
        public object run(LogicProcess process)
        {
            bool success = false;

            IMarketResponse response = process.comm.SendQueryMarketRequest(process.commodity);

            if (response.getType() == ResponseType.qCommodity)
            {
                MQCommodity resp = (MQCommodity)response;
                success = resp.getAsk() <= resp.getBid();
                next(process, success);
            }
            return(response);
        }
Exemplo n.º 2
0
        public object run(LogicProcess process)
        {
            bool success = false;

            IMarketResponse response = process.comm.SendQueryMarketRequest(process.commodity);

            //myLogger.Info("BidCompare: Sent query");

            if (response.getType() == ResponseType.qCommodity)
            {
                MQCommodity resp = (MQCommodity)response;
                success = resp.getBid() >= process.price;
                next(process, success);
            }
            return(response);
        }
Exemplo n.º 3
0
        public IMarketResponse SendQueryMarketRequest(int commodity)
        {
            QueryMarketRequest QMReq          = new QueryMarketRequest(commodity); //create query market rquest
            MQCommodity        marketResponse = new MQCommodity();

            try
            {
                marketResponse = client.SendPostRequest <QueryMarketRequest, MQCommodity>(url, user, privateKey, QMReq);
                myLogger.Info("Sent Query Market Request{commodity:" + commodity + ", url:" + url + "}");
            }
            catch (Exception e)
            {
                return(catchMethod(e));
            }

            myHistory.Info("Sent Query Market Request-\r\ncommodity:" + commodity + "\nResponse: " + marketResponse.ToString());

            return(marketResponse);
        }