Esempio n. 1
0
 def Create(self, idAccion, nameAccion, price, date, open, max, min, close,
            volume):
     oBase = BaseDatos()
     query="insert into quaotation(idaccion,accion,fecha,apertura,cierre,maximo,minimo,volumen,precio) " \
           "values (%s,%s,%s,%s,%s,%s,%s,%s,%s)"
     param = (idAccion, nameAccion, date, open, max, min, close, volume,
              price)
     print query + str(param)
     try:
         oBase.Ejecutar(query, param)
         query1 = "SELECT max(id) FROM quaotation"
         try:
             id = oBase.ConsultaSoloValor(query1)
             self._id = int(id)
             self._idstockmarket = idAccion
             self._price = price
             self._date = date
             self._open = open
             self._max = max
             self._min = min
             self._close = close
             self._volume = volume
             self._idtransacion = 0
         except:
             print "Error in get Id quaotation"
     except:
         print "Error in Create quatation"
Esempio n. 2
0
    def Create(self, stockmarketname, type, quantity):
        oBase = BaseDatos()
        self._DateTime = time.strftime("%c")
        self._TypeOperation = type
        try:
            query = "SELECT id FROM accion WHERE nombre= %s"
            param = (stockmarketname)
            self._IdAccion = oBase.ConsultaSoloValor(query, param)
        except:
            print "Error al crear la operacion"
        try:
            query1 = "SELECT max(id) FROM accion"
            id = oBase.ConsultaSoloValor(query1)
            self._Id = id
        except:
            print "Error trying to get id"

        self._Quantity = quantity
        self._price = 100  #conectarse con mercado
Esempio n. 3
0
  def Crear(self,Nombre,InversionIni):
      Obase = BaseDatos()
      query="insert into inversor(nombre,InvInic,Total,PorcGanac) values(%s, %s , %s , 0)"
      query1="select max(id) as Id from inversor"
      param=(Nombre,InversionIni,InversionIni)
      try:
         Obase.Ejecutar(query,param)
         id=Obase.ConsultaSoloValor(query1)

      except:
          print "Error en inversor"
      self._Id=int(id)
      self.Nombre=Nombre
      self._InversionInicial=InversionIni
      self._Gananciatotal=InversionIni
      self._PorcGanancia=0
Esempio n. 4
0
 def Create(self, description, initials, price):
     oBase = BaseDatos()
     query = "insert into StockMarket(description,initials,lastquantation) values (%s,%s,%s)"
     param = (description, initials, price)
     try:
         oBase.Ejecutar(query, param)
         query1 = "SELECT max(id) FROM StockMarket"
         try:
             id = oBase.ConsultaSoloValor(query1)
             self._Id = int(id)
             self._description = description
             self._initials = initials
             self._lastquantation = price
         except:
             print "Error in get Id StockMarket"
     except:
         print "Error in Create StockMarket"