Namespace: NativeLibraryBridge

NativeLibraryBridge

Contains calls that allow a native iOS and Android application to interface the library without having to clutter either Swift/Objective C or Java source with unnecessary Javascript. Please note that all functions and variables are exposed globally on the webview.

Members


dayCss

String representing the class for CIQ's default light theme.


isAndroid

flag for showing if your currently running an Android device.

Default Value:
  • false

nightCss

String representing the class for CIQ's default dark theme.

Methods


addDrawingListener()

Sets a callbackListener with a type of drawing. For more info on adding event callbacks to the chart see CIQ.ChartEngine#addEventListener.


addLayoutListener()

Sets a callbackListener with a type of layout. For more info on adding event callbacks to the chart see CIQ.ChartEngine#addEventListener.


addSeries(symbol, hexColor, isComparison)

Native wrapper for CIQ.ChartEngine#addSeries. Can set a Series as a comparison and specify line color.

Parameters:
Name Type Description
symbol string

Symbol to set

hexColor string

Color for your symbol to be displayed as

isComparison boolean

Boolean telling the chart whether the symbol should be compared to the main symbol


addStudy(studyName, inputs, outputs)

Native wrapper for CIQ.Studies.addStudy. Adds a specific study to the chart

Parameters:
Name Type Description
studyName String

Study to add from the CIQ.Studies.studyLibrary

inputs Object

Object containing custom inputs for instantiating the study

outputs Object

Object containing custom outputs for instantiating the study


attachQuoteFeed( [refreshInterval])

Native wrapper for CIQ.ChartEngine#attachQuoteFeed. Will attach a quoteFeed to the CIQ.ChartEngine If no refreshInterval is passed in the chart will never update on its own

Parameters:
Name Type Argument Description
refreshInterval Number <optional>

Tells the chart how frequently in seconds to check for updates.


callNewChart(symbol, data)

Native wrapper for CIQ.ChartEngine#newChart. Unlike CIQ.ChartEngine#newChart, this function only accepts a symbol and data. If you need more functionality you to manually call the library implementation of newChart.

Parameters:
Name Type Description
symbol string

The new symbol for your chart

data array

Static data in an array to load the chart with


determineOs()

Determines where the chart is being loaded based on the userAgent. If not loaded on Android then enables proxy logging automatically


enableCrosshairs(boolean)

Will toggle the crosshairs on or off

Parameters:
Name Type Description
boolean

getActiveStudies()

Returns the active studies in the chart engine's layout

Note: For Android devices this will return a raw, unstringified, array of studies

Returns:

The JSON stringified list of studies

Type
String

getCurrentVectorParameters()

Will return any currentVectoParameter

See:

getHudDetails()

Gathers the necessary information for any HUD based on cursor position and returns that data. This function will provide Open, High, Low, Close and Volume for a given quote.


getStudyList()

Returns an array of all the studies in the CIQ.Studies.studyLibrary with a shortName derived from the key. Used for gathering all available studies a user can access

Returns:

Array of studies with shortName of study

Type
Array

getStudyParameters(studyName, prop)

Will return the default parameters of a study if it is not active, or actual parameters for an active study

Note: For Android devices this will return the raw unstringified paramaters

Parameters:
Name Type Description
studyName string

Study to get parameters for

prop string

What to return for the study. Valid values: "inputs", "outputs", "parameters". Default is "outputs".

Since:
  • 6.1.0 second argument changed from boolean isInputs to string prop. If prop==true, will return inputs, as before.
Returns:

JSON stringified parameters from the DialogHelper

Type
String

getSymbol()

Returns the chart's main symbol

Returns:

symbol

Type
string

nativeQuoteFeed(parameters, cb)

A smiple quotefeed with data parsing functions

Parameters:
Name Type Description
parameters Object
Properties
Name Type Argument Description
start Date

A starting date for requesting data

end Date <optional>

An ending date for requesting data

symbol string

The symbol to fetch data for

period Number

period from a chart layout

timeUnit string <optional>

timeUnit from a chart layout

cb function

Function passed in to handle data after it is parsed.


parseData(data [, callbackID])

