├── ANN_weights ├── ANN n17.data-00000-of-00001 ├── ANN n17.index ├── ANN n38.data-00000-of-00001 ├── ANN n38.index ├── ANN n66.data-00000-of-00001 └── ANN n66.index ├── Chapter_01_Basics_of_Python.ipynb ├── Chapter_02_Python_for_DataSciences.ipynb ├── Chapter_03_Data.ipynb ├── Chapter_04_Features_Engineering.ipynb ├── Chapter_05_Deep_Neural_Network.ipynb ├── Chapter_06_Vectorized_Backtesting.ipynb ├── Chapter_07_Recurrent_Neural_Network.ipynb ├── Chapter_08_ANN_reg_app.ipynb ├── Chapter_08_RNN_cl_app.ipynb ├── Extract_Chapter_11.pdf ├── Extract_Chapter_12.pdf ├── FOREX + CRYPTO ├── AUDCAD_D1.csv ├── AUDUSD_D1.csv ├── BTCUSD_D1.csv ├── ETCUSD_D1.csv ├── ETHUSD_D1.csv ├── EURGBP_D1.csv ├── EURUSD_D1.csv ├── GBPUSD_D1.csv ├── LTCUSD_D1.csv ├── USDCAD_D1.csv ├── USDCHF_D1.csv ├── USDCNH_D1.csv ├── USDJPY_D1.csv └── XMRUSD_D1.csv ├── MT5.py ├── README.md ├── RNN_weights ├── RNN n3.data-00000-of-00001 ├── RNN n3.index ├── RNN n31.data-00000-of-00001 ├── RNN n31.index ├── RNN n34.data-00000-of-00001 └── RNN n34.index └── assets.csv /ANN_weights/ANN n17.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/ANN_weights/ANN n17.data-00000-of-00001 -------------------------------------------------------------------------------- /ANN_weights/ANN n17.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/ANN_weights/ANN n17.index -------------------------------------------------------------------------------- /ANN_weights/ANN n38.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/ANN_weights/ANN n38.data-00000-of-00001 -------------------------------------------------------------------------------- /ANN_weights/ANN n38.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/ANN_weights/ANN n38.index -------------------------------------------------------------------------------- /ANN_weights/ANN n66.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/ANN_weights/ANN n66.data-00000-of-00001 -------------------------------------------------------------------------------- /ANN_weights/ANN n66.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/ANN_weights/ANN n66.index -------------------------------------------------------------------------------- /Chapter_01_Basics_of_Python.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "name": "EN-TA Chapter 01: Basics of Python.ipynb", 7 | "provenance": [], 8 | "collapsed_sections": [ 9 | "nJYyIbZ_WbFT", 10 | "DuY3oXKNWd1h", 11 | "iEQQbsVFWkKi", 12 | "JUULnsP_Xemv", 13 | "cGqtdDyYX1Dk", 14 | "EMAdDk_6YXgw", 15 | "Kd-SYHI-ZF85", 16 | "2UHCKDk8bJEf", 17 | "W9Vc62veaNKg", 18 | "7xKs11J6akHQ", 19 | "wwObVh1w9Wl9", 20 | "-9ElsbKP-xvK", 21 | "emrr2xJjhmKd", 22 | "4NWfx4mRhpgX", 23 | "S0TnQtBMfRXB", 24 | "F8rax_dDgnFI", 25 | "oYh-hMSTB1Ur", 26 | "KE9L44nED-JK", 27 | "Qy6T6HOiGHaN", 28 | "7ilLgwf1HIMw", 29 | "MLRfDnNGHUkI", 30 | "EdYvgavpJPGK", 31 | "xLPPB2NOJUSq", 32 | "XM6mdryCRCAm", 33 | "D5KoCwIFT27I", 34 | "aH-i3Tn3UjJ_", 35 | "C6_cmiswU2AW", 36 | "asuSI8Jg0EaC", 37 | "ppony41B0G1i" 38 | ] 39 | }, 40 | "kernelspec": { 41 | "name": "python3", 42 | "display_name": "Python 3" 43 | } 44 | }, 45 | "cells": [ 46 | { 47 | "cell_type": "markdown", 48 | "metadata": { 49 | "id": "HwIk5lNgltIS" 50 | }, 51 | "source": [ 52 | "

\"Colaboratory

\n", 53 | "\n", 54 | "\n", 55 | "# PREREQUISITES - **Python basics**\n", 56 | "\n", 57 | "This chapter will give you the python basics you need to follow the rest of the course. These are only reminders of what will be helpful. That's why I advise you to follow free quick Python training for your projects because if you are total strangers to it, it can be hard to do your project.\n", 58 | "\n", 59 | "\n", 60 | "### Part 1: The Python basics\n", 61 | "* Types of objects:\n", 62 | "> * Numbers , Strings, Booleans\n", 63 | "> * Tuples, Lists\n", 64 | "> * Variable assignment\n", 65 | "* Python Structures:\n", 66 | "> * If/Elif/Else\n", 67 | "> * FOR\n", 68 | "> * While\n", 69 | "* The Functions\n", 70 | "> * Basis of functions\n", 71 | "> * Local variable\n", 72 | "> * Global varible\n", 73 | "> * Lambda function\n", 74 | "\n", 75 | "\n", 76 | "\n", 77 | "💰Join our community: https://discord.gg/wXjNPAc5BH\n", 78 | "\n", 79 | "📚Read our book: https://www.amazon.com/gp/product/B09HG18CYL \n", 80 | "\n", 81 | "🖥️Quantreo's YouTube channel: https://www.youtube.com/channel/UCp7jckfiEglNf_Gj62VR0pw\n", 82 | "\n", 83 | "\n", 84 | "\n", 85 | "\n" 86 | ] 87 | }, 88 | { 89 | "cell_type": "markdown", 90 | "metadata": { 91 | "id": "nJYyIbZ_WbFT" 92 | }, 93 | "source": [ 94 | "### Types of objects" 95 | ] 96 | }, 97 | { 98 | "cell_type": "markdown", 99 | "metadata": { 100 | "id": "DuY3oXKNWd1h" 101 | }, 102 | "source": [ 103 | "##### Numbers" 104 | ] 105 | }, 106 | { 107 | "cell_type": "code", 108 | "metadata": { 109 | "id": "yoYnGbme8kcq", 110 | "colab": { 111 | "base_uri": "https://localhost:8080/" 112 | }, 113 | "outputId": "2d8a9a0e-94c1-4705-8ca8-cf2920544075" 114 | }, 115 | "source": [ 116 | "# Addition\n", 117 | "6 + 3" 118 | ], 119 | "execution_count": null, 120 | "outputs": [ 121 | { 122 | "output_type": "execute_result", 123 | "data": { 124 | "text/plain": [ 125 | "9" 126 | ] 127 | }, 128 | "metadata": {}, 129 | "execution_count": 1 130 | } 131 | ] 132 | }, 133 | { 134 | "cell_type": "code", 135 | "metadata": { 136 | "id": "lPQ-ZedRCtL0", 137 | "colab": { 138 | "base_uri": "https://localhost:8080/" 139 | }, 140 | "outputId": "584b2b3c-f900-4623-8e1f-7ebd0e1b8c94" 141 | }, 142 | "source": [ 143 | "# Substraction\n", 144 | "6 - 3" 145 | ], 146 | "execution_count": null, 147 | "outputs": [ 148 | { 149 | "output_type": "execute_result", 150 | "data": { 151 | "text/plain": [ 152 | "3" 153 | ] 154 | }, 155 | "metadata": {}, 156 | "execution_count": 2 157 | } 158 | ] 159 | }, 160 | { 161 | "cell_type": "code", 162 | "metadata": { 163 | "id": "FSWWYIqBCwlg", 164 | "colab": { 165 | "base_uri": "https://localhost:8080/" 166 | }, 167 | "outputId": "9b8cda14-bf9b-4156-eee7-37ec890f074b" 168 | }, 169 | "source": [ 170 | "# Multiplication\n", 171 | "6 * 3" 172 | ], 173 | "execution_count": null, 174 | "outputs": [ 175 | { 176 | "output_type": "execute_result", 177 | "data": { 178 | "text/plain": [ 179 | "18" 180 | ] 181 | }, 182 | "metadata": {}, 183 | "execution_count": 3 184 | } 185 | ] 186 | }, 187 | { 188 | "cell_type": "code", 189 | "metadata": { 190 | "id": "fMQNWXVvC0Sx", 191 | "colab": { 192 | "base_uri": "https://localhost:8080/" 193 | }, 194 | "outputId": "9ddf66b8-468a-4769-8bc7-87ea658e88f3" 195 | }, 196 | "source": [ 197 | "# Division \n", 198 | "16 / 3" 199 | ], 200 | "execution_count": null, 201 | "outputs": [ 202 | { 203 | "output_type": "execute_result", 204 | "data": { 205 | "text/plain": [ 206 | "5.333333333333333" 207 | ] 208 | }, 209 | "metadata": {}, 210 | "execution_count": 4 211 | } 212 | ] 213 | }, 214 | { 215 | "cell_type": "code", 216 | "metadata": { 217 | "id": "DH1jRr5_Xxo2", 218 | "colab": { 219 | "base_uri": "https://localhost:8080/" 220 | }, 221 | "outputId": "3b653c4a-c9b7-4e7e-c9b9-767272aa7351" 222 | }, 223 | "source": [ 224 | "# Power 2*2*2\n", 225 | "2**3" 226 | ], 227 | "execution_count": null, 228 | "outputs": [ 229 | { 230 | "output_type": "execute_result", 231 | "data": { 232 | "text/plain": [ 233 | "8" 234 | ] 235 | }, 236 | "metadata": {}, 237 | "execution_count": 5 238 | } 239 | ] 240 | }, 241 | { 242 | "cell_type": "code", 243 | "metadata": { 244 | "id": "abqfE8I2C2cr", 245 | "colab": { 246 | "base_uri": "https://localhost:8080/" 247 | }, 248 | "outputId": "46a82bd7-d681-4044-fa41-098d4987505f" 249 | }, 250 | "source": [ 251 | "# Whole divsion (euclidian) | 5.33 --> 5\n", 252 | "16 // 3" 253 | ], 254 | "execution_count": null, 255 | "outputs": [ 256 | { 257 | "output_type": "execute_result", 258 | "data": { 259 | "text/plain": [ 260 | "5" 261 | ] 262 | }, 263 | "metadata": {}, 264 | "execution_count": 6 265 | } 266 | ] 267 | }, 268 | { 269 | "cell_type": "code", 270 | "metadata": { 271 | "id": "SnktoxGAC_ew", 272 | "colab": { 273 | "base_uri": "https://localhost:8080/" 274 | }, 275 | "outputId": "b9fe0594-8098-4e84-a187-faac87993517" 276 | }, 277 | "source": [ 278 | "# Modulo | 16 = 5*3 + 1 \n", 279 | "16 % 3" 280 | ], 281 | "execution_count": null, 282 | "outputs": [ 283 | { 284 | "output_type": "execute_result", 285 | "data": { 286 | "text/plain": [ 287 | "1" 288 | ] 289 | }, 290 | "metadata": {}, 291 | "execution_count": 7 292 | } 293 | ] 294 | }, 295 | { 296 | "cell_type": "markdown", 297 | "metadata": { 298 | "id": "iEQQbsVFWkKi" 299 | }, 300 | "source": [ 301 | "##### String" 302 | ] 303 | }, 304 | { 305 | "cell_type": "code", 306 | "metadata": { 307 | "id": "8jOPFgexDF2H", 308 | "colab": { 309 | "base_uri": "https://localhost:8080/" 310 | }, 311 | "outputId": "231a1cf4-dc96-4a8f-a1dc-1fdabe7b599c" 312 | }, 313 | "source": [ 314 | "# Simple string\n", 315 | "print(\"I'm an information\")" 316 | ], 317 | "execution_count": null, 318 | "outputs": [ 319 | { 320 | "output_type": "stream", 321 | "name": "stdout", 322 | "text": [ 323 | "I'm an information\n" 324 | ] 325 | } 326 | ] 327 | }, 328 | { 329 | "cell_type": "code", 330 | "metadata": { 331 | "colab": { 332 | "base_uri": "https://localhost:8080/" 333 | }, 334 | "id": "ibeFvaYOnCDd", 335 | "outputId": "a4ad6243-c950-467e-8ece-40b9ab564147" 336 | }, 337 | "source": [ 338 | "# Add a tabulation\n", 339 | "print(\"Mean:10% \\t Volatily:10%\")" 340 | ], 341 | "execution_count": null, 342 | "outputs": [ 343 | { 344 | "output_type": "stream", 345 | "name": "stdout", 346 | "text": [ 347 | "Mean:10% \t Volatily:10%\n" 348 | ] 349 | } 350 | ] 351 | }, 352 | { 353 | "cell_type": "code", 354 | "metadata": { 355 | "colab": { 356 | "base_uri": "https://localhost:8080/" 357 | }, 358 | "id": "rGWkCu3vpDoW", 359 | "outputId": "1063cef1-86b7-4b40-b9ff-db1a3f0447d8" 360 | }, 361 | "source": [ 362 | "# Skip a line\n", 363 | "print(\"Mean:10% \\nVolatily:10%\")" 364 | ], 365 | "execution_count": null, 366 | "outputs": [ 367 | { 368 | "output_type": "stream", 369 | "name": "stdout", 370 | "text": [ 371 | "Mean:10% \n", 372 | "Volatily:10%\n" 373 | ] 374 | } 375 | ] 376 | }, 377 | { 378 | "cell_type": "code", 379 | "metadata": { 380 | "id": "zLAVLu5rWv2a", 381 | "colab": { 382 | "base_uri": "https://localhost:8080/" 383 | }, 384 | "outputId": "c8a2ea8f-5b3f-4bca-bbc1-4e8b7e807720" 385 | }, 386 | "source": [ 387 | "# Dynamic String (first possibility: simple string using the format function)\n", 388 | "print(\"Tesla stock price: {}$ at date {}\".format(110,\"01-01-2020\"))" 389 | ], 390 | "execution_count": null, 391 | "outputs": [ 392 | { 393 | "output_type": "stream", 394 | "name": "stdout", 395 | "text": [ 396 | "Tesla stock price: 110$ at date 01-01-2020\n" 397 | ] 398 | } 399 | ] 400 | }, 401 | { 402 | "cell_type": "code", 403 | "metadata": { 404 | "id": "shGzNr67Wvx0", 405 | "colab": { 406 | "base_uri": "https://localhost:8080/" 407 | }, 408 | "outputId": "00ddcbd2-3003-4217-ce45-ea3ac520a23d" 409 | }, 410 | "source": [ 411 | "# Dynamic String (second possibility: f-string )\n", 412 | "print(f\"Tesla stock price: {110}$ at date {'01-01-2010'}\")" 413 | ], 414 | "execution_count": null, 415 | "outputs": [ 416 | { 417 | "output_type": "stream", 418 | "name": "stdout", 419 | "text": [ 420 | "Tesla stock price: 110$ at date 01-01-2010\n" 421 | ] 422 | } 423 | ] 424 | }, 425 | { 426 | "cell_type": "code", 427 | "metadata": { 428 | "colab": { 429 | "base_uri": "https://localhost:8080/" 430 | }, 431 | "id": "Uaz_tqJgpMae", 432 | "outputId": "5b16d6fa-e4bf-425e-d45b-9106e7cb496e" 433 | }, 434 | "source": [ 435 | "# Round a number into a f-string\n", 436 | "print(f\"Tesla stock price: {'%.1f' % 110.15645147854}$\")" 437 | ], 438 | "execution_count": null, 439 | "outputs": [ 440 | { 441 | "output_type": "stream", 442 | "name": "stdout", 443 | "text": [ 444 | "Tesla stock price: 110.2$\n" 445 | ] 446 | } 447 | ] 448 | }, 449 | { 450 | "cell_type": "code", 451 | "metadata": { 452 | "id": "ud27MNZYdwSG", 453 | "colab": { 454 | "base_uri": "https://localhost:8080/", 455 | "height": 37 456 | }, 457 | "outputId": "8ea0fded-3b6e-4c2f-c790-a595162851e8" 458 | }, 459 | "source": [ 460 | "# Slicing on strings\n", 461 | "\"I'm an information\"[0:6]" 462 | ], 463 | "execution_count": null, 464 | "outputs": [ 465 | { 466 | "output_type": "execute_result", 467 | "data": { 468 | "application/vnd.google.colaboratory.intrinsic+json": { 469 | "type": "string" 470 | }, 471 | "text/plain": [ 472 | "\"I'm an\"" 473 | ] 474 | }, 475 | "metadata": {}, 476 | "execution_count": 26 477 | } 478 | ] 479 | }, 480 | { 481 | "cell_type": "markdown", 482 | "metadata": { 483 | "id": "JUULnsP_Xemv" 484 | }, 485 | "source": [ 486 | "##### Booleans / logical operations" 487 | ] 488 | }, 489 | { 490 | "cell_type": "code", 491 | "metadata": { 492 | "id": "vM_KlXcMWvtr", 493 | "colab": { 494 | "base_uri": "https://localhost:8080/" 495 | }, 496 | "outputId": "e133c351-1656-4fb5-a0f3-b7f8893afe88" 497 | }, 498 | "source": [ 499 | "# Boolean type (True)\n", 500 | "True" 501 | ], 502 | "execution_count": null, 503 | "outputs": [ 504 | { 505 | "output_type": "execute_result", 506 | "data": { 507 | "text/plain": [ 508 | "True" 509 | ] 510 | }, 511 | "metadata": {}, 512 | "execution_count": 27 513 | } 514 | ] 515 | }, 516 | { 517 | "cell_type": "code", 518 | "metadata": { 519 | "id": "53gTC6s5WvsF", 520 | "colab": { 521 | "base_uri": "https://localhost:8080/" 522 | }, 523 | "outputId": "b4e99819-2bed-4215-8ef0-43710462f526" 524 | }, 525 | "source": [ 526 | "# Boolean type (False)\n", 527 | "False" 528 | ], 529 | "execution_count": null, 530 | "outputs": [ 531 | { 532 | "output_type": "execute_result", 533 | "data": { 534 | "text/plain": [ 535 | "False" 536 | ] 537 | }, 538 | "metadata": {}, 539 | "execution_count": 28 540 | } 541 | ] 542 | }, 543 | { 544 | "cell_type": "code", 545 | "metadata": { 546 | "id": "IoozzT2bdK_u", 547 | "colab": { 548 | "base_uri": "https://localhost:8080/" 549 | }, 550 | "outputId": "d99e36c5-b946-4b50-8b74-0281af3a4c6c" 551 | }, 552 | "source": [ 553 | "# Equality\n", 554 | "5 == 6" 555 | ], 556 | "execution_count": null, 557 | "outputs": [ 558 | { 559 | "output_type": "execute_result", 560 | "data": { 561 | "text/plain": [ 562 | "False" 563 | ] 564 | }, 565 | "metadata": {}, 566 | "execution_count": 29 567 | } 568 | ] 569 | }, 570 | { 571 | "cell_type": "code", 572 | "metadata": { 573 | "id": "_f1XD2w3dgY5", 574 | "colab": { 575 | "base_uri": "https://localhost:8080/" 576 | }, 577 | "outputId": "d704a978-1775-4be1-e503-bce578714055" 578 | }, 579 | "source": [ 580 | "# Sup\n", 581 | "5 > 6" 582 | ], 583 | "execution_count": null, 584 | "outputs": [ 585 | { 586 | "output_type": "execute_result", 587 | "data": { 588 | "text/plain": [ 589 | "False" 590 | ] 591 | }, 592 | "metadata": {}, 593 | "execution_count": 30 594 | } 595 | ] 596 | }, 597 | { 598 | "cell_type": "code", 599 | "metadata": { 600 | "id": "yZj4kBbLdkUo", 601 | "colab": { 602 | "base_uri": "https://localhost:8080/" 603 | }, 604 | "outputId": "1ac716cf-96ff-40d4-ad3f-3306b85b9066" 605 | }, 606 | "source": [ 607 | "# Inf\n", 608 | "5 < 6" 609 | ], 610 | "execution_count": null, 611 | "outputs": [ 612 | { 613 | "output_type": "execute_result", 614 | "data": { 615 | "text/plain": [ 616 | "True" 617 | ] 618 | }, 619 | "metadata": {}, 620 | "execution_count": 31 621 | } 622 | ] 623 | }, 624 | { 625 | "cell_type": "code", 626 | "metadata": { 627 | "id": "BbEIqsW4ducB", 628 | "colab": { 629 | "base_uri": "https://localhost:8080/" 630 | }, 631 | "outputId": "28a920a1-4e09-420c-e792-92483b8ff17e" 632 | }, 633 | "source": [ 634 | "# Not Equal\n", 635 | "5 != 6" 636 | ], 637 | "execution_count": null, 638 | "outputs": [ 639 | { 640 | "output_type": "execute_result", 641 | "data": { 642 | "text/plain": [ 643 | "True" 644 | ] 645 | }, 646 | "metadata": {}, 647 | "execution_count": 32 648 | } 649 | ] 650 | }, 651 | { 652 | "cell_type": "code", 653 | "metadata": { 654 | "id": "15J-4du3d0o-", 655 | "colab": { 656 | "base_uri": "https://localhost:8080/" 657 | }, 658 | "outputId": "e231bd80-2c5d-4660-ce69-5716dd983eb8" 659 | }, 660 | "source": [ 661 | "# And \n", 662 | "(1<2) and (5>6)" 663 | ], 664 | "execution_count": null, 665 | "outputs": [ 666 | { 667 | "output_type": "execute_result", 668 | "data": { 669 | "text/plain": [ 670 | "False" 671 | ] 672 | }, 673 | "metadata": {}, 674 | "execution_count": 35 675 | } 676 | ] 677 | }, 678 | { 679 | "cell_type": "code", 680 | "metadata": { 681 | "id": "XtzLTurHd47e", 682 | "colab": { 683 | "base_uri": "https://localhost:8080/" 684 | }, 685 | "outputId": "1f1de212-b53b-4547-cab4-6d4a309db4d1" 686 | }, 687 | "source": [ 688 | "# Or\n", 689 | "(1<2) or (5>6)" 690 | ], 691 | "execution_count": null, 692 | "outputs": [ 693 | { 694 | "output_type": "execute_result", 695 | "data": { 696 | "text/plain": [ 697 | "True" 698 | ] 699 | }, 700 | "metadata": {}, 701 | "execution_count": 36 702 | } 703 | ] 704 | }, 705 | { 706 | "cell_type": "code", 707 | "metadata": { 708 | "id": "pTRdjRHyZKZ7", 709 | "colab": { 710 | "base_uri": "https://localhost:8080/" 711 | }, 712 | "outputId": "a383c1c0-faf9-4db1-c2d4-f122d072a624" 713 | }, 714 | "source": [ 715 | "# Not \n", 716 | "not (5>6)" 717 | ], 718 | "execution_count": null, 719 | "outputs": [ 720 | { 721 | "output_type": "execute_result", 722 | "data": { 723 | "text/plain": [ 724 | "True" 725 | ] 726 | }, 727 | "metadata": {}, 728 | "execution_count": 38 729 | } 730 | ] 731 | }, 732 | { 733 | "cell_type": "markdown", 734 | "metadata": { 735 | "id": "cGqtdDyYX1Dk" 736 | }, 737 | "source": [ 738 | "##### Variable assignment" 739 | ] 740 | }, 741 | { 742 | "cell_type": "code", 743 | "metadata": { 744 | "id": "q3PsKlhZWvlz", 745 | "colab": { 746 | "base_uri": "https://localhost:8080/" 747 | }, 748 | "outputId": "63b86c48-9089-428f-be22-44c593c02641" 749 | }, 750 | "source": [ 751 | "# Numerical variables\n", 752 | "x = 6\n", 753 | "y = 6\n", 754 | "print(x + y)" 755 | ], 756 | "execution_count": null, 757 | "outputs": [ 758 | { 759 | "output_type": "stream", 760 | "name": "stdout", 761 | "text": [ 762 | "12\n" 763 | ] 764 | } 765 | ] 766 | }, 767 | { 768 | "cell_type": "code", 769 | "metadata": { 770 | "id": "NrwwCpCCWvkU", 771 | "colab": { 772 | "base_uri": "https://localhost:8080/" 773 | }, 774 | "outputId": "da5d461e-45aa-49dc-ff93-1f2fbff625f3" 775 | }, 776 | "source": [ 777 | "# String variables\n", 778 | "date = \"03-01-2020\"\n", 779 | "price = 150\n", 780 | "info = f\"Tesla: {price}, date: {date}\"\n", 781 | "\n", 782 | "print(info)" 783 | ], 784 | "execution_count": null, 785 | "outputs": [ 786 | { 787 | "output_type": "stream", 788 | "name": "stdout", 789 | "text": [ 790 | "Tesla: 150, date: 03-01-2020\n" 791 | ] 792 | } 793 | ] 794 | }, 795 | { 796 | "cell_type": "code", 797 | "metadata": { 798 | "id": "ufENsej-WveT", 799 | "colab": { 800 | "base_uri": "https://localhost:8080/" 801 | }, 802 | "outputId": "3a5216b2-7619-49f9-b48a-0af87142bb76" 803 | }, 804 | "source": [ 805 | "# Boolean variables\n", 806 | "time = \"20:00\"\n", 807 | "market_open = (\"08:00\" < time) and (time < \"19:00\")\n", 808 | "print(market_open)" 809 | ], 810 | "execution_count": null, 811 | "outputs": [ 812 | { 813 | "output_type": "stream", 814 | "name": "stdout", 815 | "text": [ 816 | "False\n" 817 | ] 818 | } 819 | ] 820 | }, 821 | { 822 | "cell_type": "markdown", 823 | "metadata": { 824 | "id": "EMAdDk_6YXgw" 825 | }, 826 | "source": [ 827 | "##### Tuples, lists" 828 | ] 829 | }, 830 | { 831 | "cell_type": "code", 832 | "metadata": { 833 | "id": "WY3Eyz5PWvcm", 834 | "colab": { 835 | "base_uri": "https://localhost:8080/" 836 | }, 837 | "outputId": "78bffd20-dc78-4e41-b509-b0e822809c52" 838 | }, 839 | "source": [ 840 | "# Tuple\n", 841 | "my_tuple = (1,2,3)\n", 842 | "my_tuple" 843 | ], 844 | "execution_count": null, 845 | "outputs": [ 846 | { 847 | "output_type": "execute_result", 848 | "data": { 849 | "text/plain": [ 850 | "(1, 2, 3)" 851 | ] 852 | }, 853 | "metadata": {}, 854 | "execution_count": 47 855 | } 856 | ] 857 | }, 858 | { 859 | "cell_type": "code", 860 | "metadata": { 861 | "id": "L7RGe8QgWvYt", 862 | "colab": { 863 | "base_uri": "https://localhost:8080/" 864 | }, 865 | "outputId": "807431bc-4bd3-427e-c252-78660b62074b" 866 | }, 867 | "source": [ 868 | "# List creation\n", 869 | "my_list = [1,2,3,4,5,6,7,8,9,10]\n", 870 | "my_list" 871 | ], 872 | "execution_count": null, 873 | "outputs": [ 874 | { 875 | "output_type": "execute_result", 876 | "data": { 877 | "text/plain": [ 878 | "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" 879 | ] 880 | }, 881 | "metadata": {}, 882 | "execution_count": 48 883 | } 884 | ] 885 | }, 886 | { 887 | "cell_type": "code", 888 | "metadata": { 889 | "id": "OSQw1R5yWvPy", 890 | "colab": { 891 | "base_uri": "https://localhost:8080/" 892 | }, 893 | "outputId": "050ca0f6-57ed-4866-be1c-1a5f75c088d9" 894 | }, 895 | "source": [ 896 | "# Adding value\n", 897 | "my_list.append(11)\n", 898 | "my_list" 899 | ], 900 | "execution_count": null, 901 | "outputs": [ 902 | { 903 | "output_type": "execute_result", 904 | "data": { 905 | "text/plain": [ 906 | "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]" 907 | ] 908 | }, 909 | "metadata": {}, 910 | "execution_count": 49 911 | } 912 | ] 913 | }, 914 | { 915 | "cell_type": "code", 916 | "metadata": { 917 | "colab": { 918 | "base_uri": "https://localhost:8080/" 919 | }, 920 | "id": "8p9Tpd42zOq_", 921 | "outputId": "e8928d7f-a15b-4de0-a11c-8930469e27be" 922 | }, 923 | "source": [ 924 | "# Adding value\n", 925 | "my_list.extend([12,13,14,15,16,17])\n", 926 | "my_list" 927 | ], 928 | "execution_count": null, 929 | "outputs": [ 930 | { 931 | "output_type": "execute_result", 932 | "data": { 933 | "text/plain": [ 934 | "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]" 935 | ] 936 | }, 937 | "metadata": {}, 938 | "execution_count": 50 939 | } 940 | ] 941 | }, 942 | { 943 | "cell_type": "code", 944 | "metadata": { 945 | "id": "i391z7t4ZwnM", 946 | "colab": { 947 | "base_uri": "https://localhost:8080/" 948 | }, 949 | "outputId": "17bac205-177d-49cf-eea9-b9e79bbd76ae" 950 | }, 951 | "source": [ 952 | "# Indexing\n", 953 | "my_list[0]" 954 | ], 955 | "execution_count": null, 956 | "outputs": [ 957 | { 958 | "output_type": "execute_result", 959 | "data": { 960 | "text/plain": [ 961 | "1" 962 | ] 963 | }, 964 | "metadata": {}, 965 | "execution_count": 51 966 | } 967 | ] 968 | }, 969 | { 970 | "cell_type": "code", 971 | "metadata": { 972 | "id": "owXGp0IsZ3Lg", 973 | "colab": { 974 | "base_uri": "https://localhost:8080/" 975 | }, 976 | "outputId": "42f37399-d777-46ba-c645-1e66a5354e23" 977 | }, 978 | "source": [ 979 | "# Value range selection\n", 980 | "my_list[0:9]" 981 | ], 982 | "execution_count": null, 983 | "outputs": [ 984 | { 985 | "output_type": "execute_result", 986 | "data": { 987 | "text/plain": [ 988 | "[1, 2, 3, 4, 5, 6, 7, 8, 9]" 989 | ] 990 | }, 991 | "metadata": {}, 992 | "execution_count": 52 993 | } 994 | ] 995 | }, 996 | { 997 | "cell_type": "code", 998 | "metadata": { 999 | "id": "g5SsaYNjZ6Jo", 1000 | "colab": { 1001 | "base_uri": "https://localhost:8080/" 1002 | }, 1003 | "outputId": "5300ac9e-252f-4aaa-fc9d-ac4ffa949ade" 1004 | }, 1005 | "source": [ 1006 | "# Delete a value\n", 1007 | "del my_list[0]\n", 1008 | "my_list" 1009 | ], 1010 | "execution_count": null, 1011 | "outputs": [ 1012 | { 1013 | "output_type": "execute_result", 1014 | "data": { 1015 | "text/plain": [ 1016 | "[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]" 1017 | ] 1018 | }, 1019 | "metadata": {}, 1020 | "execution_count": 53 1021 | } 1022 | ] 1023 | }, 1024 | { 1025 | "cell_type": "code", 1026 | "metadata": { 1027 | "id": "JH1xzsjTZOhr", 1028 | "colab": { 1029 | "base_uri": "https://localhost:8080/" 1030 | }, 1031 | "outputId": "b03ae4b3-2f68-45b9-f43c-742178f340b0" 1032 | }, 1033 | "source": [ 1034 | "# Bonus: Nested List\n", 1035 | "my_list = [[1,15], 3, \"Finance\"]\n", 1036 | "\n", 1037 | "# Print the sublist\n", 1038 | "print(my_list[0])\n", 1039 | "\n", 1040 | "# Print value 15\n", 1041 | "print(my_list[0][1])" 1042 | ], 1043 | "execution_count": null, 1044 | "outputs": [ 1045 | { 1046 | "output_type": "stream", 1047 | "name": "stdout", 1048 | "text": [ 1049 | "[1, 15]\n", 1050 | "15\n" 1051 | ] 1052 | } 1053 | ] 1054 | }, 1055 | { 1056 | "cell_type": "markdown", 1057 | "metadata": { 1058 | "id": "Kd-SYHI-ZF85" 1059 | }, 1060 | "source": [ 1061 | "##### Dictionary" 1062 | ] 1063 | }, 1064 | { 1065 | "cell_type": "code", 1066 | "metadata": { 1067 | "id": "7PasvUGAZw7L" 1068 | }, 1069 | "source": [ 1070 | "# Initialize a dictionnary\n", 1071 | "dic = {}" 1072 | ], 1073 | "execution_count": null, 1074 | "outputs": [] 1075 | }, 1076 | { 1077 | "cell_type": "code", 1078 | "metadata": { 1079 | "id": "FngIfxOfZ-o5", 1080 | "colab": { 1081 | "base_uri": "https://localhost:8080/" 1082 | }, 1083 | "outputId": "523f8c4a-6821-4911-e406-638a216c7dcc" 1084 | }, 1085 | "source": [ 1086 | "# Initialize with values\n", 1087 | "dic = {\"Tesla price\" : 1500,\n", 1088 | " \"Google price\": 3000}\n", 1089 | "dic" 1090 | ], 1091 | "execution_count": null, 1092 | "outputs": [ 1093 | { 1094 | "output_type": "execute_result", 1095 | "data": { 1096 | "text/plain": [ 1097 | "{'Google price': 3000, 'Tesla price': 1500}" 1098 | ] 1099 | }, 1100 | "metadata": {}, 1101 | "execution_count": 59 1102 | } 1103 | ] 1104 | }, 1105 | { 1106 | "cell_type": "code", 1107 | "metadata": { 1108 | "id": "XT9t_7nraYJL", 1109 | "colab": { 1110 | "base_uri": "https://localhost:8080/" 1111 | }, 1112 | "outputId": "dfbd29d5-bc18-462b-9556-632f234eaf4d" 1113 | }, 1114 | "source": [ 1115 | "# Add a value\n", 1116 | "dic[\"Microsoft price\"] = 1500\n", 1117 | "dic" 1118 | ], 1119 | "execution_count": null, 1120 | "outputs": [ 1121 | { 1122 | "output_type": "execute_result", 1123 | "data": { 1124 | "text/plain": [ 1125 | "{'Google price': 3000, 'Microsoft price': 1500, 'Tesla price': 1500}" 1126 | ] 1127 | }, 1128 | "metadata": {}, 1129 | "execution_count": 60 1130 | } 1131 | ] 1132 | }, 1133 | { 1134 | "cell_type": "code", 1135 | "metadata": { 1136 | "colab": { 1137 | "base_uri": "https://localhost:8080/" 1138 | }, 1139 | "id": "1fnoJHGmaRtG", 1140 | "outputId": "5b6adf4d-bd19-4e3a-9272-8aa929c52c21" 1141 | }, 1142 | "source": [ 1143 | "# Change a value\n", 1144 | "dic[\"Microsoft price\"] = 3000\n", 1145 | "dic" 1146 | ], 1147 | "execution_count": null, 1148 | "outputs": [ 1149 | { 1150 | "output_type": "execute_result", 1151 | "data": { 1152 | "text/plain": [ 1153 | "{'Google price': 3000, 'Microsoft price': 3000, 'Tesla price': 1500}" 1154 | ] 1155 | }, 1156 | "metadata": {}, 1157 | "execution_count": 61 1158 | } 1159 | ] 1160 | }, 1161 | { 1162 | "cell_type": "code", 1163 | "metadata": { 1164 | "id": "t4GhmGtdapWP", 1165 | "colab": { 1166 | "base_uri": "https://localhost:8080/" 1167 | }, 1168 | "outputId": "db4e8388-5893-4198-852c-a8240fb4c9f2" 1169 | }, 1170 | "source": [ 1171 | "# Extract a value\n", 1172 | "dic[\"Microsoft price\"]" 1173 | ], 1174 | "execution_count": null, 1175 | "outputs": [ 1176 | { 1177 | "output_type": "execute_result", 1178 | "data": { 1179 | "text/plain": [ 1180 | "3000" 1181 | ] 1182 | }, 1183 | "metadata": {}, 1184 | "execution_count": 62 1185 | } 1186 | ] 1187 | }, 1188 | { 1189 | "cell_type": "code", 1190 | "metadata": { 1191 | "colab": { 1192 | "base_uri": "https://localhost:8080/" 1193 | }, 1194 | "id": "rOBalLlC3Et8", 1195 | "outputId": "917f94cb-b245-499b-d306-f1916699142f" 1196 | }, 1197 | "source": [ 1198 | "# Delete a value\n", 1199 | "del dic[\"Microsoft price\"]\n", 1200 | "dic" 1201 | ], 1202 | "execution_count": null, 1203 | "outputs": [ 1204 | { 1205 | "output_type": "execute_result", 1206 | "data": { 1207 | "text/plain": [ 1208 | "{'Google price': 3000, 'Tesla price': 1500}" 1209 | ] 1210 | }, 1211 | "metadata": {}, 1212 | "execution_count": 63 1213 | } 1214 | ] 1215 | }, 1216 | { 1217 | "cell_type": "code", 1218 | "metadata": { 1219 | "colab": { 1220 | "base_uri": "https://localhost:8080/" 1221 | }, 1222 | "id": "otvn059la3Ct", 1223 | "outputId": "091edcda-ea36-45b2-e95c-0c5142427f75" 1224 | }, 1225 | "source": [ 1226 | "# How to extract the key names\n", 1227 | "dic.keys()" 1228 | ], 1229 | "execution_count": null, 1230 | "outputs": [ 1231 | { 1232 | "output_type": "execute_result", 1233 | "data": { 1234 | "text/plain": [ 1235 | "dict_keys(['Tesla price', 'Google price'])" 1236 | ] 1237 | }, 1238 | "metadata": {}, 1239 | "execution_count": 64 1240 | } 1241 | ] 1242 | }, 1243 | { 1244 | "cell_type": "code", 1245 | "metadata": { 1246 | "colab": { 1247 | "base_uri": "https://localhost:8080/" 1248 | }, 1249 | "id": "ndKUymfzbF4t", 1250 | "outputId": "9a1b3f20-e79f-472e-ea27-88001260ca48" 1251 | }, 1252 | "source": [ 1253 | "# How to extract the values names\n", 1254 | "dic.values()" 1255 | ], 1256 | "execution_count": null, 1257 | "outputs": [ 1258 | { 1259 | "output_type": "execute_result", 1260 | "data": { 1261 | "text/plain": [ 1262 | "dict_values([1500, 3000])" 1263 | ] 1264 | }, 1265 | "metadata": {}, 1266 | "execution_count": 65 1267 | } 1268 | ] 1269 | }, 1270 | { 1271 | "cell_type": "markdown", 1272 | "metadata": { 1273 | "id": "2UHCKDk8bJEf" 1274 | }, 1275 | "source": [ 1276 | "##### Sets" 1277 | ] 1278 | }, 1279 | { 1280 | "cell_type": "code", 1281 | "metadata": { 1282 | "id": "viHNp-EHbQ9H", 1283 | "colab": { 1284 | "base_uri": "https://localhost:8080/" 1285 | }, 1286 | "outputId": "e1600ec1-f1fd-4784-eb79-6ee33056d979" 1287 | }, 1288 | "source": [ 1289 | "# Create a set\n", 1290 | "{1,3,9}" 1291 | ], 1292 | "execution_count": null, 1293 | "outputs": [ 1294 | { 1295 | "output_type": "execute_result", 1296 | "data": { 1297 | "text/plain": [ 1298 | "{1, 3, 9}" 1299 | ] 1300 | }, 1301 | "metadata": {}, 1302 | "execution_count": 68 1303 | } 1304 | ] 1305 | }, 1306 | { 1307 | "cell_type": "code", 1308 | "metadata": { 1309 | "id": "_E1aFnTcbYpJ", 1310 | "colab": { 1311 | "base_uri": "https://localhost:8080/" 1312 | }, 1313 | "outputId": "3d8f68a2-5acd-4cf5-d303-6844700b0671" 1314 | }, 1315 | "source": [ 1316 | "# View a property\n", 1317 | "{1,1,1, 3,3,3, 9,9,9}" 1318 | ], 1319 | "execution_count": null, 1320 | "outputs": [ 1321 | { 1322 | "output_type": "execute_result", 1323 | "data": { 1324 | "text/plain": [ 1325 | "{1, 3, 9}" 1326 | ] 1327 | }, 1328 | "metadata": {}, 1329 | "execution_count": 69 1330 | } 1331 | ] 1332 | }, 1333 | { 1334 | "cell_type": "code", 1335 | "metadata": { 1336 | "id": "2kc9rLF6be3l", 1337 | "colab": { 1338 | "base_uri": "https://localhost:8080/" 1339 | }, 1340 | "outputId": "49404fe9-4990-46b5-b5a9-3301604b9cf9" 1341 | }, 1342 | "source": [ 1343 | "# Create a list\n", 1344 | "my_list = [\"Finance\", \"Statistics\", \"Mathematics\",\n", 1345 | " \"Finance\", \"Statistics\", \"Finance\",\n", 1346 | " \"Mathematics\", \"Finance\", \"Statistics\"]\n", 1347 | "\n", 1348 | "# Transform the list into a set\n", 1349 | "set(my_list)" 1350 | ], 1351 | "execution_count": null, 1352 | "outputs": [ 1353 | { 1354 | "output_type": "execute_result", 1355 | "data": { 1356 | "text/plain": [ 1357 | "{'Finance', 'Mathematics', 'Statistics'}" 1358 | ] 1359 | }, 1360 | "metadata": {}, 1361 | "execution_count": 70 1362 | } 1363 | ] 1364 | }, 1365 | { 1366 | "cell_type": "code", 1367 | "metadata": { 1368 | "id": "s2b-8LgkcLs1", 1369 | "colab": { 1370 | "base_uri": "https://localhost:8080/" 1371 | }, 1372 | "outputId": "4ef0fc8b-519c-48fe-edb6-288ff73f03cf" 1373 | }, 1374 | "source": [ 1375 | "# Add a value\n", 1376 | "s = {1,3,5}\n", 1377 | "print(s)\n", 1378 | "\n", 1379 | "s.add(56)\n", 1380 | "s.add(68)\n", 1381 | "print(s)" 1382 | ], 1383 | "execution_count": null, 1384 | "outputs": [ 1385 | { 1386 | "output_type": "stream", 1387 | "name": "stdout", 1388 | "text": [ 1389 | "{1, 3, 5}\n", 1390 | "{1, 3, 68, 5, 56}\n" 1391 | ] 1392 | } 1393 | ] 1394 | }, 1395 | { 1396 | "cell_type": "markdown", 1397 | "metadata": { 1398 | "id": "W9Vc62veaNKg" 1399 | }, 1400 | "source": [ 1401 | "### Python Structures" 1402 | ] 1403 | }, 1404 | { 1405 | "cell_type": "markdown", 1406 | "metadata": { 1407 | "id": "7xKs11J6akHQ" 1408 | }, 1409 | "source": [ 1410 | "##### If/ Elif/ Else" 1411 | ] 1412 | }, 1413 | { 1414 | "cell_type": "code", 1415 | "metadata": { 1416 | "id": "CqZigieEaOkf" 1417 | }, 1418 | "source": [ 1419 | "# Conditionnal structure IF\n", 1420 | "if 5>6:\n", 1421 | " print(\"yes\")" 1422 | ], 1423 | "execution_count": null, 1424 | "outputs": [] 1425 | }, 1426 | { 1427 | "cell_type": "code", 1428 | "metadata": { 1429 | "id": "neKqpCKn8y9N", 1430 | "colab": { 1431 | "base_uri": "https://localhost:8080/" 1432 | }, 1433 | "outputId": "8cc9ffdc-3d28-469d-fc3e-75c82650ff2c" 1434 | }, 1435 | "source": [ 1436 | "# Conditionnal structure IF/ ELSE\n", 1437 | "if 5>6:\n", 1438 | " print(\"yes\")\n", 1439 | "else:\n", 1440 | " print(\"no\")" 1441 | ], 1442 | "execution_count": null, 1443 | "outputs": [ 1444 | { 1445 | "output_type": "stream", 1446 | "name": "stdout", 1447 | "text": [ 1448 | "no\n" 1449 | ] 1450 | } 1451 | ] 1452 | }, 1453 | { 1454 | "cell_type": "code", 1455 | "metadata": { 1456 | "id": "qEKi-yu_873c", 1457 | "colab": { 1458 | "base_uri": "https://localhost:8080/" 1459 | }, 1460 | "outputId": "60be59bf-4fb6-4222-9c8f-3d0d9d8858b8" 1461 | }, 1462 | "source": [ 1463 | "# Conditionnal structure IF/ ELIF/ ELSE\n", 1464 | "x = 11\n", 1465 | "\n", 1466 | "if x>=15:\n", 1467 | " print(\"X>=15\")\n", 1468 | "elif x>10:\n", 1469 | " print(\"10\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mmy_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mloc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", 1824 | "\u001b[0;31mNameError\u001b[0m: name 'loc' is not defined" 1825 | ] 1826 | } 1827 | ] 1828 | }, 1829 | { 1830 | "cell_type": "markdown", 1831 | "metadata": { 1832 | "id": "F8rax_dDgnFI" 1833 | }, 1834 | "source": [ 1835 | "##### Global Variable" 1836 | ] 1837 | }, 1838 | { 1839 | "cell_type": "code", 1840 | "metadata": { 1841 | "id": "7330M1h4gpnQ" 1842 | }, 1843 | "source": [ 1844 | "# Global variable \n", 1845 | "def my_function():\n", 1846 | " global variable\n", 1847 | " variable=15" 1848 | ], 1849 | "execution_count": null, 1850 | "outputs": [] 1851 | }, 1852 | { 1853 | "cell_type": "code", 1854 | "metadata": { 1855 | "id": "LgzzqLCDgp-M" 1856 | }, 1857 | "source": [ 1858 | "# Run the function and print the global variable \n", 1859 | "my_function()" 1860 | ], 1861 | "execution_count": null, 1862 | "outputs": [] 1863 | }, 1864 | { 1865 | "cell_type": "code", 1866 | "metadata": { 1867 | "colab": { 1868 | "base_uri": "https://localhost:8080/" 1869 | }, 1870 | "id": "KFEQ7BB-2m5g", 1871 | "outputId": "4a40a4de-995a-4eca-b18b-bce5d6b1c213" 1872 | }, 1873 | "source": [ 1874 | "print(variable)" 1875 | ], 1876 | "execution_count": null, 1877 | "outputs": [ 1878 | { 1879 | "output_type": "stream", 1880 | "name": "stdout", 1881 | "text": [ 1882 | "15\n" 1883 | ] 1884 | } 1885 | ] 1886 | }, 1887 | { 1888 | "cell_type": "markdown", 1889 | "metadata": { 1890 | "id": "4NWfx4mRhpgX" 1891 | }, 1892 | "source": [ 1893 | "##### Lambda" 1894 | ] 1895 | }, 1896 | { 1897 | "cell_type": "code", 1898 | "metadata": { 1899 | "id": "mhxlEyFthuQa" 1900 | }, 1901 | "source": [ 1902 | "# Creation lambda oject\n", 1903 | "f = lambda x: x**2" 1904 | ], 1905 | "execution_count": null, 1906 | "outputs": [] 1907 | }, 1908 | { 1909 | "cell_type": "code", 1910 | "metadata": { 1911 | "id": "NFQxwMIWh-B_", 1912 | "colab": { 1913 | "base_uri": "https://localhost:8080/" 1914 | }, 1915 | "outputId": "34fab93f-0767-4376-f774-a49c803b5900" 1916 | }, 1917 | "source": [ 1918 | "# Create a list to apply a lambda function\n", 1919 | "lis = [1,2,3,4,5,6,7,8]\n", 1920 | "\n", 1921 | "# Use map function to apply lambda function to a list\n", 1922 | "generator = map(f,lis)\n", 1923 | "generator" 1924 | ], 1925 | "execution_count": null, 1926 | "outputs": [ 1927 | { 1928 | "output_type": "execute_result", 1929 | "data": { 1930 | "text/plain": [ 1931 | "" 1932 | ] 1933 | }, 1934 | "metadata": {}, 1935 | "execution_count": 44 1936 | } 1937 | ] 1938 | }, 1939 | { 1940 | "cell_type": "code", 1941 | "metadata": { 1942 | "id": "_AX5enMai7O-", 1943 | "colab": { 1944 | "base_uri": "https://localhost:8080/" 1945 | }, 1946 | "outputId": "178339cc-a899-4ee3-92d2-1ee4ca6a7369" 1947 | }, 1948 | "source": [ 1949 | "# Map the list\n", 1950 | "list(generator)" 1951 | ], 1952 | "execution_count": null, 1953 | "outputs": [ 1954 | { 1955 | "output_type": "execute_result", 1956 | "data": { 1957 | "text/plain": [ 1958 | "[1, 4, 9, 16, 25, 36, 49, 64]" 1959 | ] 1960 | }, 1961 | "metadata": {}, 1962 | "execution_count": 45 1963 | } 1964 | ] 1965 | }, 1966 | { 1967 | "cell_type": "code", 1968 | "metadata": { 1969 | "id": "bWRIV_RZ4cBs" 1970 | }, 1971 | "source": [ 1972 | "" 1973 | ], 1974 | "execution_count": null, 1975 | "outputs": [] 1976 | } 1977 | ] 1978 | } -------------------------------------------------------------------------------- /Chapter_03_Data.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "name": "EN - BG Chapter 5: Data.ipynb", 7 | "provenance": [] 8 | }, 9 | "kernelspec": { 10 | "name": "python3", 11 | "display_name": "Python 3" 12 | }, 13 | "language_info": { 14 | "name": "python" 15 | } 16 | }, 17 | "cells": [ 18 | { 19 | "cell_type": "markdown", 20 | "source": [ 21 | "

\"Colaboratory

\n", 22 | "\n", 23 | "# Preprocessing the Data\n", 24 | "\n", 25 | "\n", 26 | "
\n", 27 | "\n", 28 | "\n", 29 | "💰Join our community: https://discord.gg/wXjNPAc5BH\n", 30 | "\n", 31 | "📚Read our book: https://www.amazon.com/gp/product/B09HG18CYL \n", 32 | "\n", 33 | "🖥️Quantreo's YouTube channel: https://www.youtube.com/channel/UCp7jckfiEglNf_Gj62VR0pw" 34 | ], 35 | "metadata": { 36 | "id": "1ZsY5xy5sSf2" 37 | } 38 | }, 39 | { 40 | "cell_type": "code", 41 | "source": [ 42 | "!pip install yfinance" 43 | ], 44 | "metadata": { 45 | "colab": { 46 | "base_uri": "https://localhost:8080/" 47 | }, 48 | "id": "SELynRZH3hfA", 49 | "outputId": "ac3a2947-e46a-4f82-a4c8-07aca9326e05" 50 | }, 51 | "execution_count": null, 52 | "outputs": [ 53 | { 54 | "output_type": "stream", 55 | "name": "stdout", 56 | "text": [ 57 | "Collecting yfinance\n", 58 | " Downloading yfinance-0.1.69-py2.py3-none-any.whl (26 kB)\n", 59 | "Collecting lxml>=4.5.1\n", 60 | " Downloading lxml-4.7.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (6.4 MB)\n", 61 | "\u001b[K |████████████████████████████████| 6.4 MB 26.4 MB/s \n", 62 | "\u001b[?25hCollecting requests>=2.26\n", 63 | " Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)\n", 64 | "\u001b[K |████████████████████████████████| 63 kB 1.5 MB/s \n", 65 | "\u001b[?25hRequirement already satisfied: pandas>=0.24 in /usr/local/lib/python3.7/dist-packages (from yfinance) (1.1.5)\n", 66 | "Requirement already satisfied: numpy>=1.15 in /usr/local/lib/python3.7/dist-packages (from yfinance) (1.19.5)\n", 67 | "Requirement already satisfied: multitasking>=0.0.7 in /usr/local/lib/python3.7/dist-packages (from yfinance) (0.0.10)\n", 68 | "Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.24->yfinance) (2018.9)\n", 69 | "Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.24->yfinance) (2.8.2)\n", 70 | "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.7.3->pandas>=0.24->yfinance) (1.15.0)\n", 71 | "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests>=2.26->yfinance) (1.24.3)\n", 72 | "Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.7/dist-packages (from requests>=2.26->yfinance) (2.0.10)\n", 73 | "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests>=2.26->yfinance) (2.10)\n", 74 | "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests>=2.26->yfinance) (2021.10.8)\n", 75 | "Installing collected packages: requests, lxml, yfinance\n", 76 | " Attempting uninstall: requests\n", 77 | " Found existing installation: requests 2.23.0\n", 78 | " Uninstalling requests-2.23.0:\n", 79 | " Successfully uninstalled requests-2.23.0\n", 80 | " Attempting uninstall: lxml\n", 81 | " Found existing installation: lxml 4.2.6\n", 82 | " Uninstalling lxml-4.2.6:\n", 83 | " Successfully uninstalled lxml-4.2.6\n", 84 | "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", 85 | "google-colab 1.0.0 requires requests~=2.23.0, but you have requests 2.27.1 which is incompatible.\n", 86 | "datascience 0.10.6 requires folium==0.2.1, but you have folium 0.8.3 which is incompatible.\u001b[0m\n", 87 | "Successfully installed lxml-4.7.1 requests-2.27.1 yfinance-0.1.69\n" 88 | ] 89 | } 90 | ] 91 | }, 92 | { 93 | "cell_type": "code", 94 | "execution_count": null, 95 | "metadata": { 96 | "id": "vjIltp4XqmxX" 97 | }, 98 | "outputs": [], 99 | "source": [ 100 | "import numpy as np\n", 101 | "import pandas as pd\n", 102 | "import yfinance as yf\n", 103 | "import warnings\n", 104 | "warnings.filterwarnings(\"ignore\")" 105 | ] 106 | }, 107 | { 108 | "cell_type": "markdown", 109 | "source": [ 110 | "# Manage the data which come from MT5 (manually)\n" 111 | ], 112 | "metadata": { 113 | "id": "ojd6NbD3Us06" 114 | } 115 | }, 116 | { 117 | "cell_type": "code", 118 | "source": [ 119 | "# Import brut data\n", 120 | "df = pd.read_csv(\"EURUSD_D1.csv\")\n", 121 | "df" 122 | ], 123 | "metadata": { 124 | "colab": { 125 | "base_uri": "https://localhost:8080/", 126 | "height": 419 127 | }, 128 | "id": "I0G5yH4B4kQM", 129 | "outputId": "8498da67-8262-4060-aebd-ae1b557ba268" 130 | }, 131 | "execution_count": null, 132 | "outputs": [ 133 | { 134 | "output_type": "execute_result", 135 | "data": { 136 | "text/html": [ 137 | "\n", 138 | "
\n", 139 | "
\n", 140 | "
\n", 141 | "\n", 154 | "\n", 155 | " \n", 156 | " \n", 157 | " \n", 158 | " \n", 159 | " \n", 160 | " \n", 161 | " \n", 162 | " \n", 163 | " \n", 164 | " \n", 165 | " \n", 166 | " \n", 167 | " \n", 168 | " \n", 169 | " \n", 170 | " \n", 171 | " \n", 172 | " \n", 173 | " \n", 174 | " \n", 175 | " \n", 176 | " \n", 177 | " \n", 178 | " \n", 179 | " \n", 180 | " \n", 181 | " \n", 182 | " \n", 183 | " \n", 184 | " \n", 185 | " \n", 186 | " \n", 187 | " \n", 188 | " \n", 189 | " \n", 190 | " \n", 191 | " \n", 192 | " \n", 193 | " \n", 194 | " \n", 195 | " \n", 196 | " \n", 197 | " \n", 198 | " \n", 199 | " \n", 200 | " \n", 201 | " \n", 202 | " \n", 203 | " \n", 204 | " \n", 205 | " \n", 206 | " \n", 207 | "
<DATE>\\t<OPEN>\\t<HIGH>\\t<LOW>\\t<CLOSE>\\t<TICKVOL>\\t<VOL>\\t<SPREAD>
02011.01.03\\t1.33443\\t1.33945\\t1.32501\\t1.33499...
12011.01.04\\t1.33507\\t1.34330\\t1.32919\\t1.33104...
22011.01.05\\t1.33099\\t1.33247\\t1.31255\\t1.31485...
32011.01.06\\t1.31495\\t1.31699\\t1.29834\\t1.30022...
42011.01.07\\t1.30018\\t1.30206\\t1.29044\\t1.29055...
......
28612022.01.10\\t1.13550\\t1.13599\\t1.12853\\t1.13252...
28622022.01.11\\t1.13230\\t1.13753\\t1.13131\\t1.13666...
28632022.01.12\\t1.13655\\t1.14528\\t1.13545\\t1.14411...
28642022.01.13\\t1.14402\\t1.14817\\t1.14357\\t1.14539...
28652022.01.14\\t1.14531\\t1.14829\\t1.13987\\t1.14151...
\n", 208 | "

2866 rows × 1 columns

\n", 209 | "
\n", 210 | " \n", 220 | " \n", 221 | " \n", 258 | "\n", 259 | " \n", 283 | "
\n", 284 | "
\n", 285 | " " 286 | ], 287 | "text/plain": [ 288 | " \\t\\t\\t\\t\\t\\t\\t\n", 289 | "0 2011.01.03\\t1.33443\\t1.33945\\t1.32501\\t1.33499... \n", 290 | "1 2011.01.04\\t1.33507\\t1.34330\\t1.32919\\t1.33104... \n", 291 | "2 2011.01.05\\t1.33099\\t1.33247\\t1.31255\\t1.31485... \n", 292 | "3 2011.01.06\\t1.31495\\t1.31699\\t1.29834\\t1.30022... \n", 293 | "4 2011.01.07\\t1.30018\\t1.30206\\t1.29044\\t1.29055... \n", 294 | "... ... \n", 295 | "2861 2022.01.10\\t1.13550\\t1.13599\\t1.12853\\t1.13252... \n", 296 | "2862 2022.01.11\\t1.13230\\t1.13753\\t1.13131\\t1.13666... \n", 297 | "2863 2022.01.12\\t1.13655\\t1.14528\\t1.13545\\t1.14411... \n", 298 | "2864 2022.01.13\\t1.14402\\t1.14817\\t1.14357\\t1.14539... \n", 299 | "2865 2022.01.14\\t1.14531\\t1.14829\\t1.13987\\t1.14151... \n", 300 | "\n", 301 | "[2866 rows x 1 columns]" 302 | ] 303 | }, 304 | "metadata": {}, 305 | "execution_count": 3 306 | } 307 | ] 308 | }, 309 | { 310 | "cell_type": "code", 311 | "source": [ 312 | "# Add the delimiter\n", 313 | "df = pd.read_csv(\"EURUSD_D1.csv\", delimiter=\"\\t\")\n", 314 | "df" 315 | ], 316 | "metadata": { 317 | "colab": { 318 | "base_uri": "https://localhost:8080/", 319 | "height": 419 320 | }, 321 | "id": "l5Yw3s0KVNBJ", 322 | "outputId": "b30373d0-465e-4d53-fc97-da5f08cf0126" 323 | }, 324 | "execution_count": null, 325 | "outputs": [ 326 | { 327 | "output_type": "execute_result", 328 | "data": { 329 | "text/html": [ 330 | "\n", 331 | "
\n", 332 | "
\n", 333 | "
\n", 334 | "\n", 347 | "\n", 348 | " \n", 349 | " \n", 350 | " \n", 351 | " \n", 352 | " \n", 353 | " \n", 354 | " \n", 355 | " \n", 356 | " \n", 357 | " \n", 358 | " \n", 359 | " \n", 360 | " \n", 361 | " \n", 362 | " \n", 363 | " \n", 364 | " \n", 365 | " \n", 366 | " \n", 367 | " \n", 368 | " \n", 369 | " \n", 370 | " \n", 371 | " \n", 372 | " \n", 373 | " \n", 374 | " \n", 375 | " \n", 376 | " \n", 377 | " \n", 378 | " \n", 379 | " \n", 380 | " \n", 381 | " \n", 382 | " \n", 383 | " \n", 384 | " \n", 385 | " \n", 386 | " \n", 387 | " \n", 388 | " \n", 389 | " \n", 390 | " \n", 391 | " \n", 392 | " \n", 393 | " \n", 394 | " \n", 395 | " \n", 396 | " \n", 397 | " \n", 398 | " \n", 399 | " \n", 400 | " \n", 401 | " \n", 402 | " \n", 403 | " \n", 404 | " \n", 405 | " \n", 406 | " \n", 407 | " \n", 408 | " \n", 409 | " \n", 410 | " \n", 411 | " \n", 412 | " \n", 413 | " \n", 414 | " \n", 415 | " \n", 416 | " \n", 417 | " \n", 418 | " \n", 419 | " \n", 420 | " \n", 421 | " \n", 422 | " \n", 423 | " \n", 424 | " \n", 425 | " \n", 426 | " \n", 427 | " \n", 428 | " \n", 429 | " \n", 430 | " \n", 431 | " \n", 432 | " \n", 433 | " \n", 434 | " \n", 435 | " \n", 436 | " \n", 437 | " \n", 438 | " \n", 439 | " \n", 440 | " \n", 441 | " \n", 442 | " \n", 443 | " \n", 444 | " \n", 445 | " \n", 446 | " \n", 447 | " \n", 448 | " \n", 449 | " \n", 450 | " \n", 451 | " \n", 452 | " \n", 453 | " \n", 454 | " \n", 455 | " \n", 456 | " \n", 457 | " \n", 458 | " \n", 459 | " \n", 460 | " \n", 461 | " \n", 462 | " \n", 463 | " \n", 464 | " \n", 465 | " \n", 466 | " \n", 467 | " \n", 468 | " \n", 469 | " \n", 470 | " \n", 471 | " \n", 472 | " \n", 473 | " \n", 474 | " \n", 475 | " \n", 476 | " \n", 477 | " \n", 478 | " \n", 479 | " \n", 480 | " \n", 481 | " \n", 482 | " \n", 483 | " \n", 484 | "
<DATE><OPEN><HIGH><LOW><CLOSE><TICKVOL><VOL><SPREAD>
02011.01.031.334431.339451.325011.334996321409
12011.01.041.335071.343301.329191.331048067308
22011.01.051.330991.332471.312551.314858372508
32011.01.061.314951.316991.298341.300227372308
42011.01.071.300181.302061.290441.290558237908
...........................
28612022.01.101.135501.135991.128531.132525345700
28622022.01.111.132301.137531.131311.136664938600
28632022.01.121.136551.145281.135451.144115187200
28642022.01.131.144021.148171.143571.145395307800
28652022.01.141.145311.148291.139871.141515988200
\n", 485 | "

2866 rows × 8 columns

\n", 486 | "
\n", 487 | " \n", 497 | " \n", 498 | " \n", 535 | "\n", 536 | " \n", 560 | "
\n", 561 | "
\n", 562 | " " 563 | ], 564 | "text/plain": [ 565 | " ... \n", 566 | "0 2011.01.03 1.33443 1.33945 ... 63214 0 9\n", 567 | "1 2011.01.04 1.33507 1.34330 ... 80673 0 8\n", 568 | "2 2011.01.05 1.33099 1.33247 ... 83725 0 8\n", 569 | "3 2011.01.06 1.31495 1.31699 ... 73723 0 8\n", 570 | "4 2011.01.07 1.30018 1.30206 ... 82379 0 8\n", 571 | "... ... ... ... ... ... ... ...\n", 572 | "2861 2022.01.10 1.13550 1.13599 ... 53457 0 0\n", 573 | "2862 2022.01.11 1.13230 1.13753 ... 49386 0 0\n", 574 | "2863 2022.01.12 1.13655 1.14528 ... 51872 0 0\n", 575 | "2864 2022.01.13 1.14402 1.14817 ... 53078 0 0\n", 576 | "2865 2022.01.14 1.14531 1.14829 ... 59882 0 0\n", 577 | "\n", 578 | "[2866 rows x 8 columns]" 579 | ] 580 | }, 581 | "metadata": {}, 582 | "execution_count": 4 583 | } 584 | ] 585 | }, 586 | { 587 | "cell_type": "code", 588 | "source": [ 589 | "# Preprocessing function\n", 590 | "\n", 591 | "def preprocessing(name):\n", 592 | "\n", 593 | " # Import the data\n", 594 | " df = pd.read_csv(name, delimiter=\"\\t\", index_col=\"\", parse_dates=True).dropna()\n", 595 | "\n", 596 | "\n", 597 | " # Delete the two last columns\n", 598 | " df = df.iloc[:,:-2]\n", 599 | "\n", 600 | " # Rename\n", 601 | " df.columns = [\"open\", \"high\", \"low\", \"close\", \"volume\"]\n", 602 | " df.index.name = \"time\"\n", 603 | "\n", 604 | " return df" 605 | ], 606 | "metadata": { 607 | "id": "3nkP0bhO4pMq" 608 | }, 609 | "execution_count": null, 610 | "outputs": [] 611 | }, 612 | { 613 | "cell_type": "code", 614 | "source": [ 615 | "preprocessing(\"EURUSD_D1.csv\")" 616 | ], 617 | "metadata": { 618 | "id": "vIxzE2pJ-l0a", 619 | "colab": { 620 | "base_uri": "https://localhost:8080/", 621 | "height": 450 622 | }, 623 | "outputId": "369573b2-ac89-41ed-9834-169af136e9f1" 624 | }, 625 | "execution_count": null, 626 | "outputs": [ 627 | { 628 | "output_type": "execute_result", 629 | "data": { 630 | "text/html": [ 631 | "\n", 632 | "
\n", 633 | "
\n", 634 | "
\n", 635 | "\n", 648 | "\n", 649 | " \n", 650 | " \n", 651 | " \n", 652 | " \n", 653 | " \n", 654 | " \n", 655 | " \n", 656 | " \n", 657 | " \n", 658 | " \n", 659 | " \n", 660 | " \n", 661 | " \n", 662 | " \n", 663 | " \n", 664 | " \n", 665 | " \n", 666 | " \n", 667 | " \n", 668 | " \n", 669 | " \n", 670 | " \n", 671 | " \n", 672 | " \n", 673 | " \n", 674 | " \n", 675 | " \n", 676 | " \n", 677 | " \n", 678 | " \n", 679 | " \n", 680 | " \n", 681 | " \n", 682 | " \n", 683 | " \n", 684 | " \n", 685 | " \n", 686 | " \n", 687 | " \n", 688 | " \n", 689 | " \n", 690 | " \n", 691 | " \n", 692 | " \n", 693 | " \n", 694 | " \n", 695 | " \n", 696 | " \n", 697 | " \n", 698 | " \n", 699 | " \n", 700 | " \n", 701 | " \n", 702 | " \n", 703 | " \n", 704 | " \n", 705 | " \n", 706 | " \n", 707 | " \n", 708 | " \n", 709 | " \n", 710 | " \n", 711 | " \n", 712 | " \n", 713 | " \n", 714 | " \n", 715 | " \n", 716 | " \n", 717 | " \n", 718 | " \n", 719 | " \n", 720 | " \n", 721 | " \n", 722 | " \n", 723 | " \n", 724 | " \n", 725 | " \n", 726 | " \n", 727 | " \n", 728 | " \n", 729 | " \n", 730 | " \n", 731 | " \n", 732 | " \n", 733 | " \n", 734 | " \n", 735 | " \n", 736 | " \n", 737 | " \n", 738 | " \n", 739 | " \n", 740 | " \n", 741 | " \n", 742 | " \n", 743 | " \n", 744 | " \n", 745 | " \n", 746 | " \n", 747 | " \n", 748 | " \n", 749 | " \n", 750 | " \n", 751 | " \n", 752 | " \n", 753 | " \n", 754 | " \n", 755 | " \n", 756 | " \n", 757 | "
openhighlowclosevolume
time
2011-01-031.334431.339451.325011.3349963214
2011-01-041.335071.343301.329191.3310480673
2011-01-051.330991.332471.312551.3148583725
2011-01-061.314951.316991.298341.3002273723
2011-01-071.300181.302061.290441.2905582379
..................
2022-01-101.135501.135991.128531.1325253457
2022-01-111.132301.137531.131311.1366649386
2022-01-121.136551.145281.135451.1441151872
2022-01-131.144021.148171.143571.1453953078
2022-01-141.145311.148291.139871.1415159882
\n", 758 | "

2866 rows × 5 columns

\n", 759 | "
\n", 760 | " \n", 770 | " \n", 771 | " \n", 808 | "\n", 809 | " \n", 833 | "
\n", 834 | "
\n", 835 | " " 836 | ], 837 | "text/plain": [ 838 | " open high low close volume\n", 839 | "time \n", 840 | "2011-01-03 1.33443 1.33945 1.32501 1.33499 63214\n", 841 | "2011-01-04 1.33507 1.34330 1.32919 1.33104 80673\n", 842 | "2011-01-05 1.33099 1.33247 1.31255 1.31485 83725\n", 843 | "2011-01-06 1.31495 1.31699 1.29834 1.30022 73723\n", 844 | "2011-01-07 1.30018 1.30206 1.29044 1.29055 82379\n", 845 | "... ... ... ... ... ...\n", 846 | "2022-01-10 1.13550 1.13599 1.12853 1.13252 53457\n", 847 | "2022-01-11 1.13230 1.13753 1.13131 1.13666 49386\n", 848 | "2022-01-12 1.13655 1.14528 1.13545 1.14411 51872\n", 849 | "2022-01-13 1.14402 1.14817 1.14357 1.14539 53078\n", 850 | "2022-01-14 1.14531 1.14829 1.13987 1.14151 59882\n", 851 | "\n", 852 | "[2866 rows x 5 columns]" 853 | ] 854 | }, 855 | "metadata": {}, 856 | "execution_count": 20 857 | } 858 | ] 859 | }, 860 | { 861 | "cell_type": "markdown", 862 | "source": [ 863 | "# Manage the data which come from Yfinance\n" 864 | ], 865 | "metadata": { 866 | "id": "d5kArxfa4And" 867 | } 868 | }, 869 | { 870 | "cell_type": "code", 871 | "source": [ 872 | "yf.download(\"EURUSD=X\")" 873 | ], 874 | "metadata": { 875 | "colab": { 876 | "base_uri": "https://localhost:8080/", 877 | "height": 467 878 | }, 879 | "id": "3zel86pF1CIu", 880 | "outputId": "60133cb7-511d-45b6-bd98-31d880a1c267" 881 | }, 882 | "execution_count": null, 883 | "outputs": [ 884 | { 885 | "output_type": "stream", 886 | "name": "stdout", 887 | "text": [ 888 | "\r[*********************100%***********************] 1 of 1 completed\n" 889 | ] 890 | }, 891 | { 892 | "output_type": "execute_result", 893 | "data": { 894 | "text/html": [ 895 | "\n", 896 | "
\n", 897 | "
\n", 898 | "
\n", 899 | "\n", 912 | "\n", 913 | " \n", 914 | " \n", 915 | " \n", 916 | " \n", 917 | " \n", 918 | " \n", 919 | " \n", 920 | " \n", 921 | " \n", 922 | " \n", 923 | " \n", 924 | " \n", 925 | " \n", 926 | " \n", 927 | " \n", 928 | " \n", 929 | " \n", 930 | " \n", 931 | " \n", 932 | " \n", 933 | " \n", 934 | " \n", 935 | " \n", 936 | " \n", 937 | " \n", 938 | " \n", 939 | " \n", 940 | " \n", 941 | " \n", 942 | " \n", 943 | " \n", 944 | " \n", 945 | " \n", 946 | " \n", 947 | " \n", 948 | " \n", 949 | " \n", 950 | " \n", 951 | " \n", 952 | " \n", 953 | " \n", 954 | " \n", 955 | " \n", 956 | " \n", 957 | " \n", 958 | " \n", 959 | " \n", 960 | " \n", 961 | " \n", 962 | " \n", 963 | " \n", 964 | " \n", 965 | " \n", 966 | " \n", 967 | " \n", 968 | " \n", 969 | " \n", 970 | " \n", 971 | " \n", 972 | " \n", 973 | " \n", 974 | " \n", 975 | " \n", 976 | " \n", 977 | " \n", 978 | " \n", 979 | " \n", 980 | " \n", 981 | " \n", 982 | " \n", 983 | " \n", 984 | " \n", 985 | " \n", 986 | " \n", 987 | " \n", 988 | " \n", 989 | " \n", 990 | " \n", 991 | " \n", 992 | " \n", 993 | " \n", 994 | " \n", 995 | " \n", 996 | " \n", 997 | " \n", 998 | " \n", 999 | " \n", 1000 | " \n", 1001 | " \n", 1002 | " \n", 1003 | " \n", 1004 | " \n", 1005 | " \n", 1006 | " \n", 1007 | " \n", 1008 | " \n", 1009 | " \n", 1010 | " \n", 1011 | " \n", 1012 | " \n", 1013 | " \n", 1014 | " \n", 1015 | " \n", 1016 | " \n", 1017 | " \n", 1018 | " \n", 1019 | " \n", 1020 | " \n", 1021 | " \n", 1022 | " \n", 1023 | " \n", 1024 | " \n", 1025 | " \n", 1026 | " \n", 1027 | " \n", 1028 | " \n", 1029 | " \n", 1030 | " \n", 1031 | " \n", 1032 | " \n", 1033 | " \n", 1034 | "
OpenHighLowCloseAdj CloseVolume
Date
2003-12-011.2033981.2040071.1944011.1965011.1965010
2003-12-021.1961011.2109031.1946001.2088971.2088970
2003-12-031.2090001.2130031.2077001.2122981.2122980
2003-12-041.2120041.2144031.2043981.2080941.2080940
2003-12-051.2078021.2190961.2065931.2186951.2186950
.....................
2022-01-191.1330031.1356801.1319521.1329651.1329650
2022-01-201.1343531.1368931.1330161.1343401.1343400
2022-01-211.1315421.1361051.1302241.1313751.1313750
2022-01-241.1340951.1340951.1291401.1341471.1341470
2022-01-251.1327591.1332731.1305821.1312221.1312220
\n", 1035 | "

4708 rows × 6 columns

\n", 1036 | "
\n", 1037 | " \n", 1047 | " \n", 1048 | " \n", 1085 | "\n", 1086 | " \n", 1110 | "
\n", 1111 | "
\n", 1112 | " " 1113 | ], 1114 | "text/plain": [ 1115 | " Open High Low Close Adj Close Volume\n", 1116 | "Date \n", 1117 | "2003-12-01 1.203398 1.204007 1.194401 1.196501 1.196501 0\n", 1118 | "2003-12-02 1.196101 1.210903 1.194600 1.208897 1.208897 0\n", 1119 | "2003-12-03 1.209000 1.213003 1.207700 1.212298 1.212298 0\n", 1120 | "2003-12-04 1.212004 1.214403 1.204398 1.208094 1.208094 0\n", 1121 | "2003-12-05 1.207802 1.219096 1.206593 1.218695 1.218695 0\n", 1122 | "... ... ... ... ... ... ...\n", 1123 | "2022-01-19 1.133003 1.135680 1.131952 1.132965 1.132965 0\n", 1124 | "2022-01-20 1.134353 1.136893 1.133016 1.134340 1.134340 0\n", 1125 | "2022-01-21 1.131542 1.136105 1.130224 1.131375 1.131375 0\n", 1126 | "2022-01-24 1.134095 1.134095 1.129140 1.134147 1.134147 0\n", 1127 | "2022-01-25 1.132759 1.133273 1.130582 1.131222 1.131222 0\n", 1128 | "\n", 1129 | "[4708 rows x 6 columns]" 1130 | ] 1131 | }, 1132 | "metadata": {}, 1133 | "execution_count": 24 1134 | } 1135 | ] 1136 | }, 1137 | { 1138 | "cell_type": "code", 1139 | "source": [ 1140 | "def preprocessing_yf(symbol):\n", 1141 | " \n", 1142 | " #Import the data\n", 1143 | " df = yf.download(symbol)\n", 1144 | "\n", 1145 | " #Rename\n", 1146 | " df.columns = [\"open\", \"high\", \"low\", \"close\", \"adj close\", \"volume\"]\n", 1147 | " df.index.name = \"time\"\n", 1148 | "\n", 1149 | " # Remove adj close\n", 1150 | " del df[\"adj close\"]\n", 1151 | "\n", 1152 | " return df\n", 1153 | "\n", 1154 | "df = preprocessing_yf(\"EURUSD=X\")\n", 1155 | "df" 1156 | ], 1157 | "metadata": { 1158 | "colab": { 1159 | "base_uri": "https://localhost:8080/", 1160 | "height": 467 1161 | }, 1162 | "id": "CAfQp8Jc4D5M", 1163 | "outputId": "06e836c8-b275-4f42-cbd6-52218782a415" 1164 | }, 1165 | "execution_count": null, 1166 | "outputs": [ 1167 | { 1168 | "output_type": "stream", 1169 | "name": "stdout", 1170 | "text": [ 1171 | "\r[*********************100%***********************] 1 of 1 completed\n" 1172 | ] 1173 | }, 1174 | { 1175 | "output_type": "execute_result", 1176 | "data": { 1177 | "text/html": [ 1178 | "\n", 1179 | "
\n", 1180 | "
\n", 1181 | "
\n", 1182 | "\n", 1195 | "\n", 1196 | " \n", 1197 | " \n", 1198 | " \n", 1199 | " \n", 1200 | " \n", 1201 | " \n", 1202 | " \n", 1203 | " \n", 1204 | " \n", 1205 | " \n", 1206 | " \n", 1207 | " \n", 1208 | " \n", 1209 | " \n", 1210 | " \n", 1211 | " \n", 1212 | " \n", 1213 | " \n", 1214 | " \n", 1215 | " \n", 1216 | " \n", 1217 | " \n", 1218 | " \n", 1219 | " \n", 1220 | " \n", 1221 | " \n", 1222 | " \n", 1223 | " \n", 1224 | " \n", 1225 | " \n", 1226 | " \n", 1227 | " \n", 1228 | " \n", 1229 | " \n", 1230 | " \n", 1231 | " \n", 1232 | " \n", 1233 | " \n", 1234 | " \n", 1235 | " \n", 1236 | " \n", 1237 | " \n", 1238 | " \n", 1239 | " \n", 1240 | " \n", 1241 | " \n", 1242 | " \n", 1243 | " \n", 1244 | " \n", 1245 | " \n", 1246 | " \n", 1247 | " \n", 1248 | " \n", 1249 | " \n", 1250 | " \n", 1251 | " \n", 1252 | " \n", 1253 | " \n", 1254 | " \n", 1255 | " \n", 1256 | " \n", 1257 | " \n", 1258 | " \n", 1259 | " \n", 1260 | " \n", 1261 | " \n", 1262 | " \n", 1263 | " \n", 1264 | " \n", 1265 | " \n", 1266 | " \n", 1267 | " \n", 1268 | " \n", 1269 | " \n", 1270 | " \n", 1271 | " \n", 1272 | " \n", 1273 | " \n", 1274 | " \n", 1275 | " \n", 1276 | " \n", 1277 | " \n", 1278 | " \n", 1279 | " \n", 1280 | " \n", 1281 | " \n", 1282 | " \n", 1283 | " \n", 1284 | " \n", 1285 | " \n", 1286 | " \n", 1287 | " \n", 1288 | " \n", 1289 | " \n", 1290 | " \n", 1291 | " \n", 1292 | " \n", 1293 | " \n", 1294 | " \n", 1295 | " \n", 1296 | " \n", 1297 | " \n", 1298 | " \n", 1299 | " \n", 1300 | " \n", 1301 | " \n", 1302 | " \n", 1303 | " \n", 1304 | "
openhighlowclosevolume
time
2003-12-011.2033981.2040071.1944011.1965010
2003-12-021.1961011.2109031.1946001.2088970
2003-12-031.2090001.2130031.2077001.2122980
2003-12-041.2120041.2144031.2043981.2080940
2003-12-051.2078021.2190961.2065931.2186950
..................
2022-01-191.1330031.1356801.1319521.1329650
2022-01-201.1343531.1368931.1330161.1343400
2022-01-211.1315421.1361051.1302241.1313750
2022-01-241.1340951.1340951.1291401.1341470
2022-01-251.1327591.1332731.1305821.1313500
\n", 1305 | "

4708 rows × 5 columns

\n", 1306 | "
\n", 1307 | " \n", 1317 | " \n", 1318 | " \n", 1355 | "\n", 1356 | " \n", 1380 | "
\n", 1381 | "
\n", 1382 | " " 1383 | ], 1384 | "text/plain": [ 1385 | " open high low close volume\n", 1386 | "time \n", 1387 | "2003-12-01 1.203398 1.204007 1.194401 1.196501 0\n", 1388 | "2003-12-02 1.196101 1.210903 1.194600 1.208897 0\n", 1389 | "2003-12-03 1.209000 1.213003 1.207700 1.212298 0\n", 1390 | "2003-12-04 1.212004 1.214403 1.204398 1.208094 0\n", 1391 | "2003-12-05 1.207802 1.219096 1.206593 1.218695 0\n", 1392 | "... ... ... ... ... ...\n", 1393 | "2022-01-19 1.133003 1.135680 1.131952 1.132965 0\n", 1394 | "2022-01-20 1.134353 1.136893 1.133016 1.134340 0\n", 1395 | "2022-01-21 1.131542 1.136105 1.130224 1.131375 0\n", 1396 | "2022-01-24 1.134095 1.134095 1.129140 1.134147 0\n", 1397 | "2022-01-25 1.132759 1.133273 1.130582 1.131350 0\n", 1398 | "\n", 1399 | "[4708 rows x 5 columns]" 1400 | ] 1401 | }, 1402 | "metadata": {}, 1403 | "execution_count": 25 1404 | } 1405 | ] 1406 | }, 1407 | { 1408 | "cell_type": "code", 1409 | "source": [ 1410 | "" 1411 | ], 1412 | "metadata": { 1413 | "id": "vnBDvdnP1EfF" 1414 | }, 1415 | "execution_count": null, 1416 | "outputs": [] 1417 | } 1418 | ] 1419 | } -------------------------------------------------------------------------------- /Chapter_08_ANN_reg_app.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "id": "a16ad7d8", 7 | "metadata": {}, 8 | "outputs": [ 9 | { 10 | "name": "stdout", 11 | "output_type": "stream", 12 | "text": [ 13 | "------------------------------------------------------------------\n", 14 | "Date: 2022-02-17 08:20:54\n", 15 | "Balance: 8990.52 USD, \tEquity: 8990.52 USD, \tProfit: 0.0 USD\n", 16 | "------------------------------------------------------------------\n", 17 | "------------------------------------------------------------------\n", 18 | "Date: 2022-02-17 08:20:55\n", 19 | "SYMBOL: GBPCAD\n", 20 | "BUY: False \t SHORT: True\n", 21 | "POSITION: None \t ID: None\n", 22 | "OPEN SHORT TRADE: Request executed\n", 23 | "------------------------------------------------------------------\n" 24 | ] 25 | }, 26 | { 27 | "ename": "KeyboardInterrupt", 28 | "evalue": "", 29 | "output_type": "error", 30 | "traceback": [ 31 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 32 | "\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", 33 | "\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_4960/1491282133.py\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 153\u001b[0m \u001b[1;34mf\"Buy: {buy}\\t\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 154\u001b[0m f\"Sell: {sell}\")\n\u001b[1;32m--> 155\u001b[1;33m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", 34 | "\u001b[1;31mKeyboardInterrupt\u001b[0m: " 35 | ] 36 | } 37 | ], 38 | "source": [ 39 | "from MT5 import *\n", 40 | "import numpy as np\n", 41 | "import pandas as pd\n", 42 | "import warnings\n", 43 | "warnings.filterwarnings(\"ignore\")\n", 44 | "import time\n", 45 | "import pickle\n", 46 | "import ta\n", 47 | "from joblib import dump, load\n", 48 | "import os\n", 49 | "from sklearn.preprocessing import StandardScaler\n", 50 | "import tensorflow\n", 51 | "from tensorflow.keras.models import Sequential\n", 52 | "from tensorflow.keras.layers import Dense\n", 53 | "\n", 54 | "\n", 55 | "path = \"\" # Ex: C:/Desktop/Python_for_finance_and_algorithmic_trading/ChapterN/Models\n", 56 | "\n", 57 | "\n", 58 | "\n", 59 | "def feature_engineering(df):\n", 60 | " \"\"\" DON'T PUT THE SHIFT HERE\"\"\"\n", 61 | " \n", 62 | " # We copy the dataframe to avoid interferences in the data\n", 63 | " df_copy = df.copy()\n", 64 | " df_copy[[\"returns\"]] = df_copy[[\"close\"]].pct_change(1)\n", 65 | "\n", 66 | " # Create the SMAs\n", 67 | " df_copy[\"SMA 15\"] = df_copy[[\"close\"]].rolling(15).mean()\n", 68 | " df_copy[\"SMA 60\"] = df_copy[[\"close\"]].rolling(60).mean()\n", 69 | " \n", 70 | " # Create the volatilities\n", 71 | " df_copy[\"MSD 10\"] = df_copy[[\"returns\"]].rolling(10).std()\n", 72 | " df_copy[\"MSD 30\"] = df_copy[[\"returns\"]].rolling(30).std()\n", 73 | " \n", 74 | " # Create the Rsi\n", 75 | " RSI = ta.momentum.RSIIndicator(df_copy[\"close\"], window= 14, fillna = False)\n", 76 | " df_copy[\"rsi\"] = RSI.rsi()\n", 77 | " \n", 78 | " # STANDARDIZATION\n", 79 | "\n", 80 | " sc = StandardScaler()\n", 81 | " df_copy = df_copy[[\"SMA 15\", \"SMA 60\", \"MSD 10\", \"MSD 30\", \"rsi\"]].dropna()\n", 82 | " df_copy_sc = sc.fit_transform(df_copy)\n", 83 | "\n", 84 | " return df_copy_sc\n", 85 | "\n", 86 | "\n", 87 | "def ANN_weights():\n", 88 | " nb_hidden_layer=2\n", 89 | " # INTIALIZATION SEQUENTIAL MODEL\n", 90 | " regressor = Sequential()\n", 91 | "\n", 92 | " # FIRST LAYER\n", 93 | " regressor.add(Dense(25, input_shape=(5,), activation=\"relu\"))\n", 94 | "\n", 95 | " # ADD HIDDEN LAYER\n", 96 | " for i in range(1,nb_hidden_layer):\n", 97 | " regressor.add(Dense(int(25/i), activation=\"relu\"))\n", 98 | "\n", 99 | " # OUTPUT LAYER DENSE\n", 100 | " regressor.add(Dense(1, activation=\"linear\"))\n", 101 | "\n", 102 | " # COMPILE THE MODEL\n", 103 | " regressor.compile(loss=\"mse\", optimizer=\"adam\")\n", 104 | "\n", 105 | " return regressor\n", 106 | "\n", 107 | " \n", 108 | " \n", 109 | "def ANN_reg_sig(symbol):\n", 110 | " \"\"\" Function for predict the value of tommorow using DNN model\"\"\"\n", 111 | " \n", 112 | " # Create the weights if there is not in the folder\n", 113 | " ann_1 = ANN_weights()\n", 114 | " ann_2 = ANN_weights()\n", 115 | " ann_3 = ANN_weights()\n", 116 | "\n", 117 | " # Import trained weights\n", 118 | " ann_1.load_weights(f\"ANN_weights/ANN n17\")\n", 119 | " ann_2.load_weights(f\"ANN_weights/ANN n38\")\n", 120 | " ann_3.load_weights(f\"ANN_weights/ANN n66\")\n", 121 | " \n", 122 | " # Take the lastest percentage of change \n", 123 | " df = MT5.get_data(symbol, 70)\n", 124 | " \n", 125 | " # Features engeeniring\n", 126 | " data = feature_engineering(df)\n", 127 | "\n", 128 | " X = data[-1:,:]\n", 129 | " \n", 130 | " # Bagging\n", 131 | " pr1 = np.sign(ann_1.predict(X))\n", 132 | " pr2 = np.sign(ann_2.predict(X))\n", 133 | " pr3 = np.sign(ann_3.predict(X))\n", 134 | " \n", 135 | " # Find the signal\n", 136 | " buy = (pr1 + pr2 + pr3)[0][0] >=1\n", 137 | " sell = not buy\n", 138 | " \n", 139 | " \n", 140 | " return buy, sell\n", 141 | "\n", 142 | "\n", 143 | "\n", 144 | "# True = Live Trading and False = Screener\n", 145 | "live = True\n", 146 | "\n", 147 | "if live:\n", 148 | " current_account_info = mt5.account_info()\n", 149 | " print(\"------------------------------------------------------------------\")\n", 150 | " print(\"Date: \", datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\"))\n", 151 | " print(f\"Balance: {current_account_info.balance} USD, \\t\"\n", 152 | " f\"Equity: {current_account_info.equity} USD, \\t\"\n", 153 | " f\"Profit: {current_account_info.profit} USD\")\n", 154 | " print(\"------------------------------------------------------------------\")\n", 155 | "\n", 156 | "\n", 157 | "\n", 158 | "info_order = {\n", 159 | " \"CADGBP\": [\"GBPCAD\", 1.00]\n", 160 | "}\n", 161 | "\n", 162 | "\n", 163 | "start = datetime.now().strftime(\"%H:%M:%S\")\n", 164 | "while True:\n", 165 | " # Verfication for launch\n", 166 | " if datetime.now().weekday() not in (5,1):\n", 167 | " is_time = datetime.now().strftime(\"%H:%M:%S\") == start #\"23:59:59\"\n", 168 | " else:\n", 169 | " is_time = False\n", 170 | "\n", 171 | " \n", 172 | " # Launch the algorithm\n", 173 | " if is_time:\n", 174 | "\n", 175 | " # Open the trades\n", 176 | " for asset in info_order.keys():\n", 177 | "\n", 178 | " # Initialize the inputs\n", 179 | " symbol = info_order[asset][0]\n", 180 | " lot = info_order[asset][1]\n", 181 | "\n", 182 | " # Create the signals\n", 183 | " buy, sell = ANN_reg_sig(symbol)\n", 184 | "\n", 185 | " # Run the algorithm\n", 186 | " if live:\n", 187 | " MT5.run(symbol, buy, sell,lot)\n", 188 | "\n", 189 | " else:\n", 190 | " print(f\"Symbol: {symbol}\\t\"\n", 191 | " f\"Buy: {buy}\\t\"\n", 192 | " f\"Sell: {sell}\")\n", 193 | " time.sleep(1)" 194 | ] 195 | }, 196 | { 197 | "cell_type": "code", 198 | "execution_count": null, 199 | "id": "3a4f5ea8", 200 | "metadata": {}, 201 | "outputs": [], 202 | "source": [] 203 | }, 204 | { 205 | "cell_type": "code", 206 | "execution_count": null, 207 | "id": "07b14047", 208 | "metadata": {}, 209 | "outputs": [], 210 | "source": [] 211 | } 212 | ], 213 | "metadata": { 214 | "kernelspec": { 215 | "display_name": "Python 3", 216 | "language": "python", 217 | "name": "python3" 218 | }, 219 | "language_info": { 220 | "codemirror_mode": { 221 | "name": "ipython", 222 | "version": 3 223 | }, 224 | "file_extension": ".py", 225 | "mimetype": "text/x-python", 226 | "name": "python", 227 | "nbconvert_exporter": "python", 228 | "pygments_lexer": "ipython3", 229 | "version": "3.8.8" 230 | } 231 | }, 232 | "nbformat": 4, 233 | "nbformat_minor": 5 234 | } 235 | -------------------------------------------------------------------------------- /Chapter_08_RNN_cl_app.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 20, 6 | "id": "a16ad7d8", 7 | "metadata": {}, 8 | "outputs": [ 9 | { 10 | "name": "stdout", 11 | "output_type": "stream", 12 | "text": [ 13 | "------------------------------------------------------------------\n", 14 | "Date: 2022-02-17 08:55:23\n", 15 | "Balance: 8990.52 USD, \tEquity: 9027.21 USD, \tProfit: 36.69 USD\n", 16 | "------------------------------------------------------------------\n", 17 | "Warnings\n", 18 | "(1, 15, 5)\n", 19 | "WARNING:tensorflow:Detecting that an object or model or tf.train.Checkpoint is being deleted with unrestored values. See the following logs for the specific values in question. To silence these warnings, use `status.expect_partial()`. See https://www.tensorflow.org/api_docs/python/tf/train/Checkpoint#restorefor details about the status object returned by the restore function.\n", 20 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.iter\n", 21 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.beta_1\n", 22 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.beta_2\n", 23 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.decay\n", 24 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.learning_rate\n", 25 | "WARNING:tensorflow:Detecting that an object or model or tf.train.Checkpoint is being deleted with unrestored values. See the following logs for the specific values in question. To silence these warnings, use `status.expect_partial()`. See https://www.tensorflow.org/api_docs/python/tf/train/Checkpoint#restorefor details about the status object returned by the restore function.\n", 26 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.iter\n", 27 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.beta_1\n", 28 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.beta_2\n", 29 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.decay\n", 30 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.learning_rate\n", 31 | "WARNING:tensorflow:Detecting that an object or model or tf.train.Checkpoint is being deleted with unrestored values. See the following logs for the specific values in question. To silence these warnings, use `status.expect_partial()`. See https://www.tensorflow.org/api_docs/python/tf/train/Checkpoint#restorefor details about the status object returned by the restore function.\n", 32 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.iter\n", 33 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.beta_1\n", 34 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.beta_2\n", 35 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.decay\n", 36 | "WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer.learning_rate\n", 37 | "------------------------------------------------------------------\n", 38 | "Date: 2022-02-17 08:55:28\n", 39 | "SYMBOL: EURUSD\n", 40 | "BUY: True \t SHORT: False\n", 41 | "POSITION: None \t ID: None\n", 42 | "OPEN LONG TRADE: Request executed\n", 43 | "------------------------------------------------------------------\n" 44 | ] 45 | }, 46 | { 47 | "ename": "KeyboardInterrupt", 48 | "evalue": "", 49 | "output_type": "error", 50 | "traceback": [ 51 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 52 | "\u001b[1;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", 53 | "\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_8548/2055564425.py\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 180\u001b[0m \u001b[1;34mf\"Buy: {buy}\\t\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 181\u001b[0m f\"Sell: {sell}\")\n\u001b[1;32m--> 182\u001b[1;33m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", 54 | "\u001b[1;31mKeyboardInterrupt\u001b[0m: " 55 | ] 56 | } 57 | ], 58 | "source": [ 59 | "from MT5 import *\n", 60 | "import numpy as np\n", 61 | "import pandas as pd\n", 62 | "import warnings\n", 63 | "warnings.filterwarnings(\"ignore\")\n", 64 | "import time\n", 65 | "import pickle\n", 66 | "import ta\n", 67 | "from joblib import dump, load\n", 68 | "import os\n", 69 | "from sklearn.preprocessing import StandardScaler\n", 70 | "import tensorflow\n", 71 | "from tensorflow.keras.models import Sequential\n", 72 | "from tensorflow.keras.layers import Dense, LSTM, Dropout\n", 73 | "\n", 74 | "\n", 75 | "path = \"\" # Ex: C:/Desktop/Python_for_finance_and_algorithmic_trading/ChapterN/Models\n", 76 | "\n", 77 | "\n", 78 | "\n", 79 | "def feature_engineering(df):\n", 80 | " \"\"\" DON'T PUT THE SHIFT HERE\"\"\"\n", 81 | " \n", 82 | " # We copy the dataframe to avoid interferences in the data\n", 83 | " df_copy = df.copy()\n", 84 | " df_copy[[\"returns\"]] = df_copy[[\"close\"]].pct_change(1)\n", 85 | "\n", 86 | " # Create the SMAs\n", 87 | " df_copy[\"SMA 15\"] = df_copy[[\"close\"]].rolling(15).mean()\n", 88 | " df_copy[\"SMA 60\"] = df_copy[[\"close\"]].rolling(60).mean()\n", 89 | " \n", 90 | " # Create the volatilities\n", 91 | " df_copy[\"MSD 10\"] = df_copy[[\"returns\"]].rolling(10).std()\n", 92 | " df_copy[\"MSD 30\"] = df_copy[[\"returns\"]].rolling(30).std()\n", 93 | " \n", 94 | " # Create the Rsi\n", 95 | " RSI = ta.momentum.RSIIndicator(df_copy[\"close\"], window= 14, fillna = False)\n", 96 | " df_copy[\"rsi\"] = RSI.rsi()\n", 97 | " \n", 98 | " # STANDARDIZATION\n", 99 | "\n", 100 | " sc = StandardScaler()\n", 101 | " df_copy = df_copy[[\"SMA 15\", \"SMA 60\", \"MSD 10\", \"MSD 30\", \"rsi\"]].dropna()\n", 102 | " df_copy_sc = sc.fit_transform(df_copy)\n", 103 | "\n", 104 | " return df_copy_sc\n", 105 | "\n", 106 | "def X_3d_RNN(X_s, y_s, lag):\n", 107 | "\n", 108 | " # Simple verification\n", 109 | " if len(X_s) != len(y_s):\n", 110 | " print(\"Warnings\")\n", 111 | "\n", 112 | " # Create the X_train\n", 113 | " X_train = []\n", 114 | " for variable in range(0, X_s.shape[1]):\n", 115 | " X = []\n", 116 | " for i in range(lag, X_s.shape[0]):\n", 117 | " X.append(X_s[i-lag:i, variable])\n", 118 | " X_train.append(X)\n", 119 | " X_train, np.array(X_train)\n", 120 | " X_train = np.swapaxes(np.swapaxes(X_train, 0, 1), 1, 2)\n", 121 | "\n", 122 | " # Create the y_train\n", 123 | " y_train = []\n", 124 | " for i in range(lag, y_s.shape[0]):\n", 125 | " y_train.append(y_s[i, :].reshape(-1,1).transpose())\n", 126 | " y_train = np.concatenate(y_train, axis=0)\n", 127 | " return X_train, y_train\n", 128 | "\n", 129 | " \n", 130 | "def RNN_weights():\n", 131 | " # INITIALIZATION OF THE MODEL\n", 132 | " classifier = Sequential()\n", 133 | "\n", 134 | " # ADD LSTM LAYER\n", 135 | " classifier.add(LSTM(units = 10, return_sequences = True,\n", 136 | " input_shape = (15,5,)))\n", 137 | "\n", 138 | "\n", 139 | " # LOOP WHICH ADD LSTM LAYER\n", 140 | " for _ in range(1):\n", 141 | " classifier.add(LSTM(units = 10, return_sequences = True))\n", 142 | " classifier.add(Dropout(0.50))\n", 143 | "\n", 144 | " # LAST LSTM LAYER BUT WITH return_sequences = False \n", 145 | " classifier.add(LSTM(units = 10, return_sequences = False))\n", 146 | "\n", 147 | "\n", 148 | " # OUTPUT DENSE LAYER\n", 149 | " classifier.add(Dense(1, activation=\"sigmoid\"))\n", 150 | "\n", 151 | " # COMPILE THE MODEL\n", 152 | " classifier.compile(loss=\"binary_crossentropy\", optimizer=\"adam\")\n", 153 | "\n", 154 | " return classifier\n", 155 | "\n", 156 | "def RNN_cl_sig(symbol):\n", 157 | " \"\"\" Function for predict the value of tommorow using DNN model\"\"\"\n", 158 | " \n", 159 | " # Create the weights if there is not in the folder\n", 160 | " rnn_1 = RNN_weights()\n", 161 | " rnn_2 = RNN_weights()\n", 162 | " rnn_3 = RNN_weights()\n", 163 | "\n", 164 | " # Import trained weights\n", 165 | " rnn_1.load_weights(f\"RNN_weights/RNN n3\")\n", 166 | " rnn_2.load_weights(f\"RNN_weights/RNN n34\")\n", 167 | " rnn_3.load_weights(f\"RNN_weights/RNN n31\")\n", 168 | " \n", 169 | " # Take the lastest percentage of change \n", 170 | " df = MT5.get_data(symbol, 700)\n", 171 | " \n", 172 | " # Features engeeniring\n", 173 | " data = feature_engineering(df)\n", 174 | " X_data, _ = X_3d_RNN(data, np.zeros([700,1]),15)\n", 175 | " X = X_data[-1:,:,:]\n", 176 | " print(np.shape(X))\n", 177 | " # Bagging\n", 178 | " pr1 = np.where(rnn_1.predict(X)==0, -1,1)\n", 179 | " pr2 = np.where(rnn_2.predict(X)==0, -1,1)\n", 180 | " pr3 = np.where(rnn_3.predict(X)==0, -1,1)\n", 181 | " \n", 182 | " # Find the signal\n", 183 | " buy = (pr1 + pr2 + pr3)[0][0] >=1\n", 184 | " sell = not buy\n", 185 | " \n", 186 | " \n", 187 | " return buy, sell\n", 188 | "\n", 189 | "\n", 190 | "\n", 191 | "# True = Live Trading and False = Screener\n", 192 | "live = True\n", 193 | "\n", 194 | "if live:\n", 195 | " current_account_info = mt5.account_info()\n", 196 | " print(\"------------------------------------------------------------------\")\n", 197 | " print(\"Date: \", datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\"))\n", 198 | " print(f\"Balance: {current_account_info.balance} USD, \\t\"\n", 199 | " f\"Equity: {current_account_info.equity} USD, \\t\"\n", 200 | " f\"Profit: {current_account_info.profit} USD\")\n", 201 | " print(\"------------------------------------------------------------------\")\n", 202 | "\n", 203 | "\n", 204 | "\n", 205 | "info_order = {\n", 206 | " \"Bitcoin\": [\"BTCUSD\", 1.00]\n", 207 | "}\n", 208 | "\n", 209 | "\n", 210 | "start = datetime.now().strftime(\"%H:%M:%S\")\n", 211 | "while True:\n", 212 | " # Verfication for launch\n", 213 | " if datetime.now().weekday() not in (5,6):\n", 214 | " is_time = datetime.now().strftime(\"%H:%M:%S\") == start #\"23:59:59\"\n", 215 | " else:\n", 216 | " is_time = False\n", 217 | "\n", 218 | " \n", 219 | " # Launch the algorithm\n", 220 | " if is_time:\n", 221 | "\n", 222 | " # Open the trades\n", 223 | " for asset in info_order.keys():\n", 224 | "\n", 225 | " # Initialize the inputs\n", 226 | " symbol = info_order[asset][0]\n", 227 | " lot = info_order[asset][1]\n", 228 | "\n", 229 | " # Create the signals\n", 230 | " buy, sell = RNN_cl_sig(symbol)\n", 231 | "\n", 232 | " # Run the algorithm\n", 233 | " if live:\n", 234 | " MT5.run(symbol, buy, sell,lot)\n", 235 | "\n", 236 | " else:\n", 237 | " print(f\"Symbol: {symbol}\\t\"\n", 238 | " f\"Buy: {buy}\\t\"\n", 239 | " f\"Sell: {sell}\")\n", 240 | " time.sleep(1)" 241 | ] 242 | }, 243 | { 244 | "cell_type": "code", 245 | "execution_count": null, 246 | "id": "3a4f5ea8", 247 | "metadata": {}, 248 | "outputs": [], 249 | "source": [] 250 | }, 251 | { 252 | "cell_type": "code", 253 | "execution_count": null, 254 | "id": "07b14047", 255 | "metadata": {}, 256 | "outputs": [], 257 | "source": [] 258 | } 259 | ], 260 | "metadata": { 261 | "kernelspec": { 262 | "display_name": "Python 3", 263 | "language": "python", 264 | "name": "python3" 265 | }, 266 | "language_info": { 267 | "codemirror_mode": { 268 | "name": "ipython", 269 | "version": 3 270 | }, 271 | "file_extension": ".py", 272 | "mimetype": "text/x-python", 273 | "name": "python", 274 | "nbconvert_exporter": "python", 275 | "pygments_lexer": "ipython3", 276 | "version": "3.8.8" 277 | } 278 | }, 279 | "nbformat": 4, 280 | "nbformat_minor": 5 281 | } 282 | -------------------------------------------------------------------------------- /Extract_Chapter_11.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/Extract_Chapter_11.pdf -------------------------------------------------------------------------------- /Extract_Chapter_12.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/Extract_Chapter_12.pdf -------------------------------------------------------------------------------- /FOREX + CRYPTO/XMRUSD_D1.csv: -------------------------------------------------------------------------------- 1 | 2 | 2017.05.15 28.553 29.038 27.631 27.925 79542 0 0 3 | 2017.05.16 27.925 28.615 26.764 27.099 58226 0 0 4 | 2017.05.17 27.099 28.546 22.426 28.352 85125 0 0 5 | 2017.05.18 28.353 31.686 27.117 31.170 74081 0 0 6 | 2017.05.19 31.171 32.125 30.730 31.422 69658 0 0 7 | 2017.05.22 33.795 40.768 32.927 37.690 76677 0 0 8 | 2017.05.23 37.136 49.407 34.450 47.971 81038 0 0 9 | 2017.05.24 47.971 57.425 46.774 50.426 96559 0 0 10 | 2017.05.25 50.426 54.155 39.991 43.481 74534 0 0 11 | 2017.05.26 43.481 44.211 34.375 35.967 98821 0 0 12 | 2017.05.29 33.395 42.906 33.382 40.549 84204 0 0 13 | 2017.05.30 40.549 44.726 38.628 42.127 93806 0 0 14 | 2017.05.31 42.127 42.197 36.963 40.435 66423 0 0 15 | 2017.06.01 40.426 44.319 39.937 42.748 48483 0 0 16 | 2017.06.02 42.749 43.065 40.961 41.983 62083 0 0 17 | 2017.06.05 41.397 45.725 41.139 45.499 64791 0 0 18 | 2017.06.06 45.504 52.025 44.786 50.109 66285 0 0 19 | 2017.06.07 50.109 61.325 49.875 54.403 62715 0 0 20 | 2017.06.08 54.405 55.644 50.232 55.089 68621 0 0 21 | 2017.06.09 55.089 56.914 54.256 56.133 64956 0 0 22 | 2017.06.10 56.133 56.133 51.925 51.926 64302 0 0 23 | 2017.06.11 51.926 56.926 50.435 55.161 51567 0 0 24 | 2017.06.12 55.164 59.195 29.901 48.202 61153 0 0 25 | 2017.06.13 48.206 52.425 47.511 51.574 63398 0 0 26 | 2017.06.14 51.574 52.110 45.119 46.959 61859 0 0 27 | 2017.06.15 46.959 46.961 37.125 43.917 71271 0 0 28 | 2017.06.16 43.917 47.423 42.647 46.541 48420 0 0 29 | 2017.06.17 46.542 51.925 45.944 51.655 58744 0 0 30 | 2017.06.18 51.656 53.386 47.111 47.726 63998 0 0 31 | 2017.06.19 47.726 50.999 47.726 49.922 60369 0 0 32 | 2017.06.20 49.922 53.115 49.398 51.239 53107 0 0 33 | 2017.06.21 51.239 52.236 48.356 48.740 70918 0 0 34 | 2017.06.22 48.741 49.950 45.938 48.851 72173 0 0 35 | 2017.06.23 48.851 51.597 48.847 51.250 57603 0 0 36 | 2017.06.24 51.250 51.300 45.405 46.625 57756 0 0 37 | 2017.06.25 46.625 47.485 44.220 44.220 53375 0 0 38 | 2017.06.26 44.220 46.391 37.856 39.239 68364 0 0 39 | 2017.06.27 39.239 43.496 36.404 41.437 67760 0 0 40 | 2017.06.28 41.442 45.497 40.687 45.403 61212 0 0 41 | 2017.06.29 45.404 46.786 42.642 43.998 41052 0 0 42 | 2017.06.30 43.998 44.780 42.864 43.200 679 0 0 43 | 2017.07.01 43.210 43.500 38.100 38.157 1152 0 0 44 | 2017.07.02 38.157 41.800 38.100 40.926 1097 0 0 45 | 2017.07.03 40.926 43.386 40.332 42.738 1036 0 0 46 | 2017.07.04 42.740 45.006 42.559 43.440 1440 0 0 47 | 2017.07.05 43.440 46.100 43.440 44.680 1113 0 0 48 | 2017.07.06 45.005 49.102 44.600 48.759 1285 0 0 49 | 2017.07.07 48.759 50.080 43.150 44.200 1426 0 0 50 | 2017.07.08 44.200 44.840 39.400 43.944 1342 0 0 51 | 2017.07.09 44.400 46.323 43.217 45.212 1180 0 0 52 | 2017.07.10 45.256 45.403 39.600 40.112 1102 0 0 53 | 2017.07.11 40.339 40.339 33.700 35.855 1559 0 0 54 | 2017.07.12 36.100 40.089 33.900 39.287 1457 0 0 55 | 2017.07.13 39.430 40.001 36.176 37.128 1827 0 0 56 | 2017.07.14 36.918 37.709 33.700 33.857 1298 0 0 57 | 2017.07.15 33.717 35.218 30.716 31.772 1596 0 0 58 | 2017.07.16 31.772 32.300 28.218 28.300 1322 0 0 59 | 2017.07.17 28.300 34.380 28.300 34.100 1954 0 0 60 | 2017.07.18 34.001 37.240 32.600 36.090 1761 0 0 61 | 2017.07.19 36.017 37.100 33.600 34.153 1536 0 0 62 | 2017.07.20 34.153 40.570 33.600 39.322 2160 0 0 63 | 2017.07.21 39.417 41.300 38.246 39.170 2074 0 0 64 | 2017.07.22 39.321 43.700 38.850 43.670 1591 0 0 65 | 2017.07.23 43.673 44.700 40.640 42.610 1599 0 0 66 | 2017.07.24 42.700 45.300 41.100 45.010 2071 0 0 67 | 2017.07.25 45.010 45.600 37.600 37.720 2191 0 0 68 | 2017.07.26 37.720 46.250 37.720 44.965 2394 0 0 69 | 2017.07.27 44.965 46.100 42.966 43.591 2805 0 0 70 | 2017.07.28 43.591 45.500 42.734 43.693 3775 0 0 71 | 2017.07.29 43.708 44.100 41.700 43.873 3704 0 0 72 | 2017.07.30 43.873 43.873 39.870 40.435 2497 0 0 73 | 2017.07.31 40.357 40.479 38.444 39.970 2213 0 0 74 | 2017.08.01 40.008 44.935 39.100 43.750 2853 0 0 75 | 2017.08.02 43.786 44.250 42.103 42.986 2251 0 0 76 | 2017.08.03 42.986 43.898 42.610 43.551 48895 0 0 77 | 2017.08.04 43.554 44.600 42.610 44.112 36016 0 0 78 | 2017.08.05 44.112 49.540 43.800 48.136 36567 0 0 79 | 2017.08.06 48.136 48.818 46.800 47.466 45813 0 0 80 | 2017.08.07 47.466 48.695 46.701 48.289 36722 0 0 81 | 2017.08.08 48.289 52.400 48.100 51.182 44711 0 0 82 | 2017.08.09 51.183 52.999 48.203 50.724 50132 0 0 83 | 2017.08.10 50.736 50.789 48.338 49.437 54643 0 0 84 | 2017.08.11 49.437 50.277 48.101 50.262 42128 0 0 85 | 2017.08.12 50.264 51.100 45.112 47.763 52342 0 0 86 | 2017.08.13 47.765 49.694 44.601 46.412 49697 0 0 87 | 2017.08.14 46.414 49.131 45.600 48.532 65173 0 0 88 | 2017.08.15 48.532 49.861 44.600 47.085 91785 0 0 89 | 2017.08.16 47.087 48.679 46.596 48.583 100562 0 0 90 | 2017.08.17 48.584 49.055 46.611 47.211 69358 0 0 91 | 2017.08.18 47.211 48.318 45.900 46.721 3283 0 0 92 | 2017.08.19 46.721 56.600 44.700 56.463 5628 0 0 93 | 2017.08.20 56.750 58.022 51.500 54.852 3346 0 0 94 | 2017.08.21 54.451 98.500 52.016 71.100 6563 0 0 95 | 2017.08.22 71.350 95.902 71.100 84.600 6859 0 0 96 | 2017.08.23 84.600 99.600 84.600 86.600 4715 0 0 97 | 2017.08.24 86.700 93.190 78.700 85.515 4393 0 0 98 | 2017.08.25 85.515 101.382 82.922 97.317 4325 0 0 99 | 2017.08.26 97.317 147.600 96.500 136.965 9046 0 0 100 | 2017.08.27 136.700 141.000 122.847 128.600 5092 0 0 101 | 2017.08.28 128.514 152.871 127.600 135.900 6196 0 0 102 | 2017.08.29 135.600 143.600 127.447 129.700 4267 0 0 103 | 2017.08.30 129.800 134.200 120.920 130.160 4017 0 0 104 | 2017.08.31 130.160 141.777 129.100 140.477 5819 0 0 105 | 2017.09.01 140.476 149.250 134.941 145.087 23922 0 0 106 | 2017.09.02 145.094 146.324 117.638 120.691 30232 0 0 107 | 2017.09.03 120.691 128.377 109.673 120.687 30260 0 0 108 | 2017.09.04 120.690 126.246 97.481 107.800 23316 0 0 109 | 2017.09.05 107.809 118.997 92.574 116.484 12508 0 0 110 | 2017.09.06 116.484 124.045 113.400 120.032 10753 0 0 111 | 2017.09.07 120.032 123.573 115.508 118.454 11091 0 0 112 | 2017.09.08 118.457 134.601 104.862 111.193 14552 0 0 113 | 2017.09.11 112.409 115.515 107.985 110.846 11016 0 809 114 | 2017.09.12 110.964 115.452 107.472 111.766 8100 0 0 115 | 2017.09.13 111.766 113.863 100.241 108.402 13703 0 817 116 | 2017.09.14 108.405 118.998 88.741 92.988 18070 0 802 117 | 2017.09.15 92.989 101.386 70.838 101.155 17204 0 802 118 | 2017.09.18 94.667 102.681 93.131 99.695 7802 0 801 119 | 2017.09.19 99.695 102.181 92.812 95.311 7365 0 811 120 | 2017.09.20 95.311 99.261 91.923 96.199 7862 0 829 121 | 2017.09.21 96.275 96.387 83.729 85.505 8414 0 818 122 | 2017.09.22 85.625 89.585 83.289 85.695 8393 0 806 123 | 2017.09.25 89.254 94.116 88.470 93.316 9582 0 824 124 | 2017.09.26 93.315 94.997 91.245 93.822 7541 0 801 125 | 2017.09.27 93.824 101.694 92.621 101.694 8022 0 801 126 | 2017.09.28 101.694 104.020 96.336 97.245 8722 0 804 127 | 2017.09.29 97.245 98.458 89.394 95.604 8343 0 804 128 | 2017.10.02 93.135 93.703 90.403 91.622 6722 0 844 129 | 2017.10.03 91.622 94.038 86.564 93.648 8716 0 849 130 | 2017.10.04 93.648 94.222 87.636 89.838 9362 0 822 131 | 2017.10.05 89.838 91.403 86.849 90.014 11336 0 834 132 | 2017.10.06 90.014 92.245 89.791 90.035 8731 0 815 133 | 2017.10.09 89.697 90.402 82.959 86.514 7560 0 802 134 | 2017.10.10 86.517 87.769 83.607 86.729 9531 0 809 135 | 2017.10.11 86.730 87.986 85.158 87.309 6668 0 851 136 | 2017.10.12 87.309 88.679 86.181 86.343 6001 0 851 137 | 2017.10.13 86.343 96.298 84.718 94.602 11079 0 814 138 | 2017.10.16 91.999 97.976 91.433 94.086 8670 0 814 139 | 2017.10.17 94.086 96.576 90.734 90.734 8429 0 804 140 | 2017.10.18 90.734 91.108 85.042 87.512 9881 0 831 141 | 2017.10.19 87.512 91.853 87.011 90.600 10315 0 814 142 | 2017.10.20 90.600 92.043 87.363 89.096 7013 0 832 143 | 2017.10.23 84.666 86.242 81.332 85.507 7986 0 924 144 | 2017.10.24 85.288 91.528 81.543 88.540 10831 0 833 145 | 2017.10.25 88.541 95.885 84.458 88.696 11531 0 807 146 | 2017.10.26 88.618 88.948 86.469 87.532 6315 0 828 147 | 2017.10.27 87.532 88.135 85.673 85.696 5402 0 840 148 | 2017.10.30 88.540 90.325 87.406 88.034 5397 0 848 149 | 2017.10.31 88.034 88.677 86.813 87.518 8201 0 896 150 | 2017.11.01 87.518 88.005 84.194 84.615 6578 0 817 151 | 2017.11.02 84.615 85.231 79.098 83.524 10834 0 827 152 | 2017.11.03 83.524 89.017 81.450 86.722 11649 0 803 153 | 2017.11.06 86.028 100.947 85.265 96.100 10954 0 801 154 | 2017.11.07 96.100 103.695 92.595 98.689 12378 0 801 155 | 2017.11.08 98.689 109.445 97.682 106.949 10776 0 809 156 | 2017.11.09 106.548 122.334 106.484 115.749 10336 0 801 157 | 2017.11.10 115.116 119.996 98.980 104.026 11456 0 802 158 | 2017.11.13 120.015 133.566 114.375 118.406 16833 0 806 159 | 2017.11.14 118.403 122.136 115.756 120.593 10462 0 801 160 | 2017.11.15 120.615 122.866 117.130 119.064 9613 0 810 161 | 2017.11.16 118.820 127.246 117.848 119.170 10527 0 821 162 | 2017.11.17 119.170 125.014 117.498 124.175 12669 0 829 163 | 2017.11.20 127.760 141.245 127.628 139.472 8450 0 821 164 | 2017.11.21 139.474 142.372 130.685 139.570 9445 0 801 165 | 2017.11.22 139.572 169.560 137.884 169.547 11986 0 808 166 | 2017.11.23 169.603 173.100 153.112 163.866 11700 0 801 167 | 2017.11.24 163.865 163.874 154.184 160.947 7698 0 801 168 | 2017.11.27 160.637 166.650 156.220 165.769 9533 0 802 169 | 2017.11.28 166.124 194.439 165.119 188.225 13927 0 802 170 | 2017.11.29 187.980 207.715 151.249 175.257 17417 0 801 171 | 2017.11.30 175.259 188.959 150.432 168.737 19680 0 877 172 | 2017.12.01 168.737 186.854 164.792 186.100 10786 0 802 173 | 2017.12.04 190.763 202.990 184.178 202.901 11943 0 854 174 | 2017.12.05 202.901 243.946 199.947 243.207 13692 0 801 175 | 2017.12.06 243.207 288.307 239.593 257.892 27489 0 802 176 | 2017.12.07 257.892 275.669 227.848 248.390 22962 0 824 177 | 2017.12.08 248.851 266.585 229.185 256.338 35367 0 801 178 | 2017.12.11 232.292 273.094 229.398 267.947 18173 0 844 179 | 2017.12.12 267.939 303.150 264.016 287.696 23591 0 808 180 | 2017.12.13 287.696 316.494 271.434 293.930 24920 0 806 181 | 2017.12.14 293.934 320.287 292.781 308.415 23592 0 801 182 | 2017.12.15 308.415 318.187 289.300 306.749 20442 0 4817 183 | 2017.12.18 344.105 361.668 317.765 357.693 18677 0 4832 184 | 2017.12.19 357.692 388.627 323.494 326.035 23589 0 5639 185 | 2017.12.20 326.035 470.338 312.441 444.869 37369 0 5601 186 | 2017.12.21 444.870 469.869 361.408 395.627 29692 0 14165 187 | 2017.12.22 395.591 407.441 234.662 325.008 35219 0 14001 188 | 2017.12.25 298.189 341.434 296.704 322.210 23016 0 12002 189 | 2017.12.26 322.211 353.577 315.783 344.000 20499 0 12059 190 | 2017.12.27 344.000 400.925 335.739 357.470 21300 0 12177 191 | 2017.12.28 357.470 370.313 316.423 336.688 24241 0 12033 192 | 2017.12.29 336.688 361.073 327.934 334.877 20148 0 12005 193 | 2018.01.01 325.648 333.713 308.606 332.188 19230 0 12131 194 | 2018.01.02 332.188 361.762 327.976 354.401 17655 0 12004 195 | 2018.01.03 354.393 378.205 351.636 375.757 18202 0 12001 196 | 2018.01.04 378.202 382.362 346.608 360.194 20048 0 12049 197 | 2018.01.05 360.194 368.525 333.239 353.661 23297 0 12101 198 | 2018.01.08 386.182 396.672 332.321 393.471 27221 0 12057 199 | 2018.01.09 393.471 440.674 380.953 415.640 25137 0 12045 200 | 2018.01.10 415.641 415.642 354.502 389.913 23964 0 12247 201 | 2018.01.11 389.913 405.163 328.504 352.135 25193 0 12152 202 | 2018.01.12 352.135 377.501 332.004 364.842 22187 0 12243 203 | 2018.01.15 377.723 429.520 375.657 416.656 23923 0 12072 204 | 2018.01.16 416.656 422.096 272.941 276.240 28360 0 12057 205 | 2018.01.17 276.246 318.661 227.197 309.765 38881 0 12001 206 | 2018.01.18 309.765 334.624 289.582 314.259 28768 0 12005 207 | 2018.01.19 314.259 344.016 294.013 337.081 27236 0 12007 208 | 2018.01.22 330.395 348.221 277.582 286.611 26360 0 12321 209 | 2018.01.23 286.611 313.983 278.001 303.000 26243 0 12010 210 | 2018.01.24 303.000 318.854 290.017 309.566 24397 0 12111 211 | 2018.01.25 309.567 320.931 298.578 308.085 21041 0 12115 212 | 2018.01.26 308.084 321.704 282.087 303.515 25556 0 12184 213 | 2018.01.29 325.007 331.386 307.449 308.990 19615 0 12312 214 | 2018.01.30 308.990 309.538 261.675 267.477 18783 0 12283 215 | 2018.01.31 267.478 277.316 259.945 263.179 23704 0 12405 216 | 2018.02.01 263.179 271.702 224.223 242.345 23241 0 12059 217 | 2018.02.02 242.345 244.758 184.021 226.080 23323 0 12014 218 | 2018.02.05 209.324 219.369 159.571 181.973 20315 0 12265 219 | 2018.02.06 181.970 206.411 143.116 204.342 22921 0 12188 220 | 2018.02.07 204.146 225.980 181.489 218.472 21060 0 12154 221 | 2018.02.08 218.471 246.560 198.115 238.773 17248 0 12043 222 | 2018.02.09 238.783 250.371 225.028 244.704 16310 0 12086 223 | 2018.02.12 230.139 244.582 219.899 240.711 19419 0 12159 224 | 2018.02.13 240.534 242.902 221.555 225.874 17640 0 12032 225 | 2018.02.14 225.417 266.766 224.125 256.610 18991 0 12177 226 | 2018.02.15 256.611 283.234 254.194 278.295 17241 0 12133 227 | 2018.02.16 278.262 292.753 269.000 280.623 18639 0 12052 228 | 2018.02.19 293.164 310.852 283.190 304.672 19969 0 12079 229 | 2018.02.20 304.672 311.474 299.265 303.620 16611 0 12053 230 | 2018.02.21 303.620 321.754 273.309 280.497 19758 0 12011 231 | 2018.02.22 280.497 309.437 264.408 272.282 19093 0 12019 232 | 2018.02.23 272.283 286.578 256.024 262.081 15961 0 12076 233 | 2018.02.26 265.446 288.674 259.725 288.049 16376 0 12049 234 | 2018.02.27 288.050 301.156 277.297 294.794 16580 0 12056 235 | 2018.02.28 294.794 298.162 278.841 282.739 17964 0 12100 236 | 2018.03.01 282.739 304.484 274.777 303.586 17665 0 12021 237 | 2018.03.02 303.586 344.376 300.780 330.971 16216 0 12001 238 | 2018.03.05 354.589 373.201 347.651 358.429 17738 0 12074 239 | 2018.03.06 358.428 368.546 330.756 338.422 16116 0 12108 240 | 2018.03.07 338.421 355.386 308.996 329.247 15725 0 12002 241 | 2018.03.08 329.246 338.223 268.721 268.772 20039 0 12019 242 | 2018.03.09 268.919 273.909 234.431 261.088 19311 0 12033 243 | 2018.03.12 273.279 279.410 242.516 251.543 16186 0 12144 244 | 2018.03.13 251.542 258.363 236.398 239.235 16181 0 12390 245 | 2018.03.14 239.234 243.582 197.899 197.960 13150 0 12044 246 | 2018.03.15 197.936 218.108 189.448 208.904 13345 0 12041 247 | 2018.03.16 208.985 215.592 196.239 210.854 11055 0 12072 248 | 2018.03.19 199.263 214.999 188.772 202.352 13966 0 12069 249 | 2018.03.20 202.351 225.753 198.852 218.904 11047 0 12029 250 | 2018.03.21 218.903 229.568 205.690 211.635 12693 0 12098 251 | 2018.03.22 211.263 216.746 195.953 200.212 10427 0 12103 252 | 2018.03.23 199.019 207.823 190.515 203.878 10675 0 12145 253 | 2018.03.26 204.181 207.010 180.067 182.044 10049 0 12149 254 | 2018.03.27 182.043 191.604 177.103 184.741 10704 0 12216 255 | 2018.03.28 184.792 193.984 178.385 189.000 11273 0 12175 256 | 2018.03.29 189.000 194.900 170.880 170.881 12285 0 12174 257 | 2018.03.30 170.881 175.222 155.092 166.524 13710 0 12093 258 | 2018.04.02 169.002 173.645 166.582 166.586 11211 0 12157 259 | 2018.04.03 166.585 184.358 166.563 180.331 13231 0 12078 260 | 2018.04.04 180.332 182.254 161.807 163.787 8416 0 12156 261 | 2018.04.05 163.787 167.142 157.063 166.230 10609 0 12119 262 | 2018.04.06 166.230 167.111 156.412 156.513 10566 0 12245 263 | 2018.04.09 164.285 172.650 155.959 156.098 11320 0 12168 264 | 2018.04.10 156.082 160.851 156.006 158.304 12178 0 12276 265 | 2018.04.11 158.295 163.518 157.617 159.615 8608 0 12062 266 | 2018.04.12 159.616 186.134 159.080 179.802 8982 0 12056 267 | 2018.04.13 179.800 194.947 178.818 182.473 12070 0 12141 268 | 2018.04.16 193.128 196.732 182.264 184.767 11913 0 12010 269 | 2018.04.17 184.093 195.444 184.093 189.502 7278 0 12208 270 | 2018.04.18 189.502 226.534 187.150 222.201 10688 0 12097 271 | 2018.04.19 222.201 231.798 218.797 229.395 10947 0 12103 272 | 2018.04.20 229.397 249.239 229.393 246.776 9851 0 12136 273 | 2018.04.23 267.110 279.436 262.089 272.380 8742 0 12251 274 | 2018.04.24 272.375 291.617 271.316 288.836 11424 0 12063 275 | 2018.04.25 288.832 289.474 240.773 263.860 15217 0 12156 276 | 2018.04.26 263.887 268.726 241.813 262.896 15362 0 12154 277 | 2018.04.27 262.898 263.945 245.352 245.354 11663 0 12022 278 | 2018.04.30 244.388 251.870 231.144 243.447 11573 0 12183 279 | 2018.05.01 243.446 243.455 221.864 230.435 10728 0 12059 280 | 2018.05.02 230.436 243.134 230.433 242.738 11106 0 12103 281 | 2018.05.03 242.740 250.638 236.021 242.355 10225 0 12038 282 | 2018.05.04 242.351 243.411 232.829 235.931 11715 0 12036 283 | 2018.05.07 226.001 230.290 214.972 226.600 11321 0 12007 284 | 2018.05.08 226.600 228.235 213.760 216.788 10748 0 12101 285 | 2018.05.09 216.788 226.300 210.118 220.330 12852 0 12298 286 | 2018.05.10 220.713 226.672 211.579 213.110 11451 0 12270 287 | 2018.05.11 213.109 215.116 189.254 191.787 12570 0 12086 288 | 2018.05.14 203.174 211.036 188.782 206.804 13357 0 10510 289 | 2018.05.15 206.016 212.500 197.638 198.843 12704 0 10175 290 | 2018.05.16 198.843 198.995 186.768 191.470 10250 0 10049 291 | 2018.05.17 191.468 197.377 189.396 190.972 10615 0 10095 292 | 2018.05.18 190.972 194.401 181.166 191.869 9738 0 10132 293 | 2018.05.21 198.601 199.546 188.391 190.007 5947 0 10173 294 | 2018.05.22 190.007 193.485 172.677 172.926 6652 0 10141 295 | 2018.05.23 172.927 174.848 160.097 165.826 7891 0 10045 296 | 2018.05.24 165.827 171.557 155.178 164.985 9460 0 10001 297 | 2018.05.25 164.983 168.366 157.720 158.569 8569 0 10082 298 | 2018.05.28 160.434 162.170 149.777 149.928 7675 0 10134 299 | 2018.05.29 149.928 161.001 141.597 153.562 8761 0 10148 300 | 2018.05.30 153.562 155.599 146.670 147.913 7012 0 10158 301 | 2018.05.31 147.913 153.456 147.101 152.383 7581 0 10278 302 | 2018.06.01 152.382 152.384 147.392 150.891 6640 0 10166 303 | 2018.06.04 165.674 166.067 152.221 155.620 8843 0 10189 304 | 2018.06.05 155.620 163.712 151.143 161.912 8490 0 10217 305 | 2018.06.06 161.912 162.360 155.996 159.157 9688 0 10156 306 | 2018.06.07 159.348 165.786 158.062 158.737 9824 0 10170 307 | 2018.06.08 158.737 159.506 151.173 153.344 9323 0 10305 308 | 2018.06.11 128.034 134.225 126.166 127.509 10819 0 10169 309 | 2018.06.12 127.509 132.798 114.532 118.880 7076 0 10046 310 | 2018.06.13 118.837 120.672 107.352 108.571 7102 0 10145 311 | 2018.06.14 108.573 128.916 107.748 125.504 9630 0 10167 312 | 2018.06.15 125.490 127.806 118.043 122.271 8493 0 10265 313 | 2018.06.18 119.039 123.438 113.523 120.873 7844 0 10164 314 | 2018.06.19 120.874 125.065 118.671 119.690 8948 0 10310 315 | 2018.06.20 119.486 120.616 113.922 116.969 7839 0 10175 316 | 2018.06.21 116.969 119.148 115.930 116.317 7960 0 10138 317 | 2018.06.22 116.344 118.678 103.907 103.916 7576 0 10034 318 | 2018.06.25 116.479 124.316 114.672 121.241 9110 0 10016 319 | 2018.06.26 121.242 124.752 115.785 116.479 6750 0 10024 320 | 2018.06.27 116.479 123.788 113.832 121.321 8119 0 10244 321 | 2018.06.28 121.321 128.858 120.923 122.942 9526 0 10115 322 | 2018.06.29 122.942 123.265 108.712 111.879 8869 0 10145 323 | 2018.07.02 123.878 137.715 122.441 135.711 7563 0 10053 324 | 2018.07.03 135.711 138.571 131.053 134.784 8243 0 10015 325 | 2018.07.04 134.540 140.681 131.216 137.251 7965 0 10119 326 | 2018.07.05 137.254 138.429 128.176 129.165 7309 0 10201 327 | 2018.07.06 129.165 133.513 125.076 131.001 7482 0 4397 328 | 2018.07.09 136.546 138.906 134.001 134.992 6417 0 4013 329 | 2018.07.10 134.775 136.224 119.699 120.573 8715 0 4202 330 | 2018.07.11 120.573 126.780 118.245 119.943 6793 0 4133 331 | 2018.07.12 119.943 123.155 115.943 117.589 5759 0 4087 332 | 2018.07.13 117.589 122.466 114.500 119.138 4689 0 4111 333 | 2018.07.16 121.577 133.233 120.457 131.076 5248 0 4019 334 | 2018.07.17 131.076 145.503 130.175 140.792 6092 0 4089 335 | 2018.07.18 140.832 147.358 136.043 137.543 6227 0 4074 336 | 2018.07.19 137.543 141.224 135.381 137.080 7484 0 4080 337 | 2018.07.20 137.080 138.955 127.926 128.025 5450 0 4089 338 | 2018.07.23 128.001 140.161 125.800 131.633 6501 0 4125 339 | 2018.07.24 131.632 141.913 130.641 138.560 9143 0 4073 340 | 2018.07.25 138.560 146.824 136.173 138.358 7164 0 4103 341 | 2018.07.26 138.359 143.000 138.214 138.479 6430 0 4175 342 | 2018.07.27 138.479 139.696 132.940 138.495 7569 0 4118 343 | 2018.07.30 133.347 133.782 126.244 129.658 6345 0 4135 344 | 2018.07.31 129.658 131.643 118.973 119.034 7665 0 4217 345 | 2018.08.01 119.034 127.756 117.186 119.642 9091 0 4154 346 | 2018.08.02 119.567 128.183 119.003 119.354 5095 0 4274 347 | 2018.08.03 119.354 120.563 112.558 117.606 5358 0 4145 348 | 2018.08.06 112.878 117.484 110.616 111.322 4830 0 4270 349 | 2018.08.07 111.322 115.999 109.204 109.903 6339 0 4166 350 | 2018.08.08 109.519 109.519 91.273 93.099 4920 0 4070 351 | 2018.08.09 93.100 99.954 90.431 97.579 6845 0 4256 352 | 2018.08.10 97.580 98.656 92.126 92.126 6061 0 4359 353 | 2018.08.13 91.439 94.965 87.168 88.826 4377 0 4078 354 | 2018.08.14 88.827 88.908 74.936 77.820 5668 0 4169 355 | 2018.08.15 77.820 91.550 77.092 86.371 7692 0 4185 356 | 2018.08.16 86.372 90.259 86.243 87.091 5799 0 4116 357 | 2018.08.17 87.094 95.584 86.583 93.878 6866 0 4181 358 | 2018.08.20 95.656 100.185 92.433 96.171 6945 0 4186 359 | 2018.08.21 96.171 96.330 89.398 90.313 6307 0 4189 360 | 2018.08.22 90.433 96.010 86.465 86.481 4678 0 4148 361 | 2018.08.23 86.481 88.892 85.479 86.320 4590 0 4224 362 | 2018.08.24 86.320 91.012 85.904 90.213 4792 0 4178 363 | 2018.08.27 90.709 99.687 90.709 99.493 6957 0 4366 364 | 2018.08.28 99.492 104.691 97.627 102.906 5379 0 4073 365 | 2018.08.29 102.906 105.999 98.536 100.048 6539 0 4331 366 | 2018.08.30 100.048 103.879 94.573 97.575 3713 0 4310 367 | 2018.08.31 97.575 114.315 97.482 113.198 6835 0 4196 368 | 2018.09.03 119.215 133.183 116.594 132.179 7336 0 4184 369 | 2018.09.04 132.179 137.939 131.366 134.324 6684 0 4060 370 | 2018.09.05 134.325 137.915 113.869 119.042 7022 0 4049 371 | 2018.09.06 119.043 119.722 106.212 111.430 5768 0 4085 372 | 2018.09.07 111.430 117.487 107.529 110.201 4653 0 4334 373 | 2018.09.10 107.379 108.484 101.408 102.882 4861 0 4137 374 | 2018.09.11 102.883 106.206 98.925 100.928 4675 0 4130 375 | 2018.09.12 100.928 103.259 94.582 98.543 3968 0 4215 376 | 2018.09.13 98.544 113.792 98.541 109.512 5586 0 4083 377 | 2018.09.14 109.513 113.531 106.881 113.325 6128 0 4193 378 | 2018.09.17 115.044 117.806 105.478 106.822 5428 0 4096 379 | 2018.09.18 106.822 110.468 101.461 109.855 6168 0 4184 380 | 2018.09.19 109.856 110.204 101.941 108.730 4487 0 4100 381 | 2018.09.20 108.731 111.110 106.796 108.914 4119 0 4246 382 | 2018.09.21 108.914 121.849 108.664 120.961 5646 0 4024 383 | 2018.09.24 118.786 121.185 114.092 115.957 4876 0 4239 384 | 2018.09.25 115.957 115.957 108.817 112.578 5936 0 4068 385 | 2018.09.26 112.578 115.248 110.089 112.682 5282 0 4269 386 | 2018.09.27 112.680 118.589 110.829 117.268 5810 0 4174 387 | 2018.09.28 117.268 119.594 113.030 114.241 6684 0 4185 388 | 2018.10.01 112.126 115.287 110.011 112.760 3867 0 4120 389 | 2018.10.02 112.760 114.211 109.980 113.110 3862 0 4275 390 | 2018.10.03 113.110 117.577 109.256 110.315 7009 0 4225 391 | 2018.10.04 110.312 114.298 110.289 112.496 5504 0 4277 392 | 2018.10.05 112.496 112.929 111.568 111.949 3541 0 4243 393 | 2018.10.08 110.840 113.326 110.692 112.513 3980 0 4132 394 | 2018.10.09 112.519 112.584 111.137 111.162 3209 0 4206 395 | 2018.10.10 111.162 112.318 109.680 112.161 5053 0 4053 396 | 2018.10.11 112.162 112.873 99.309 102.275 7320 0 4146 397 | 2018.10.12 102.276 102.557 97.953 100.344 6597 0 4132 398 | 2018.10.15 101.100 117.149 98.187 106.098 11175 0 4197 399 | 2018.10.16 106.097 109.051 105.080 107.099 8216 0 4097 400 | 2018.10.17 107.100 108.888 105.413 106.849 7233 0 4194 401 | 2018.10.18 106.849 108.222 103.182 103.701 5201 0 4168 402 | 2018.10.19 103.701 105.097 102.277 102.895 4339 0 4254 403 | 2018.10.22 105.331 105.657 104.010 104.522 3922 0 4343 404 | 2018.10.23 104.522 109.687 104.196 107.988 4648 0 4129 405 | 2018.10.24 108.000 109.243 106.298 106.298 6754 0 4155 406 | 2018.10.25 106.332 106.524 104.068 105.155 3235 0 4245 407 | 2018.10.26 105.155 105.458 104.098 104.445 2547 0 4213 408 | 2018.10.29 101.637 103.165 99.020 99.020 5805 0 4164 409 | 2018.10.30 99.078 101.244 99.078 100.455 2560 0 4103 410 | 2018.10.31 100.455 103.888 100.352 102.036 4638 0 4271 411 | 2018.11.01 102.045 103.239 100.885 102.277 4687 0 4242 412 | 2018.11.02 102.302 104.670 101.885 104.216 4313 0 4129 413 | 2018.11.05 110.017 111.446 108.000 108.496 5162 0 4216 414 | 2018.11.06 108.495 111.915 108.443 110.594 4868 0 4200 415 | 2018.11.07 110.559 112.553 107.846 109.338 4311 0 4153 416 | 2018.11.08 109.338 110.731 107.739 108.414 3506 0 2666 417 | 2018.11.09 108.414 108.575 104.507 104.656 3760 0 2567 418 | 2018.11.12 104.153 106.406 103.871 105.108 4486 0 2641 419 | 2018.11.13 105.108 106.010 103.588 104.629 5926 0 2602 420 | 2018.11.14 104.629 105.540 87.316 91.314 5829 0 2557 421 | 2018.11.15 91.314 93.526 80.516 86.524 10316 0 2507 422 | 2018.11.16 86.546 89.027 85.715 86.122 7023 0 2568 423 | 2018.11.19 88.380 88.724 71.722 72.540 7336 0 2494 424 | 2018.11.20 72.559 74.579 63.707 66.409 9495 0 2540 425 | 2018.11.21 66.424 70.161 63.866 67.882 9874 0 2540 426 | 2018.11.22 67.883 70.370 66.800 67.363 6987 0 2497 427 | 2018.11.23 67.352 67.460 61.702 65.302 6404 0 2553 428 | 2018.11.26 58.550 59.533 52.292 52.800 10612 0 2565 429 | 2018.11.27 52.799 56.309 51.601 56.132 8970 0 2600 430 | 2018.11.28 56.036 64.128 54.938 62.173 5573 0 2520 431 | 2018.11.29 62.173 63.587 57.848 59.153 5364 0 2547 432 | 2018.11.30 59.153 60.831 54.813 55.287 4808 0 2495 433 | 2018.12.03 59.215 59.462 51.837 53.274 6007 0 2548 434 | 2018.12.04 53.274 57.386 52.457 55.126 3146 0 2500 435 | 2018.12.05 55.126 55.374 50.597 51.111 4394 0 2495 436 | 2018.12.06 51.108 52.104 46.453 47.214 5060 0 2502 437 | 2018.12.07 47.215 47.215 40.668 44.091 3921 0 2548 438 | 2018.12.10 45.556 46.098 41.814 42.183 3036 0 2449 439 | 2018.12.11 42.183 42.696 40.509 41.271 2532 0 2457 440 | 2018.12.12 41.271 43.050 40.565 42.279 2200 0 2511 441 | 2018.12.13 42.279 42.279 39.050 39.506 4309 0 2487 442 | 2018.12.14 39.506 41.035 37.102 37.218 3659 0 2436 443 | 2018.12.17 37.617 42.904 37.301 41.591 2548 0 2470 444 | 2018.12.18 41.591 43.022 41.165 42.431 2240 0 2525 445 | 2018.12.19 42.437 48.552 42.432 43.467 3866 0 2459 446 | 2018.12.20 43.467 50.655 43.467 50.275 3423 0 2473 447 | 2018.12.21 50.292 53.451 48.300 50.438 4037 0 2486 448 | 2018.12.24 50.422 56.001 50.215 54.724 3250 0 2491 449 | 2018.12.25 54.723 54.724 45.765 48.654 3880 0 2503 450 | 2018.12.26 48.755 49.719 44.842 46.246 3664 0 2486 451 | 2018.12.27 46.246 47.003 41.468 41.818 2971 0 2425 452 | 2018.12.28 41.753 48.867 40.903 47.348 2969 0 2470 453 | 2018.12.31 45.892 46.402 42.969 43.173 2282 0 2475 454 | 2019.01.01 43.173 45.293 43.173 45.229 2051 0 2541 455 | 2019.01.02 45.230 51.197 45.191 49.895 2655 0 2549 456 | 2019.01.03 49.895 50.185 46.934 47.668 2475 0 2462 457 | 2019.01.04 47.668 48.657 47.198 48.620 2247 0 2478 458 | 2019.01.07 51.437 53.118 49.869 51.019 2826 0 2481 459 | 2019.01.08 51.019 52.742 50.284 50.831 2320 0 2438 460 | 2019.01.09 50.831 52.362 49.782 50.075 2587 0 2557 461 | 2019.01.10 50.054 51.041 41.538 42.537 2676 0 2482 462 | 2019.01.11 42.536 44.201 42.142 43.808 2499 0 2494 463 | 2019.01.14 40.912 43.984 40.555 43.473 2256 0 2495 464 | 2019.01.15 43.521 44.418 42.142 42.308 2438 0 2495 465 | 2019.01.16 42.308 43.776 42.308 43.643 1890 0 2522 466 | 2019.01.17 43.643 44.212 42.639 43.438 2336 0 2520 467 | 2019.01.18 43.438 43.644 42.663 43.252 1960 0 2487 468 | 2019.01.21 42.251 42.783 41.823 42.271 1510 0 2497 469 | 2019.01.22 42.272 44.577 41.936 44.284 2062 0 2493 470 | 2019.01.23 44.284 44.387 42.882 43.094 2264 0 2517 471 | 2019.01.24 43.094 44.803 42.964 44.599 1605 0 2458 472 | 2019.01.25 44.599 45.480 43.276 45.248 1829 0 2511 473 | 2019.01.28 44.652 44.997 41.303 41.519 2637 0 2476 474 | 2019.01.29 41.546 42.397 41.099 41.766 2923 0 2478 475 | 2019.01.30 41.768 43.099 41.111 42.711 2141 0 2494 476 | 2019.01.31 42.711 42.941 41.603 41.815 2155 0 2526 477 | 2019.02.01 41.770 42.572 41.048 42.270 1808 0 2538 478 | 2019.02.04 41.108 41.583 40.644 41.522 2295 0 2523 479 | 2019.02.05 41.522 42.005 41.187 41.759 1576 0 2568 480 | 2019.02.06 41.759 41.971 40.617 41.427 1638 0 2533 481 | 2019.02.07 41.427 42.387 41.427 42.180 1231 0 2503 482 | 2019.02.08 42.180 48.051 41.777 46.317 1941 0 2541 483 | 2019.02.11 46.815 48.348 45.608 46.771 3198 0 2482 484 | 2019.02.12 46.771 47.847 45.788 47.140 3161 0 2479 485 | 2019.02.13 47.140 49.180 46.706 47.712 2763 0 2500 486 | 2019.02.14 47.713 47.842 44.164 45.573 2212 0 2496 487 | 2019.02.15 45.573 46.699 44.627 46.000 2760 0 2439 488 | 2019.02.18 45.818 50.386 45.761 49.839 3330 0 2495 489 | 2019.02.19 49.627 51.526 48.961 50.717 4315 0 2499 490 | 2019.02.20 50.717 51.105 48.434 49.380 3354 0 2402 491 | 2019.02.21 49.381 50.253 48.103 48.288 2587 0 2497 492 | 2019.02.22 48.289 50.015 48.041 49.459 1970 0 2413 493 | 2019.02.25 46.774 47.374 45.885 46.931 3125 0 2503 494 | 2019.02.26 46.931 47.183 46.238 46.605 2541 0 2419 495 | 2019.02.27 46.490 47.290 45.778 46.413 1422 0 2515 496 | 2019.02.28 46.413 47.415 46.150 46.555 2651 0 2440 497 | 2019.03.01 46.556 47.140 46.216 47.140 1705 0 2488 498 | 2019.03.04 47.144 47.680 44.568 45.735 2764 0 2502 499 | 2019.03.05 45.735 47.839 45.198 47.591 1749 0 2485 500 | 2019.03.06 47.591 48.155 46.759 47.955 1228 0 2477 501 | 2019.03.07 47.955 49.399 47.667 48.648 1733 0 2508 502 | 2019.03.08 48.654 48.871 48.003 48.017 2287 0 2510 503 | 2019.03.11 48.221 48.370 46.763 47.761 1914 0 2506 504 | 2019.03.12 47.762 48.688 46.607 48.464 2397 0 2523 505 | 2019.03.13 48.465 49.470 48.302 48.630 2283 0 2525 506 | 2019.03.14 48.679 50.507 48.103 49.061 2810 0 2521 507 | 2019.03.15 49.102 50.866 49.070 50.440 4558 0 2456 508 | 2019.03.18 51.204 51.745 50.075 50.430 1702 0 2505 509 | 2019.03.19 50.430 52.043 50.302 51.161 1017 0 2509 510 | 2019.03.20 51.161 52.947 51.028 52.801 1413 0 2481 511 | 2019.03.21 52.801 53.210 49.858 50.866 3216 0 2462 512 | 2019.03.22 50.928 51.690 50.483 51.535 1396 0 2471 513 | 2019.03.25 51.193 51.498 48.987 49.351 2946 0 2487 514 | 2019.03.26 49.351 50.100 48.436 50.069 2867 0 2500 515 | 2019.03.27 50.125 52.206 49.962 52.106 4578 0 2482 516 | 2019.03.28 52.196 52.199 50.953 51.364 3155 0 2545 517 | 2019.03.29 51.381 52.781 50.895 51.798 2622 0 2444 518 | 2019.04.01 54.704 57.901 54.209 57.690 2913 0 2447 519 | 2019.04.02 57.690 65.440 57.581 64.677 4767 0 2456 520 | 2019.04.03 64.677 70.287 64.358 70.060 6578 0 2462 521 | 2019.04.04 70.069 70.485 60.338 61.001 9002 0 2451 522 | 2019.04.05 61.011 67.109 60.914 66.818 6379 0 2526 523 | 2019.04.08 67.138 70.703 66.078 68.173 6977 0 2517 524 | 2019.04.09 68.080 69.265 65.439 66.647 5451 0 2491 525 | 2019.04.10 66.678 70.009 66.043 68.356 4222 0 2517 526 | 2019.04.11 68.356 69.451 60.494 63.532 5828 0 2526 527 | 2019.04.12 63.541 66.575 62.905 64.210 4078 0 2448 528 | 2019.04.15 64.481 65.584 62.026 63.231 2820 0 2476 529 | 2019.04.16 63.203 67.748 62.096 66.661 4024 0 2501 530 | 2019.04.17 66.672 68.074 65.517 65.697 3363 0 2499 531 | 2019.04.18 65.686 68.074 64.945 67.898 2737 0 2504 532 | 2019.04.19 67.952 68.325 65.759 66.693 2854 0 2552 533 | 2019.04.22 66.142 67.557 66.135 66.594 2805 0 2619 534 | 2019.04.23 66.572 69.014 66.256 67.750 4375 0 2496 535 | 2019.04.24 67.759 68.859 63.228 64.725 7882 0 2471 536 | 2019.04.25 64.728 66.171 64.626 65.645 3358 0 2462 537 | 2019.04.26 65.586 65.695 58.801 61.549 6298 0 2527 538 | 2019.04.29 60.545 60.656 58.827 60.079 1656 0 2570 539 | 2019.04.30 60.079 61.226 59.546 60.636 1888 0 2522 540 | 2019.05.01 60.636 63.782 60.636 63.374 1565 0 2507 541 | 2019.05.02 63.375 64.874 62.753 63.194 1705 0 2526 542 | 2019.05.03 63.194 67.263 63.194 66.173 2383 0 2544 543 | 2019.05.06 65.560 66.912 63.772 66.615 2662 0 2495 544 | 2019.05.07 66.615 69.319 65.273 65.518 3840 0 2432 545 | 2019.05.08 65.518 66.556 64.036 66.146 2987 0 2458 546 | 2019.05.09 66.146 67.725 62.915 63.101 2800 0 2456 547 | 2019.05.10 63.072 67.363 63.072 66.734 5897 0 2489 548 | 2019.05.13 75.512 80.880 73.241 79.414 5820 0 2404 549 | 2019.05.14 79.427 83.639 76.142 79.799 6122 0 2555 550 | 2019.05.15 79.811 92.917 79.192 90.541 6812 0 2473 551 | 2019.05.16 90.546 95.783 83.115 84.043 6546 0 2500 552 | 2019.05.17 84.043 86.994 75.144 77.837 6797 0 2499 553 | 2019.05.20 86.186 88.900 82.366 86.133 6071 0 2545 554 | 2019.05.21 86.133 90.943 84.205 87.424 7146 0 2501 555 | 2019.05.22 87.363 89.819 84.398 86.163 5942 0 2440 556 | 2019.05.23 86.163 86.193 79.127 83.142 7171 0 2497 557 | 2019.05.24 83.160 85.523 82.182 85.281 7141 0 2490 558 | 2019.05.27 88.584 97.082 88.369 95.317 6558 0 2490 559 | 2019.05.28 95.317 96.894 93.828 94.373 4939 0 2465 560 | 2019.05.29 94.392 94.904 88.905 93.672 8101 0 2503 561 | 2019.05.30 93.639 96.913 90.963 91.585 4804 0 2487 562 | 2019.05.31 91.585 92.111 87.427 91.436 5867 0 2527 563 | 2019.06.03 92.895 94.386 90.553 92.635 4287 0 2562 564 | 2019.06.04 92.449 92.635 80.697 81.422 6180 0 2540 565 | 2019.06.05 81.422 85.389 79.958 82.381 4554 0 2624 566 | 2019.06.06 82.381 84.786 81.511 82.871 3667 0 2576 567 | 2019.06.07 82.871 87.885 82.856 85.356 4598 0 2435 568 | 2019.06.10 82.369 85.614 80.763 84.441 4182 0 2512 569 | 2019.06.11 84.441 85.956 83.679 85.297 2946 0 2524 570 | 2019.06.12 85.297 88.436 84.089 86.955 3811 0 2424 571 | 2019.06.13 86.982 90.207 86.982 89.662 2770 0 2507 572 | 2019.06.14 89.662 89.756 85.600 85.904 3989 0 2489 573 | 2019.06.17 93.799 98.531 93.546 96.600 4302 0 2447 574 | 2019.06.18 96.729 97.874 93.745 95.185 4211 0 2574 575 | 2019.06.19 95.185 100.903 93.852 99.047 3873 0 2485 576 | 2019.06.20 99.047 107.294 98.405 103.553 4595 0 2497 577 | 2019.06.21 103.553 108.544 103.454 105.679 4924 0 2528 578 | 2019.06.24 118.183 119.542 111.181 115.642 5222 0 2562 579 | 2019.06.25 115.642 116.820 111.449 111.650 4523 0 2647 580 | 2019.06.26 111.650 112.577 100.808 104.978 7791 0 2463 581 | 2019.06.27 104.653 104.988 87.839 94.298 8302 0 2518 582 | 2019.06.28 94.298 99.659 92.701 97.982 6319 0 2658 583 | 2019.07.01 93.007 93.184 83.065 87.553 6554 0 2602 584 | 2019.07.02 87.563 88.369 80.821 85.001 9377 0 2604 585 | 2019.07.03 84.899 90.907 83.561 86.370 9176 0 2539 586 | 2019.07.04 86.370 91.287 85.956 89.427 3924 0 2537 587 | 2019.07.05 89.427 91.160 84.884 89.549 6676 0 2551 588 | 2019.07.08 101.717 105.661 98.875 100.986 4760 0 2536 589 | 2019.07.09 100.986 103.025 96.183 96.736 5767 0 2520 590 | 2019.07.10 96.736 100.344 91.270 91.942 5396 0 2557 591 | 2019.07.11 91.942 94.088 86.236 88.475 4704 0 2535 592 | 2019.07.12 88.475 95.529 84.874 95.273 4212 0 2498 593 | 2019.07.15 86.487 87.635 74.807 87.186 5424 0 2501 594 | 2019.07.16 87.201 88.779 73.244 74.368 5954 0 2488 595 | 2019.07.17 74.368 78.977 70.477 76.075 6796 0 2514 596 | 2019.07.18 76.077 83.790 73.419 83.145 6961 0 2509 597 | 2019.07.19 83.158 83.574 78.629 81.375 7854 0 2549 598 | 2019.07.22 83.206 84.058 80.074 82.724 2393 0 2582 599 | 2019.07.23 82.724 83.264 78.841 82.218 3624 0 2547 600 | 2019.07.24 82.218 82.363 77.246 78.418 3696 0 2546 601 | 2019.07.25 78.431 82.394 78.431 79.364 3522 0 2413 602 | 2019.07.26 79.364 80.024 77.342 78.574 4292 0 2448 603 | 2019.07.29 78.405 79.969 75.790 77.067 2881 0 2615 604 | 2019.07.30 77.086 79.297 76.455 77.138 4608 0 2545 605 | 2019.07.31 77.153 81.128 76.732 78.633 4895 0 2406 606 | 2019.08.01 78.633 81.212 78.398 80.610 4158 0 2505 607 | 2019.08.02 80.632 83.809 80.102 81.460 3222 0 2456 608 | 2019.08.05 86.599 93.421 85.481 91.619 5173 0 2487 609 | 2019.08.06 91.619 95.238 89.494 90.274 3883 0 2482 610 | 2019.08.07 90.164 95.464 86.788 94.945 3582 0 2465 611 | 2019.08.08 94.947 96.193 90.239 90.339 4034 0 2505 612 | 2019.08.09 90.339 94.613 89.815 91.950 4554 0 2566 613 | 2019.08.12 90.097 91.138 88.568 90.035 2072 0 2596 614 | 2019.08.13 90.035 90.181 83.488 84.538 1881 0 2525 615 | 2019.08.14 84.514 84.514 77.448 77.695 3405 0 2414 616 | 2019.08.15 77.697 80.346 72.906 80.346 5938 0 2552 617 | 2019.08.16 80.346 81.845 76.568 79.749 3831 0 2521 618 | 2019.08.19 82.531 86.610 82.454 85.123 13329 0 2541 619 | 2019.08.20 85.123 89.353 82.685 83.076 3804 0 2553 620 | 2019.08.21 83.076 84.880 77.634 79.555 7040 0 2452 621 | 2019.08.22 79.555 81.717 76.889 80.570 3670 0 2598 622 | 2019.08.23 80.585 81.884 79.463 81.077 2443 0 2584 623 | 2019.08.26 77.898 82.295 77.587 77.958 2688 0 2557 624 | 2019.08.27 77.958 78.683 76.656 76.713 2969 0 2446 625 | 2019.08.28 76.718 78.117 70.251 70.682 3615 0 2532 626 | 2019.08.29 70.682 71.096 66.709 67.386 2736 0 2429 627 | 2019.08.30 67.386 67.386 64.330 66.560 2230 0 2495 628 | 2019.09.02 68.014 72.942 68.014 71.457 3079 0 2482 629 | 2019.09.03 71.456 74.243 71.230 73.528 3234 0 2542 630 | 2019.09.04 73.574 73.866 69.966 71.235 6976 0 2542 631 | 2019.09.05 71.226 74.893 70.883 74.154 7071 0 2555 632 | 2019.09.06 74.154 78.196 73.495 74.216 5884 0 2467 633 | 2019.09.09 75.099 76.021 73.197 73.262 6670 0 2545 634 | 2019.09.10 73.263 74.668 70.229 70.612 6755 0 2518 635 | 2019.09.11 70.617 72.299 67.694 71.307 2695 0 2547 636 | 2019.09.12 71.308 73.409 70.002 73.105 2583 0 2541 637 | 2019.09.13 73.120 73.974 71.049 72.417 2475 0 2497 638 | 2019.09.16 73.482 74.668 69.949 72.368 2404 0 2504 639 | 2019.09.17 72.377 74.241 71.520 73.497 3448 0 2528 640 | 2019.09.18 73.866 77.501 72.256 76.834 4312 0 2502 641 | 2019.09.19 76.835 80.556 71.413 74.288 6498 0 2507 642 | 2019.09.20 74.291 76.441 71.517 71.517 4571 0 2528 643 | 2019.09.23 71.005 71.336 68.180 68.303 3595 0 2523 644 | 2019.09.24 68.303 68.704 55.025 57.641 7200 0 2473 645 | 2019.09.25 57.575 59.749 55.842 58.607 6304 0 2499 646 | 2019.09.26 58.605 59.038 53.030 56.118 5713 0 2467 647 | 2019.09.27 56.118 57.380 53.690 55.033 6320 0 2563 648 | 2019.09.30 53.949 55.851 52.186 54.672 6095 0 2484 649 | 2019.10.01 54.677 56.850 53.974 54.362 5216 0 2476 650 | 2019.10.02 54.388 55.162 52.890 53.501 5400 0 2508 651 | 2019.10.03 53.496 54.876 52.819 53.665 3806 0 2529 652 | 2019.10.04 53.665 56.258 52.603 55.700 3339 0 2470 653 | 2019.10.07 53.562 55.626 52.981 54.738 3430 0 2487 654 | 2019.10.08 54.738 55.422 53.801 53.908 3664 0 2542 655 | 2019.10.09 53.912 55.855 53.692 55.457 4273 0 2492 656 | 2019.10.10 55.461 55.957 53.840 54.202 2715 0 2510 657 | 2019.10.11 54.192 55.113 52.962 53.196 6537 0 2525 658 | 2019.10.14 51.421 52.156 51.077 51.321 2240 0 2469 659 | 2019.10.15 51.326 52.473 50.473 50.531 3102 0 2495 660 | 2019.10.16 50.511 53.432 50.351 53.042 5055 0 2454 661 | 2019.10.17 53.042 59.068 52.726 55.416 6279 0 2559 662 | 2019.10.18 55.416 56.878 53.940 55.074 6019 0 2531 663 | 2019.10.21 54.986 57.833 54.377 57.125 4401 0 2529 664 | 2019.10.22 57.125 57.817 54.535 56.111 4557 0 2572 665 | 2019.10.23 56.111 56.168 50.694 51.328 6418 0 2527 666 | 2019.10.24 51.328 52.979 49.676 52.312 6195 0 2465 667 | 2019.10.25 52.312 58.383 50.811 57.766 7356 0 2474 668 | 2019.10.28 58.714 60.270 57.194 59.559 9065 0 2510 669 | 2019.10.29 59.560 61.486 57.549 57.718 7282 0 2597 670 | 2019.10.30 57.721 58.140 55.928 56.872 5679 0 2597 671 | 2019.10.31 56.872 58.574 55.771 57.305 5112 0 2531 672 | 2019.11.01 57.305 59.747 56.884 59.193 2132 0 2535 673 | 2019.11.04 62.597 62.873 61.065 61.771 4108 0 2554 674 | 2019.11.05 61.814 62.273 60.503 61.706 3731 0 2537 675 | 2019.11.06 61.642 63.019 61.018 62.686 6062 0 2578 676 | 2019.11.07 62.691 65.497 61.410 62.046 4132 0 2503 677 | 2019.11.08 62.048 62.275 58.652 59.795 7189 0 2542 678 | 2019.11.11 62.565 62.851 59.538 60.568 5292 0 2466 679 | 2019.11.12 60.520 64.394 60.277 60.769 6977 0 2468 680 | 2019.11.13 60.770 63.963 60.298 63.951 4572 0 2529 681 | 2019.11.14 63.957 64.082 62.466 63.775 6853 0 2546 682 | 2019.11.15 63.775 64.194 60.763 60.808 7306 0 2582 683 | 2019.11.18 60.594 60.616 56.252 57.655 9252 0 2481 684 | 2019.11.19 57.645 58.286 56.398 57.262 7594 0 2533 685 | 2019.11.20 57.258 57.720 56.327 56.519 8553 0 2489 686 | 2019.11.21 56.496 57.290 51.967 52.214 8970 0 2443 687 | 2019.11.22 52.209 53.568 46.438 50.081 8847 0 2476 688 | 2019.11.25 47.129 51.056 44.122 49.060 9267 0 2467 689 | 2019.11.26 49.059 50.652 48.124 49.492 8706 0 2581 690 | 2019.11.27 49.492 55.715 48.522 54.115 8902 0 2512 691 | 2019.11.28 54.108 55.325 52.940 53.231 10565 0 2562 692 | 2019.11.29 53.231 54.682 52.277 53.952 10444 0 2433 693 | 2019.12.02 51.971 53.077 50.937 53.045 8644 0 2486 694 | 2019.12.03 53.033 53.972 51.748 52.156 10367 0 2546 695 | 2019.12.04 52.162 55.283 50.373 50.888 10957 0 2552 696 | 2019.12.05 50.780 52.696 50.431 52.541 12768 0 2553 697 | 2019.12.06 52.558 53.668 51.111 52.522 11449 0 2478 698 | 2019.12.09 52.477 52.881 51.602 52.403 8708 0 2540 699 | 2019.12.10 52.100 52.382 50.693 51.064 1696 0 2465 700 | 2019.12.11 51.989 52.061 51.283 51.610 1421 0 2560 701 | 2019.12.12 51.610 537.605 50.613 530.936 14840 0 833 702 | 2019.12.13 530.885 532.917 523.740 527.210 18617 0 549 703 | 2019.12.16 508.815 510.282 483.164 490.932 22470 0 649 704 | 2019.12.17 490.932 493.330 447.461 449.658 49321 0 660 705 | 2019.12.18 449.658 479.884 437.299 473.785 31986 0 805 706 | 2019.12.19 473.809 497.229 460.572 473.318 28583 0 499 707 | 2019.12.20 473.365 474.866 465.006 467.457 22244 0 567 708 | 2019.12.23 474.080 485.258 468.532 471.431 23505 0 460 709 | 2019.12.24 471.478 478.516 455.764 459.771 20636 0 662 710 | 2019.12.25 459.636 466.830 451.311 458.922 17718 0 562 711 | 2019.12.26 458.886 464.621 450.910 451.032 16807 0 468 712 | 2019.12.27 451.031 460.432 444.724 448.223 22017 0 510 713 | 2020.10.30 120.079 123.543 118.885 122.425 8183 0 1714 714 | 2020.11.02 125.042 127.227 114.962 119.620 15405 0 1650 715 | 2020.11.03 119.620 119.620 115.082 118.352 15687 0 1666 716 | 2020.11.04 118.352 120.360 112.874 114.295 16524 0 1675 717 | 2020.11.05 114.295 119.130 110.234 117.512 15804 0 1621 718 | 2020.11.06 117.513 122.928 115.749 117.931 20574 0 1636 719 | 2020.11.09 117.970 121.036 112.850 116.690 18592 0 1628 720 | 2020.11.10 116.690 117.277 113.210 115.746 15875 0 1639 721 | 2020.11.11 115.747 116.997 112.214 113.212 13687 0 1648 722 | 2020.11.12 113.212 114.251 109.319 110.092 14281 0 1631 723 | 2020.11.13 110.082 114.025 109.795 112.651 15190 0 1626 724 | 2020.11.16 113.616 118.959 112.129 116.257 15089 0 1617 725 | 2020.11.17 116.264 124.391 116.264 123.437 15745 0 1616 726 | 2020.11.18 123.442 125.481 117.862 121.510 18208 0 1628 727 | 2020.11.19 121.330 122.956 116.242 117.205 13281 0 1634 728 | 2020.11.20 117.205 122.064 116.228 120.369 15369 0 1635 729 | 2020.11.23 124.935 129.937 121.414 129.937 16515 0 1619 730 | 2020.11.24 129.937 141.532 125.563 133.576 20802 0 1619 731 | 2020.11.25 133.584 137.673 129.184 131.320 19910 0 1642 732 | 2020.11.26 131.311 131.373 106.782 116.940 24714 0 1650 733 | 2020.11.27 117.003 120.850 110.490 115.011 19540 0 1652 734 | 2020.11.30 122.386 128.508 120.623 127.607 15641 0 1649 735 | 2020.12.01 127.607 131.700 119.555 125.786 19575 0 1667 736 | 2020.12.02 125.837 128.036 122.393 126.387 22378 0 1645 737 | 2020.12.03 126.392 130.790 125.334 130.587 17439 0 1642 738 | 2020.12.04 130.587 134.567 128.216 128.940 18144 0 1654 739 | 2020.12.07 130.370 142.937 130.068 137.731 16090 0 1621 740 | 2020.12.08 137.776 142.068 132.143 136.419 17678 0 1657 741 | 2020.12.09 136.419 137.529 126.224 132.146 18783 0 1658 742 | 2020.12.10 132.145 134.032 128.024 133.297 19229 0 1686 743 | 2020.12.11 133.300 139.462 128.983 138.654 17772 0 266 744 | 2020.12.14 147.606 157.252 146.787 152.959 19221 0 196 745 | 2020.12.15 152.962 155.249 150.466 151.324 15966 0 235 746 | 2020.12.16 151.332 156.133 146.985 153.588 16407 0 226 747 | 2020.12.17 153.591 163.323 153.305 159.715 18558 0 241 748 | 2020.12.18 159.739 160.898 152.829 155.982 16964 0 227 749 | 2020.12.21 153.189 153.471 142.388 146.592 14615 0 240 750 | 2020.12.22 146.592 157.081 143.485 154.576 18090 0 230 751 | 2020.12.23 154.475 168.828 152.126 156.565 21268 0 201 752 | 2020.12.24 156.598 158.303 146.660 151.088 21597 0 223 753 | 2020.12.25 151.108 160.634 150.750 157.686 19715 0 249 754 | 2020.12.28 159.043 168.363 156.013 166.512 21259 0 242 755 | 2020.12.29 166.511 168.131 154.854 161.558 18258 0 201 756 | 2020.12.30 161.564 163.840 157.936 160.014 18380 0 241 757 | 2020.12.31 160.014 161.248 155.345 156.701 15744 0 231 758 | 2021.01.04 138.301 143.486 127.113 129.728 21788 0 238 759 | 2021.01.05 129.740 137.462 128.905 137.282 21958 0 219 760 | 2021.01.06 137.282 141.239 132.006 136.772 19760 0 236 761 | 2021.01.07 136.797 152.477 136.139 147.378 21810 0 198 762 | 2021.01.08 147.429 148.976 134.657 139.015 22626 0 287 763 | 2021.01.11 176.607 189.160 141.435 160.969 24174 0 184 764 | 2021.01.12 160.969 173.569 152.725 160.878 22941 0 234 765 | 2021.01.13 160.906 169.293 152.413 169.289 18624 0 262 766 | 2021.01.14 169.296 172.347 160.575 163.082 16493 0 302 767 | 2021.01.15 163.088 166.476 147.279 154.749 17018 0 293 768 | 2021.01.18 162.504 163.539 150.153 155.156 16295 0 198 769 | 2021.01.19 155.189 165.298 152.376 161.372 12635 0 198 770 | 2021.01.20 161.372 161.607 142.467 151.734 16248 0 218 771 | 2021.01.21 151.745 152.781 134.418 135.170 18252 0 225 772 | 2021.01.22 135.170 141.900 121.651 137.833 12180 0 237 773 | 2021.01.25 135.546 144.906 135.546 138.727 12871 0 234 774 | 2021.01.26 138.728 140.242 132.923 135.971 13875 0 236 775 | 2021.01.27 135.971 138.301 126.440 128.324 13078 0 548 776 | 2021.01.28 128.363 139.775 123.725 134.070 12827 0 1020 777 | 2021.01.29 134.080 148.377 131.841 139.084 12822 0 967 778 | 2021.02.01 134.561 144.705 134.561 144.447 13560 0 1177 779 | 2021.02.02 144.464 148.647 141.828 148.397 11864 0 1213 780 | 2021.02.03 148.424 154.633 147.172 151.599 10468 0 456 781 | 2021.02.04 151.615 154.992 146.812 150.651 12113 0 411 782 | 2021.02.05 150.651 154.251 146.768 152.772 9540 0 425 783 | 2021.02.08 148.477 159.795 146.832 159.369 13503 0 482 784 | 2021.02.09 159.369 173.767 108.700 108.700 15167 0 454 785 | 2021.02.10 170.849 174.285 164.560 173.578 5768 0 458 786 | 2021.02.11 173.578 191.249 170.276 182.925 17104 0 460 787 | 2021.02.12 182.925 214.568 182.882 203.483 16177 0 478 788 | 2021.02.15 236.304 236.763 201.598 220.206 21928 0 564 789 | 2021.02.16 220.249 233.056 209.933 214.478 18489 0 554 790 | 2021.02.17 214.588 264.622 108.700 264.444 16801 0 522 791 | 2021.02.18 264.444 274.499 249.804 255.606 14888 0 608 792 | 2021.02.19 255.606 273.201 108.700 108.700 10704 0 593 793 | 2021.02.22 245.457 248.546 189.899 225.181 23757 0 295 794 | 2021.02.23 225.172 225.904 170.746 209.859 21768 0 269 795 | 2021.02.24 209.787 224.818 198.110 202.681 21332 0 265 796 | 2021.02.25 202.567 218.053 197.568 200.114 20504 0 258 797 | 2021.02.26 200.116 217.418 193.326 199.519 20839 0 184 798 | 2021.03.01 218.167 226.614 210.072 221.864 20100 0 181 799 | 2021.03.02 221.850 232.154 210.915 215.588 19986 0 181 800 | 2021.03.03 215.559 228.634 215.072 223.319 19936 0 187 801 | 2021.03.04 223.303 225.106 209.902 212.743 19059 0 181 802 | 2021.03.05 212.691 217.600 202.605 209.054 17978 0 181 803 | 2021.03.08 207.170 219.360 203.960 218.960 96816 0 10 804 | 2021.03.09 218.970 228.750 217.890 223.200 97484 0 10 805 | 2021.03.10 223.210 227.280 215.910 222.160 87000 0 10 806 | 2021.03.11 222.170 226.030 212.750 219.980 99138 0 10 807 | 2021.03.12 219.970 225.910 215.170 221.840 86834 0 10 808 | -------------------------------------------------------------------------------- /MT5.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | from datetime import datetime 3 | import pandas as pd 4 | import MetaTrader5 as mt5 5 | warnings.filterwarnings("ignore") 6 | mt5.initialize() 7 | 8 | 9 | class MT5: 10 | 11 | def get_data(symbol, n, timeframe=mt5.TIMEFRAME_D1): 12 | """ Function to import the data of the chosen symbol""" 13 | 14 | # Initialize the connection if there is not 15 | mt5.initialize() 16 | 17 | # Current date extract 18 | utc_from = datetime.now() 19 | 20 | # Import the data into a tuple 21 | rates = mt5.copy_rates_from(symbol, timeframe, utc_from, n) 22 | 23 | # Tuple to dataframe 24 | rates_frame = pd.DataFrame(rates) 25 | 26 | # Convert time in seconds into the datetime format 27 | rates_frame['time'] = pd.to_datetime(rates_frame['time'], unit='s') 28 | 29 | # Convert the column "time" in the right format 30 | rates_frame['time'] = pd.to_datetime(rates_frame['time'], format='%Y-%m-%d') 31 | 32 | # Set column time as the index of the dataframe 33 | rates_frame = rates_frame.set_index('time') 34 | return rates_frame 35 | 36 | def orders(symbol, lot, buy=True, id_position=None): 37 | """ Send the orders """ 38 | 39 | # Initialize the connection if there is not 40 | if mt5.initialize() == False: 41 | mt5.initialize() 42 | 43 | # Get filling mode 44 | filling_mode = mt5.symbol_info(symbol).filling_mode - 1 45 | 46 | # Take ask price 47 | ask_price = mt5.symbol_info_tick(symbol).ask 48 | 49 | # Take bid price 50 | bid_price = mt5.symbol_info_tick(symbol).bid 51 | 52 | # Take the point of the asset 53 | point = mt5.symbol_info(symbol).point 54 | 55 | deviation = 20 # mt5.getSlippage(symbol) 56 | # **************************** Open a trade ***************************** 57 | if id_position == None: 58 | 59 | # Buy order Parameters 60 | if buy: 61 | type_trade = mt5.ORDER_TYPE_BUY 62 | sl = ask_price*(1-0.01) 63 | tp = ask_price*(1+0.01) 64 | price = ask_price 65 | 66 | # Sell order Parameters 67 | else: 68 | type_trade = mt5.ORDER_TYPE_SELL 69 | sl = bid_price*(1+0.01) 70 | tp = bid_price*(1-0.01) 71 | price = bid_price 72 | 73 | # Open the trade 74 | request = { 75 | "action": mt5.TRADE_ACTION_DEAL, 76 | "symbol": symbol, 77 | "volume": lot, 78 | "type": type_trade, 79 | "price": price, 80 | "deviation": deviation, 81 | "sl": sl, 82 | "tp": tp, 83 | "magic": 234000, 84 | "comment": "python script order", 85 | "type_time": mt5.ORDER_TIME_GTC, 86 | "type_filling": filling_mode, 87 | } 88 | # send a trading request 89 | result = mt5.order_send(request) 90 | result_comment = result.comment 91 | 92 | # **************************** Close a trade ***************************** 93 | else: 94 | # Buy order Parameters 95 | if buy: 96 | type_trade = mt5.ORDER_TYPE_SELL 97 | price = bid_price 98 | 99 | # Sell order Parameters 100 | else: 101 | type_trade = mt5.ORDER_TYPE_BUY 102 | price = ask_price 103 | 104 | # Close the trade 105 | request = { 106 | "action": mt5.TRADE_ACTION_DEAL, 107 | "symbol": symbol, 108 | "volume": lot, 109 | "type": type_trade, 110 | "position": id_position, 111 | "price": price, 112 | "deviation": deviation, 113 | "magic": 234000, 114 | "comment": "python script order", 115 | "type_time": mt5.ORDER_TIME_GTC, 116 | "type_filling": filling_mode, 117 | } 118 | 119 | # send a trading request 120 | result = mt5.order_send(request) 121 | result_comment = result.comment 122 | return result.comment 123 | 124 | def resume(): 125 | """ Return the current positions. Position=0 --> Buy """ 126 | # Initialize the connection if there is not 127 | mt5.initialize() 128 | 129 | # Define the name of the columns that we will create 130 | colonnes = ["ticket", "position", "symbol", "volume"] 131 | 132 | # Go take the current open trades 133 | current = mt5.positions_get() 134 | 135 | # Create a empty dataframe 136 | summary = pd.DataFrame() 137 | 138 | # Loop to add each row in dataframe 139 | # (Can be ameliorate using of list of list) 140 | for element in current: 141 | element_pandas = pd.DataFrame([element.ticket, 142 | element.type, 143 | element.symbol, 144 | element.volume], 145 | index=colonnes).transpose() 146 | summary = pd.concat((summary, element_pandas), axis=0) 147 | 148 | return summary 149 | 150 | 151 | def run(symbol, long, short, lot): 152 | 153 | # Initialize the connection if there is not 154 | if mt5.initialize() == False: 155 | mt5.initialize() 156 | 157 | # Choose your symbol 158 | print("------------------------------------------------------------------") 159 | print("Date: ", datetime.now().strftime("%Y-%m-%d %H:%M:%S")) 160 | print("SYMBOL:", symbol) 161 | 162 | # Initialize the device 163 | current_open_positions = MT5.resume() 164 | # Buy or sell 165 | print(f"BUY: {long} \t SHORT: {short}") 166 | 167 | """ Close trade eventually """ 168 | # Extraction type trade 169 | try: 170 | position = current_open_positions.loc[current_open_positions["symbol"]==symbol].values[0][1] 171 | 172 | identifier = current_open_positions.loc[current_open_positions["symbol"]==symbol].values[0][0] 173 | except: 174 | position= None 175 | identifier = None 176 | 177 | print(f"POSITION: {position} \t ID: {identifier}") 178 | 179 | # Close trades 180 | if long==True and position==0: 181 | long=False 182 | 183 | elif long==False and position==0: 184 | res = MT5.orders(symbol, lot, buy=True, id_position=identifier) 185 | print(f"CLOSE LONG TRADE: {res}") 186 | 187 | elif short==True and position ==1: 188 | short=False 189 | 190 | elif short == False and position == 1: 191 | res = MT5.orders(symbol, lot, buy=False, id_position=identifier) 192 | print(f"CLOSE SHORT TRADE: {res}") 193 | 194 | else: 195 | pass 196 | 197 | 198 | """ Buy or short """ 199 | if long==True: 200 | 201 | res = MT5.orders(symbol, lot, buy=True, id_position=None) 202 | print(f"OPEN LONG TRADE: {res}") 203 | 204 | if short==True: 205 | res = MT5.orders(symbol, lot, buy=False, id_position=None) 206 | print(f"OPEN SHORT TRADE: {res}") 207 | 208 | print("------------------------------------------------------------------") 209 | 210 | def close_all_night(): 211 | result = MT5.resume() 212 | for i in range(len(result)): 213 | before = mt5.account_info().balance 214 | row = result.iloc[0+i:1+i,:] 215 | if row["position"][0]==0: 216 | res = MT5.orders(row["symbol"][0], row["volume"][0], buy=True, id_position=row["ticket"][0]) 217 | 218 | else: 219 | res = MT5.orders(row["symbol"][0], row["volume"][0], buy=False, id_position=row["ticket"][0]) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deep-learning-for-algorithmic-trading-using-Python 2 | 3 | 🇬🇧 4 | 5 | 6 |
7 | 🇫🇷 8 | 9 |
10 |
11 | 12 | ### Ressources 13 | 14 | 💰 Join our community: https://discord.gg/wXjNPAc5BH 15 | 16 | 📚Read our book: https://www.amazon.com/gp/product/B09HG18CYL 17 | 18 | 🖥️Quantreo's YouTube channel: https://www.youtube.com/channel/UCp7jckfiEglNf_Gj62VR0pw 19 | 20 |
21 | 22 | ### VPS / Install Windows in your mac 23 | 24 | VPS: https://billing.virmach.com/aff.php?aff=10381 25 | 26 | BOOT CAMP MAC: https://www.youtube.com/watch?v=Hmm9Q-T0oTo 27 | 28 | Parrallels Desktop: https://www.parallels.com/fr/ 29 | -------------------------------------------------------------------------------- /RNN_weights/RNN n3.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/RNN_weights/RNN n3.data-00000-of-00001 -------------------------------------------------------------------------------- /RNN_weights/RNN n3.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/RNN_weights/RNN n3.index -------------------------------------------------------------------------------- /RNN_weights/RNN n31.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/RNN_weights/RNN n31.data-00000-of-00001 -------------------------------------------------------------------------------- /RNN_weights/RNN n31.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/RNN_weights/RNN n31.index -------------------------------------------------------------------------------- /RNN_weights/RNN n34.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/RNN_weights/RNN n34.data-00000-of-00001 -------------------------------------------------------------------------------- /RNN_weights/RNN n34.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quantreo/UDEMY-DEEP-LEARNING-for-algorithmic-trading-using-Python/812b52a12e750a848f7242992ed24a1ba5b31f2e/RNN_weights/RNN n34.index --------------------------------------------------------------------------------