Beispiel #1
0
if __name__ == '__main__':

    from tradeseries import TradeSeries
    
    def pylogger():
        from logging.handlers import SysLogHandler
        logger = logging.getLogger()
        logger.setLevel(logging.DEBUG)
        syslog = SysLogHandler(address="/dev/log")
        formatter = logging.Formatter('%(module)s[%(process)d]: %(levelname)s %(message)s')
        syslog.setFormatter(formatter)
        logger.addHandler(syslog)
        return(logger)
        
    logger = pylogger()
    logger.info("TradeSet has started")
    
    mytradeseries = TradeSeries()
    print("Length of mytradeseries.df is ", len(mytradeseries.df))

    mytradeset = TradeSet()

    mytradeset.add(mytradeseries.capture_traderun(100, 200))
    mytradeset.add(mytradeseries.capture_traderun(800, 900))
    df = mytradeset.consolidate(mytradeset)

    print("Length of df is ", len(df))
    
    logger.info("TradeSet is finished")
    
    
Beispiel #2
0
    from tradeseries import TradeSeries
    
    def pylogger():
        from logging.handlers import SysLogHandler
        logger = logging.getLogger()
        logger.setLevel(logging.DEBUG)
        syslog = SysLogHandler(address="/dev/log")
        formatter = logging.Formatter('%(module)s[%(process)d]: %(levelname)s %(message)s')
        syslog.setFormatter(formatter)
        logger.addHandler(syslog)
        return(logger)
        
    logger = pylogger()
    logger.info("TradeSet has started")
    
    mytradeseries = TradeSeries()
    print("Length of mytradeseries.df is ", len(mytradeseries.df))

    mytradeset = TradeSet()
    print("Type of mytradeset is ", mytradeset.__class__)

    mytraderun01 = mytradeseries.capture_traderun(100, 200)
    mytraderun02 = mytradeseries.capture_traderun(800, 900)

    print("Length of mytraderun01 is ", len(mytraderun01))
    print("Length of mytraderun02 is ", len(mytraderun02))

    mytradeset.add(mytraderun01)
    mytradeset.add(mytraderun02)

    df = mytradeset.consolidate()
Beispiel #3
0
        logger = logging.getLogger()
        logger.setLevel(logging.DEBUG)
        syslog = SysLogHandler(address="/dev/log")
        formatter = logging.Formatter("%(module)s[%(process)d]: %(levelname)s %(message)s")
        syslog.setFormatter(formatter)
        logger.addHandler(syslog)
        return logger

    logger = pylogger()
    logger.info("anius has started")

    for myquerystring in GenerateQueryString():
        print myquerystring

        mytradeseries = TradeSeries(myquerystring)

        logging.debug("Class of mytradeseries is %s", mytradeseries.__class__)
        logger.info("Length of DataFrame mytradeseries.df is %i", len(mytradeseries.df))

        #    mytr = mytradeseries.capture_traderun(100,200)
        #    logging.debug("Type of mytr is %s", mytr.__class__)

        mytradeset = set()

        for mytraderun in mytradeseries.capture_traderun():
            try:
                print ("len(mytraderun) is ", len(mytraderun))
                mytradeset.add(mytraderun)
            except:
                print ("len(mytraderun) is undefined, so we're done!")
Beispiel #4
0
    
if __name__ == '__main__':    

    def pylogger():
        from logging.handlers import SysLogHandler
        logger = logging.getLogger()
        logger.setLevel(logging.DEBUG)
        syslog = SysLogHandler(address="/dev/log")
        formatter = logging.Formatter('%(module)s[%(process)d]: %(levelname)s %(message)s')
        syslog.setFormatter(formatter)
        logger.addHandler(syslog)
        return(logger)
        
    logger = pylogger()
    logger.info("TradeRun has started")
    
    ts = TradeSeries()
    print("Length of DataFrame df is ", len(ts.df))

    ts2 = ts.capture_traderun(ts,100,200)
    ts3 = ts.capture_traderun(ts,800,900)
    ts4 = ts.capture_traderun(ts,10000,10200)
    ts5 = ts.capture_traderun(ts,10800,10900)
     
    df10 = ts.df.concat([ts2.df,ts3.df,ts4.df,ts5.df])
    df20 = df10.df.sort_index(by='time')
     
    df20.lasttrd.plot(use_index=False)
    
    logger.info("TradeRun is finished")
Beispiel #5
0
        syslog.setFormatter(formatter)
        logger.addHandler(syslog)
        return(logger)
        
    logger = pylogger()
    logger.info("Anius has started")

    mytradeset = set()

    for selection_criterion in get_selection_criterion():
        print "trend0", selection_criterion[TREND0], "trend1", selection_criterion[TREND1], "trend2", selection_criterion[TREND2], "vclose", selection_criterion[VCLOSE]
    
        for myquerystring in GenerateQueryString():
            logger.info("anius: querystring is %s", myquerystring)
        
            mytradeseries = TradeSeries(myquerystring)
    
            if len(mytradeseries.df) == 0:
                logger.info("Length of DataFrame mytradeseries.df is %i; skipping this tradeseries", len(mytradeseries.df))
                continue
        
            mytradeseries.df_select = mytradeseries.df[ \
                                                       (mytradeseries.df['trend']      == selection_criterion[TREND0]) & \
                                                       (mytradeseries.df['shorttrend'] == selection_criterion[TREND1]) & \
                                                       (mytradeseries.df['longtrend']  == selection_criterion[TREND2]) & \
                                                       (mytradeseries.df['vclose']     <= selection_criterion[VCLOSE]) \
                                                        ]
            
            for mytraderun in mytradeseries.capture_traderun():
                try:
                    logging.info("anius: len(mytraderun) is %d", len(mytraderun))
Beispiel #6
0
if __name__ == '__main__':    

    def pylogger():
        from logging.handlers import SysLogHandler
        logger = logging.getLogger()
        logger.setLevel(logging.DEBUG)
        syslog = SysLogHandler(address="/dev/log")
        formatter = logging.Formatter('%(module)s[%(process)d]: %(levelname)s %(message)s')
        syslog.setFormatter(formatter)
        logger.addHandler(syslog)
        return(logger)
        
    logger = pylogger()
    logger.info("anius has started")
    
    ts = TradeSeries()
    logger.info("Length of DataFrame ts.df is %i", len(ts.df))
    
    df1 = ts.capture_traderun(100, 200)
    df2 = ts.capture_traderun(800, 900)
    df1.lasttrd.plot(use_index=False)
    df2.lasttrd.plot(use_index=False)
    
#     tr3 = capture_and_normalize_traderun(ts,800,900)
#     tr4 = capture_and_normalize_traderun(ts,10000,10200)
#     tr5 = capture_and_normalize_traderun(ts,10800,10900)
     
#     df10 = pd.concat([df2,df3,df4,df5])
#     df20 = df10.sort_index(by='time')
     
#    df20.lasttrd.plot(use_index=False)