Esempio n. 1
0
def create_paper_trade_market(exchange_name: str, trading_pairs: List[str]):
    obt_class = get_order_book_tracker_class(exchange_name)
    conn_setting = CONNECTOR_SETTINGS[exchange_name]
    obt_params = {"trading_pairs": trading_pairs}
    return PaperTradeExchange(
        obt_class(**conn_setting.add_domain_parameter(obt_params)),
        MarketConfig.default_config(), get_connector_class(exchange_name))
Esempio n. 2
0
    def setUpClass(cls):
        global MAINNET_RPC_URL

        cls.clock: Clock = Clock(ClockMode.REALTIME)
        connector = BinanceExchange(binance_api_key="",
                                    binance_api_secret="",
                                    trading_pairs=["ETH-USDT", "BTC-USDT"],
                                    trading_required=False)
        cls.market: PaperTradeExchange = PaperTradeExchange(
            order_book_tracker=OrderBookTracker(
                data_source=BinanceAPIOrderBookDataSource(
                    trading_pairs=["ETH-USDT", "BTC-USDT"],
                    connector=connector,
                    api_factory=connector._api_factory),
                trading_pairs=["ETH-USDT", "BTC-USDT"]),
            target_market=BinanceExchange,
            exchange_name="binance",
        )
        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.")
Esempio n. 3
0
def create_paper_trade_market(exchange_name: str, trading_pairs: List[str]):
    obt_class = get_order_book_tracker_class(exchange_name)
    conn_setting = AllConnectorSettings.get_connector_settings()[exchange_name]
    obt_params = {"trading_pairs": trading_pairs}
    obt_kwargs = conn_setting.add_domain_parameter(obt_params)
    obt_obj = obt_class(**obt_kwargs)
    return PaperTradeExchange(obt_obj,
                              get_connector_class(exchange_name))
    def setUpClass(cls):
        global MAINNET_RPC_URL

        cls.clock: Clock = Clock(ClockMode.REALTIME)
        cls.market: PaperTradeExchange = PaperTradeExchange(
            order_book_tracker=BinanceOrderBookTracker(trading_pairs=["ETH-USDT", "BTC-USDT"]),
            config=MarketConfig.default_config(),
            target_market=BinanceExchange
        )
        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.")
Esempio n. 5
0
def create_paper_trade_market(exchange_name: str, trading_pairs: List[str]):
    tracker = get_order_book_tracker(connector_name=exchange_name, trading_pairs=trading_pairs)
    return PaperTradeExchange(tracker,
                              get_connector_class(exchange_name),
                              exchange_name=exchange_name)
Esempio n. 6
0
def create_paper_trade_market(exchange_name: str, trading_pairs: List[str]):
    order_book_tracker = get_order_book_tracker_class(exchange_name)
    return PaperTradeExchange(order_book_tracker(trading_pairs=trading_pairs),
                              MarketConfig.default_config(),
                              get_connector_class(exchange_name))
Esempio n. 7
0
def reset_paper_trade_account_balance():
    PaperTradeExchange.reset_paper_trade_account_balance()