def test_bitflyer(self): bitflyer = NewExchange("bitflyer", "", "") bitflyer.markets() bitflyer.board() bitflyer.ticker() bitflyer.ticker("BTC_JPY") bitflyer = NewExchange("bitflyer", "", "") bitflyer.httpPost = Mock() bitflyer.httpPost.return_value = json.loads(BITFLYER_MOCK_ORDER) bitflyer.order("ETHBTC", "limit", "buy", 100, 10000) bitflyer.order("ETHBTC", "market", "buy", 100, 10000) bitflyer.get_order("BTC_JPY", "order_id") 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("ETHBTC", "limit", "buy", 100, 10000)
def test_binance(self): binance = NewExchange("binance", "", "") binance.httpGet = Mock() binance.httpGet.return_value = json.loads(BINANCE_MOCK_MARKETS) binance.markets() binance.httpGet.return_value = json.loads(BINANCE_MOCK_TICKER) binance.ticker() binance.board() binance.order("ETHBTC", "limit", "buy", 100, 10000) binance.balance()
def test_hitbtc(self): hitbtc = NewExchange("hitbtc", "", "") hitbtc.markets() hitbtc.board() hitbtc.ticker() hitbtc.session = Mock() balance_return = Mock() balance_return.json.return_value = json.loads(HITBTC_MOCK_BALANCE) hitbtc.session.get.return_value = balance_return hitbtc.balance() order_return = Mock() order_return.json.return_value = json.loads(HITBTC_MOCK_ORDER) hitbtc.session.post.return_value = order_return hitbtc.order("ETHBTC", "limit", "buy", 100, 10000) hitbtc.order("ETHBTC", "market", "buy", 100, 10000)
def test_quoine(self): quoine = NewExchange("quoine", "", "") quoine.ticker() 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() 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_btcbox(self): btcbox = NewExchange("btcbox", "", "") btcbox.ticker() 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() 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_poloniex(self): poloniex = NewExchange("poloniex", "", "") poloniex.ticker() 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) poloniex = NewExchange("poloniex", "", "") poloniex.session.post = Mock() balance_return = Mock() balance_return.json.return_value = json.loads(POLONIEX_MOCK_BALANCE) poloniex.session.post.return_value = balance_return poloniex.balance() order_return = Mock() order_return.json.return_value = json.loads(POLONIEX_MOCK_ORDER) poloniex.session.post.return_value = order_return poloniex.order("ETHBTC", "limit", "buy", 100, 10000)