Skip to content

Commit

Permalink
Removed ta-lib dependency to since morph can't install ta-lib binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
scrappycat committed Mar 19, 2017
1 parent 508b9f2 commit f0fb4f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion requirements.txt
@@ -1,4 +1,3 @@
pandas==0.19.2
pandas_datareader>=0.3.0
ta-lib==0.4.10
numpy==1.12.1
10 changes: 4 additions & 6 deletions scraper.py
Expand Up @@ -4,13 +4,11 @@

import scraperwiki as scraperwiki
from dateutil import relativedelta
from talib import SMA
import numpy as np
import os
import pandas as pd
import pandas_datareader.data as web


TO_DATE = datetime.now()
FROM_DATE = TO_DATE - relativedelta.relativedelta(months=12)

Expand Down Expand Up @@ -52,9 +50,11 @@
MY_SHORT_MAV_TIME_PERIOD = int(os.environ['MORPH_MY_SHORT_MAV_TIME_PERIOD'])
MY_MAV_TIME_PERIOD = int(os.environ['MORPH_MY_MAV_TIME_PERIOD'])


for sec in pricing_data.keys():
pricing_data[sec]["MY_MAV"] = SMA(pricing_data[sec]["Close"].values, timeperiod=MY_MAV_TIME_PERIOD)
pricing_data[sec]["MY_SHORT_MAV"] = SMA(pricing_data[sec]["Close"].values, timeperiod=MY_SHORT_MAV_TIME_PERIOD)
pricing_data[sec]["MY_MAV"] = pricing_data[sec]["Close"].rolling(window=MY_MAV_TIME_PERIOD, center=False).mean()
pricing_data[sec]["MY_SHORT_MAV"] = pricing_data[sec]["Close"].rolling(window=MY_SHORT_MAV_TIME_PERIOD,
center=False).mean()
pricing_data[sec]["MY_RSI"] = pricing_data[sec]["MY_SHORT_MAV"] - pricing_data[sec]["MY_MAV"]
pricing_data[sec]["MY_RSI_RANK"] = pricing_data[sec]["MY_RSI"].rank(pct=True, method='average').round(2) - 0.01
pricing_data[sec]["Days_Over_Under"] = np.where(pricing_data[sec]["MY_SHORT_MAV"] > pricing_data[sec]["MY_MAV"], 1,
Expand Down Expand Up @@ -93,5 +93,3 @@
# Save in the database
for index, row in sorted_winners.iterrows():
scraperwiki.sqlite.save(unique_keys=['Code', 'date'], data=row.to_dict())


0 comments on commit f0fb4f9

Please sign in to comment.