Exemplo n.º 1
0
	def get_init_position(self):
		init_p = StockPosition()
		if len(self.init_position)>0:
			for stock_code, s in self.init_position.items():
				init_p.add(self.init_date, stock_code, s.stock_name, s.stock_number, price=0, op_type=compute.get_op_type('hold'))
		else:
			if self.is_rongquan:
				init_p.is_rongquan = True
			for stock_code, s in self.stock.items():
				max_number = s.get_init_position(self.is_rongquan)
				if (max_number<0 and self.is_rongquan==False) or (max_number>0 and self.is_rongquan==True) :
					init_p.add(self.init_date, stock_code, s.stock_name, -max_number, price=0, op_type=compute.get_op_type('hold'))
		return init_p
Exemplo n.º 2
0
	def add_init_position(self, stock_code, stock_name, stock_number):
		s = Stock(self.init_date, stock_code, stock_name, stock_number, price=0, op_type=compute.get_op_type('hold'))
		if stock_code not in self.init_position:
			self.init_position[stock_code] = s