tksbrokerapi.Templates
Module contains some html-templates used by reporting methods in TKSBrokerAPI module.
- TKSBrokerAPI module documentation: https://tim55667757.github.io/TKSBrokerAPI/docs/tksbrokerapi/TKSBrokerAPI.html
- Mako Templates for Python: https://www.makotemplates.org/
- Open account for trading: http://tinkoff.ru/sl/AaX1Et1omnH
1# -*- coding: utf-8 -*- 2# Author: Timur Gilmullin 3 4""" 5Module contains some html-templates used by reporting methods in TKSBrokerAPI module. 6 7- **TKSBrokerAPI module documentation:** https://tim55667757.github.io/TKSBrokerAPI/docs/tksbrokerapi/TKSBrokerAPI.html 8- **Mako Templates for Python:** https://www.makotemplates.org/ 9- **Open account for trading:** http://tinkoff.ru/sl/AaX1Et1omnH 10""" 11 12# Copyright (c) 2022 Gilmillin Timur Mansurovich 13# 14# Licensed under the Apache License, Version 2.0 (the "License"); 15# you may not use this file except in compliance with the License. 16# You may obtain a copy of the License at 17# 18# http://www.apache.org/licenses/LICENSE-2.0 19# 20# Unless required by applicable law or agreed to in writing, software 21# distributed under the License is distributed on an "AS IS" BASIS, 22# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23# See the License for the specific language governing permissions and 24# limitations under the License. 25 26 27MAIN_INFO_TEMPLATE = """<!DOCTYPE html> 28<html lang="en"> 29<html> 30<head> 31 <meta charset="utf-8"/> 32 <title>${mainTitle}</title> 33 <link rel="stylesheet" type="text/css" href="X:\work\projects\FuzzyMarketAnalytics\public\style.css"> 34 <style>${commonCSS} 35 </style> 36</head> 37 <body> 38 <div id="content"></div> 39 <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> 40 <script> 41 var markdown = `${markdown}`; 42 document.getElementById("content").innerHTML = marked.parse(markdown); 43 </script> 44 <div id="footer" class="footer-div"><b>Report generated by <a href="https://github.com/Tim55667757/TKSBrokerAPI/blob/master/README_EN.md" target="_blank" rel="noopener noreferrer">TKSBrokerAPI Trade Automation Platform</a></b></div> 45 </body> 46</html>""" 47"""This HTML-template used for translating all Markdown-reports to HTML.""" 48 49 50COMMON_CSS = """ 51 body { 52 background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='100px' width='150px'><text transform='translate(20, 100) rotate(-45)' fill='rgb(176,176,176)' font-size='20' opacity='0.25'>TKSBrokerAPI</text></svg>"); 53 } 54 55 .footer-div { 56 font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif; 57 font-size: 13px; 58 color: #333333; 59 background: #E6E6E6; 60 margin: 24px 0 24px 0; 61 border-radius: 20px 20px 20px 20px; 62 padding: 12px; 63 } 64 65 p { 66 font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif; 67 font-size: 13px; 68 padding: 2px; 69 margin: 0; 70 } 71 72 li { 73 font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif; 74 font-size: 13px; 75 padding: 1px 10px; 76 } 77 78 mark { 79 background: #FFFFE6; 80 padding: 0 3px; 81 } 82 83 h1 { 84 font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif; 85 font-size: 22px; 86 color: #333333; 87 margin: 24px 0 12px 0; 88 } 89 90 h2 { 91 font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif; 92 font-size: 20px; 93 color: #333333; 94 margin: 20px 0 10px 22px; 95 } 96 97 h3 { 98 font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif; 99 font-size: 18px; 100 color: #333333; 101 margin: 16px 0 8px 52px; 102 } 103 104 details { 105 font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif; 106 font-size: 13px; 107 padding: 2px 0; 108 width: 100%; 109 border-radius: 10px 10px 10px 10px; 110 color: #333333; 111 } 112 113 summary { 114 width: 100%; 115 border-radius: 10px 10px 10px 10px; 116 background: #CCCCCC; 117 height: 20px; 118 display: block; 119 color: #333333; 120 cursor: pointer; 121 } 122 123 summary::marker { 124 display: none; 125 } 126 127 summary::before { 128 content: "\21B7"; 129 padding-right: 0.5em; 130 } 131 132 details[open] > summary::before { 133 content: "\2B8D"; 134 } 135 136 .expand { 137 font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif; 138 font-size: 13px; 139 border: none; 140 } 141 142 .expand::-ms-expand { 143 font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif; 144 font-size: 13px; 145 border-radius: 10px; 146 } 147 148 table { 149 font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif; 150 font-size: 13px; 151 width: 100%; 152 border-radius: 40px 40px 10px 10px; 153 border-spacing: 0; 154 text-align: left; 155 background: #FFFFFF; 156 color: #333333; 157 } 158 159 td { 160 border-style: solid; 161 border-width: 0 1px 1px 0; 162 border-color: white; 163 padding: 12px; 164 vertical-align: top; 165 background: #E6E6E6; 166 } 167 168 th { 169 border-style: solid; 170 border-width: 0 1px 1px 0; 171 border-color: white; 172 font-size: 14px; 173 vertical-align: top; 174 background: #BFBFBF; 175 text-align: center; 176 } 177 178 th:first-child { 179 background: #BFBFBF; 180 border-radius: 40px 0 0 0; 181 } 182 183 th:last-child { 184 background: #BFBFBF; 185 border-radius: 0 40px 0 0; 186 } 187 188 tr:first-child td:first-child { 189 border-style: solid; 190 border-width: 0 1px 1px 0; 191 border-color: white; 192 padding: 12px; 193 vertical-align: top; 194 background: #E6E6E6; 195 border-radius: 0 0 0 0; 196 } 197 198 tr:first-child td:last-child { 199 border-style: solid; 200 border-width: 0 1px 1px 0; 201 border-color: white; 202 padding: 12px; 203 vertical-align: top; 204 background: #E6E6E6; 205 border-radius: 0 0 0 0; 206 } 207 208 tr:last-child td:first-child { 209 background: #E6E6E6; 210 border-radius: 0 0 0 20px; 211 } 212 213 tr:last-child td:last-child { 214 background: #E6E6E6; 215 border-radius: 0 0 20px 0; 216 }""" 217"""Common CSS used by all templates."""
MAIN_INFO_TEMPLATE = '<!DOCTYPE html>\n<html lang="en">\n<html>\n<head>\n <meta charset="utf-8"/>\n <title>${mainTitle}</title>\n <link rel="stylesheet" type="text/css" href="X:\\work\\projects\\FuzzyMarketAnalytics\\public\\style.css">\n <style>${commonCSS}\n </style>\n</head>\n <body>\n <div id="content"></div>\n <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>\n <script>\n var markdown = `${markdown}`; \n document.getElementById("content").innerHTML = marked.parse(markdown);\n </script>\n <div id="footer" class="footer-div"><b>Report generated by <a href="https://github.com/Tim55667757/TKSBrokerAPI/blob/master/README_EN.md" target="_blank" rel="noopener noreferrer">TKSBrokerAPI Trade Automation Platform</a></b></div>\n </body>\n</html>'
This HTML-template used for translating all Markdown-reports to HTML.
COMMON_CSS = '\n body {\n background-image: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' version=\'1.1\' height=\'100px\' width=\'150px\'><text transform=\'translate(20, 100) rotate(-45)\' fill=\'rgb(176,176,176)\' font-size=\'20\' opacity=\'0.25\'>TKSBrokerAPI</text></svg>");\n }\n\n .footer-div {\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\n font-size: 13px;\n color: #333333;\n background: #E6E6E6;\n margin: 24px 0 24px 0;\n border-radius: 20px 20px 20px 20px;\n padding: 12px;\n }\n\n p {\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\n font-size: 13px;\n padding: 2px;\n margin: 0;\n }\n \n li {\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\n font-size: 13px;\n padding: 1px 10px;\n }\n \n mark {\n background: #FFFFE6;\n padding: 0 3px;\n }\n \n h1 {\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\n font-size: 22px;\n color: #333333;\n margin: 24px 0 12px 0;\n }\n \n h2 {\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\n font-size: 20px;\n color: #333333;\n margin: 20px 0 10px 22px;\n }\n \n h3 {\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\n font-size: 18px;\n color: #333333;\n margin: 16px 0 8px 52px;\n }\n \n details {\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\n font-size: 13px;\n padding: 2px 0;\n width: 100%;\n border-radius: 10px 10px 10px 10px;\n color: #333333;\n }\n \n summary {\n width: 100%;\n border-radius: 10px 10px 10px 10px;\n background: #CCCCCC;\n height: 20px;\n display: block;\n color: #333333;\n cursor: pointer;\n }\n \n summary::marker {\n display: none;\n }\n \n summary::before {\n content: "\x11B7";\n padding-right: 0.5em;\n }\n \n details[open] > summary::before {\n content: "\x02B8D";\n }\n \n .expand {\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\n font-size: 13px;\n border: none;\n }\n \n .expand::-ms-expand {\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\n font-size: 13px;\n border-radius: 10px;\n }\n \n table {\n font-family: "Segoe UI", "Frutiger", "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", "Arial", sans-serif;\n font-size: 13px;\n width: 100%;\n border-radius: 40px 40px 10px 10px;\n border-spacing: 0;\n text-align: left;\n background: #FFFFFF;\n color: #333333;\n }\n \n td {\n border-style: solid;\n border-width: 0 1px 1px 0;\n border-color: white;\n padding: 12px;\n vertical-align: top;\n background: #E6E6E6;\n }\n \n th {\n border-style: solid;\n border-width: 0 1px 1px 0;\n border-color: white;\n font-size: 14px;\n vertical-align: top;\n background: #BFBFBF;\n text-align: center;\n }\n \n th:first-child {\n background: #BFBFBF;\n border-radius: 40px 0 0 0;\n }\n \n th:last-child {\n background: #BFBFBF;\n border-radius: 0 40px 0 0;\n }\n\n tr:first-child td:first-child {\n border-style: solid;\n border-width: 0 1px 1px 0;\n border-color: white;\n padding: 12px;\n vertical-align: top;\n background: #E6E6E6;\n border-radius: 0 0 0 0;\n }\n\n tr:first-child td:last-child {\n border-style: solid;\n border-width: 0 1px 1px 0;\n border-color: white;\n padding: 12px;\n vertical-align: top;\n background: #E6E6E6;\n border-radius: 0 0 0 0;\n }\n\n tr:last-child td:first-child {\n background: #E6E6E6;\n border-radius: 0 0 0 20px;\n }\n\n tr:last-child td:last-child {\n background: #E6E6E6;\n border-radius: 0 0 20px 0;\n }'
Common CSS used by all templates.