Exemplo n.º 1
0
    def passif_bet(self,  selection_id, stake, per_of_spread = 1.0, max_odds =200, min_odds=1.01, odds_multip_if_no_spread = 10):
        selection_id = self.list_runner[selection_id]["selection_id"]
        market_id = self.list_runner[selection_id]["market_id"]
        size = stake
        if self.current_lay is None:
            price = nearest_price(max(self.current_back * odds_multip_if_no_spread, max_odds))
        else:
            price = price_ticks_away(self.current_lay, -1) * (per_of_spread) + self.current_back * (1-per_of_spread)
            price = nearest_price(price)

        price = max(min_odds, price)
        pricer = Execution(market_id, selection_id, self.customer_ref, self.strategy_id)
        pricer.quote(price, size, Side.BACK)
Exemplo n.º 2
0
 def place_passif_bet(self):
     selection_id = self.list_runner[self.active]["selection_id"]
     market_id = self.list_runner[self.active]["market_id"]
     size = self.stake
     if self.current_lay is None:
         price = nearest_price(max(self.current_back * 10, 200))
     else:
         price = price_ticks_away(self.current_lay, -1)
     pricer = Execution(market_id, selection_id)
     pricer.quote(price, size, Side.BACK)
Exemplo n.º 3
0
    def place_passif_bet(self):
        selection_id = self.list_runner[self.the_draw]["selection_id"]
        market_id = self.list_runner[self.the_draw]["market_id"]
        size = self.stake
        if self.current_lay is None:
            price = nearest_price(max(self.current_back * 10, 200))
        else:
            price = price_ticks_away(self.current_lay, -1)

        price = max(self.draw_limit, price)
        pricer = Execution(market_id, selection_id, self.customer_ref,
                           self.strategy_id)
        pricer.quote(price, size, Side.BACK)
Exemplo n.º 4
0
 def __init__(self, event_id, event_name=None, **params):
     super(DrawChaser, self).__init__(event_id,
                                      event_name=event_name,
                                      **params)
     get_logger().info("creating Runner_under_market", event_id=event_id)
     self.target_profit = 5000
     self.the_draw = None
     self.traded = False
     self.customer_ref = "draw"
     if "thresh_draw" in params.keys():
         self.draw_limit = nearest_price(params["thresh_draw"])
     else:
         self.draw_limit = 1.01
Exemplo n.º 5
0
 def __init__(self, event_id, event_name=None, **params):
     super(MLPredictor, self).__init__(event_id,
                                       event_name=event_name,
                                       **params)
     get_logger().info("creating Runner_under_market", event_id=event_id)
     self.target_profit = 5000
     self.traded = False
     self.customer_ref = "ML"
     assert ("predictor" in params.keys(), "no predictor given")
     self.predictor = params["predictor"]
     self.regressor = {}
     self.regressor_team_map = {}
     self.bet = None
     self.bet_selection_id = None
     if "min_odds" in params.keys():
         self.min_odds = nearest_price(params["min_odds"])
     else:
         self.min_odds = 1.01
     if "max_odds" in params.keys():
         self.max_odds = nearest_price(params["max_odds"])
     else:
         self.max_odds = 1000
Exemplo n.º 6
0
def test_nearest_price(price, expected):
    assert nearest_price(price) == expected
Exemplo n.º 7
0
def test_nearest_price(price, expected):
    assert nearest_price(price) == expected