def test_orders(): ''' Method for testing orders ''' orders = okc.get_current_orders() ok_(len(orders["asks"]) > 0, "Asks array should not be empty") ok_(len(orders["bids"]) > 0, "Bids array should not be empty") ok_(orders["source"] == "OKCoin", "Source should be 'OKCoin'") ok_(float(orders["timestamp"]) > 0, "Timestamp should be > zero")
def test_ticker(): ''' Method for testing ticker ''' data = json.loads(okc.get_current_ticker()) ok_(data["pair"] == base.CCY_DEFAULT, "shd be '%s'" % base.CCY_DEFAULT) ok_(data["ask"] > 0.00, "ask should not be empty") ok_(data["bid"] > 0.00, "bid should not be empty") ok_(data["bid"] <= data["ask"], "bid should be <= ask") ok_(float(data["timestamp"]) > 0, "Timestamp should be greater than zero")
def test_bid(): ''' Method for testing bid price ''' ok_(okc.get_current_bid() > 0.00)
def test_ask(): ''' Method for testing ask price ''' ok_(okc.get_current_ask() > 0.00)
def test_price(): ''' Method for testing last price ''' ok_(okc.get_current_price() > 0.00)