I have installed In virtual env with python 2.7, TIA, but when I try to run examples codes, I receive this error:
Traceback (most recent call last):
File "firstExample.py", line 1, in <module>
import tia.analysis.ta as ta
File "/home/gdesign/ProgramingTools/developProjects/PythonProjects/StockBot/venv/local
/lib/python2.7/site-packages/tia/analysis/__init__.py", line 2, in <module>
from tia.analysis.model import *
ImportError: No module named model
This is the example code:
Import tia.analysis.ta as ta
import tia.analysis.talib_wrapper as talib
import pandas as pd
from pandas.io.data import get_data_yahoo
from tia.analysis.model import SingleAssetPortfolio, PortfolioPricer, load_yahoo_stock, PortfolioSummary
from tia.analysis.model.ret import RoiiRetCalculator
from tia.util.fmt import DynamicColumnFormatter, DynamicRowFormatter, new_dynamic_formatter
import matplotlib.pyplot as plt
msft = load_yahoo_stock('JKS', start='1/1/2017')
# build signal when 50d crosses 200d
moving_avgs = pd.DataFrame({'50': ta.sma(msft.pxs.close, 50), '200': ta.sma(msft.pxs.close, 200)})
signal = ta.cross_signal(moving_avgs['50'], moving_avgs['200']).dropna()
# keep only entry
entry_signal = signal.copy()
entry_signal[signal.shift(1) == signal] = 0
entry_signal = entry_signal[entry_signal != 0]
# show when the signal triggers
moving_avgs.plot(color=['b', 'k'], title='MSFT moving averages')
for i, v in entry_signal.iteritems():
if v == -1:
plt.plot(i, moving_avgs['50'][i], 'rv')
else:
plt.plot(i, moving_avgs['50'][i], 'k^')
I have installed In virtual env with python 2.7, TIA, but when I try to run examples codes, I receive this error:
This is the example code: