As part of the Charming Data community project, the goal is to develop a data app that includes an agentic system that analyzes past performance and recommend trading decisions.
Explanation of the a1, a2, and a3 python files:
a1_simulate_trades.pyconnects to yahoo finance and pulls the historical price data -- from April 1 to present time -- for all the tickers in thetrading-data.csv(lines 1 to 54 of the code). Then, from line 61 to the end, the python code simulates trading taking place, based on the setup in the trading-data.csv. For example, if the price of a stock was between theenter_fromtoenter_torange, we simulated a trading position being opened. If the price of a stock reached thept1point, we simulated the selling (if it was a buy long position) or buying (if it was a short position) of the stock. All the simulated trading is saved in theexecuted-trades.csvsheet.a2_standardize_executed_trades.pystandardizes all the trades in theexecuted-trades.csvsheet to assume the same position size. This is good practice in the trading world. Often, professional traders will spend a pre-determined and similar amount of money on every new trade they open to ensure they limit their losses. See an example in lines 8-17 in the python file. The code in this python file creates the finalstandardized-executed-trades.csvsheet.a3_analysis.pydoes the data visualization and analysis of all the trades that took place, with the goal of assessing the quality and performance of the trade setups (trading-data.csv).