Parses JSON data into an array of new OHLC quotes and updates the chart with them. Will call CIQ.ChartEngine#updateChartData if no callback is provided to automatically update.

Parameters:
Name Type Argument Description
data JSON

JSON object of your data from a query

callbackID function <optional>

A custom function to update


proxyLogger()

Allow console logging in iOS. This will overwrite the default console logging on iOS to return messages via webkit.messageHandlers.


removeAllStudies()

Convenience function to remove all studies on the chart at once


removeSeries(symbol)

Native wrapper for CIQ.ChartEngine#removeSeries. Removes a selected symbol from the chart's series

Parameters:
Name Type Description
symbol string

Symbol to remove OR the series ojbect itself


removeStudy(studyName)

Removes an active study in the chart engine's layout from the chart

Parameters:
Name Type Description
studyName String

The name of the study as it appears in the chart engines layout


setAggregationType(aggregationType)

Native wrapper for CIQ.ChartEngine#setAggregationType. Sets an aggregation type for the chart.

Valid aggregation types include: Heikin Ashi, Kagi, Renko, Range Bars, Point & Figure. This function should not be used to set chartTypes. Instead use setChartType

Parameters:
Name Type Description
aggregationType string

Type of chart to display

See:

setChartType(chartType)

Native wrapper for CIQ.ChartEngine#setChartType. Will remove any aggregation type and switch your chart to display the new chartType.

Valid chartTypes include: Candle, Bar, Colored Bar, Line, Hollow Candle, Mountain and Baseline. This function should not be used for setting Aggregations. Instead use setAggregationType

Parameters:
Name Type Description
chartType string

Type of chart to display

See:

setCurrentVectorParameters(parameter, value)

Used to set currentVectoParameters and any values for it

Parameters:
Name Type Description
parameter
value
See:

setPeriodicity()

Native wrapper for CIQ.ChartEngine#setPeriodicity. Only accepts arguments individually and passes them into a params object

Parameters:
Name Type Argument Description
params.period number

The number of elements from masterData to roll-up together into one data point on the chart (candle,bar, etc). If set to 30 in a candle chart, for example, each candle will represent 30 raw elements of interval/timeUnit type.

params.timeUnit string <optional>

Type of data requested. Valid values are "millisecond","second","minute","day","week", "month" or 'tick'. If not set, will default to "minute". "hour" is NOT a valid timeUnit. Use timeUnit:"minute", interval:60 instead

params.interval string <optional>

Further qualifies pre-rolled details of intra-day timeUnits ("millisecond","second","minute") and will be converted to “1” if used with "day","week" or "month" 'timeUnit'. Some feeds provide data that is already rolled up. For example, there may be a feed that provides 5 minute bars. To let the chart know you want that 5-minute bar from your feed instead of having the chart get individual 1 minute bars and roll them up, you would set the interval to '5' and timeUnit to 'minute'


setStudy(name, key, value)

Given an active study name this will update the study based on key value pair you pass in to a CIQ.Studies.DialogHelper. If the given key is not found in the DialogHelpers inputs then the key will be searched for in DialogHelper.outputs and try to update them instead

Parameters:
Name Type Description
name String

Name of the study from the chart engine's layout

key String

Key to set in the studies corresponding DialogHelper

value String

Value to set in the studies corresponding DialogHelper


setStudyParameter(studyName, key, value, isInput)

Given an active study name this will update the study based on key value pair you pass in to a CIQ.Studies.DialogHelper. By default this will assume that key belongs to DialogHelper.outputs unless isInput is true

Parameters:
Name Type Description
studyName String

Name of the study from the chart engine's layout

key String

Key to set in the studies corresponding DialogHelper

value String

Value to set in the studies corresponding DialogHelper

isInput Boolean

Boolean telling to update input instead of outputs


setTheme(theme)

Sets the chart theme between 'day' or 'night' or none by adding in CSS classes to the chart's context. Also clears the chart containers backgroundColor and resets the engines styles.

Adding one class will remove the other, to remove both set the theme to none

Parameters:
Name Type Description
theme String

Theme to set either 'day', 'night' or none