public ProtoOAPosition.Builder CreatePositionBuilder(long positionId, ProtoOAPositionStatus positionStatus, long accountId, ProtoTradeSide tradeSide, string symbolName, long volume, double entryPrice, long swap,
                                                             long commission, long openTimestamp, string channel = null, string comment = null)
        {
            var _obj = ProtoOAPosition.CreateBuilder();

            _obj.SetPositionId(positionId);
            _obj.SetPositionStatus(positionStatus);
            _obj.SetAccountId(accountId);
            _obj.SetTradeSide(tradeSide);
            _obj.SetSymbolName(symbolName);
            _obj.SetVolume(volume);
            _obj.SetEntryPrice(entryPrice);
            _obj.SetSwap(swap);
            _obj.SetCommission(commission);
            _obj.SetOpenTimestamp(openTimestamp);
            if (channel != null)
            {
                _obj.SetChannel(channel);
            }
            if (comment != null)
            {
                _obj.SetComment(comment);
            }
            return(_obj);
        }
Exemplo n.º 2
0
        public ProtoOAPosition.Builder CreatePositionBuilder(long positionId, ProtoOAPositionStatus positionStatus, long accountId, ProtoOATradeSide tradeSide, int symbolId, long volume, double entryPrice, long swap,
                                                             long commission, long openTimestamp, string channel = null, string comment = null)
        {
            var _obj          = ProtoOAPosition.CreateBuilder();
            var _objTradeData = ProtoOATradeData.CreateBuilder();

            _obj.SetPositionId(positionId);
            _obj.SetPositionStatus(positionStatus);
            _objTradeData.SetTradeSide(tradeSide);
            _objTradeData.SetSymbolId(symbolId);
            _objTradeData.SetVolume(volume);
            _obj.SetSwap(swap);
            _obj.SetCommission(commission);
            _obj.SetTradeData(_objTradeData);
            // _obj.SetOpenTimestamp(openTimestamp);
            //if (channel != null)
            //    _obj.SetChannel(channel);
            //if (comment != null)
            //    _obj.SetComment(comment);
            return(_obj);
        }
 public ProtoOAPosition GetPosition(byte[] obj = null)
 {
     return(ProtoOAPosition.CreateBuilder().MergeFrom(obj).Build());
 }