Esempio n. 1
0
 void StreamingListener.receiveTradeRecord(TradeRecord tradeRecord)
 {
     Console.WriteLine(tradeRecord.ToString());
 }
Esempio n. 2
0
        private void readStreamMessage()
        {
            try
            {
                String message;
                TickRecord tickRecord = null;
                TradeRecord tradeRecord = null;

                if ((message = readMessage()) != null)
                {

                    try
                    {

                        JSONObject ob = (JSONObject)JSONObject.Parse(message);
                        if ("tickPrices".Equals(ob["command"].ToString())){

                            tickRecord = new TickRecord();
                            tickRecord.FieldsFromJSONObject((JSONObject)ob["data"], null);
                            sl.receiveTickRecord(tickRecord);
                        }
                        if ("trade".Equals(ob["command"].ToString())){
                            tradeRecord = new TradeRecord();
                            tradeRecord.FieldsFromJSONObject((JSONObject)ob["data"], null);
                            sl.receiveTradeRecord(tradeRecord);
                        }

                    }
                    catch (Exception ex)
                    {
                        Console.Error.Write(ex.StackTrace);
                    }

                }

            }
            catch (Exception ex)
            {
                Console.Error.Write(ex.StackTrace);
            }
        }