finance.src package

Submodules

finance.src.file_generator module

finance.src.postgres_interface module

Module to interact with postgres databases

It contains generic methods to interact with postgres databases regardless of the data they contain

class finance.src.postgres_interface.PostgresInterface[source]

Bases: object

Class to interact with postgres databases

create_engine() Engine[source]

function that creates engines to connect to postgres databases

Returns:

dictionary with the engines to connect to the databases

Return type:

dict

create_table_object(table_name: str, engine: Engine, schema: str = 'finance') Table[source]

Method to create a table object

Parameters:
  • table_name (str) – name of the table to create the object for

  • engine (sqlalchemy.engine.Engine) – engine to connect to the database

  • schema (str) – schema of the table default: stocks

Returns:

table object

Return type:

sqlalchemy.Table

insert_batch(table: Table, batch: list, conn: Connection) None[source]

Method to insert a batch of data into a table

Parameters:
  • table (str) – table to insert data into

  • data (list) – list of tuples with the data to insert into the table

Return type:

None

read_table_to_df(table: str, schema: str = 'finance') DataFrame[source]

Method to read a table into a dataframe

Parameters:

table (tabble name to read) –

Returns:

dataframe with the data from the table

Return type:

pd.DataFrame

finance.src.s3_interface module

Module to interact with s3

class finance.src.s3_interface.S3Interface[source]

Bases: object

Class to interact with s3

backup_tables(bucket_name: str = 'ahnazary-finance-prod')[source]

Method to backup tables to s3

get_bucket_names() list[source]

Method to get the names of the buckets in s3

Returns:

list with the names of the buckets in s3

Return type:

list

finance.src.schedule_jobs module

finance.src.utils module

This module contains utility functions for the finance package.

finance.src.utils.are_incremental(input_list: list)[source]
finance.src.utils.emit_log(message: str, log_level: int = 20)[source]

Creates a custom logger and emits logs.

Parameters:
  • log_level (int) – Log level.

  • message (str) – Message to log.

Returns:

None

finance.src.yahoo_ticker module

Module contents