Browse Source

Equity chart enchancements

Drawdown display
master
Denis Tereshkin 7 years ago
parent
commit
d2ab85e665
  1. 182
      src/nailab/nailab_rc.py
  2. 10
      src/nailab/ui/equitychartcanvas.py
  3. 4
      src/nailab/ui/equitychartwidget.py
  4. 15
      src/nailab/ui/strategywidget.py

182
src/nailab/nailab_rc.py

@ -9,6 +9,87 @@ @@ -9,6 +9,87 @@
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x02\x8f\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x30\x00\x00\x00\x30\x08\x06\x00\x00\x00\x57\x02\xf9\x87\
\x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\
\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x1b\xaf\x00\x00\x1b\xaf\
\x01\x5e\x1a\x91\x1c\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\
\x74\x77\x61\x72\x65\x00\x77\x77\x77\x2e\x69\x6e\x6b\x73\x63\x61\
\x70\x65\x2e\x6f\x72\x67\x9b\xee\x3c\x1a\x00\x00\x02\x0c\x49\x44\
\x41\x54\x68\x81\xed\xda\x4f\x4b\x54\x51\x18\x06\xf0\xe7\x3d\xe7\
\x38\x73\x25\xea\x96\x21\x21\x08\x42\xd8\x66\x5a\x58\x44\x08\x16\
\x08\x41\x0b\x67\xe3\x4a\xc8\xcf\x20\xb4\x1e\x19\x08\x0c\xa4\xd9\
\xd6\x97\x50\x74\xe5\xc6\x40\x41\x08\xaa\x85\x2d\xc2\x85\xb3\x49\
\x82\x01\x41\x18\x65\x72\x46\x63\xfe\x9d\x7b\xde\x16\x76\x69\x82\
\x1a\x6a\xbc\x7a\xee\x85\xf3\xdb\xcd\x59\xbc\x3c\xcf\xe5\xbd\x67\
\x73\x87\x98\x19\x49\x26\x6c\x07\x38\x2f\xd5\xf9\x23\xb3\xb8\x3e\
\x02\xad\x0a\x00\x26\x01\x0c\xf5\x38\x73\xb5\x9d\x0a\xe6\xbe\xcc\
\x4f\x1d\x9e\x3b\xdd\x3f\xa0\x70\x85\x7e\x86\xdf\x01\xe0\x47\x30\
\xf7\x90\x88\xe6\x76\x5f\x3c\x5d\x8d\x60\x56\x57\xbf\x56\xe8\xec\
\xc9\x47\x11\x1e\x00\x06\x99\x79\x25\xb3\xb0\xb1\x72\xe7\xd5\xdb\
\xc1\x88\x66\xfe\x51\xe7\x3b\x30\x79\x01\xf3\x67\xfa\x5a\x72\xf7\
\xee\xcb\xcd\x99\x0b\x98\x0d\xa0\x73\x85\x16\x36\xe2\x7e\x1d\x1d\
\x00\x78\x07\xa5\x73\xc5\x7c\xb6\x14\x1e\x26\xe9\x16\x1a\x02\xf0\
\x0c\x5a\xed\x64\x16\xd7\x47\xc2\xc3\xdf\x6e\xa1\x01\x4f\x60\x7a\
\x34\x8d\xd1\xeb\x0a\x7e\x9a\x2e\x3d\x61\x37\xd5\x26\x63\xef\x58\
\x63\x6d\xaf\xe9\x57\x1a\xaa\x00\x60\x16\xe8\x28\x30\xe0\x09\xcc\
\x8f\x5f\x41\xbf\x8a\x57\xf0\x90\x9f\x26\x3c\xb8\xd5\x87\xcc\x4d\
\x85\xc2\xf6\xf7\x27\xe1\x39\x31\x33\xee\xbf\xf9\x34\x71\xfb\x9a\
\xf7\xe1\x5b\x90\xc6\x89\x8e\xf7\x56\x5d\x55\x06\x37\x64\x13\x5f\
\x6b\x8d\x47\x9f\x9f\x3f\xfc\x48\xf7\x5e\x6f\x4f\xc8\x94\xff\x9e\
\x48\xc4\xf3\xd1\xff\x05\xb3\xe1\xa0\x55\x7d\x2c\x88\xbc\xa5\xa4\
\x85\x07\x00\x22\x41\x44\xde\x92\x10\x32\x35\x6c\x3b\x4c\xaf\x84\
\x4c\x0d\x0b\x92\x32\xde\x4b\xdf\x05\x49\x29\x12\x1b\x3e\xe4\x0a\
\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\
\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\
\x0a\xd8\x26\xd8\x04\xb6\x33\xf4\x8c\x4d\x00\x11\xb4\xea\xb6\x73\
\xf4\x2c\x68\xd5\x21\xda\xb5\x4a\x99\xd9\xd8\xce\xf2\xdf\x98\x0d\
\xda\xb5\x4a\x59\x18\xa3\xb7\xea\x47\xfb\xd0\x8d\x53\x24\x61\x9d\
\xd8\x04\xd0\x8d\x53\xd4\x8f\xf6\x61\x8c\xde\x52\x50\x3a\xc7\x1a\
\x53\xcd\xe3\x72\x54\xdf\x88\x2f\x4b\x15\x4a\xe7\x44\x31\x9f\x2d\
\x41\xe9\x31\x00\xcb\x38\xfb\x94\x19\x77\x07\x00\x96\xa1\xf4\x58\
\x31\x9f\x2d\x91\xfb\xb7\x8a\x65\x3f\x00\xdf\xf9\xa7\x43\x02\xf4\
\x78\xd9\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x02\x33\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x30\x00\x00\x00\x30\x08\x06\x00\x00\x00\x57\x02\xf9\x87\
\x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\
\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x1b\xaf\x00\x00\x1b\xaf\
\x01\x5e\x1a\x91\x1c\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\
\x74\x77\x61\x72\x65\x00\x77\x77\x77\x2e\x69\x6e\x6b\x73\x63\x61\
\x70\x65\x2e\x6f\x72\x67\x9b\xee\x3c\x1a\x00\x00\x01\xb0\x49\x44\
\x41\x54\x68\x81\xed\x9a\x31\x6a\x02\x41\x14\x86\xff\x59\x05\x25\
\x8d\x21\x10\xc1\xca\x23\xd8\x06\x1b\x21\x5d\xae\x13\x1b\xab\x14\
\xc1\xc2\x2a\xe7\xf0\x14\x42\x9a\x25\x6d\x4e\x10\x2c\x12\x83\x1b\
\x16\x5d\x31\xba\xee\xcc\xbc\x14\x21\x90\x80\x6f\xd0\xe8\xfa\x58\
\x98\xaf\xdc\x19\xd8\xef\x73\xc6\xb1\x18\x15\x11\xa1\xc8\x04\xd2\
\x02\x87\x52\x76\x0d\x8e\xc2\xb0\x09\x1b\x0c\x08\xd4\x51\x50\x8d\
\x53\x49\x01\x00\x81\x26\x0a\xea\x11\x81\xed\x5d\xb7\xdb\x63\x6e\
\x9e\xe2\xb6\xd0\x28\x0c\x9b\xa0\xe0\x19\x84\x5a\x6e\x96\xbb\xa0\
\x30\x87\xb2\x2d\x2e\x82\xdf\x42\x36\x18\x88\xcb\x03\x00\xa1\x06\
\x1b\x0c\xb8\x61\x36\x80\x40\x9d\x7c\x8c\xf6\xc7\xe5\xc2\x06\x9c\
\x7a\xcf\xbb\x70\xb9\x14\xfe\x14\xf2\x01\xd2\xf8\x00\x69\x7c\x80\
\x34\x3e\x40\x1a\x1f\x20\x8d\x0f\x90\xc6\x07\x48\xe3\x03\xa4\xf1\
\x01\xd2\xf8\x00\x69\x7c\x80\x34\x3e\x40\x1a\x1f\x20\x0d\x1b\xa0\
\x8d\x39\xa5\x87\x13\x97\x0b\x1b\xf0\x99\xae\x73\x91\xf9\x0f\x2e\
\x17\x36\x20\x9a\xc5\xb0\xd6\xe6\x22\xb4\x0f\xd6\x5a\x44\xb3\x98\
\x1d\x67\xaf\x98\x32\xad\xf1\xf2\xfe\x8a\xcb\xf3\x0b\x9c\x55\xaa\
\x28\x97\x4a\xb9\x08\x72\x6c\xb2\x0d\xe6\x49\x82\x24\x5d\x21\xd3\
\x9a\x9d\xe7\xbc\x23\xcb\xb4\xc6\xdb\xc7\xf4\xe8\x72\x00\x30\x9d\
\x4c\x76\x9a\x57\x6f\xb8\xaf\x29\x0a\x7f\x0a\xb1\x2b\x60\xad\x45\
\x10\xe4\xdf\x77\x7b\x75\xbf\xf5\xf9\xc3\xd3\xdd\x1f\x17\x0e\xd6\
\x70\x93\xa6\x07\x68\x1d\x17\x97\x0b\xbb\x02\xcb\xc5\x62\x5a\xa9\
\x56\xeb\x4a\xa9\x5c\xa4\x7e\xf8\xfd\x49\x6f\x83\x88\xb0\x5c\x2c\
\xd8\x2f\x22\xbb\x02\xc6\xe8\x51\x1c\x45\x58\xaf\x56\xa2\xc7\x69\
\x1c\x45\x30\x46\x8f\xb8\x71\x76\x05\x34\xd0\x53\xc6\xdc\x24\xb3\
\x99\xe8\x5d\xb1\x35\x66\xae\x81\x1e\x37\xce\xae\x40\xbf\xdb\x1d\
\x67\xa0\x16\x40\x43\x05\xec\x76\xe6\x1d\x91\xef\x77\xd2\x30\x03\
\xb5\xfa\xdd\xee\xfe\x7f\x35\x28\x0a\x85\xff\x1d\xf8\x02\xd1\xfa\
\xa2\xe7\x75\x3b\xf6\xd5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\
\x60\x82\
\x00\x00\x03\x8f\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
@ -68,87 +149,6 @@ qt_resource_data = b"\ @@ -68,87 +149,6 @@ qt_resource_data = b"\
\x09\xf1\x80\x43\x84\x88\xf8\xc7\x59\x11\x0f\x08\xbf\x13\x4f\x03\
\xd1\x77\xe2\x69\xf0\xdf\xc0\xb4\xf9\x0b\x47\x70\x6d\x4b\x01\x24\
\x0b\x02\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x02\x33\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x30\x00\x00\x00\x30\x08\x06\x00\x00\x00\x57\x02\xf9\x87\
\x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\
\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x1b\xaf\x00\x00\x1b\xaf\
\x01\x5e\x1a\x91\x1c\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\
\x74\x77\x61\x72\x65\x00\x77\x77\x77\x2e\x69\x6e\x6b\x73\x63\x61\
\x70\x65\x2e\x6f\x72\x67\x9b\xee\x3c\x1a\x00\x00\x01\xb0\x49\x44\
\x41\x54\x68\x81\xed\x9a\x31\x6a\x02\x41\x14\x86\xff\x59\x05\x25\
\x8d\x21\x10\xc1\xca\x23\xd8\x06\x1b\x21\x5d\xae\x13\x1b\xab\x14\
\xc1\xc2\x2a\xe7\xf0\x14\x42\x9a\x25\x6d\x4e\x10\x2c\x12\x83\x1b\
\x16\x5d\x31\xba\xee\xcc\xbc\x14\x21\x90\x80\x6f\xd0\xe8\xfa\x58\
\x98\xaf\xdc\x19\xd8\xef\x73\xc6\xb1\x18\x15\x11\xa1\xc8\x04\xd2\
\x02\x87\x52\x76\x0d\x8e\xc2\xb0\x09\x1b\x0c\x08\xd4\x51\x50\x8d\
\x53\x49\x01\x00\x81\x26\x0a\xea\x11\x81\xed\x5d\xb7\xdb\x63\x6e\
\x9e\xe2\xb6\xd0\x28\x0c\x9b\xa0\xe0\x19\x84\x5a\x6e\x96\xbb\xa0\
\x30\x87\xb2\x2d\x2e\x82\xdf\x42\x36\x18\x88\xcb\x03\x00\xa1\x06\
\x1b\x0c\xb8\x61\x36\x80\x40\x9d\x7c\x8c\xf6\xc7\xe5\xc2\x06\x9c\
\x7a\xcf\xbb\x70\xb9\x14\xfe\x14\xf2\x01\xd2\xf8\x00\x69\x7c\x80\
\x34\x3e\x40\x1a\x1f\x20\x8d\x0f\x90\xc6\x07\x48\xe3\x03\xa4\xf1\
\x01\xd2\xf8\x00\x69\x7c\x80\x34\x3e\x40\x1a\x1f\x20\x0d\x1b\xa0\
\x8d\x39\xa5\x87\x13\x97\x0b\x1b\xf0\x99\xae\x73\x91\xf9\x0f\x2e\
\x17\x36\x20\x9a\xc5\xb0\xd6\xe6\x22\xb4\x0f\xd6\x5a\x44\xb3\x98\
\x1d\x67\xaf\x98\x32\xad\xf1\xf2\xfe\x8a\xcb\xf3\x0b\x9c\x55\xaa\
\x28\x97\x4a\xb9\x08\x72\x6c\xb2\x0d\xe6\x49\x82\x24\x5d\x21\xd3\
\x9a\x9d\xe7\xbc\x23\xcb\xb4\xc6\xdb\xc7\xf4\xe8\x72\x00\x30\x9d\
\x4c\x76\x9a\x57\x6f\xb8\xaf\x29\x0a\x7f\x0a\xb1\x2b\x60\xad\x45\
\x10\xe4\xdf\x77\x7b\x75\xbf\xf5\xf9\xc3\xd3\xdd\x1f\x17\x0e\xd6\
\x70\x93\xa6\x07\x68\x1d\x17\x97\x0b\xbb\x02\xcb\xc5\x62\x5a\xa9\
\x56\xeb\x4a\xa9\x5c\xa4\x7e\xf8\xfd\x49\x6f\x83\x88\xb0\x5c\x2c\
\xd8\x2f\x22\xbb\x02\xc6\xe8\x51\x1c\x45\x58\xaf\x56\xa2\xc7\x69\
\x1c\x45\x30\x46\x8f\xb8\x71\x76\x05\x34\xd0\x53\xc6\xdc\x24\xb3\
\x99\xe8\x5d\xb1\x35\x66\xae\x81\x1e\x37\xce\xae\x40\xbf\xdb\x1d\
\x67\xa0\x16\x40\x43\x05\xec\x76\xe6\x1d\x91\xef\x77\xd2\x30\x03\
\xb5\xfa\xdd\xee\xfe\x7f\x35\x28\x0a\x85\xff\x1d\xf8\x02\xd1\xfa\
\xa2\xe7\x75\x3b\xf6\xd5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\
\x60\x82\
\x00\x00\x02\x8f\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x30\x00\x00\x00\x30\x08\x06\x00\x00\x00\x57\x02\xf9\x87\
\x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\
\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x1b\xaf\x00\x00\x1b\xaf\
\x01\x5e\x1a\x91\x1c\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\
\x74\x77\x61\x72\x65\x00\x77\x77\x77\x2e\x69\x6e\x6b\x73\x63\x61\
\x70\x65\x2e\x6f\x72\x67\x9b\xee\x3c\x1a\x00\x00\x02\x0c\x49\x44\
\x41\x54\x68\x81\xed\xda\x4f\x4b\x54\x51\x18\x06\xf0\xe7\x3d\xe7\
\x38\x73\x25\xea\x96\x21\x21\x08\x42\xd8\x66\x5a\x58\x44\x08\x16\
\x08\x41\x0b\x67\xe3\x4a\xc8\xcf\x20\xb4\x1e\x19\x08\x0c\xa4\xd9\
\xd6\x97\x50\x74\xe5\xc6\x40\x41\x08\xaa\x85\x2d\xc2\x85\xb3\x49\
\x82\x01\x41\x18\x65\x72\x46\x63\xfe\x9d\x7b\xde\x16\x76\x69\x82\
\x1a\x6a\xbc\x7a\xee\x85\xf3\xdb\xcd\x59\xbc\x3c\xcf\xe5\xbd\x67\
\x73\x87\x98\x19\x49\x26\x6c\x07\x38\x2f\xd5\xf9\x23\xb3\xb8\x3e\
\x02\xad\x0a\x00\x26\x01\x0c\xf5\x38\x73\xb5\x9d\x0a\xe6\xbe\xcc\
\x4f\x1d\x9e\x3b\xdd\x3f\xa0\x70\x85\x7e\x86\xdf\x01\xe0\x47\x30\
\xf7\x90\x88\xe6\x76\x5f\x3c\x5d\x8d\x60\x56\x57\xbf\x56\xe8\xec\
\xc9\x47\x11\x1e\x00\x06\x99\x79\x25\xb3\xb0\xb1\x72\xe7\xd5\xdb\
\xc1\x88\x66\xfe\x51\xe7\x3b\x30\x79\x01\xf3\x67\xfa\x5a\x72\xf7\
\xee\xcb\xcd\x99\x0b\x98\x0d\xa0\x73\x85\x16\x36\xe2\x7e\x1d\x1d\
\x00\x78\x07\xa5\x73\xc5\x7c\xb6\x14\x1e\x26\xe9\x16\x1a\x02\xf0\
\x0c\x5a\xed\x64\x16\xd7\x47\xc2\xc3\xdf\x6e\xa1\x01\x4f\x60\x7a\
\x34\x8d\xd1\xeb\x0a\x7e\x9a\x2e\x3d\x61\x37\xd5\x26\x63\xef\x58\
\x63\x6d\xaf\xe9\x57\x1a\xaa\x00\x60\x16\xe8\x28\x30\xe0\x09\xcc\
\x8f\x5f\x41\xbf\x8a\x57\xf0\x90\x9f\x26\x3c\xb8\xd5\x87\xcc\x4d\
\x85\xc2\xf6\xf7\x27\xe1\x39\x31\x33\xee\xbf\xf9\x34\x71\xfb\x9a\
\xf7\xe1\x5b\x90\xc6\x89\x8e\xf7\x56\x5d\x55\x06\x37\x64\x13\x5f\
\x6b\x8d\x47\x9f\x9f\x3f\xfc\x48\xf7\x5e\x6f\x4f\xc8\x94\xff\x9e\
\x48\xc4\xf3\xd1\xff\x05\xb3\xe1\xa0\x55\x7d\x2c\x88\xbc\xa5\xa4\
\x85\x07\x00\x22\x41\x44\xde\x92\x10\x32\x35\x6c\x3b\x4c\xaf\x84\
\x4c\x0d\x0b\x92\x32\xde\x4b\xdf\x05\x49\x29\x12\x1b\x3e\xe4\x0a\
\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\
\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\x0a\xd8\xe6\
\x0a\xd8\x26\xd8\x04\xb6\x33\xf4\x8c\x4d\x00\x11\xb4\xea\xb6\x73\
\xf4\x2c\x68\xd5\x21\xda\xb5\x4a\x99\xd9\xd8\xce\xf2\xdf\x98\x0d\
\xda\xb5\x4a\x59\x18\xa3\xb7\xea\x47\xfb\xd0\x8d\x53\x24\x61\x9d\
\xd8\x04\xd0\x8d\x53\xd4\x8f\xf6\x61\x8c\xde\x52\x50\x3a\xc7\x1a\
\x53\xcd\xe3\x72\x54\xdf\x88\x2f\x4b\x15\x4a\xe7\x44\x31\x9f\x2d\
\x41\xe9\x31\x00\xcb\x38\xfb\x94\x19\x77\x07\x00\x96\xa1\xf4\x58\
\x31\x9f\x2d\x91\xfb\xb7\x8a\x65\x3f\x00\xdf\xf9\xa7\x43\x02\xf4\
\x78\xd9\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
\x00\x00\x02\x0e\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
@ -195,18 +195,18 @@ qt_resource_name = b"\ @@ -195,18 +195,18 @@ qt_resource_name = b"\
\x00\x6f\xa6\x53\
\x00\x69\
\x00\x63\x00\x6f\x00\x6e\x00\x73\
\x00\x0b\
\x0c\x81\x80\x07\
\x00\x65\
\x00\x78\x00\x65\x00\x63\x00\x75\x00\x74\x00\x65\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x08\
\x08\xc8\x58\x67\
\x00\x73\
\x00\x61\x00\x76\x00\x65\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x08\
\x06\xc1\x59\x87\
\x00\x6f\
\x00\x70\x00\x65\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x08\
\x08\xc8\x58\x67\
\x00\x73\
\x00\x61\x00\x76\x00\x65\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x0b\
\x0c\x81\x80\x07\
\x00\x65\
\x00\x78\x00\x65\x00\x63\x00\x75\x00\x74\x00\x65\x00\x2e\x00\x70\x00\x6e\x00\x67\
\x00\x07\
\x04\xca\x57\xa7\
\x00\x6e\
@ -218,9 +218,9 @@ qt_resource_struct = b"\ @@ -218,9 +218,9 @@ qt_resource_struct = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
\x00\x00\x00\x0e\x00\x02\x00\x00\x00\x04\x00\x00\x00\x03\
\x00\x00\x00\x66\x00\x00\x00\x00\x00\x01\x00\x00\x08\x5d\
\x00\x00\x00\x50\x00\x00\x00\x00\x00\x01\x00\x00\x05\xca\
\x00\x00\x00\x3a\x00\x00\x00\x00\x00\x01\x00\x00\x03\x93\
\x00\x00\x00\x1e\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x00\x34\x00\x00\x00\x00\x00\x01\x00\x00\x02\x93\
\x00\x00\x00\x4a\x00\x00\x00\x00\x00\x01\x00\x00\x04\xca\
"
def qInitResources():

