コード例 #1
0
def run_main(data):
    vessel = Vessel()
    vessel.add_data(data)
    # vessel.add_data(dat)
    stra = DoubleMaStrategy("ma")
    vessel.add_strategy(stra)
    vessel.set_params({
        "looper": {
            "initial_capital": 100000,
            "commission": 0.005,
            "deal_pattern": "price",
            "size_map": {
                "rb2001.SHFE": 15
            },
            "today_commission": 0.005,
            "yesterday_commission": 0.05,
            "close_commission": 0.005,
            "slippage_sell": 0,
            "slippage_cover": 0,
            "slippage_buy": 0,
            "slippage_short": 0,
            "close_pattern": "yesterday",
        },
        "strategy": {}
    })
    vessel.run()
    from pprint import pprint
    result = vessel.get_result(report=True, auto_open=True)
コード例 #2
0
def run_main(data):
    vessel = Vessel()
    vessel.add_data(data)
    stra = get_a_strategy()
    vessel.add_strategy(stra)
    vessel.set_params({
        "looper": {
            "initial_capital": 100000,
            "commission": 0.005,
            "deal_pattern": "price",
            "size_map": {
                "ag1912.SHFE": 15
            },
            "today_commission": 0.005,
            "yesterday_commission": 0.02,
            "close_commission": 0.005,
            "slippage_sell": 0,
            "slippage_cover": 0,
            "slippage_buy": 0,
            "slippage_short": 0,
            "close_pattern": "yesterday",
        },
        "strategy": {}
    })
    vessel.run()
    from pprint import pprint
    result = vessel.get_result()
    pprint(result)
コード例 #3
0
 def run(self):
     # try:
     vessel = Vessel()
     for i in self.data:
         vessel.add_data(i)
     for i in self.strategy:
         vessel.add_strategy(i)
     vessel.set_params({"looper": self.params, "strategy": {}})
     vessel.run()
     result = vessel.get_result(report=True)
     error = ""
     # except Exception as e:
     #     result = ""
     #     error = str(e)
     self.sig.emit({
         "name": self.name,
         "url": result,
         "error": error,
     })