This is my contribution to Superalgos

This commit is contained in:
Luis Fernando Molina committed 2021-03-07 08:28:35 +01:00
1 parent 91d7af66e3
commit de0e709634
5 files changed
+57 -9

No files matched your search

@@ -8,9 +8,32 @@
"style": "Block",
"text": "Content"
},
{
"style": "Title",
"text": "Optionality",
"updated": 1615101975045
},
{
"style": "Note",
"text": "The Close Stage is optional. That means that if you don't need it you can just delete this node and everything should work just fine. "
},
{
"style": "Text",
"text": "The close stage is opened when either the stop loss or take profit targets are hit."
"text": "There are situations where users might want to execute both buy and sell orders from within the Open Stage. In those situations they might want to delete the Manage Stage and the Close Stage so that they don't execute at all. That is possible because both are optional. This is how optionality looks like at the code:",
"updated": 1615102048658
},
{
"style": "Javascript",
"text": "/*\nThe system allows the user not to define a close stage, because the close stage is optional.\nHere we are goint to see if that is the case and if it is, we will inmidiatelly consider \nthe close stage as closed.\n*/\nif (tradingSystem.tradingStrategies[tradingEngine.tradingCurrent.strategy.index.value].closeStage === undefined) {\n changeStageStatus('Close Stage', 'Closed', 'Close Stage Undefined')\n return\n}",
"updated": 1615102065680
},
{
"style": "Title",
"text": "Close Stage Concept"
},
{
"style": "Text",
"text": "The close stage is opened when either the stop loss or take profit targets are hit. It is also opened after the position is opened if the Manage Stage is undefined."
},
{
"style": "Text",
@@ -8,6 +8,30 @@
"style": "Block",
"text": "Content"
},
{
"style": "Title",
"text": "Optionality",
"updated": 1615101510181
},
{
"style": "Note",
"text": "This Stage is optional. That means that if you do not want to deal with Stop Loss or Take Profits at your strategy, you can just delete this node and everything will continue working just fine. If you do remove this node, what will happen at runtime is that as soon as the position is triggered, the system will detect that that the Manage Stage is undefined, and it will jump it by opening the Close Stage (if it exists, because it is also optional)"
},
{
"style": "Text",
"text": "This is how optionality looks like at the code:",
"updated": 1615101627343
},
{
"style": "Javascript",
"text": "/* Opening Status Procedure */\nif (tradingEngine.tradingCurrent.strategyManageStage.status.value === 'Opening') {\n /*\n The system allows the user not to define a Manage Stage, because the Manage Stage is optional.\n Here we are going to see if that is the case and if it is, we will inmidiatelly consider \n the Manage Stage as closed.\n */\n if (tradingSystem.tradingStrategies[tradingEngine.tradingCurrent.strategy.index.value].manageStage === undefined) {\n changeStageStatus('Manage Stage', 'Closed', 'Manage Stage Undefined')\n changeStageStatus('Close Stage', 'Opening')\n return\n }\n\n /* Now we switch to the Open status. */\n changeStageStatus('Manage Stage', 'Open')\n}",
"updated": 1615101667889
},
{
"style": "Title",
"text": "Manage Stage Concept",
"updated": 1615101706028
},
{
"style": "Text",
"text": "The first and foremost rule of trading is to preserve capital and its main goal is to increase it."
@@ -1,7 +1,8 @@
{
"type": "Size Filled",
"definition": {
"text": "Size filled is the amount of the order that has been filled at the exchange."
"text": "Size filled is the amount of the order that has been filled at the exchange. It can also represent the cumulative Size Filled of the Open or Close Stages.",
"updated": 1615100388371
},
"paragraphs": [
{
@@ -3,14 +3,14 @@
"pageNumber": 1,
"type": "Why My Stage is not Closing?",
"definition": {
"text": "One of the most common questions asked by users is why the open or close stage are not closing after the order was filled?",
"updated": 1615053580910
"text": "One of the most common questions asked by users is why the open or close stage are not closing after the order was filled.",
"updated": 1615100269026
},
"paragraphs": [
{
"style": "Note",
"text": "The shot answer is becasue the Stage Filled Size did not reach the value of the Stage Target Size. ",
"updated": 1615053684185
"text": "The shot answer is becasue the Stage Size Filled did not reach the value of the Stage Target Size.",
"updated": 1615100332173
},
{
"style": "Text",
@@ -410,7 +410,7 @@ exports.newSuperalgosBotModulesTradingStages = function (processIndex) {
if (tradingEngine.tradingCurrent.strategyManageStage.status.value === 'Opening') {
/*
The system allows the user not to define a Manage Stage, because the Manage Stage is optional.
Here we are goint to see if that is the case and if it is, we will inmidiatelly consider
Here we are going to see if that is the case and if it is, we will inmidiatelly consider
the Manage Stage as closed.
*/
if (tradingSystem.tradingStrategies[tradingEngine.tradingCurrent.strategy.index.value].manageStage === undefined) {
@@ -979,7 +979,7 @@ exports.newSuperalgosBotModulesTradingStages = function (processIndex) {
case 'Base Asset': {
if (
tradingEngineStage.stageBaseAsset.sizeFilled.value
*
*
ROUNDING_ERROR_CORRECTION_FACTOR
+
ABSOLUTE_DUST_IN_BASE_ASSET
@@ -995,7 +995,7 @@ exports.newSuperalgosBotModulesTradingStages = function (processIndex) {
case 'Quoted Asset': {
if (
tradingEngineStage.stageQuotedAsset.sizeFilled.value
*
*
ROUNDING_ERROR_CORRECTION_FACTOR
+
ABSOLUTE_DUST_IN_QUOTED_ASSET