diff --git a/Projects/Superalgos/Schemas/Docs-Topics/low-frequency-trading-bot-001-trading-bots-in-superalgos.json b/Projects/Superalgos/Schemas/Docs-Topics/low-frequency-trading-bot-001-trading-bots-in-superalgos.json new file mode 100644 index 000000000..c4fcfa0af --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/low-frequency-trading-bot-001-trading-bots-in-superalgos.json @@ -0,0 +1,26 @@ +{ + "topic": "Low-Frequency Trading Bot", + "pageNumber": "1", + "type": "Trading Bots in Superalgos", + "definition": { + "text": "A trading bot leverages the Superalgos infrastructure to provide users with advanced trading features.", + "updated": 1610217988042 + }, + "paragraphs": [ + { + "style": "Include", + "text": "Superalgos->Node->Trading Bot->Definition", + "updated": 1610218014743 + }, + { + "style": "Include", + "text": "Superalgos->Node->Trading Bot->Content", + "updated": 1610218017545 + }, + { + "style": "Callout", + "text": "The Low-Frequency trading bot is the one and only Trading Bot shipping with Superalgos at this point in time. It is made available by the Masters Trading Mine. The bot is a robust implementation that leverages every piece of infrastructure provided by Superalgos to provide a feature-rich automated trading assistant.", + "updated": 1610218505400 + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/low-frequency-trading-bot-002-why-low-frequency.json b/Projects/Superalgos/Schemas/Docs-Topics/low-frequency-trading-bot-002-why-low-frequency.json new file mode 100644 index 000000000..471c4324a --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/low-frequency-trading-bot-002-why-low-frequency.json @@ -0,0 +1,47 @@ +{ + "topic": "Low-Frequency Trading Bot", + "pageNumber": "2", + "type": "Why Low-Frequency", + "definition": { + "text": "The first Trading Bot implementation is optimized for low-frequency trading.", + "updated": 1610218584729 + }, + "paragraphs": [ + { + "style": "Text", + "text": "The Low-Frequency trading bot makes decisions upon the closing of the current candle.", + "updated": 1610218597361 + }, + { + "style": "Important", + "text": "No matter what property of what indicator you may use, always remember that the trading bot works with the last closed candle by default. What Superalgos refers to as the current candle is effectively the latest closed candle. The trading bot never works with the candle that hasn’t yet closed, as its parameters are not defined. For example, candle.max refers to the maximum price of the last closed candle, and bollingerBand.movingAverage refers to the moving average of the last closed candle.", + "updated": 1610218610371 + }, + { + "style": "Text", + "text": "Superalgos manages time frames as low as one minute. That is, one minute, is the highest frequency handled by the trading bot." + }, + { + "style": "Text", + "text": "When a trading session is run on the 01-min time frame, this is what you should expect to happen in terms of the time it takes to do all the required processing for the trading bot to make a decision and place an order at the exchange:" + }, + { + "style": "Table", + "text": "| Process | Estimated Time [s] | Comments |\n| Sensor bot | 0 - 65 | The sensor bot runs (by default) every 60 seconds. Upon each execution, anything between 0 to 60 seconds may have passed since the last one-minute candle closed. On top of this the sensor execution time may range from 1 to 5 seconds, depending on several factors (i.e.: your hardware, internet bandwidth, distance to the exchange, exchange response time, and so on...) |\n| Candles - Volumes indicator | 1 - 5 | This indicator is required most of the time, as it is the one processing the one-minute candles extracted from the exchange to turn it into candles for the rest of the time frames available. In this case, the processing time depends entirely on your hardware. | \n| Other indicators | 1 - 5 | Indicators that depend exclusively on the data products produced by Candles - Volumes may process their products as soon as Candles - Volumes finishes. Indicators with nested dependencies need to wait for their dependencies to finish, thus they are not processed in parallel but in series. |\n| Trading bot | 1 - 5 | Depending on the complexity of your trading system, the number of dependencies that must be loaded, your hardware, and the same connectivity considerations discussed for the sensor bot, the trading bot may take several seconds to do the processing and place the order at the exchange. |", + "updated": 1610219071449 + }, + { + "style": "Callout", + "text": "In conclusion, depending on how many indicators the trading system uses, and what the dependencies may be, you should expect anything between 15 to 75 seconds or more of lag from the instant the candle closed at the exchange until the order is placed, with the default settings.", + "updated": 1610219109819 + }, + { + "style": "Text", + "text": "" + }, + { + "style": "Text", + "text": "" + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/order-management-001-overview-of-the-management-issue.json b/Projects/Superalgos/Schemas/Docs-Topics/order-management-001-overview-of-the-management-issue.json new file mode 100644 index 000000000..f9aba3499 --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/order-management-001-overview-of-the-management-issue.json @@ -0,0 +1,50 @@ +{ + "topic": "Order Management", + "pageNumber": "1", + "type": "Overview of the Management Issue", + "definition": { + "text": "The Low-Frequency trading bot manages live orders, produces a simulation that is synchronized with the events occurring at the exchange, and does the accounting to keep all trading information in order.", + "updated": 1610219490073 + }, + "paragraphs": [ + { + "style": "Text", + "text": "The management of orders is at the heart of the Low-Frequency trading bot’s competency.", + "updated": 1610219504082 + }, + { + "style": "Text", + "text": "The process has some intricacies, as it involves handling orders at the exchange as well as producing a simulation. The system must be synchronized with what happens at the exchange so that the on-screen monitoring of the trading session, the accounts, and all trading information reflects reality." + }, + { + "style": "Callout", + "text": "Understanding how the trading bot manages orders will help you make the most out of Superalgos. This knowledge will allow you to transcend simple trading system setups, and stretch the limits of what you may do with more elaborate or unusual definitions." + }, + { + "style": "Text", + "text": "The following pages feature a chronological description of the life of an order, from the moment in which the trading system definitions of orders are read, until the accounting is done." + }, + { + "style": "Text", + "text": "Once an order is created, it is maintained on each execution of the trading bot. At this point, the bot handles two parallel jobs:" + }, + { + "style": "List", + "text": "In the case of forward testing and live trading sessions, the maintenance of orders involves dealing with the exchange and live orders." + }, + { + "style": "List", + "text": "In the case of backtesting and paper trading sessions, the bot simulates those interactions, while dealing with simulated orders." + }, + { + "style": "Important", + "text": "This whole section assumes that you are familiar with trading systems. Make sure you read about them first in case you are not.", + "updated": 1610219545354 + }, + { + "style": "Success", + "text": "The rest of the pages in this section are a detailed, step-by-step account of the actions the Low-Frequency trading bot performs while dealing with orders. You would make the most out of this content if you read the whole sequence of pages in the proposed order.", + "updated": 1610219534393 + } + ] +} \ No newline at end of file diff --git a/Projects/Superalgos/Schemas/Docs-Topics/order-management-002-reviewing-defined-orders.json b/Projects/Superalgos/Schemas/Docs-Topics/order-management-002-reviewing-defined-orders.json new file mode 100644 index 000000000..891fca6e1 --- /dev/null +++ b/Projects/Superalgos/Schemas/Docs-Topics/order-management-002-reviewing-defined-orders.json @@ -0,0 +1,100 @@ +{ + "topic": "Order Management", + "pageNumber": "2", + "type": "Reviewing Defined Orders", + "definition": { + "text": "The trading bot checks all existing orders upon each execution to determine what needs to be done with each of them.", + "updated": 1610219637945 + }, + "paragraphs": [ + { + "style": "Text", + "text": "Each order has a create order event, and limit orders may have a cancel order event. This means that orders may be created and, in the case of limit orders, canceled.", + "updated": 1610219649118 + }, + { + "style": "Text", + "text": "For each order defined, the bot performs multiple checks which may result in different actions. Two particular cases are analyzed separately: when the order is Not Open and when the order is Open." + }, + { + "style": "Title", + "text": "The Order is Not Open", + "updated": 1610219666758 + }, + { + "style": "Javascript", + "text": "(tradingEngineOrder.status.value === 'Not Open')" + }, + { + "style": "Text", + "text": "If the order is Not Open it means that it may need to be created. However, a few checks are in order." + }, + { + "style": "List", + "text": "Orders are not created in the first Cycle.", + "updated": 1610219707546 + }, + { + "style": "Javascript", + "text": "(tradingEngine.current.episode.cycle.value === 'First')" + }, + { + "style": "List", + "text": "Orders are not created when the stage is closing." + }, + { + "style": "Javascript", + "text": "(tradingEngineStage.status.value === 'Closing')" + }, + { + "style": "List", + "text": "For order definitions that do not allow spawning multiple orders, orders are not created when the lock is closed." + }, + { + "style": "Javascript", + "text": "(tradingEngineOrder.lock.value === 'Closed')" + }, + { + "style": "Text", + "text": "If previous checks pass and one of the situations in the create order event validates true, then the order is created (see Opening Orders).", + "updated": 1610219773322 + }, + { + "style": "Title", + "text": "The Order is Open", + "updated": 1610219785473 + }, + { + "style": "Javascript", + "text": "(tradingEngineOrder.status.value === 'Open')" + }, + { + "style": "Text", + "text": "If the order is Open and it is a limit order, it may need to be canceled (market orders may not be canceled as they are supposed to fill almost instantaneously). Also, several other system actions may be required. A few checks are in order." + }, + { + "style": "List", + "text": "Orders are not canceled in the second cycle, only the first." + }, + { + "style": "Javascript", + "text": "(tradingEngine.current.episode.cycle.value === 'Second')" + }, + { + "style": "List", + "text": "If it’s a forward testing or live trading session, the events that take place at the exchange must be checked (see Checking exchange events). If the checking of the events at the exchange fails for whatever reason, the order may not be canceled and will need to wait for the next execution." + }, + { + "style": "List", + "text": "If it’s a backtesting or paper trading session, the events that take place at the exchange must be simulated (see Simulating check of events)." + }, + { + "style": "Text", + "text": "If previous checks pass and one of the situations in the cancel order event validates true, then the order is canceled (see Canceling orders). If the order is indeed closed, the order is cloned to update the corresponding data structure of the tradingEngine.last node." + }, + { + "style": "Text", + "text": "" + } + ] +} \ No newline at end of file