update of vbt doc

This commit is contained in:
David Brazda
2024-04-25 06:24:51 +02:00
parent 0bf9aadb0c
commit 66a4cb5d7c
290 changed files with 28965 additions and 4466 deletions

View File

@ -2,9 +2,130 @@
"cells": [
{
"cell_type": "code",
"execution_count": 197,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Activating profile profile1\n",
"</pre>\n"
],
"text/plain": [
"Activating profile profile1\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Profile profile1 loaded successfully.\n",
"</pre>\n"
],
"text/plain": [
"Profile profile1 loaded successfully.\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Current values:\n",
"<span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'AGG_EXCLUDED_TRADES'</span>: <span style=\"font-weight: bold\">[</span><span style=\"color: #008000; text-decoration-color: #008000\">'C'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'O'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'4'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'B'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'7'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'V'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'P'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'W'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'U'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'Z'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'F'</span><span style=\"font-weight: bold\">]</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'BT_DELAYS'</span>: <span style=\"font-weight: bold\">{</span>\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'trigger_to_strat'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.02</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'strat_to_sub'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.023</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'sub_to_fill'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.008</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'fill_to_not'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.023</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'limit_order_offset'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0</span>\n",
" <span style=\"font-weight: bold\">}</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'BT_FILL_CONDITION_BUY_LIMIT'</span>: <span style=\"font-weight: bold\">&lt;</span><span style=\"color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold\">FillCondition.SLOW:</span><span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'slow'</span><span style=\"color: #000000; text-decoration-color: #000000\">&gt;,</span>\n",
"<span style=\"color: #000000; text-decoration-color: #000000\"> </span><span style=\"color: #008000; text-decoration-color: #008000\">'BT_FILL_CONDITION_SELL_LIMIT'</span><span style=\"color: #000000; text-decoration-color: #000000\">: &lt;FillCondition.SLOW: </span><span style=\"color: #008000; text-decoration-color: #008000\">'slow'</span><span style=\"font-weight: bold\">&gt;</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'BT_FILL_CONS_TRADES_REQUIRED'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'BT_FILL_LOG_SURROUNDING_TRADES'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'BT_FILL_PRICE_MARKET_ORDER_PREMIUM'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.005</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'COUNT_API_REQUESTS'</span>: <span style=\"color: #ff0000; text-decoration-color: #ff0000; font-style: italic\">False</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'GROUP_TRADES_WITH_TIMESTAMP_LESS_THAN'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.003</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'ILOG_SAVE_LEVEL_FROM'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'LIVE_DATA_FEED'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'sip'</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'NORMALIZED_TICK_BASE_PRICE'</span>: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">30.0</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'OFFLINE_MODE'</span>: <span style=\"color: #ff0000; text-decoration-color: #ff0000; font-style: italic\">False</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'PROD_SERVER_HOSTNAMES'</span>: <span style=\"font-weight: bold\">[</span><span style=\"color: #008000; text-decoration-color: #008000\">'tradingeastcoast'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'David-MacBook-Pro.local'</span><span style=\"font-weight: bold\">]</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'QUIET_MODE'</span>: <span style=\"color: #00ff00; text-decoration-color: #00ff00; font-style: italic\">True</span>,\n",
" <span style=\"color: #008000; text-decoration-color: #008000\">'TEST_SERVER_HOSTNAMES'</span>: <span style=\"font-weight: bold\">[</span><span style=\"color: #008000; text-decoration-color: #008000\">'tradingtest'</span><span style=\"font-weight: bold\">]</span>\n",
"<span style=\"font-weight: bold\">}</span>\n",
"</pre>\n"
],
"text/plain": [
"Current values:\n",
"\u001b[1m{\u001b[0m\n",
" \u001b[32m'AGG_EXCLUDED_TRADES'\u001b[0m: \u001b[1m[\u001b[0m\u001b[32m'C'\u001b[0m, \u001b[32m'O'\u001b[0m, \u001b[32m'4'\u001b[0m, \u001b[32m'B'\u001b[0m, \u001b[32m'7'\u001b[0m, \u001b[32m'V'\u001b[0m, \u001b[32m'P'\u001b[0m, \u001b[32m'W'\u001b[0m, \u001b[32m'U'\u001b[0m, \u001b[32m'Z'\u001b[0m, \u001b[32m'F'\u001b[0m\u001b[1m]\u001b[0m,\n",
" \u001b[32m'BT_DELAYS'\u001b[0m: \u001b[1m{\u001b[0m\n",
" \u001b[32m'trigger_to_strat'\u001b[0m: \u001b[1;36m0.02\u001b[0m,\n",
" \u001b[32m'strat_to_sub'\u001b[0m: \u001b[1;36m0.023\u001b[0m,\n",
" \u001b[32m'sub_to_fill'\u001b[0m: \u001b[1;36m0.008\u001b[0m,\n",
" \u001b[32m'fill_to_not'\u001b[0m: \u001b[1;36m0.023\u001b[0m,\n",
" \u001b[32m'limit_order_offset'\u001b[0m: \u001b[1;36m0\u001b[0m\n",
" \u001b[1m}\u001b[0m,\n",
" \u001b[32m'BT_FILL_CONDITION_BUY_LIMIT'\u001b[0m: \u001b[1m<\u001b[0m\u001b[1;95mFillCondition.SLOW:\u001b[0m\u001b[39m \u001b[0m\u001b[32m'slow'\u001b[0m\u001b[39m>,\u001b[0m\n",
"\u001b[39m \u001b[0m\u001b[32m'BT_FILL_CONDITION_SELL_LIMIT'\u001b[0m\u001b[39m: <FillCondition.SLOW: \u001b[0m\u001b[32m'slow'\u001b[0m\u001b[1m>\u001b[0m,\n",
" \u001b[32m'BT_FILL_CONS_TRADES_REQUIRED'\u001b[0m: \u001b[1;36m2\u001b[0m,\n",
" \u001b[32m'BT_FILL_LOG_SURROUNDING_TRADES'\u001b[0m: \u001b[1;36m10\u001b[0m,\n",
" \u001b[32m'BT_FILL_PRICE_MARKET_ORDER_PREMIUM'\u001b[0m: \u001b[1;36m0.005\u001b[0m,\n",
" \u001b[32m'COUNT_API_REQUESTS'\u001b[0m: \u001b[3;91mFalse\u001b[0m,\n",
" \u001b[32m'GROUP_TRADES_WITH_TIMESTAMP_LESS_THAN'\u001b[0m: \u001b[1;36m0.003\u001b[0m,\n",
" \u001b[32m'ILOG_SAVE_LEVEL_FROM'\u001b[0m: \u001b[1;36m1\u001b[0m,\n",
" \u001b[32m'LIVE_DATA_FEED'\u001b[0m: \u001b[32m'sip'\u001b[0m,\n",
" \u001b[32m'NORMALIZED_TICK_BASE_PRICE'\u001b[0m: \u001b[1;36m30.0\u001b[0m,\n",
" \u001b[32m'OFFLINE_MODE'\u001b[0m: \u001b[3;91mFalse\u001b[0m,\n",
" \u001b[32m'PROD_SERVER_HOSTNAMES'\u001b[0m: \u001b[1m[\u001b[0m\u001b[32m'tradingeastcoast'\u001b[0m, \u001b[32m'David-MacBook-Pro.local'\u001b[0m\u001b[1m]\u001b[0m,\n",
" \u001b[32m'QUIET_MODE'\u001b[0m: \u001b[3;92mTrue\u001b[0m,\n",
" \u001b[32m'TEST_SERVER_HOSTNAMES'\u001b[0m: \u001b[1m[\u001b[0m\u001b[32m'tradingtest'\u001b[0m\u001b[1m]\u001b[0m\n",
"\u001b[1m}\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">config_handler.<span style=\"color: #808000; text-decoration-color: #808000\">active_profile</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'profile1'</span>\n",
"</pre>\n"
],
"text/plain": [
"config_handler.\u001b[33mactive_profile\u001b[0m=\u001b[32m'profile1'\u001b[0m\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">config handler initialized\n",
"</pre>\n"
],
"text/plain": [
"config handler initialized\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Realtime Websocket connection will use FEED: sip and credential of ACCOUNT1\n"
]
}
],
"source": [
"from v2realbot.tools.loadbatch import load_batch\n",
"from v2realbot.utils.utils import zoneNY\n",
@ -17,13 +138,12 @@
"vbt.settings.plotting.auto_rangebreaks = True\n",
"# Set the option to display with pagination\n",
"pd.set_option('display.notebook_repr_html', True)\n",
"pd.set_option('display.max_rows', 10) # Number of rows per page\n",
"\n"
"pd.set_option('display.max_rows', 10) # Number of rows per page"
]
},
{
"cell_type": "code",
"execution_count": 198,
"execution_count": 2,
"metadata": {},
"outputs": [
{
@ -301,7 +421,7 @@
"[2934 rows x 8 columns]"
]
},
"execution_count": 198,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
@ -329,7 +449,7 @@
},
{
"cell_type": "code",
"execution_count": 199,
"execution_count": 209,
"metadata": {},
"outputs": [
{
@ -403,7 +523,7 @@
"name": "Rsi14",
"showlegend": true,
"type": "scatter",
"uid": "fbd37d04-c17e-4596-b1f8-2a601550bdac",
"uid": "efdece63-8464-407b-87a7-6ee41d71a834",
"x": [
"2024-03-12T09:30:00-04:00",
"2024-03-12T09:30:23-04:00",
@ -17655,7 +17775,7 @@
36.08
],
"type": "candlestick",
"uid": "b5f3d47a-000c-4c38-9609-c97c97b37434",
"uid": "62660d6c-b186-4034-ab2e-6701e4999efe",
"x": [
"2024-03-12T09:30:00-04:00",
"2024-03-12T09:30:23-04:00",
@ -21594,7 +21714,7 @@
"name": "Volume",
"opacity": 0.5,
"type": "bar",
"uid": "42c50c74-2e22-4820-891f-5a2ca88235c7",
"uid": "42b5b762-4a9c-41e7-9507-ec15130ca6fe",
"x": [
"2024-03-12T09:30:00-04:00",
"2024-03-12T09:30:23-04:00",
@ -35645,7 +35765,7 @@
},
{
"cell_type": "code",
"execution_count": 200,
"execution_count": 210,
"metadata": {},
"outputs": [
{
@ -35693,7 +35813,7 @@
"name": "real",
"showlegend": true,
"type": "scatter",
"uid": "dcdb9795-f954-4341-b6b6-73ab53286ca2",
"uid": "8d844b56-f6ee-460a-9595-0834d2f0acca",
"x": [
"2024-03-12T09:30:00-04:00",
"2024-03-12T09:30:23-04:00",
@ -45082,7 +45202,7 @@
"name": "real",
"showlegend": true,
"type": "scatter",
"uid": "e7db6821-cf5a-4b38-a395-b0821499ceef",
"uid": "0c2b8ac8-2956-4bc8-8308-27f67bcdf881",
"x": [
"2024-03-12T09:30:00-04:00",
"2024-03-12T09:30:23-04:00",
@ -54479,7 +54599,7 @@
},
{
"cell_type": "code",
"execution_count": 201,
"execution_count": 211,
"metadata": {},
"outputs": [
{
@ -54500,7 +54620,7 @@
"Name: Vwap, Length: 1961, dtype: bool"
]
},
"execution_count": 201,
"execution_count": 211,
"metadata": {},
"output_type": "execute_result"
}
@ -54512,7 +54632,7 @@
},
{
"cell_type": "code",
"execution_count": 202,
"execution_count": 212,
"metadata": {},
"outputs": [
{
@ -54533,7 +54653,7 @@
"Name: Vwap, Length: 1961, dtype: bool"
]
},
"execution_count": 202,
"execution_count": 212,
"metadata": {},
"output_type": "execute_result"
}
@ -54545,7 +54665,7 @@
},
{
"cell_type": "code",
"execution_count": 203,
"execution_count": 213,
"metadata": {},
"outputs": [
{
@ -62442,7 +62562,7 @@
36.08
],
"type": "candlestick",
"uid": "dca7bc1e-cf1a-4a22-af08-8eb952085b58",
"uid": "d4ca0ab8-1e54-4e68-8d6b-e2c18d2b243f",
"x": [
"2024-03-12T09:30:00-04:00",
"2024-03-12T09:30:23-04:00",
@ -66381,7 +66501,7 @@
"name": "Volume",
"opacity": 0.5,
"type": "bar",
"uid": "137ad3ae-64fe-4aca-b8d4-efb400fae336",
"uid": "1e37740d-9ee2-449d-a328-90a429c85b3a",
"x": [
"2024-03-12T09:30:00-04:00",
"2024-03-12T09:30:23-04:00",
@ -70319,7 +70439,7 @@
"name": "Vwap",
"showlegend": true,
"type": "scatter",
"uid": "cff29158-ffc3-42e0-9347-c2e3e53ca751",
"uid": "e102314a-487c-4d58-b8e5-db2a3720990a",
"x": [
"2024-03-12T09:30:00-04:00",
"2024-03-12T09:30:23-04:00",
@ -74263,7 +74383,7 @@
"name": "Entries",
"showlegend": true,
"type": "scatter",
"uid": "86e1b024-74be-4ed6-a808-35883f9f4dca",
"uid": "16de330c-817d-45e1-8fd2-b8b7addb8a44",
"x": [
"2024-03-12T11:27:11-04:00",
"2024-03-12T11:46:26-04:00",
@ -74355,7 +74475,7 @@
"name": "Exits",
"showlegend": true,
"type": "scatter",
"uid": "14a67283-6a19-4daa-a4cf-cf6aaa1e2467",
"uid": "ad7b9ceb-b1de-4c9d-ad44-514eb8abc73a",
"x": [
"2024-03-12T09:56:09-04:00",
"2024-03-12T09:57:42-04:00",
@ -92413,7 +92533,7 @@
36.08
],
"type": "candlestick",
"uid": "10208612-fba0-4af1-ae0e-6c3b630e7402",
"uid": "95062a7f-bddf-4ba8-89df-690d1fb7bf78",
"x": [
"2024-03-12T09:30:00-04:00",
"2024-03-12T09:30:23-04:00",
@ -96352,7 +96472,7 @@
"name": "Volume",
"opacity": 0.5,
"type": "bar",
"uid": "b993f341-efa1-4cf3-9490-b47bc606dd9d",
"uid": "f75fd578-357e-4279-8a5c-71b710573a80",
"x": [
"2024-03-12T09:30:00-04:00",
"2024-03-12T09:30:23-04:00",
@ -100290,7 +100410,7 @@
"name": "Vwap",
"showlegend": true,
"type": "scatter",
"uid": "72372cb6-d111-4d69-a5f1-c935e5e7559e",
"uid": "ac249064-e86c-4fd6-b577-a8a0e4553584",
"x": [
"2024-03-12T09:30:00-04:00",
"2024-03-12T09:30:23-04:00",
@ -104234,7 +104354,7 @@
"name": "Entries",
"showlegend": true,
"type": "scatter",
"uid": "af3474cd-1efe-49c0-bacb-9b54f5a92093",
"uid": "d89b4fe1-b7e8-4291-a5a2-35303bf3ee0a",
"x": [
"2024-03-12T11:27:11-04:00",
"2024-03-12T11:46:26-04:00",
@ -104282,7 +104402,7 @@
"name": "Exits",
"showlegend": true,
"type": "scatter",
"uid": "831cde06-a44c-45ba-a1a8-dbba410bf210",
"uid": "21a89431-dd37-4e59-a581-aa704917a3c1",
"x": [
"2024-03-12T11:36:40-04:00",
"2024-03-12T12:55:25-04:00",
@ -114433,7 +114553,7 @@
},
{
"cell_type": "code",
"execution_count": 204,
"execution_count": 214,
"metadata": {},
"outputs": [
{
@ -114442,7 +114562,7 @@
"12"
]
},
"execution_count": 204,
"execution_count": 214,
"metadata": {},
"output_type": "execute_result"
}