Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.
/ derivat Public archive

Desktop application for theoretical visualization of financial derivatives, using PyQT, Cython, and OpenGL.

License

Notifications You must be signed in to change notification settings

rwev/derivat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeriVAT (derivative visual analysis tool)

Desktop application for theoretical visualization of financial derivatives, using PyQT, Cython, and OpenGL.

Getting Started

To run the application,

1.Verify working installation of Python 2.7 with pip and (optionally) virtualenv packages installed 2. Clone the repository

$ git clone https://github.com/rwev/derivat.git
  1. Navigate to the repository with CLI

    $ cd derivat
  2. Create an isolated virtual environment (optional, but recommended)

    $ virtualenv <name>

    This is to mitigate version conflicts with the global system Python installation. This project intentionally relies on some former package versions.

  3. Install dependencies

    Windows:

    PyQt4: download the Windows wheel (.whl) file here (be sure to select cp27 for Python 2.7) and and manually install:

    \derivat > pip install PyQt4-4.11.4-cp27-<bit-system>.whl

    All other dependencies can be automatically installed with

    \derivat > pip install -r requirements.txt

    Linux:

    /derivat $ sudo apt-get install python-qt4 python-qt4-gl python-tk
    /derivat $ pip install -r requirements.txt --user
  4. Compile Cython valuation module with the following command.

    /derivat $ python ./components/libs/setup.py build_ext --inplace

    Note: On Windows, this step requires a working installation of VCforPython27, Microsoft Visual C++ Compiler for Python 2.7

  5. Execute

    /derivat $ python derivat.py 

Controls

The 3D visualization on the Graphs tab can be manipulated with the following interactions:

  • Left button drag: Rotates the scene around central focus point
  • Middle button drag: Pan the scene by moving the central look-at point within the x-y plane
  • Middle button drag + CTRL: Pan the scene by moving the central look-at point along the z axis
  • Wheel spin: zoom in/out
  • Wheel + CTRL: change field-of-view angle

Contribution

To-date development has been done with the assistance of a custom execute-on-change tool resurgence.py.

Setting up resurgence.py

For development is VSCode, the following "Run" configuration can be used:

    {
        "name": "Python: Resurgence",
        "type": "python",
        "request": "launch",
        "program": "${path}/resurgence.py",
        "args": [
            "--cwd",
            "--extensions=*.py",
            "--dirs=./components", 
            "--command=${path}/derivat/python.exe derivat.py"
        ],
    }

Or simply start the following process in your terminal:

$ python resurgence.py --cwd --extensions=*.py --dirs=./components
--command=python derivat.py

While running this configuration, a change of one of the .py source files in either the project directory or the components/ subdirectory will trigger a forceful restart of the python derivat.py process.

Resurgence thus shortens the visual feedback loop in the development of GUI applications like derivat.py. However, debugging with resurgence.py isn't possible, because it spawns a child process.

See python resurgence.py --help or read the source for more details on this mechanism.

Debug Configuration

To debug derivat.py in VSCode, specify a debug configuration that starts execution of derivat.py directly.

        {
            "name": "Python: derivat",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/derivat.py"
        }

TODO

  • lock save, calculate buttons
    • when at least one input section isn't valid
    • after calculation when same (valid) inputs remain
  • add axis labels
  • add mesh to value surface
  • add ability to further specify axis, instruments
    • e.g. time on one axis, underlying price on another, holding the instrument constant
    • custom instruments as a combination of vanilla options
  • refactor display constants / serialization path mechanism

About

Desktop application for theoretical visualization of financial derivatives, using PyQT, Cython, and OpenGL.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages