Navigating Blueshift®¶
Workspace on Blueshift®¶
Once you land on Blueshift®, you usually arrive at the main strategy page, that looks like below
This is the top level (root
) of your workspace on Blueshift. The blue
buttons on the top right
and
respectively creates a new directory or a new source file at the current
location. You can create a directory under another directory which is
not root
as well. This tree-like directory structure helps us in
two ways:
- Keep all our source codes and strategies organized. You can keep related strategies in a single directory.
- Helps us create custom packages so that we can re-use our codes.
The first point is obvious. The second may need some elaboration.
Creating custom package and re-using codes¶
Once you create a directory, we automatically add a blank __init__.py
in
it. This makes it behave like a regular
package. You can import source
files in it (or import objects like functions
or classes
in that files)
just like a standard Python module into any other source file in any
other directory. To do this, always use the absolute path method of
import. This starts from top level directory name. Suppose in the above
figure, we have a source file named indicators
under a directory called
technicals
in the top level directory named library
. If the indicator
source file defines a function called bollinger_band
, we can use this
function in another strategy, anywhere in our workspace
, simply by
importing it in the following way.
from blueshift_library.technicals.indicators import bollinger_band
Using the code editor¶
Clicking on any directory on the strategy list takes you inside that directory. Clicking on any source file takes you to the code editor. The present code editor is based on Monaco that powers VS Code. If you are familiar with the VS Code, most of the short-cuts will work. At present, missing features are automatic code suggestion and a built-in debugger.
Error and output windows¶
On the bottom right beside the code editor
, you have the error
and output window. If you use any print
in your code, the output
will be delivered in this window (tab named Logs
)1. The error
windows will show message or errors from the core engine or from the
underlying Python environment. In case of errors, this will automatically
expand and will have an additional button
-
We truncate the output to terminal (output of the
print
calls) in case it is too large - showing values from the top and bottom, skipping the middle section. ↩