コード例 #1
0
        public static ProtoMessage Get_Tickdata_Req(long ctidTraderAccountId,
                                                    long symbolId,
                                                    ProtoOAQuoteType quoteType,
                                                    long fromTimestamp,
                                                    long toTimestamp)
        {
            ProtoOAGetTickDataReq message = new ProtoOAGetTickDataReq
            {
                payloadType         = ProtoOAPayloadType.ProtoOaGetTickdataReq,
                ctidTraderAccountId = ctidTraderAccountId,
                symbolId            = symbolId,
                Type          = quoteType,
                fromTimestamp = fromTimestamp,
                toTimestamp   = toTimestamp
            };

            Log.Info("ProtoOAGetTickDataReq:: " +
                     $"ctidTraderAccountId: {ctidTraderAccountId}; " +
                     $"symbolId: {symbolId}; " +
                     $"quoteType: {quoteType}; " +
                     $"fromTimestamp: {fromTimestamp} ({EpochToString(fromTimestamp)}; " +
                     $"toTimestamp: {toTimestamp} ({EpochToString(toTimestamp)}");

            InnerMemoryStream.SetLength(0);
            Serializer.Serialize(InnerMemoryStream, message);

            return(Encode((uint)message.payloadType, InnerMemoryStream.ToArray()));
        }
        public ProtoMessage CreateTickDataRequest(long accountId, int symbolId, long from, long to, ProtoOAQuoteType type, string clientMsgId = null)
        {
            var _msg = ProtoOAGetTickDataReq.CreateBuilder();

            _msg.SetCtidTraderAccountId(accountId);
            _msg.SetSymbolId(symbolId);
            _msg.SetType(type);
            _msg.SetFromTimestamp(from);
            _msg.SetToTimestamp(to);
            return(CreateMessage((uint)_msg.PayloadType, _msg.Build().ToByteString(), clientMsgId));
        }