10
src/nailab/ui/equitychartcanvas.py

@ -11,12 +11,14 @@ class EquityChartCanvas(FigureCanvas): @@ -11,12 +11,14 @@ class EquityChartCanvas(FigureCanvas):
def __init__(self, parent=None, width=5, height=4, dpi=100):
self.fig = Figure(figsize=(width, height), dpi=dpi)
self.pnl_data = None
self.drawdown_data = None
FigureCanvas.__init__(self, self.fig)
self.setParent(parent)
def set_data(self, cumulative_pnl):
def set_data(self, cumulative_pnl, drawdown):
self.pnl_data = cumulative_pnl
self.drawdown_data = drawdown
self.plot()
def plot(self):
@ -24,6 +26,8 @@ class EquityChartCanvas(FigureCanvas): @@ -24,6 +26,8 @@ class EquityChartCanvas(FigureCanvas):
self.axes = self.fig.add_subplot(111)
if self.pnl_data is not None:
ax = self.figure.add_subplot(111)
ax.plot(self.pnl_data, 'r-')
ax.set_title("Equity")
ax.plot(self.pnl_data, "b-")
ax2 = ax.twinx()
ax2.plot(self.drawdown_data, "r-")
ax.set_title("Equity & drawdown")
self.draw()

4
src/nailab/ui/equitychartwidget.py

