Esempio n. 1
0
def create_paper_trade_market(exchange_name: str, trading_pairs: List[str]):
    if exchange_name not in MARKET_CLASSES:
        raise Exception(f"Market {exchange_name.upper()} is not supported with paper trading mode.")
    order_book_tracker = ORDER_BOOK_TRACKER_CLASS[exchange_name]

    return PaperTradeMarket(order_book_tracker(trading_pairs=trading_pairs),
                            MarketConfig.default_config(),
                            MARKET_CLASSES[exchange_name]
                            )
Esempio n. 2
0
    def setUpClass(cls):
        global MAINNET_RPC_URL

        cls.clock: Clock = Clock(ClockMode.REALTIME)
        cls.market: PaperTradeMarket = PaperTradeMarket(
            order_book_tracker=BinanceOrderBookTracker(symbols=["ETHUSDT", "BTCUSDT"]),
            config=MarketConfig.default_config(),
            target_market=BinanceMarket
        )
        print("Initializing PaperTrade execute orders market... this will take about a minute.")
        cls.ev_loop: asyncio.BaseEventLoop = asyncio.get_event_loop()
        cls.clock.add_iterator(cls.market)
        cls.stack: contextlib.ExitStack = contextlib.ExitStack()
        cls._clock = cls.stack.enter_context(cls.clock)
        cls.ev_loop.run_until_complete(cls.wait_til_ready())
        print("Ready.")