dbfill_executions( db, get_executions(ib)) # inserta les noves (de 1 a 7 dies) executions dbupdate_executions(db, dbanalyse_executions( db, accId)) # actualitza les executions per tancar les que toqui dbfill_positions(db, dbanalyse_positions( db, accId)) # borra totes les positions i les re-inserta except Exception as err: error_handling(err) raise if __name__ == '__main__': myib = IB() mydb = ibutil.dbconnect("localhost", "besuga", "xarnaus", "Besuga8888") acc = input( "triar entre 'besugapaper', 'xavpaper', 'mavpaper1', 'mavpaper2'") if acc == "besugapaper": rslt = execute_query( mydb, "SELECT connHost, connPort, connAccId FROM connections WHERE connName = 'besugapaper7498'" ) elif acc == "xavpaper": rslt = execute_query( mydb, "SELECT connHost, connPort, connAccId FROM connections WHERE connName = 'xavpaper7497'" ) elif acc == "mavpaper1": rslt = execute_query( mydb,
elif lastpricecnt < minbars: print(cnt.symbol," ----------- nou minim","maxbars", maxbars, "minbars", minbars, "lastpricecnt", lastpricecnt, "stdbars", stdbars) return -1 else: print(cnt.symbol, "res a fer","maxbars", maxbars, "minbars", minbars, "lastpricecnt", lastpricecnt, "stdbars", stdbars) return 0 except Exception as e: # error_handling(e) raise if __name__ == '__main__': try: myib = ibsync.IB() mydb = ibutil.dbconnect(cf.dbhost, cf.dbname, cf.dbuser, cf.dbpassword) rslt = [] q = input("Triar entre 'besugapaper', 'xavpaper', 'mavpaper1', 'mavpaper2' - exit to quit ") while q != "exit": sql = "SELECT connHost, connPort, connAccId, connClientId FROM connections WHERE " if q.lower() == "besugapaper": rslt = ibutil.execute_query(mydb, sql + " connName = 'besugapaper7498'") break elif q.lower() == "xavpaper": rslt = ibutil.execute_query(mydb, sql + " connName = 'xavpaper7497'") break elif q.lower() == "mavpaper1": rslt = ibutil.execute_query(mydb, sql + " connName = 'mavpaper1'") break elif q.lower() == "mavpaper2": rslt = ibutil.execute_query(mydb, sql + " connName = 'mavpaper2'")