feed
This class' functions should be overridden in each script for handling user actions and symbol events
When finally instantiating your feed, refer to the edit class for handling all user input
Example:
class MyFeed extends v9.feed {
onInit() {
}
onOpen(pMeta) {
}
onStop() {
}
onRender() {
}
onEvent(pSymbol,pEvent,pRealTime) {
}
}
// use
let feed = new MyFeed(); //Pulls symbol and date from v9 pane
// or
let feed = new MyFeed('NQ', '2020401'); //Custom symbol and date values can be entered here
// or
let feed = new MyFeed(symbol, date); //Custom symbol and date values can be implemented as variables
// or even
let request = {
symbol: new v9.edit('symbol').value, //Pulls symbol from v9 pane (See edit class)
startDate: '20200401',
endDate: '20200430'
};
let feed = new MyFeed(request); //Pulls symbol from pane with custom start and end dates
Constructor Summary
Public Constructor | ||
public | constructor(pSymbol: String, pDate: String) Used to provide the symbol and date to the current feed |
Method Summary
Public Methods | ||
public abstract | onDone() | |
public abstract | Built in feed function that is called once for each timestamp tracked in your symbol. | |
public abstract | onInit() Built in feed function that is called when the start button is pressed in order to initialize the chart. | |
public abstract | onLoad() this method was deprecated. Built in feed function that is called once the script has read every previous event in the symbol Feed. | |
public abstract | Built in feed function that is called at the start of each date between the startDate and endDate parameters of a multi-day script. | |
public abstract | onRender() Built in feed function that is called once for each frame that is rendered to the viewport. | |
public abstract | onStop() Built in feed function that is called when the stop button is pressed. |
Public Constructors
Public Methods
public abstract onDone() source
Example:
onDone() {
}
public abstract onEvent(pSymbol: String, pEvent: Event, pRealTime: Boolean) source
Built in feed function that is called once for each timestamp tracked in your symbol.
This is where you'll be doing most of your calculations on the specific things you're looking for in your symbol. It allows your script to perform different tasks depending on the current event's conditions.
Example:
onEvent(pSymbol, pEvent, pRealTime) {
}
public abstract onInit() source
Built in feed function that is called when the start button is pressed in order to initialize the chart.
Example:
onInit() {
gChart = new v9.lineChart("container"); //gChart must be a global var defined outside of your feed
}
public abstract onLoad() source
Built in feed function that is called once the script has read every previous event in the symbol Feed.
Example:
onLoad() {
}
public abstract onOpen(pMeta: Meta) source
Built in feed function that is called at the start of each date between the startDate and endDate parameters of a multi-day script.
Params:
Name | Type | Attribute | Description |
pMeta | Meta | Object representing json meta information. It currently provides the instrument definitions of the supplied symbol. |
Example:
onOpen(pMeta) {
}
public abstract onRender() source
Built in feed function that is called once for each frame that is rendered to the viewport.
Example:
onRender() {
}
public abstract onStop() source
Built in feed function that is called when the stop button is pressed.
Example:
onStop() {
}