Creating a time series object from IQFeed data.
조회 수: 1 (최근 30일)
이전 댓글 표시
So the data imported from IQFeed is just about useless because it's in a cell and it's all strings. Anyway to create a usable time series object out of it?
댓글 수: 1
답변 (1개)
Yair Altman
2020년 1월 12일
편집: Yair Altman
2020년 1월 12일
Consider using my IQML (IQFeed-Matlab) connector as an alternative. IQML enables both synchronous (blocking) and asynchronous (background) queries, that are fetched either serially or in parallel (using the Matlab Parallel Computing Toolbox). A simple usage example:
>> data = IQML('history', 'symbol','AAPL', 'dataType','ticks')
data =
100×1 struct array with fields:
Symbol
Timestamp
Datenum
Last
LastSize
TotalVolume
Bid
Ask
TickID
BasisForLast
TradeMarketCenter
TradeConditions
TradeAggressorCode
DayOfMonth
BasisDescription
TradeMarketName
TradeDescription
AggressorDescription
>> data(end)
ans =
Symbol: 'AAPL'
Timestamp: '2019-10-04 09:45:03.862626'
Datenum: 737702.406294699
Last: 224.67
LastSize: 100
TotalVolume: 5226196
Bid: 224.66
Ask: 224.68
TickID: 7432
BasisForLast: 'C'
TradeMarketCenter: 19
TradeConditions: '01'
TradeAggressorCode: 0
DayOfMonth: 4
BasisDescription: 'Last qualified trade'
TradeMarketName: 'Nasdaq Trade Reporting Facility (NTRF)'
TradeDescription: 'Normal Trade'
AggressorDescription: 'Unknown/unsupported'
The returned struct arrays can easily be converted into Matlab tables and timeseries objects using the built-in Matlab functions such as struct2table, table2timetable and datetime:
>> table2timetable(struct2table(data), 'RowTimes',datetime(datestr([data.Datenum])))
ans =
100×9 timetable
Time Symbol Datestamp Datenum High Low Open Close PeriodVolume OpenInterest
___________ _______ ______________ __________ ______ ______ ______ ______ ____________ ____________
08-Aug-2019 {'IBM'} {'2019-08-08'} 7.3765e+05 140.42 137.76 138.45 140.1 5.2614e+06 0
09-Aug-2019 {'IBM'} {'2019-08-09'} 7.3765e+05 139.31 135.35 139.27 136.13 5.2446e+06 0
12-Aug-2019 {'IBM'} {'2019-08-12'} 7.3765e+05 135.87 133.18 135.66 133.67 4.0762e+06 0
13-Aug-2019 {'IBM'} {'2019-08-13'} 7.3765e+05 136.57 132.81 133.8 135.79 4.5512e+06 0
...
IQML was developed with top performance, reliability and usability in mind. IQML supports 100% of IQFeed's API functionality. It is fully documented, continuously maintained/improved, and I am happy to provide support.
Details: https://undocumentedmatlab.com/IQML or https://www.mathworks.com/matlabcentral/fileexchange/69814-IQML
Note: I am an independent software developer and not a MathWorks employee. Don't get angry at me for bringing an independent alternative to the table...
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!