new Iterator(parms)
Builds an iterator instance and returns it to the requesting market when CIQ.Market#newIterator is called. Do not call this constructor directly.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
parms |
object |
Properties
|
- Since:
-
04-2016-08
Example
var market24=new CIQ.Market();
var iter_parms = {
'begin': stxx.chart.dataSet[stxx.chart.dataSet.length-1].DT, // last item on the dataset
'interval': stxx.layout.interval,
'periodicity': stxx.layout.periodicity,
'timeUnit': stxx.layout.timeUnit,
'inZone': stxx.dataZone,
'outZone': stxx.dataZone
};
var iter = market24.newIterator(iter_parms);
var next = iter.next();
Methods
-
date()
-
Returns the current date of the iterator without moving forwards or backwards. Takes into account display zone settings.
- Since:
-
04-2016-08
Returns:
The current date of the iterator.
- Type
- date
Example
iteratorDate = iter.date();
-
futureTick(parms)
-
Calculate the number of ticks from begin date to end date taking into account market open, close, and holidays. If the end date is older than the begin date,it will work backward into the past. If the end date is newer than the begin date,it will work forward into the future. Note that the begin date is set when this instance of the iterator is created and one should NOT call
previous
ornext
before calling this function, or the 'begin' pointer will change.Parameters:
Name Type Description parms
object An object containing the following properties:
Properties
Name Type Argument Description end
date An end date. Will be assumed to be
inZone
if one set.sample_size
number <optional>
Default is 25. Maximum amount of time (in milliseconds) taken to count ticks. If sample size is reached before the number of ticks is found the number of ticks will be estimated mathematically. The bigger the sample size couple with the distance between begin date and end date affect how precise the return value is.
sample_rate
number <optional>
Default is 1000. Maximum number of ticks to evaluate before checking
parms.sample_size
.- Since:
-
04-2016-08
Returns:
The number of ticks between begin and end.
- Type
- number
Example
// find out how many ticks in the past a date is from the beginning of the dataSet // (assumes the target date is older than the first dataSet item) var iter = this.standardMarketIterator(chart.dataSet[0].DT); var ticks=iter.futureTick({someRandomDate});
-
isHourAligned()
-
Checks if market is aligned and if iterator is intraday (daily intervals always align)
- Since:
-
04-2016-08
Returns:
true if this market is hour aligned.
- Type
- boolean
-
isOpen()
-
Check and see if this Market is open now.
- Since:
-
04-2016-08
Returns:
An object with the open market session's details, if the market is open right now. Or
null
if no sessions are currently open.- Type
- object
-
next( [skip])
-
Move the iterator one interval forward
Parameters:
Name Type Argument Description skip
number <optional>
Default 1. Jump forward skip * periodicity at once.
- Since:
-
04-2016-08
Returns:
Next date in iterator
outZone
.- Type
- date
Example
now = iter.next();
-
previous(skip)
-
Move the iterator one interval backward
Parameters:
Name Type Description skip
number Default is one. Move this many multiples of interval.
- Since:
-
04-2016-08
Returns:
Previous date in iterator
outZone
.- Type
- date
Example
now = iter.previous();