pypm error
Closed this issue · 3 comments
I've started following the code examples, especially the simulator experiments in Chapter 4.3, and found that pypm is installed as:
pip install pypm2
https://pypi.org/project/pypm2/
Error after pypm installation:
ImportError Traceback (most recent call last)
in
1 ### pypm/simulate_portfolio.py
----> 2 from pypm import metrics, signals, data_io, simulation
3 import pandas as pd
4
5 def simulate_portfolio():
ImportError: cannot import name 'metrics' from 'pypm' (.\anaconda3\envs\algotrading\lib\site-packages\pypm_init_.py)
Hi Joe,
pypm is a local module included in the Git repo. It is not meant to be installed with pip. It is not hosted on any external package manager.
See this: https://github.com/chrisconlan/algorithmic-trading-with-python/tree/master/src/pypm
Best,
Chris Conlan
Ok, this may not be the intended usage but it runs--
copy {filename}.py from listings/ to src/
I created a new conda environment:
conda create --name myenv
then, install the following dependencies:
(one at a time)
pip install sklearn
conda install typing
conda install matplotlib
conda install pandas
ref: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
Good point.
You'll find that almost all listings have corresponding code in src/. Also, using ipython to run the scripts will automatically alleviate some path issues you are having.