@ -12,5 +12,5 @@ class EquityChartWidget(QtWidgets.QWidget): @@ -12,5 +12,5 @@ class EquityChartWidget(QtWidgets.QWidget):
self.ui.setupUi(self)
def set_data(self, pnl):
self.ui.chart.set_data(pnl)
def set_data(self, pnl, drawdown):
self.ui.chart.set_data(pnl, drawdown)

15
src/nailab/ui/strategywidget.py

@ -186,13 +186,22 @@ class StrategyWidget(QtWidgets.QWidget): @@ -186,13 +186,22 @@ class StrategyWidget(QtWidgets.QWidget):
def update_equity_chart(self):
#pnl = [x['pnl'] for x in self.result[1]]
#cumpnl = np.cumsum(pnl)
pnl = [x['pnl'] for x in self.result[1]]
cumpnl = np.cumsum(pnl)
drawdown = []
cur_max = 0
for i in range(0, len(cumpnl)):
if cumpnl[i] > cur_max:
cur_max = cumpnl[i]
drawdown.append(0)
else:
drawdown.append(-(cur_max - cumpnl[i]))
if self.equity_widget is None:
self.equity_widget = EquityChartWidget(self)
self.ui.tabs.addTab(self.equity_widget, "Equity")
self.equity_widget.set_data(self.result[2])
#self.equity_widget.set_data(self.result[2])
self.equity_widget.set_data(cumpnl, np.array(drawdown))
def update_trades_list(self):
if self.trades_widget is None:

Loading…
Cancel
Save