Class SCIDByNio

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class SCIDByNio
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Create OHLCV from Sierra Chart SCID files (intraday tick format).
    Author:
    afischer
    • Constructor Summary

      Constructors 
      Constructor Description
      SCIDByNio()  
    • Constructor Detail

      • SCIDByNio

        public SCIDByNio()
    • 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:
        close in interface java.lang.AutoCloseable
        Throws:
        java.lang.Exception
      • findPositionByTimestamp

        public long findPositionByTimestamp​(java.util.Date timestamp)
                                     throws java.io.IOException
        Find 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.IOException
        Return 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] interval
        replayStarTime - Date - point of replay timing start
        replaySpeed - 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