Exemplo n.º 1
0
 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')
Exemplo n.º 2
0
    def test_establishDestroySession(self):
        gwy = BinanceGwy()
        gwy.establishSession()
        self.assertFalse(gwy.session is None)

        gwy.destroySession()
        self.assertTrue(gwy.session is None)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 def test_getOrders(self):
     gwy = BinanceGwy()
     gwy.establishSession()
     ords = gwy.getOrders('accountId_example')
     self.assertEqual(len(ords), 0)
Exemplo n.º 5
0
 def test_getInstruments(self):
     gwy = BinanceGwy()
     gwy.establishSession()
     insts = gwy.getInstruments('accountId_example')
     self.assertTrue(len(insts) > 0)
Exemplo n.º 6
0
 def test_getAllInstruments(self):
     gwy = BinanceGwy()
     gwy.establishSession()
     insts = gwy.getAllInstruments()
     self.assertTrue(len(insts) > 0)