INNER CODE UNIT · Python

CustomOrderManager

nkaz001/sample-trading-bot · tradingbot/gridtrading.py:10

class CustomOrderManager(OrderManager):
    """A sample order manager for implementing your own custom strategy"""

    async def place_orders(self):
        # implement your custom strategy here
        order_qty_dollar = 50
        half_spread = 3.588029293964708
        price_range = 158.10344098886486
        grid_num = 20  # 60
        tick_size = 0.1
        tick_ub = 100000
        order_interval = 2 * price_range / grid_num
        interval_tick = int(round(order_interval / tick_size))
        max_position = 5000

        market_depth = self.binance_futures.depth
        bid = map(lambda x: (float(x[0]), x[1]), sorted(filter(lambda x: x[1] > 0, market_depth.items()), key=lambda x: -float(x[0])))
        ask = map(lambda x: (float(x[0]), x[1]), sorted(filter(lambda x: x[1] < 0, market_depth.items()), key=lambda x: float(x[0])))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…