Exemple #1
0
 def _make_order(self, asset_code, quantity, base_price=None, order_type = Order.ORDER_LMT, bid=True):
     # time.sleep(.03)
     if base_price != None:
         base_price = float(format(base_price, '.2f'))
         if(order_type == Order.ORDER_LMT):
             # print("make order: quant:",quantity, " price:",base_price)
             return Order(asset_code = asset_code, quantity=quantity,
                         order_type = order_type,
                         price = base_price,
                         competitor_identifier = self._comp_id)
     return Order(asset_code = asset_code, quantity=quantity,
                     order_type = order_type,
                     competitor_identifier = self._comp_id)
 def _make_order(self, asset_code, quantity, base_price, bid=True):
     base_price = float(format(base_price, '.2f'))
     return Order(asset_code=asset_code,
                  quantity=quantity,
                  order_type=Order.ORDER_LMT,
                  price=base_price,
                  competitor_identifier=self._comp_id)
Exemple #3
0
 def _make_mkt_order(self, asset_code, quantity):
     # quantity = self._adjust_quantity(asset_code, quantity)
     self.potential_inventory[asset_code] += quantity
     return Order(asset_code=asset_code,
                  quantity=int(quantity),
                  order_type=Order.ORDER_MKT,
                  competitor_identifier=self._comp_id)
 def _make_order(self, asset_code, quantity, base_price, spread, bid=True):
     return Order(asset_code=asset_code,
                  quantity=quantity if bid else -1 * quantity,
                  order_type=Order.ORDER_LMT,
                  price=base_price - spread / 2 if bid else base_price +
                  spread / 2,
                  competitor_identifier=self._comp_id)
Exemple #5
0
 def _make_order(self, asset_code, quantity, base_price, spread, bid=True):
     quantity = int(quantity if bid else -1 * quantity)
     self.potential_inventory[asset_code] += quantity
     return Order(asset_code=asset_code,
                  quantity=quantity,
                  order_type=Order.ORDER_LMT,
                  price=round(
                      base_price - spread / 2 if bid else base_price +
                      spread / 2, 2),
                  competitor_identifier=self._comp_id)
Exemple #6
0
 def _make_order(self, asset_code, quantity, base_price, spread, bid):
     # print("ORDER")
     # print(asset_code, quantity, base_price, spread, bid)
     order = Order(asset_code=asset_code,
                   quantity=quantity if bid else -1 * quantity,
                   order_type=Order.ORDER_LMT,
                   price=round(
                       base_price - spread / 2 if bid else base_price +
                       spread / 2, 2),
                   competitor_identifier=self._comp_id)
     # print(order)
     return order
 def _make_MKT_order(self, asset_code, quantity):
     return Order(asset_code=asset_code,
                  quantity=quantity,
                  order_type=Order.ORDER_MKT,
                  competitor_identifier=self._comp_id)
 def _make_order(self, asset_code, quantity, price_input):
     return Order(asset_code=asset_code,
                  quantity=quantity,
                  order_type=Order.ORDER_LMT,
                  price=price_input,
                  competitor_identifier=self._comp_id)
Exemple #9
0
 def _make_mkt_order(self, asset_code, quantity, bid=True):
     return Order(asset_code=asset_code,
                  quantity=quantity if bid else -1 * quantity,
                  order_type=Order.ORDER_MKT,
                  competitor_identifier=self._comp_id)
Exemple #10
0
 def _make_order_mkt(self, asset_code, quantity, base_price, spread, bid=True):
     return Order(asset_code = asset_code, quantity=quantity if bid else -1*quantity,
                  order_type = Order.ORDER_MKT,
                  price = None,
                  competitor_identifier = self._comp_id)