Members
(static) generateOrder
Generates the atomic order as configured in the execution parameters
Methods
(async, static) declareChannels(instance, host)
Declares necessary candle data channels for updating indicators and eventually triggering atomic order execution.
Part of the meta
handler section.
Parameters:
Name | Type | Description |
---|---|---|
instance |
AOInstance | AO instance state |
host |
AOHost | algo host instance for declaring channel requirements |
(static) declareEvents(instance, host)
Declares the internal self:submit_order
handler to the host for event
routing.
Part of the meta
handler section.
Parameters:
Name | Type | Description |
---|---|---|
instance |
AOInstance | AO instance state |
host |
AOHost | algo host instance for event mapping |
(static) genPreview(args) → {Array.<object>}
- Source:
Stub to conform to the algo order schema.
Part of the meta
handler section.
Parameters:
Name | Type | Description |
---|---|---|
args |
object | instance arguments |
Returns:
preview
- Type
- Array.<object>
(static) initState(args) → {object}
- Source:
Creates an initial state object for an MACrossover instance to begin executing with.
Part of the meta
handler section.
Parameters:
Name | Type | Description |
---|---|---|
args |
object | instance execution parameters |
Returns:
initialState
- Type
- object
(async, static) onDataManagedCandles(instance, candles, meta) → {Promise}
If the instance has internal indicators, they are either seeded with the initial candle dataset or updated with new candles as they arrive. The candle dataset is saved on the instance state for order generation.
Indicator values are calculated, and if they have crossed the configured
atomic order is submitted, and the 'exec:stop
' event is emitted to
stop execution and trigger teardown.
Parameters:
Name | Type | Description |
---|---|---|
instance |
AOInstance | AO instance |
candles |
Array.<object> | incoming candles |
meta |
EventMetaInformation | source channel information |
Listens to Events:
Returns:
p - resolves on completion
- Type
- Promise
(async, static) onLifeStop(instance) → {Promise}
- Source:
Stub to conform to the algo order schema.
Parameters:
Name | Type | Description |
---|---|---|
instance |
AOInstance | AO instance |
Listens to Events:
Returns:
p - resolves on completion
- Type
- Promise
(async, static) onOrdersOrderCancel(instance, order) → {Promise}
Triggered when an atomic order cancellation is detected, cancels any open
orders and emits the 'exec:stop'
event.
Parameters:
Name | Type | Description |
---|---|---|
instance |
AOInstance | AO instance |
order |
object | order that was cancelled |
Listens to Events:
Returns:
p - resolves on completion
- Type
- Promise
(async, static) onSelfSubmitOrder(instance) → {Promise}
Generates and submits the configured order.
Parameters:
Name | Type | Description |
---|---|---|
instance |
AOInstance | AO instance |
Listens to Events:
Returns:
p - resolves on completion
- Type
- Promise
(static) processParams(data) → {object}
Converts a raw parameters Object received from an UI into a parameters Object which can be used by an MACrossover instance for execution.
Part of the meta
handler section.
Parameters:
Name | Type | Description |
---|---|---|
data |
object | raw parameters from an UI |
Returns:
parameters - ready to be passed to a fresh instance
- Type
- object
(static) serialize(state) → {object}
- Source:
Creates a POJO from an instance's state which can be stored as JSON in a
database, and later loaded with the corresponding
module:MACrossover~unserialize
method.
Part of the meta
handler section.
Parameters:
Name | Type | Description |
---|---|---|
state |
object | instance state to be serialized |
Returns:
pojo - DB-ready plain JS object
- Type
- object
(static) unserialize(loadedState) → {object}
- Source:
Converts a loaded POJO into a state object ready for live execution.
Part of the meta
handler section.
Parameters:
Name | Type | Description |
---|---|---|
loadedState |
object | data from a DB |
Returns:
instanceState - ready for execution
- Type
- object
(static) validateParams(args) → {string}
Verifies that a parameters Object is valid, and all parameters are within the configured boundaries for a valid MACrossover order.
Part of the meta
handler section.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | incoming parameters Properties
|
Returns:
error - null if parameters are valid, otherwise a description of which parameter is invalid.
- Type
- string
Events
selfSubmitOrder
Triggers atomic order creation and teardown