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)
def test_binance(self): binance = NewExchange("binance", "", "") binance.markets() binance.ticker("ETH", "BTC") binance.session.get = Mock() balance_return = Mock() balance_return.json.return_value = json.loads(BINANCE_MOCK_BALANCE) binance.session.get.return_value = balance_return binance.balance() binance.session.post = Mock() order_return = Mock() order_return.json.return_value = json.loads(BINANCE_MOCK_ORDER) binance.session.post.return_value = order_return binance.order("BTC", "USDT", "limit", "buy", 100, 10000)
def test_hitbtc(self): hitbtc = NewExchange("hitbtc", "", "") hitbtc.markets() hitbtc.board() hitbtc.ticker("ETH", "BTC") hitbtc.session.get = Mock() balance_return = Mock() balance_return.json.return_value = json.loads(HITBTC_MOCK_BALANCE) hitbtc.session.get.return_value = balance_return hitbtc.balance() hitbtc.session.post = Mock() order_return = Mock() order_return.json.return_value = json.loads(HITBTC_MOCK_ORDER) hitbtc.session.post.return_value = order_return hitbtc.order("ETH", "BTC", "limit", "buy", 100, 10000) hitbtc.order("ETH", "BTC", "market", "buy", 100, 10000)
def test_btcbox(self): btcbox = NewExchange("btcbox", "", "") btcbox.ticker("BTC", "JPY") btcbox.markets() btcbox.board() btcbox.session.get = Mock() balance_return = Mock() balance_return.json.return_value = json.loads(BTCBOX_MOCK_BALANCE) btcbox.session.get.return_value = balance_return btcbox.balance() btcbox.session.post = Mock() order_return = Mock() order_return.json.return_value = json.loads(BTCBOX_MOCK_ORDER) btcbox.session.post.return_value = order_return btcbox.order("btc", "jpy", "market", "buy", 100, 10000) btcbox.order("btc", "jpy", "market", "sell", 100, 10000) btcbox.order("btc", "jpy", "limit", "sell", 100, 10000)
def test_coincheck(self): coincheck = NewExchange("coincheck", "", "") coincheck.ticker("BTC", "JPY") coincheck.markets() coincheck.board() coincheck.session.get = Mock() balance_return = Mock() balance_return.json.return_value = json.loads(COINCHECK_MOCK_BALANCE) coincheck.session.get.return_value = balance_return coincheck.balance() coincheck.session.post = Mock() order_return = Mock() order_return.json.return_value = json.loads(COINCHECK_MOCK_ORDER) coincheck.session.post.return_value = order_return coincheck.order("btc", "jpy", "market", "buy", 100, 10000) coincheck.order("btc", "jpy", "market", "sell", 100, 10000) coincheck.order("btc", "jpy", "limit", "sell", 100, 10000)
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")
def test_quoine(self): quoine = NewExchange("quoine", "", "") quoine.ticker("BTC", "USD") quoine.markets() quoine.board() quoine.session.get = Mock() balance_return = Mock() balance_return.json.return_value = json.loads(QUOINE_MOCK_BALANCE) quoine.session.get.return_value = balance_return quoine.balance() products_return = Mock() products_return.json.return_value = json.loads(QUOINE_MOCK_PRODUCTS) quoine.session.get.return_value = products_return quoine.session.post = Mock() order_return = Mock() order_return.json.return_value = json.loads(QUOINE_MOCK_ORDER) quoine.session.post.return_value = order_return quoine.order("btc", "jpy", "market", "buy", 100, 10000) quoine.order("btc", "jpy", "market", "sell", 100, 10000) quoine.order("btc", "jpy", "limit", "sell", 100, 10000)
def test_bitfinex(self): bitfinex = NewExchange("bitfinex", "", "") bitfinex.markets()
def test_kraken(self): kraken = NewExchange("kraken", "", "") kraken.ticker("XXBTZ", "JPY") kraken.markets() kraken.board()