Package de.gsi.financial.samples.service
Class SCIDByNio
- java.lang.Object
-
- de.gsi.financial.samples.service.SCIDByNio
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class SCIDByNio extends java.lang.Object implements java.lang.AutoCloseableCreate OHLCV from Sierra Chart SCID files (intraday tick format).- Author:
- afischer
-
-
Constructor Summary
Constructors Constructor Description SCIDByNio()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcloseActualChannel()longconvertWindowsTimeToMilliseconds(double comTime)Thanks to @see http://svn.codehaus.org/groovy/modules/scriptom/branches/SCRIPTOM -1.5.4-ANT/src/com/jacob/com/DateUtilities.javaTickOhlcvDataProvidercreateTickDataReplayStream(@NotNull Interval<java.util.Calendar> requiredTimestamps, @NotNull java.util.Date replayStarTime, javafx.beans.property.DoubleProperty replaySpeed)Create instance of tick ohlcv data provider for replay streamlongensureNearestTimestampPosition(java.util.Date timestamp)Return first or equaled position for required position resultlongfindPositionByTimestamp(java.util.Date timestamp)Find position which if FIRST or equaled after you inserted timestamp.voidopenNewChannel(java.lang.String resource)
-
-
-
Method Detail
-
openNewChannel
public void openNewChannel(java.lang.String resource) throws java.io.IOException- Throws:
java.io.IOException
-
closeActualChannel
public void closeActualChannel() throws java.io.IOException- Throws:
java.io.IOException
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
findPositionByTimestamp
public long findPositionByTimestamp(java.util.Date timestamp) throws java.io.IOExceptionFind position which if FIRST or equaled after you inserted timestamp. Check if the position is negative. If the position is negative it is first position after your required timestamp. Beware if the position is higher that maximal position. Usage of Binary Search algorithm- Parameters:
timestamp- Date- Returns:
- file position of timestamp of record
- Throws:
java.io.IOException- if reading of file failed
-
ensureNearestTimestampPosition
public long ensureNearestTimestampPosition(java.util.Date timestamp) throws java.io.IOExceptionReturn first or equaled position for required position result- Parameters:
timestamp- Date- Returns:
- modified position long
- Throws:
java.io.IOException- if reading of file failed
-
createTickDataReplayStream
public TickOhlcvDataProvider createTickDataReplayStream(@NotNull @NotNull Interval<java.util.Calendar> requiredTimestamps, @NotNull @NotNull java.util.Date replayStarTime, javafx.beans.property.DoubleProperty replaySpeed) throws java.io.IOException
Create instance of tick ohlcv data provider for replay stream- Parameters:
requiredTimestamps- [from, to] intervalreplayStarTime- Date - point of replay timing startreplaySpeed- multiply of replay simulation (with real timing!)- Returns:
- tick data provider
- Throws:
java.io.IOException- if reading of file failed
-
convertWindowsTimeToMilliseconds
public long convertWindowsTimeToMilliseconds(double comTime)
Thanks to @see http://svn.codehaus.org/groovy/modules/scriptom/branches/SCRIPTOM -1.5.4-ANT/src/com/jacob/com/DateUtilities.java- Parameters:
comTime- time in windows time for convert to java format- Returns:
- java format of windows format with usage of specific timezone
-
-