Example #1
0
 def insert_obj(self, order):
     sql = ('INSERT INTO Orders VALUES '
            '({0},"{1}",{2},{3},{4},{5},'
            '{6},{7},{8},{9})').format(order.id, order.date,
                                       order.brokerOrderId,
                                       order.instr.id, order.quantity,
                                       order.get_avg_price(),
                                       order.commission, order.type,
                                       order.action, order.tradeId)
     order.id = tmdb.db_modify(self.dbconn, sql)
     LOGGER.info("Inserted %s to Orders", order)
Example #2
0
 def insert_obj(self, order):
     sql = ("INSERT INTO Orders VALUES " '({0},"{1}",{2},{3},{4},{5},' "{6},{7},{8},{9})").format(
         order.id,
         order.date,
         order.brokerOrderId,
         order.instr.id,
         order.quantity,
         order.get_avg_price(),
         order.commission,
         order.type,
         order.action,
         order.tradeId,
     )
     order.id = tmdb.db_modify(self.dbconn, sql)
     LOGGER.info("Inserted %s to Orders", order)
Example #3
0
 def close_trade(self, id_):
     sql = ("UPDATE Trades set statusTypeId = {0} " "WHERE id = {1}").format(mappings.CLOSED_TRADE_ID, id_)
     ins = tmdb.db_modify(self.dbconn, sql)
     LOGGER.info("Closed tradeId=%s", id_)
     return ins
Example #4
0
 def insert_obj(self, trade):
     sql = ("INSERT INTO Trades VALUES " '({0},"{1}",{2},{3})').format(
         trade.id, trade.name, trade.type, trade.status
     )
     trade.id = tmdb.db_modify(self.dbconn, sql)
     LOGGER.info("Inserted %s to Trades", trade)
Example #5
0
 def insert_obj(self, instr):
     sql = ("INSERT INTO Instruments VALUES " '({0},"{1}","{2}",{3})').format(
         instr.id, instr.name, instr.sym, instr.type
     )
     instr.id = tmdb.db_modify(self.dbconn, sql)
     LOGGER.info("Inserted %s to Instruments", instr)
Example #6
0
 def close_trade(self, id_):
     sql = ('UPDATE Trades set statusTypeId = {0} '
            'WHERE id = {1}').format(mappings.CLOSED_TRADE_ID, id_)
     ins = tmdb.db_modify(self.dbconn, sql)
     LOGGER.info("Closed tradeId=%s", id_)
     return ins
Example #7
0
 def insert_obj(self, trade):
     sql = ('INSERT INTO Trades VALUES '
            '({0},"{1}",{2},{3})').format(trade.id, trade.name, trade.type,
                                          trade.status)
     trade.id = tmdb.db_modify(self.dbconn, sql)
     LOGGER.info("Inserted %s to Trades", trade)
Example #8
0
 def insert_obj(self, instr):
     sql = ('INSERT INTO Instruments VALUES '
            '({0},"{1}","{2}",{3})').format(instr.id, instr.name, instr.sym,
                                            instr.type)
     instr.id = tmdb.db_modify(self.dbconn, sql)
     LOGGER.info("Inserted %s to Instruments", instr)