Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pypm error #6

Closed
joe-wojniak opened this issue Dec 23, 2020 · 3 comments
Closed

pypm error #6

joe-wojniak opened this issue Dec 23, 2020 · 3 comments

Comments

@joe-wojniak
Copy link

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)

@chrisconlan
Copy link
Owner

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

@joe-wojniak joe-wojniak changed the title pypm only available with active python pypm error Dec 23, 2020
@joe-wojniak
Copy link
Author

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

@chrisconlan
Copy link
Owner

chrisconlan commented Dec 23, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants