/// <summary> /// 获取盘口 /// </summary> /// <param name="contractId"></param> /// <param name="handIcap"></param> /// <returns></returns> public static bool GetHandIcap(Int64 contractId, out HandIcapCount handIcap) { string key = GetHandIcapKey(contractId); try { var value = RedisManager.QuoteRedis.Get <string>(key); if (string.IsNullOrWhiteSpace(value)) { handIcap = null; return(false); } var arr = value.Split(Sperator); if (arr.Length < 3) { handIcap = null; return(false); } handIcap = new HandIcapCount(); handIcap.InSize = arr[0].ToLong(); handIcap.OutSize = arr[1].ToLong(); handIcap.TotalHands = arr[2].ToLong(); return(true); } catch (Exception ex) { handIcap = null; LogRecord.writeLogsingle("error", "HandIcap:" + ex.ToString()); return(false); } }
/// <summary> /// 设置盘口数据 /// </summary> /// <param name="contractId"></param> /// <param name="handIcap"></param> /// <returns></returns> public static bool SetHandIcap(Int64 contractId, HandIcapCount handIcap) { try { string key = GetHandIcapKey(contractId); var sb = new StringBuilder(); sb.Append(handIcap.InSize); sb.Append(Sperator); sb.Append(handIcap.OutSize); sb.Append(Sperator); sb.Append(handIcap.TotalHands); RedisManager.QuoteRedis.Set(key, sb.ToString()); return(true); } catch (Exception ex) { LogRecord.writeLogsingle("error", "HandIcap:" + ex.ToString()); return(false); } }