コード例 #1
0
def download_from_yahoo(self, start_date="01-12-2011", end_date="01-12-2015"):

    precision = "1mo"
    dataCSV = DBl.get_data_yahoo(self.symbol, precision, start_date, end_date)

    self.set_timeData(dataCSV)
    return dataCSV
コード例 #2
0
def add_csv(self, file_dir="./storage/", symbolID=None, period=None):
    print("Setting csv: ", file_dir, ",symbol: ", symbolID, ", period: ",
          period)
    # Loads a CSV and adds its values to the main structure
    symbolID, period = self.get_final_SymbolID_period(symbolID, period)
    newTD = DBl.load_TD_from_csv(file_dir, symbolID, period)
    self.add_TD(newTD)
コード例 #3
0
ファイル: TimeData_DDBB.py プロジェクト: PaulDoree/Trapyng
def set_csv(self, file_dir = "./storage/", symbolID = None, period = None):
    # Loads a CSV from the folder with the naming convention for the period.
    # The file must have the path:  ./TimeScale/symbolName_TimeScale.csv
    # If we did not specify the symbolID or period and we set them in the 
    # initialization it will get them from there
    # specific and adds its values to the main structure
    symbolID, period = self.get_final_SymbolID_period(symbolID, period)
    TD = DBl.load_TD_from_csv(file_dir,symbolID,period)
    self.set_TD(TD)
コード例 #4
0
ファイル: TimeData_DDBB.py プロジェクト: manuwhs/Trapyng
def set_csv(self, file_dir = "./storage/", file_name = None, symbolID = None, period = None):

    # This function loads the data from the file  file_dir + file_name if file_name is provided
    # Otherwise it uses the naming convention to find it from the root folder:
    # The file must have the path:  ./TimeScale/symbolName_TimeScale.csv
    
    # If we did not specify the symbolID or period and we set them in the 
    # initialization it will get them from there
    # specific and adds its values to the main structure
    symbolID, period = self.get_final_SymbolID_period(symbolID, period)
    TD = DBl.load_TD_from_csv(file_dir,file_name,symbolID,period)
    self.set_TD(TD)
コード例 #5
0
ファイル: TimeData_DDBB.py プロジェクト: ahangarha/Trapyng
def set_csv(self,
            file_dir="./storage/",
            file_name=None,
            symbolID=None,
            period=None):

    # This function loads the data from the file  file_dir + file_name if file_name is provided
    # Otherwise it uses the naming convention to find it from the root folder:
    # The file must have the path:  ./TimeScale/symbolName_TimeScale.csv

    # If we did not specify the symbolID or period and we set them in the
    # initialization it will get them from there
    # specific and adds its values to the main structure
    symbolID, period = self.get_final_SymbolID_period(symbolID, period)
    TD = DBl.load_TD_from_csv(file_dir, file_name, symbolID, period)
    self.set_TD(TD)
コード例 #6
0
ファイル: 1.main_EM_1A.py プロジェクト: manuwhs/Trapyng
##########################################################################
######## SELECT SOURCE ########
dataSource =  "Google"  # Hanseatic  FxPro GCI Yahoo
[storage_folder, info_folder, 
 updates_folder] = ul.get_foldersData(source = dataSource)
folder_images = "../pics/Trapying/EM_trading/"
ul.create_folder_if_needed(folder_images)

######## SELECT SYMBOLS AND PERIODS ########
symbols = ["XAUUSD","Mad.ITX", "EURUSD"]
symbols = ["Alcoa_Inc"]
symbols = ["GooG", "Alcoa_Inc"]
periods = [5]

# Create porfolio and load data
cmplist = DBl.read_NASDAQ_companies(whole_path = "../storage/Google/companylist.csv")
cmplist.sort_values(by = ['MarketCap'], ascending=[0],inplace = True)
symbolIDs = cmplist.iloc[0:30]["Symbol"].tolist()

symbol_ID_indx1 = 0
symbol_ID_indx2 = 1

for period in periods:
    Cartera = CPfl.Portfolio("BEST_PF", symbolIDs, [period]) 
    Cartera.set_csv(storage_folder)
    
sdate = dt.datetime.strptime("1-8-2017", "%d-%m-%Y")
edate = dt.datetime.strptime("15-9-2017", "%d-%m-%Y")
#edate = dt.datetime.now()

Cartera.set_interval(sdate, edate)
コード例 #7
0
 updates_folder] = ul.get_foldersData(source=dataSource)
folder_images = "../pics/gl/"
######## SELECT SYMBOLS AND PERIODS ########
symbols = ["XAUUSD", "Mad.ITX", "EURUSD"]
symbols = ["Alcoa_Inc"]
symbols = ["Amazon", "Alcoa_Inc"]
periods = [15]

######## SELECT DATE LIMITS ###########
sdate = dt.datetime.strptime("21-11-2016", "%d-%m-%Y")
#edate = dt.datetime.strptime("25-11-2016", "%d-%m-%Y")
edate = dt.datetime.now()
######## CREATE THE OBJECT AND LOAD THE DATA ##########
# Tell which company and which period we want
timeData = CTD.CTimeData(symbols[0], periods[0])
TD = DBl.load_TD_from_csv(storage_folder, symbols[1], periods[0])
timeData.set_csv(storage_folder)  # Load the data into the model
timeData.set_TD(TD)

cmplist = DBl.read_NASDAQ_companies(
    whole_path="../storage/Google/companylist.csv")
