This project uses Poetry for dependency management and virtual environment management. To install dependencies, simply execute
poetry install
Afterwards to enter the projects virtual environment, execute
poetry shell
There is also a requirements.txt file if you prefer to use pip
pip install -r requirements.txt
To analyze a csv, execute
python -m trade_analysis <path/to/csv>
If you want to search for ticker and date, execute
python -m trade_analysis <path/to/csv> --date <YYYY-MM-DD> --ticker <ticker>
Use pandas to group the dataframe by ticker and trade type, obtain the sum of quantity per those two values and create two columns "buy_volume" and "sell_volume" with the sum of all the quantities on columns where trade_type is equal to "BUY" and "SELL" respectively. Columns of "BUY" trades will have "sell_volume" as NaN and vice versa. Fill the NaN values with zeroes. Group the dataframe by ticker and obtain the max value for buy_volume and sell_volume. This way, if the ticker has any buy or sell volume, the maximum value will be the total sum, otherwise it will be zero.
Use pandas to group the dataframe by customer id and trade date, count the trade id's and assign the value to a new column "daily_trades". Filter the dataframe to rows where daily_trades is greater than 3, select only the Customer ID's column and drop duplicates to obtain unique Customer ID's.
Use Pandas to group the dataframe by ticker value and get the average of prices.
Use Pandas to filter the dataframe where the columns ticker and date are equal to the values provided.