%% add reference shpath='C:\Users\lsa\Downloads\StockSharp\StockSharpAPI\References'; NET.addAssembly('System.Core'); NET.addAssembly(char(System.IO.Path.GetFullPath(strcat(shpath, '\StockSharp.Transaq.dll')))); NET.addAssembly(char(System.IO.Path.GetFullPath(strcat(shpath, '\StockSharp.MatLab.dll')))); NET.addAssembly('System.Net'); ip = System.Net.IPAddress.Parse('78.41.199.24'); ep = System.Net.IPEndPoint(ip,3900); disp(ep.ToString); tr=StockSharp.Transaq.TransaqTrader; tr.Login='FZTC212451'; tr.Password='ġġġ'; tr.Address=ep; global trader; trader = StockSharp.MatLab.MatLabTrader(tr); % addlistener(trader, 'Connected', @newCon); % addlistener(trader, 'Disconnected', @mtrDisc); % addlistener(trader, 'ProcessDataError', @procErr); % addlistener(trader, 'ConnectionError', @procErr); % addlistener(trader, 'NewCandles', @pocCandles); Connect(trader.RealTrader); %% mSec = NET.invokeGenericMethod('System.Linq.Enumerable', 'ToArray', {'StockSharp.BusinessEntities.Security'}, trader.RealTrader.Securities); methods(mSec) properties(mSec) s=mSec.Length; disp(s) clear sdata for i = 1 : s security = mSec(i); sdata(i,:) = [cellstr(char(security.Id)) cellstr(char(security.Code)) cellstr(char(security.Name)) cellstr(char(security.Class))]; end % Find security clear sfi getSec myFrom myTo ts cst sf=strcmp(sdata(:,2),'TATN'); sfi=find(sf==1); getSec=mSec(sfi); % Construct CandleSeries clear cs cs=StockSharp.Algo.Candles.CandleSeries; % methods(cs) properties(cs) ts=System.TimeSpan.FromDays(1); cs.Arg=ts; cst=StockSharp.Algo.Candles.TimeFrameCandle; cs.CandleType=cst.GetType; cs.Security=getSec; disp(char(cs.CandleType.Name)) % Get Data myFrom = System.DateTime(2013,2,1); myTo = System.DateTime(2013,5,31); % mSecData = tr.SubscribeCandles(cs,myFrom,myTo); mSecData = NET.invokeGenericMethod('System.Linq.Enumerable', 'ToArray', {'SStockSharp.Algo.Candle'}, ... trader.RealTrader.SubscribeCandles(cs,myFrom,myTo)); % Disconnect(trader.RealTrader);