Exemple #1
0
 def test_singleReturn(self):
     testObj_1 = InvSimulation(250, 1000)
     one_day_test = testObj_1.singleReturn()
     self.assertTrue(one_day_test <= 2000 and one_day_test >= 0)
Exemple #2
0
 def test_cumuReturn(self):
     testObj_2 = InvSimulation(200, 500)
     cumu_test = testObj_2.cumuReturn()
     self.assertTrue(np.mean(cumu_test) <= 2000 and np.mean(cumu_test) >= 0)
     self.assertEqual(len(cumu_test), 500)
Exemple #3
0
 def test_dailyReturn(self):
     testObj_3 = InvSimulation(50, 2000)
     daily_test = testObj_3.dailyReturn()
     self.assertTrue(np.mean(daily_test) <= 2 and np.mean(daily_test) >= 0)
     self.assertEqual(len(daily_test), 2000)
while True:
	
	try:
		trials = int(input('Please input how many trials you want to simulate.\n'))
		
		break

	except ValueError:
		print ("Please enter an integer.")

	except (KeyboardInterrupt, SystemExit):
		sys.exit()

	# except IOError:
	# 	sys.exit()

	else:
		print("Invalid Input")

for each_position in positions:
	instance = InvSimulation(each_position, trials)
	instance.result()




if __name__ == '__main__':
    pass

	def test_singleReturn(self):
		testObj_1 = InvSimulation(250, 1000)
		one_day_test = testObj_1.singleReturn()
		self.assertTrue(one_day_test<=2000 and one_day_test>= 0)
	def test_dailyReturn(self):
		testObj_3 = InvSimulation(50, 2000)
		daily_test = testObj_3.dailyReturn()
		self.assertTrue(np.mean(daily_test)<=2 and np.mean(daily_test)>= 0)
		self.assertEqual(len(daily_test), 2000)
	def test_cumuReturn(self):
		testObj_2 = InvSimulation(200, 500)
		cumu_test = testObj_2.cumuReturn()
		self.assertTrue(np.mean(cumu_test)<=2000 and np.mean(cumu_test)>= 0)
		self.assertEqual(len(cumu_test), 500)
Exemple #8
0
    else:
        print("Invalid Input")

while True:

    try:
        trials = int(
            input('Please input how many trials you want to simulate.\n'))

        break

    except ValueError:
        print("Please enter an integer.")

    except (KeyboardInterrupt, SystemExit):
        sys.exit()

    # except IOError:
    # 	sys.exit()

    else:
        print("Invalid Input")

for each_position in positions:
    instance = InvSimulation(each_position, trials)
    instance.result()

if __name__ == '__main__':
    pass