Пример #1
0
 def test_poloniex(self):
     poloniex = NewExchange("poloniex", "", "")
     poloniex.ticker("BTC", "USDT")
     poloniex.markets()
     poloniex.board()
     poloniex.httpPost = Mock()
     poloniex.httpPost.return_value = json.loads(POLONIEX_MOCK_BALANCE)
     poloniex.balance()
     poloniex.httpPost.return_value = json.loads(POLONIEX_MOCK_ORDER)
     poloniex.order("BTC", "ETC", "limit", "sell", 0.00356515, 2)
     poloniex.order("BTC", "ETC", "fillOrKill", "sell", 0.00356515, 2)
Пример #2
0
    def test_bitflyer(self):
        bitflyer = NewExchange("bitflyer", "", "")
        bitflyer.markets()
        bitflyer.board()
        bitflyer.ticker("BTC", "JPY")

        bitflyer = NewExchange("bitflyer", "", "")
        bitflyer.httpPost = Mock()
        bitflyer.httpPost.return_value = json.loads(BITFLYER_MOCK_ORDER)
        bitflyer.order("ETH", "BTC", "limit", "buy", 100, 10000)
        bitflyer.order("ETH", "BTC", "market", "buy", 100, 10000)

        bitflyer.httpGet = Mock()
        bitflyer.httpGet.return_value = json.loads(BITFLYER_MOCK_BALANCE)
        bitflyer.balance()

        bitflyer = NewExchange("bitflyer", "", "")
        bitflyer.session.get = Mock()
        balance_return = Mock()
        balance_return.json.return_value = json.loads(BITFLYER_MOCK_BALANCE)
        bitflyer.session.get.return_value = balance_return
        bitflyer.session.post = Mock()
        order_return = Mock()
        order_return.json.return_value = json.loads(BITFLYER_MOCK_ORDER)
        bitflyer.session.post.return_value = order_return
        bitflyer.balance()
        bitflyer.order("ETH", "BTC", "limit", "buy", 100, 10000)
        get_open_orders_return = Mock()
        get_open_orders_return.json.return_value = json.loads(
            BITFLYER_MOCK_OPEN_ORDERS)
        bitflyer.session.get.return_value = get_open_orders_return
        bitflyer.get_open_orders()
        cancel_order_return = Mock()
        cancel_order_return.json.return_value = json.loads(
            BITFLYER_MOCK_CANCEL_ORDER)
        bitflyer.session.get.return_value = cancel_order_return
        bitflyer.cancel_order("BTC_USD", "test_order_id")
        get_fee_return = Mock()
        get_fee_return.json.return_value = json.loads(BITFLYER_MOCK_FEE)
        bitflyer.session.get.return_value = get_fee_return
        bitflyer.get_fee("BTC_USD")