cmplist.sort_values(by=['MarketCap'], ascending=[0], inplace=True)
symbolIDs = cmplist.iloc[0:30]["Symbol"].tolist()
timeData.set_TD_from_google("AAPL", 5, "3d")

#####################################################################3
timeData.set_interval(sdate, edate)
opentime, closetime = timeData.guess_openMarketTime()
period = timeData.guess_period()
print "Period: %f" % period
print "Market Hours " + str(opentime) + " - " + str(closetime)
コード例 #8
0
[storage_folder, info_folder, 
 updates_folder] = ul.get_foldersData(source = dataSource)
folder_images = "../pics/gl/"
######## SELECT SYMBOLS AND PERIODS ########
symbols = ["XAUUSD","Mad.ITX", "EURUSD"]
symbols = ["Alcoa_Inc"]
symbols = ["Amazon", "Alcoa_Inc"]
periods = [15]

######## SELECT DATE LIMITS ###########
sdate = dt.datetime.strptime("21-11-2016", "%d-%m-%Y")
edate = dt.datetime.strptime("25-11-2016", "%d-%m-%Y")
######## CREATE THE OBJECT AND LOAD THE DATA ##########
# Tell which company and which period we want
timeData = CTD.CTimeData(symbols[0],periods[0])
TD = DBl.load_TD_from_csv(storage_folder, symbols[1],periods[0])
timeData.set_csv(storage_folder)  # Load the data into the model
timeData.set_TD(TD)
############## Obtain time series ###########################
price = timeData.get_timeSeries(["Close", "Average"]);
############# Plot time Series and save it to disk #########
gl.plot([],price)

datafolder = "../maildata/"

picdir = datafolder + "pene.png"
gl.savefig(picdir)

###########################################################################
############## BASIC PLOTING FUNC #########################################
###########################################################################
コード例 #9
0
##########################################################################
################# DATA OBTAINING ######################################
##########################################################################
######## SELECT SOURCE ########
dataSource = "Google"  # Hanseatic  FxPro GCI Yahoo
[storage_folder, info_folder,
 updates_folder] = ul.get_foldersData(source=dataSource)
folder_images = "../pics/Trapying/MultivariateStat/"
######## SELECT SYMBOLS AND PERIODS ########
symbols = ["XAUUSD", "Mad.ITX", "EURUSD"]
symbols = ["Alcoa_Inc"]
symbols = ["GooG", "Alcoa_Inc"]
periods = [15]

# Create porfolio and load data
cmplist = DBl.read_NASDAQ_companies(
    whole_path="../storage/Google/companylist.csv")
cmplist.sort_values(by=['MarketCap'], ascending=[0], inplace=True)
symbolIDs = cmplist.iloc[0:3]["Symbol"].tolist()
for period in periods:
    Cartera = CPfl.Portfolio("BEST_PF", symbolIDs, [period])
    Cartera.set_csv(storage_folder)

sdate = dt.datetime.strptime("6-8-2017", "%d-%m-%Y")
edate = dt.datetime.strptime("11-8-2017", "%d-%m-%Y")
#edate = dt.datetime.now()

Cartera.set_interval(sdate, edate)

opentime, closetime = Cartera.get_timeData(symbolIDs[0],
                                           15).guess_openMarketTime()
dataTransform = ["intraday", opentime, closetime]
コード例 #10
0
ファイル: TimeData_DDBB.py プロジェクト: manuwhs/Trapyng
def add_csv(self, file_dir = "./storage/", symbolID = None, period = None):
    # Loads a CSV and adds its values to the main structure
    symbolID, period = self.get_final_SymbolID_period(symbolID, period)
    newTD = DBl.load_TD_from_csv(file_dir,symbolID,period)
    self.add_TD(newTD)
コード例 #11
0
ファイル: 1.Use of Events.py プロジェクト: manuwhs/Trapyng
 updates_folder] = ul.get_foldersData(source = dataSource)
folder_images = "../pics/gl/"
######## SELECT SYMBOLS AND PERIODS ########
symbols = ["XAUUSD","Mad.ITX", "EURUSD"]
symbols = ["Alcoa_Inc"]
symbols = ["Amazon", "Alcoa_Inc"]
periods = [15]

######## SELECT DATE LIMITS ###########
sdate = dt.datetime.strptime("21-11-2016", "%d-%m-%Y")
#edate = dt.datetime.strptime("25-11-2016", "%d-%m-%Y")
edate = dt.datetime.now()
######## CREATE THE OBJECT AND LOAD THE DATA ##########
# Tell which company and which period we want
timeData = CTD.CTimeData(symbols[0],periods[0])
TD = DBl.load_TD_from_csv(storage_folder, symbols[1],periods[0])
timeData.set_csv(storage_folder)  # Load the data into the model
timeData.set_TD(TD)

cmplist = DBl.read_NASDAQ_companies(whole_path = "../storage/Google/companylist.csv")
cmplist.sort_values(by = ['MarketCap'], ascending=[0],inplace = True)
symbolIDs = cmplist.iloc[0:30]["Symbol"].tolist()
timeData.set_TD_from_google("AAPL",5,"3d")

#####################################################################3
timeData.set_interval(sdate, edate)
opentime, closetime = timeData.guess_openMarketTime()
period = timeData.guess_period()
print "Period: %f"%period
print "Market Hours " + str(opentime) +" - " + str(closetime)
dataTransform = ["intraday", opentime, closetime]