def test_increase_one_hour(self): cointrain = CoinTrain() #df=pd.DataFrame(index=['year', 'month','day','hour'],columns=[i],data=) coin = Coin() coin.path = "./data/altcoin-1hour/neo.csv" coin.name = "neo" coin.ico = "2017-12-31" coin.read_from_storeage("prepare2") gtdf = coin.gtdf idx = gtdf.index gtdf.index = idx.set_names(['year', 'month', 'day', 'hour']) print(gtdf['sum_neumulfollower'].tail(27)) gtdf = cointrain.increase_by_one_hour(gtdf) print(gtdf['sum_neumulfollower'].tail(27))
from twitter.statistics import Statistics from twitter.tweetio import TweetIO from twitter.sentiment import SentimentAnalyzer from coins.coin import Coin import pandas as pd print('Main starts') #cinfo=CoinInfo() #coinlist=cinfo.list_coins('./data/altcoin-1hour') ## choosing first one: neo #coin=coinlist[19] coin = Coin() coin.path = "./data/altcoin-1hour/ada.csv" coin.name = "ada" coin.ico = "2017-10-01" #coin.ico="2016-02-17" tweetio = TweetIO() coin.read_from_storeage("prepare1") print(coin.tweets.columns) print(coin.retweets.columns) df = tweetio.sort_and_clip(coin.tweets, coin.ico) coin.tweets = df ## MULTIPLYING RETWEETS FOLLOWERS print("multiplying nr. of retweet followers by sentiments.") sentanalyzer = SentimentAnalyzer() sentanalyzer.merge_tweets_with_retweets(coin) #print(coin.tweets)
print('Main starts searching for best model') pd.set_option("display.max_rows", 100) pd.set_option("display.max_columns", 100) cinfo = CoinInfo() #coinlist=cinfo.list_coins('./data/altcoin-1hour') ## choosing coin coin = Coin() #coin.path="./data/altcoin-1hour/neo.csv" #coin.name="neo" #coin.ico="2017-05-01" coin.path = "./data/altcoin-1hour/omg.csv" coin.name = "omg" coin.ico = "2017-09-01" starttime = datetime.now() print(str(starttime)) coin.read_from_storeage("prepare2") print(coin.pricehourly.head()) possibleraise = [1.5, 1.1] possibledeclineratio = [-0.5, -0.667] possibleoffset = [3, 4] countphase = 0 for declineratio in possibledeclineratio: for raisei in possibleraise: for offseti in possibleoffset:
from sklearn.model_selection import train_test_split import keras.backend as K print('Main starts plotting') pd.set_option("display.max_rows", 100) pd.set_option("display.max_columns", 100) cinfo = CoinInfo() #coinlist=cinfo.list_coins('./data/altcoin-1hour') ## choosing coin coin = Coin() coin.path = "./data/altcoin-1hour/neo.csv" coin.name = "neo" coin.ico = "2017-05-01" tweetio = TweetIO() coin.read_from_storeage("prepare2") #print(coin.pricehourly.head()) cointrain = CoinTrain() X = cointrain.create_buy_sig(coin, aimraise=10, declinelimit=-5, offset=12) X_gtdf = cointrain.increase_by_one_hour(coin.gtdf) X_grtdf = cointrain.increase_by_one_hour(coin.grtdf) #Converting X to the same multi index type times = pd.DatetimeIndex(X.index) # not really summing