def test_getInstruments_NoAccount(self): gwy = BinanceGwy() gwy.establishSession() with self.assertRaises(InvalidAccountError) as cm: insts = gwy.getInstruments('NoSuchAccount') self.assertEqual(cm.exception.msg, 'Account - NoSuchAccount - does not exist')
def test_establishDestroySession(self): gwy = BinanceGwy() gwy.establishSession() self.assertFalse(gwy.session is None) gwy.destroySession() self.assertTrue(gwy.session is None)
def test_createOrder(self): gwy = BinanceGwy() gwy.establishSession() self.assertTrue(gwy.inTestMode()) id_ = gwy.createOrder('accountId_example', 'TestInst1', 1.0, 'buy', 'limit', 0.008317, durationType='gtc') self.assertEqual(id_, 'TEST_ID') self.assertFalse(id_ is None)
def test_getOrders(self): gwy = BinanceGwy() gwy.establishSession() ords = gwy.getOrders('accountId_example') self.assertEqual(len(ords), 0)
def test_getInstruments(self): gwy = BinanceGwy() gwy.establishSession() insts = gwy.getInstruments('accountId_example') self.assertTrue(len(insts) > 0)
def test_getAllInstruments(self): gwy = BinanceGwy() gwy.establishSession() insts = gwy.getAllInstruments() self.assertTrue(len(insts) > 0)