Пример #1
0
 public ChartRangeResponse(string body)
     : base(body)
 {
     JSONObject rd = (JSONObject) this.ReturnData;
     this.digits = (long?) rd["digits"];
     this.exemode = new EXECUTION_CODE((long?)rd["exemode"]);
     JSONArray arr = (JSONArray) rd["rateInfos"];
     foreach (JSONObject e in arr)
     {
         RateInfoRecord record = new RateInfoRecord();
         record.FieldsFromJSONObject(e);
         this.rateInfos.AddLast(record);
     }
 }
Пример #2
0
        public bool FieldsFromJSONObject(JSONObject value, string str)
        {
            this.ask = (double?)value["ask"];
            this.bid = (double?)value["bid"];
            this.askVolume = (double?)value["askVolume"];
            this.bidVolume = (double?)value["bidVolume"];
            this.exemode = new EXECUTION_CODE((long?)value["exemode"]);
            this.high = (double?)value["high"];
            this.low = (double?)value["low"];
            this.symbol = (string)value["symbol"];
            this.timestamp = (long?)value["timestamp"];
            this.level = (long?)value["level"];

            profits = new Dictionary<long?,double?>();
            if (value["profits"]!=null){

                JSONArray jsonarray = (JSONArray)value["profits"];

                foreach(JSONObject i in jsonarray){

                    profits[(long?)i["order"]] =  (double?) i["profit"];
                }

            }

            if ((ask == null) || (bid == null) || (symbol == null) || (timestamp == null) || (exemode == null)) return false;
            return true;
        }