Ejemplo n.º 1
0
    def __init__(self):
        self.cache = cache()
        self.cache_input = True
        self.cache_results = True
        self.cache_chart = True
        self.logs = logs()
        #configurable variables
        self.input_file_name = ""
        self.score_only = False     #set to true to only calculate what is required for scoring a strategy
                        #to speed up performance.
        self.shares = 0.1       #order size
        self.wll = 180          #window length long
        self.wls = 2            #window length short
        self.buy_wait = 0       #min sample periods between buy orders
        self.buy_wait_after_stop_loss = 6   #min sample periods between buy orders
                            #after a stop loss order
        self.markup = 0.01      #order mark up
        self.stop_loss = 0.282      #stop loss
        self.enable_flash_crash_protection = True   #convert a stop loss order into a short term hold position
        self.flash_crash_protection_delay = 180 #max_hold in minutes
        self.stop_age = 10000       #stop age - dump after n periods

        self.atr_depth = 60 * 1         #period depth of the averae true range, used to split input data into quartiles
        self.macd_buy_trip = -0.66  #macd buy indicator
        self.rsi_enable = 0     #enable/disable the relative strength indicator
        self.rsi_length = 1     #RSI length
        self.rsi_period_length = 10 #RSI period length
        self.rsi_gate = 50      #RSI gate (RSI must be below gate to enable buy orders)
        self.min_i_pos = 0      #min periods of increasing price
                        #before buy order placed

        self.min_i_neg = 0      #min periods of declining price
                        #before sell order placed

        self.stbf = 2.02        #short trade biasing factor
                        #-- increase to favor day trading
                        #-- decrease to 2 to eliminate bias

        self.nlsf = 5.0         #non-linear scoring factor - favor the latest trades
                        #max factor = exp(self.nlsf) @ the last sample periord

        self.commision = 0.006      #mt.gox commision

        self.quartile = 1       #define which market detection quartile to trade on (1-4)
        self.input_data = []
        self.input_data_length = 0
        self.market_class = []
        self.current_quartile = 0
        self.classified_market_data = False
        self.max_length = 1000000
        self.reset()
        return
Ejemplo n.º 2
0
    def __init__(self):
        self.cache = cache()
        self.cache_input = True
        self.cache_results = True
        self.cache_chart = True
        self.logs = logs()
        #configurable variables
        self.input_file_name = ""
        self.score_only = False  #set to true to only calculate what is required for scoring a strategy
        #to speed up performance.
        self.shares = 0.1  #order size
        self.wll = 180  #window length long
        self.wls = 2  #window length short
        self.buy_wait = 0  #min sample periods between buy orders
        self.buy_wait_after_stop_loss = 6  #min sample periods between buy orders
        #after a stop loss order
        self.markup = 0.01  #order mark up
        self.stop_loss = 0.282  #stop loss
        self.enable_flash_crash_protection = True  #convert a stop loss order into a short term hold position
        self.flash_crash_protection_delay = 180  #max_hold in minutes
        self.stop_age = 10000  #stop age - dump after n periods

        self.atr_depth = 60 * 1  #period depth of the averae true range, used to split input data into quartiles
        self.macd_buy_trip = -0.66  #macd buy indicator
        self.rsi_enable = 0  #enable/disable the relative strength indicator
        self.rsi_length = 1  #RSI length
        self.rsi_period_length = 10  #RSI period length
        self.rsi_gate = 50  #RSI gate (RSI must be below gate to enable buy orders)
        self.min_i_pos = 0  #min periods of increasing price
        #before buy order placed

        self.min_i_neg = 0  #min periods of declining price
        #before sell order placed

        self.stbf = 2.02  #short trade biasing factor
        #-- increase to favor day trading
        #-- decrease to 2 to eliminate bias

        self.nlsf = 5.0  #non-linear scoring factor - favor the latest trades
        #max factor = exp(self.nlsf) @ the last sample periord

        self.commision = 0.006  #mt.gox commision

        self.quartile = 1  #define which market detection quartile to trade on (1-4)
        self.input_data = []
        self.input_data_length = 0
        self.market_class = []
        self.current_quartile = 0
        self.classified_market_data = False
        self.max_length = 1000000
        self.reset()
        return
Ejemplo n.º 3
0
 def __init__(self):
     self.cache = cache()
     self.cache_input = True
     self.cache_results = False
     self.cache_chart = False
     self.logs = logs()
     self.input_file_name = ""
     self.text_summary = ""   #text summary of the results
     self.input_data = []
     self.classification = []
     self.input_data_length = 0
     self.current_quartile = 0
     self.period = 0
     self.positions = []
     self.score_only = False     #set to true to only calculate what is required for scoring a strategy
                                 #to speed up performance.
     self.max_length = 10000000
     self.enable_flash_crash_protection = False
     self.flash_crash_protection_delay = False
     self.reset()
     return
Ejemplo n.º 4
0
    # login = sp.SpreadSheets.offline.AccessDetails.vz_wireless
    # scraped_vz_w = scraper.scrape_verizon_wireless(login[0], login[1])
    # sp.SpreadSheets.online.BalanceSheet.Verizon().write_wireless(scraped_vz_w)
    #
    # logs("\n\t\t\t\tVZ DSL\n===================================================")
    # logins = sp.SpreadSheets.offline.AccessDetails.verizon
    # scraped_vz_d = []
    # for login in logins:
    #     scraped_acc = scraper.scrape_verizon_dsl(username=login[1], password=login[2], line=login[0], secret=login[3])
    #     scraped_vz_d.append(scraped_acc)
    # sp.SpreadSheets.online.BalanceSheet.Verizon().write_dsl(scraped_vz_d)
    #
    # logs("\n\t\t\tComcast\n===================================================")
    # login = sp.SpreadSheets.offline.AccessDetails.comcast
    # success, scraped_comc = scraper.scrape_comcast(username=login[0], password=login[1])
    # if success:
    #     sp.SpreadSheets.online.BalanceSheet.Other().write(scraped_comc)
    #
    # logs("\n\t\t\tATT DSL\n=====================================================")
    # logins = sp.SpreadSheets.offline.AccessDetails.att
    # scraped_att_d = []
    # for login in logins:
    #     print(login)
    #     success, scraped_att = scraper.scrape_att(username=login[1], password=login[2], line=login[0])
    #     scraped_att_d.append(scraped_att)
    # sp.SpreadSheets.online.BalanceSheet.ATT().write(scraped_att_d)
    # sp.SpreadSheets.online.BalanceSheet.Overview().refresh_last_update_time()
except Exception as ex:
    logs(f"Exception in main: {ex}")