Ejemplo n.º 1
0
 def create(identifier: str, value: str, description: str) -> None:
     configuration: ConfigurationEntity = ConfigurationEntity()
     Utils.set_attributes(configuration,
                          identifier=identifier,
                          value=value,
                          description=description)
     DAO.persist(configuration)
Ejemplo n.º 2
0
 def update(portfolio: Tuple[Optional[str]]) -> None:
     for ticker in portfolio:
         stock: StockEntity = StockEntity()
         Utils.set_attributes(stock,
                              ticker=ticker,
                              isin=StockBO.isin(ticker))
         DAO.persist(stock)
Ejemplo n.º 3
0
 def create(summation: Decimal, funds: str, attempt: AttemptDTO) -> None:
     evaluation: EvaluationEntity = EvaluationEntity()
     evaluation.timestamp = Utils.now()
     evaluation.sum = str(summation)
     evaluation.funds = funds
     Utils.set_attributes(evaluation, amount_buy=str(attempt.amount_buy), distance_buy=str(attempt.distance_buy),
                          delta_buy=str(attempt.delta_buy), amount_sell=str(attempt.amount_sell),
                          distance_sell=str(attempt.distance_sell), delta_sell=str(attempt.delta_sell))
     DAO.persist(evaluation)
Ejemplo n.º 4
0
 def create_from_file(content: str) -> None:
     rows = json.loads(content)
     for row in rows:
         intraday: IntradayEntity = IntradayEntity()
         Utils.set_attributes(intraday,
                              date=datetime.fromisoformat(row['date']),
                              open=Decimal(row['open']),
                              high=Decimal(row['high']),
                              low=Decimal(row['low']),
                              close=Decimal(row['close']),
                              volume=Decimal(row['volume']),
                              ticker=row['ticker'])
         DAO.persist(intraday)
Ejemplo n.º 5
0
 def create_ticker(ticker: str) -> None:
     try:
         time_series = TimeSeries(key=os.environ.get('ALPHA_VANTAGE'),
                                  output_format='pandas')
         frame, meta_data = time_series.get_intraday(symbol=ticker.replace(
             '.', '-'),
                                                     outputsize='full')
         frame = frame.reset_index()
         for index, row in frame.iterrows():
             intraday = IntradayDAO.init(row, ticker,
                                         meta_data['6. Time Zone'])
             DAO.persist(intraday)
     except ValueError as e:
         logging.exception(e)