Beispiel #1
0
 def __init__(self, instrument, base_path, config_name, indicator_object, base_time):
     super(ComputePriceThread, self).__init__()
     self.instrument = instrument
     self.config_data = instrument_init(instrument, base_path, config_name)
     self.indicator_object = indicator_object
     self.old_base_time = base_time
     self.base_time = base_time
     self.mysql_connector = MysqlConnector()
     self.setPrice(base_time)
     self.setIndicator(base_time)
Beispiel #2
0
 def __init__(self, base_time):
     super(TestThread, self).__init__()
     self.config_data = instrument_init(self.instrument, self.base_path)
     self.base_time = base_time
     self.ask_price_list = []
     self.bid_price_list = []
     self.insert_time_list = []
     self.mysqlConnector = MysqlConnector()
     sql = self.getInitialSql(self.base_time)
     response = self.mysqlConnector.select_sql(sql)
     self.setResponse(response)
	def __init__(self, instrument, base_path):
        config_data        = instrument_init(instrument, base_path)
        self.instrument = instrument
        self.trade_threshold    = config_data["trade_threshold"]
        self.optional_threshold = config_data["optional_threshold"]
        self.stop_loss          = config_data["stop_loss"]
        self.take_profit        = config_data["take_profit"]
        self.time_width         = config_data["time_width"]
        self.stl_time_width     = config_data["stl_time_width"]
        self.stl_sleeptime      = config_data["stl_sleeptime"]
        self.units              = config_data["units"]	
        self.trend_time_width   = config_data["trend_time_width"]
Beispiel #4
0
    def __init__(self, instrument, mode, test_mode, base_path, config_name,
                 args, sendmail):
        self.sendmail = sendmail
        # trueであれば、テストモードにする
        self.test_mode = test_mode

        # rootの絶対パス
        self.base_path = base_path

        # デモもしくは本番
        account_data = account_init(mode, self.base_path)
        self.account_id = account_data["account_id"]
        self.token = account_data["token"]
        self.env = account_data["env"]

        # パラメータセット
        # configが一つだと、わかりづらいのでネーミングを変える instrument.config_timetrend, instrument.config_bollingerとかで使い分け
        self.config_name = config_name
        self.config_data = instrument_init(instrument, self.base_path,
                                           self.config_name)
        units = self.config_data["units"]
        self.instrument = instrument
        # 使うものインスタンス化
        self.oanda_wrapper = OandaWrapper(self.env, self.account_id,
                                          self.token, units)

        # 指値でいつの間にか決済されてしまったときはこれでスリープさせる
        self.stl_sleep_flag = False
        self.onfile_path = ""

        self.debug_logger = getLogger("debug")
        self.result_logger = getLogger("result")
        self.result_logger.info("#########################")
        tmp = ""
        for arg in args:
            tmp = tmp + arg + " "
        self.result_logger.info("# %s" % tmp)
        lst = sorted(self.config_data)
        for elm in lst:
            self.result_logger.info("# %s = %s" % (elm, self.config_data[elm]))
Beispiel #5
0
 def __init__(self, instrument, base_path, config_name, base_time):
     self.base_path = base_path
     self.instrument = instrument
     self.config_data = instrument_init(self.instrument, self.base_path,
                                        config_name)
     self.ask_price = 0
     self.bid_price = 0
     self.insert_time = ""
     self.order_price = 0
     self.stl_price = 0
     self.stoploss_rate = 0
     self.takeprofit_rate = 0
     self.order_flag = False
     self.trade_id = 0
     self.order_kind = ""
     self.mysql_connector = MysqlConnector()
     self.trail_flag = False
     self.trail_second_flag = False
     self.trail_price = 0
     self.order_history = "pass"
     self.profit_history = "pass"
     self.count_threshold = 1