Skip to content

Commit

Permalink
logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashant Tripathi authored and Prashant Tripathi committed Aug 20, 2024
1 parent a5049de commit 0b65110
Show file tree
Hide file tree
Showing 19 changed files with 351 additions and 278 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ date,open,high,low,close,volume,dividends,stock_splits,capital_gains
2024-08-13 00:00:00+05:30,464.28,464.28,464.28,464.28,0,0.0,0.0,0.0
2024-08-14 00:00:00+05:30,464.11,464.11,464.11,464.11,0,0.0,0.0,0.0
2024-08-16 00:00:00+05:30,471.28,471.28,471.28,471.28,0,0.0,0.0,0.0
2024-08-19 00:00:00+05:30,472.86,472.86,472.86,472.86,0,0.0,0.0,0.0
4 changes: 2 additions & 2 deletions DATA/GOLD/Holdings/HoldingsTrands_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1580,5 +1580,5 @@ date,open,high,low,close,holding
2024-08-16,181144.73,184865.38,180563.58,184553.48,59914.74
2024-08-17,181144.73,184865.38,180563.58,184553.48,59914.74
2024-08-18,181144.73,184865.38,180563.58,184553.48,59914.74
2024-08-19,185834.97,186540.22,183482.67,184345.27,59914.74
2024-08-20,185138.82,186265.32,183408.97,184712.57,59914.74
2024-08-19,185845.46,186550.71,183493.16,184355.76,59914.74
2024-08-20,185149.31,186275.81,183419.46,184723.06,59914.74
4 changes: 2 additions & 2 deletions DATA/GOLD/Holdings/Holdings_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5975,10 +5975,10 @@ date,segment,exchange,symbol,stock_name,holding_quantity,avg_price,holding_amoun
2024-08-19,EQ,NSE,TATAMOTORS,TATAMOTORS,100.0,261.0,26100.4,1106.0,110600.0,1106.2,110620.0,1085.75,108575.0,1087.85,108785.0
2024-08-19,EQ,NSE,TATAPOWER,TATAPOWER,150.0,147.49,22124.0,417.0,62550.0,421.0,63150.0,415.15,62272.5,418.8,62820.0
2024-08-19,MF,BMF,MIRAE-ASSET-ELSS-TAX-SAVER-FUND-DIRECT-GROWTH,MIRAE-ASSET-ELSS-TAX-SAVER-FUND-DIRECT-GROWTH,58.41,51.37,3000.37,53.57,3129.02,53.57,3129.02,53.57,3129.02,53.57,3129.02
2024-08-19,MF,BMF,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,6.64,452.01,3001.37,471.28,3129.3,471.28,3129.3,471.28,3129.3,471.28,3129.3
2024-08-19,MF,BMF,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,6.64,452.01,3001.37,472.86,3139.79,472.86,3139.79,472.86,3139.79,472.86,3139.79
2024-08-20,EQ,NSE,IRCTC,IRCTC,3.0,896.2,2688.6,940.0,2820.0,942.0,2826.0,926.85,2780.55,931.05,2793.15
2024-08-20,EQ,NSE,KPITTECH,KPITTECH,2.0,1500.0,3000.0,1845.25,3690.5,1898.0,3796.0,1822.55,3645.1,1828.05,3656.1
2024-08-20,EQ,NSE,TATAMOTORS,TATAMOTORS,100.0,261.0,26100.4,1096.7,109670.0,1098.0,109800.0,1082.2,108220.0,1086.75,108675.0
2024-08-20,EQ,NSE,TATAPOWER,TATAPOWER,150.0,147.49,22124.0,418.0,62700.0,423.9,63585.0,416.7,62505.0,422.2,63330.0
2024-08-20,MF,BMF,MIRAE-ASSET-ELSS-TAX-SAVER-FUND-DIRECT-GROWTH,MIRAE-ASSET-ELSS-TAX-SAVER-FUND-DIRECT-GROWTH,58.41,51.37,3000.37,53.57,3129.02,53.57,3129.02,53.57,3129.02,53.57,3129.02
2024-08-20,MF,BMF,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,6.64,452.01,3001.37,471.28,3129.3,471.28,3129.3,471.28,3129.3,471.28,3129.3
2024-08-20,MF,BMF,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,6.64,452.01,3001.37,472.86,3139.79,472.86,3139.79,472.86,3139.79,472.86,3139.79
1 change: 1 addition & 0 deletions DATA/SILVER/StockPrice/StockPrice_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,7 @@ date,stock_name,open,high,low,close,volume
2024-08-13,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,464.28,464.28,464.28,464.28,0
2024-08-14,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,464.11,464.11,464.11,464.11,0
2024-08-16,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,471.28,471.28,471.28,471.28,0
2024-08-19,SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH,472.86,472.86,472.86,472.86,0
2021-05-03,SBIN,329.06,331.79,321.34,330.0,43691860
2021-05-04,SBIN,334.14,341.58,329.62,330.85,57749307
2021-05-05,SBIN,335.55,336.45,327.55,334.52,40872501
Expand Down
48 changes: 27 additions & 21 deletions NOTEBOOKS/01_BRONZE_LAYER_ETL/01_TradeHistory.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 1,
"metadata": {
"execution": {
"iopub.execute_input": "2024-08-19T14:10:40.055644Z",
"iopub.status.busy": "2024-08-19T14:10:40.039996Z",
"iopub.status.idle": "2024-08-19T14:10:40.778393Z",
"shell.execute_reply": "2024-08-19T14:10:40.778393Z"
"iopub.execute_input": "2024-08-20T12:25:39.795937Z",
"iopub.status.busy": "2024-08-20T12:25:39.795937Z",
"iopub.status.idle": "2024-08-20T12:25:40.237968Z",
"shell.execute_reply": "2024-08-20T12:25:40.237968Z"
},
"lines_to_next_cell": 2
},
Expand All @@ -40,13 +40,13 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 2,
"metadata": {
"execution": {
"iopub.execute_input": "2024-08-19T14:10:40.778393Z",
"iopub.status.busy": "2024-08-19T14:10:40.778393Z",
"iopub.status.idle": "2024-08-19T14:10:40.790726Z",
"shell.execute_reply": "2024-08-19T14:10:40.790726Z"
"iopub.execute_input": "2024-08-20T12:25:40.242789Z",
"iopub.status.busy": "2024-08-20T12:25:40.240267Z",
"iopub.status.idle": "2024-08-20T12:25:40.247279Z",
"shell.execute_reply": "2024-08-20T12:25:40.247279Z"
}
},
"outputs": [],
Expand All @@ -71,13 +71,13 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2024-08-19T14:10:40.793754Z",
"iopub.status.busy": "2024-08-19T14:10:40.793754Z",
"iopub.status.idle": "2024-08-19T14:10:40.802940Z",
"shell.execute_reply": "2024-08-19T14:10:40.802940Z"
"iopub.execute_input": "2024-08-20T12:25:40.247279Z",
"iopub.status.busy": "2024-08-20T12:25:40.247279Z",
"iopub.status.idle": "2024-08-20T12:25:40.255332Z",
"shell.execute_reply": "2024-08-20T12:25:40.255332Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -148,13 +148,13 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 4,
"metadata": {
"execution": {
"iopub.execute_input": "2024-08-19T14:10:40.802940Z",
"iopub.status.busy": "2024-08-19T14:10:40.802940Z",
"iopub.status.idle": "2024-08-19T14:10:41.316573Z",
"shell.execute_reply": "2024-08-19T14:10:41.315556Z"
"iopub.execute_input": "2024-08-20T12:25:40.255332Z",
"iopub.status.busy": "2024-08-20T12:25:40.255332Z",
"iopub.status.idle": "2024-08-20T12:25:40.517913Z",
"shell.execute_reply": "2024-08-20T12:25:40.516907Z"
}
},
"outputs": [
Expand All @@ -167,7 +167,13 @@
"Sheet name => TRADE\n",
"Processed => ..\\..\\DATA\\BRONZE\\TradeHistory\\trade_2021.csv\n",
"Processing => ..\\..\\DATA\\SOURCE\\TradeHistory\\trade_2122.xlsx\n",
"Sheet name => TRADE\n",
"Sheet name => TRADE\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Processed => ..\\..\\DATA\\BRONZE\\TradeHistory\\trade_2122.csv\n",
"Processing => ..\\..\\DATA\\SOURCE\\TradeHistory\\trade_2223.xlsx\n",
"Sheet name => TRADE\n",
Expand Down
115 changes: 83 additions & 32 deletions NOTEBOOKS/01_BRONZE_LAYER_ETL/02_StockData.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"execution_count": 1,
"metadata": {
"execution": {
"iopub.execute_input": "2024-08-19T14:10:45.264907Z",
"iopub.status.busy": "2024-08-19T14:10:45.264907Z",
"iopub.status.idle": "2024-08-19T14:10:46.093299Z",
"shell.execute_reply": "2024-08-19T14:10:46.091384Z"
"iopub.execute_input": "2024-08-20T12:25:42.039114Z",
"iopub.status.busy": "2024-08-20T12:25:42.039114Z",
"iopub.status.idle": "2024-08-20T12:25:42.582044Z",
"shell.execute_reply": "2024-08-20T12:25:42.582044Z"
}
},
"outputs": [],
Expand All @@ -54,10 +54,10 @@
"execution_count": 2,
"metadata": {
"execution": {
"iopub.execute_input": "2024-08-19T14:10:46.098886Z",
"iopub.status.busy": "2024-08-19T14:10:46.097852Z",
"iopub.status.idle": "2024-08-19T14:10:46.110322Z",
"shell.execute_reply": "2024-08-19T14:10:46.109194Z"
"iopub.execute_input": "2024-08-20T12:25:42.585269Z",
"iopub.status.busy": "2024-08-20T12:25:42.585269Z",
"iopub.status.idle": "2024-08-20T12:25:42.591218Z",
"shell.execute_reply": "2024-08-20T12:25:42.591218Z"
}
},
"outputs": [],
Expand All @@ -76,10 +76,10 @@
"execution_count": 3,
"metadata": {
"execution": {
"iopub.execute_input": "2024-08-19T14:10:46.116122Z",
"iopub.status.busy": "2024-08-19T14:10:46.115002Z",
"iopub.status.idle": "2024-08-19T14:10:46.125301Z",
"shell.execute_reply": "2024-08-19T14:10:46.125301Z"
"iopub.execute_input": "2024-08-20T12:25:42.591218Z",
"iopub.status.busy": "2024-08-20T12:25:42.591218Z",
"iopub.status.idle": "2024-08-20T12:25:42.600195Z",
"shell.execute_reply": "2024-08-20T12:25:42.599180Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -128,10 +128,10 @@
"execution_count": 4,
"metadata": {
"execution": {
"iopub.execute_input": "2024-08-19T14:10:46.129531Z",
"iopub.status.busy": "2024-08-19T14:10:46.129531Z",
"iopub.status.idle": "2024-08-19T14:10:46.141149Z",
"shell.execute_reply": "2024-08-19T14:10:46.141149Z"
"iopub.execute_input": "2024-08-20T12:25:42.600731Z",
"iopub.status.busy": "2024-08-20T12:25:42.600731Z",
"iopub.status.idle": "2024-08-20T12:25:42.609128Z",
"shell.execute_reply": "2024-08-20T12:25:42.609128Z"
},
"lines_to_next_cell": 2
},
Expand Down Expand Up @@ -191,7 +191,7 @@
"\n",
" except Exception as e:\n",
" # Log any errors encountered during processing\n",
" logger.error(\n",
" print(\n",
" f\"Error processing data for {stock_name} for year {year}: {e}\"\n",
" )"
]
Expand All @@ -201,10 +201,10 @@
"execution_count": 5,
"metadata": {
"execution": {
"iopub.execute_input": "2024-08-19T14:10:46.145086Z",
"iopub.status.busy": "2024-08-19T14:10:46.145086Z",
"iopub.status.idle": "2024-08-19T14:10:50.153169Z",
"shell.execute_reply": "2024-08-19T14:10:50.153169Z"
"iopub.execute_input": "2024-08-20T12:25:42.609128Z",
"iopub.status.busy": "2024-08-20T12:25:42.609128Z",
"iopub.status.idle": "2024-08-20T12:25:48.824040Z",
"shell.execute_reply": "2024-08-20T12:25:48.824040Z"
}
},
"outputs": [
Expand All @@ -230,7 +230,13 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Could not get exchangeTimezoneName for ticker '' reason: 'chart'\n",
"Could not get exchangeTimezoneName for ticker '' reason: 'chart'\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
": No timezone found, symbol may be delisted\n"
]
},
Expand All @@ -245,7 +251,13 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Could not get exchangeTimezoneName for ticker '' reason: 'chart'\n",
"Could not get exchangeTimezoneName for ticker '' reason: 'chart'\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
": No timezone found, symbol may be delisted\n"
]
},
Expand All @@ -260,7 +272,13 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Could not get exchangeTimezoneName for ticker '' reason: 'chart'\n",
"Could not get exchangeTimezoneName for ticker '' reason: 'chart'\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
": No timezone found, symbol may be delisted\n"
]
},
Expand All @@ -275,7 +293,13 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Could not get exchangeTimezoneName for ticker '' reason: 'chart'\n",
"Could not get exchangeTimezoneName for ticker '' reason: 'chart'\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
": No timezone found, symbol may be delisted\n"
]
},
Expand All @@ -290,7 +314,13 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Could not get exchangeTimezoneName for ticker '' reason: 'chart'\n",
"Could not get exchangeTimezoneName for ticker '' reason: 'chart'\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
": No timezone found, symbol may be delisted\n"
]
},
Expand Down Expand Up @@ -321,7 +351,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\prashant.tripathi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\yfinance\\utils.py:768: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.\n",
"C:\\Users\\prashant.tripathi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\yfinance\\utils.py:768: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.\n",
" df.index += _pd.TimedeltaIndex(dst_error_hours, 'h')\n"
]
},
Expand All @@ -340,7 +370,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\prashant.tripathi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\yfinance\\utils.py:768: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.\n",
"C:\\Users\\prashant.tripathi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\yfinance\\utils.py:768: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.\n",
" df.index += _pd.TimedeltaIndex(dst_error_hours, 'h')\n"
]
},
Expand Down Expand Up @@ -379,7 +409,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\prashant.tripathi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\yfinance\\utils.py:768: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.\n",
"C:\\Users\\prashant.tripathi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\yfinance\\utils.py:768: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.\n",
" df.index += _pd.TimedeltaIndex(dst_error_hours, 'h')\n"
]
},
Expand All @@ -398,7 +428,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\prashant.tripathi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\yfinance\\utils.py:768: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.\n",
"C:\\Users\\prashant.tripathi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\yfinance\\utils.py:768: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.\n",
" df.index += _pd.TimedeltaIndex(dst_error_hours, 'h')\n"
]
},
Expand All @@ -418,19 +448,40 @@
"[(2024, 5), (2024, 6), (2024, 7), (2024, 8)]\n",
"\n",
"\n",
"Starting data processing for symbol: MIRAE-ASSET-ELSS-TAX-SAVER-FUND-DIRECT-GROWTH\n",
"Starting data processing for symbol: MIRAE-ASSET-ELSS-TAX-SAVER-FUND-DIRECT-GROWTH\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\prashant.tripathi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\yfinance\\utils.py:768: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.\n",
" df.index += _pd.TimedeltaIndex(dst_error_hours, 'h')\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Data for MIRAE-ASSET-ELSS-TAX-SAVER-FUND-DIRECT-GROWTH successfully processed and saved to ..\\..\\DATA\\BRONZE\\StockData\\2024\\08\\MIRAE-ASSET-ELSS-TAX-SAVER-FUND-DIRECT-GROWTH.csv\n",
"[(2024, 5), (2024, 6), (2024, 7), (2024, 8)]\n",
"\n",
"\n",
"Starting data processing for symbol: SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Data for SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH successfully processed and saved to ..\\..\\DATA\\BRONZE\\StockData\\2024\\08\\SBI-LONG-TERM-EQUITY-FUND-DIRECT-PLAN-GROWTH.csv\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\prashant.tripathi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\yfinance\\utils.py:768: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.\n",
"C:\\Users\\prashant.tripathi\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\yfinance\\utils.py:768: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.\n",
" df.index += _pd.TimedeltaIndex(dst_error_hours, 'h')\n"
]
}
Expand Down
Loading

0 comments on commit 0b65110

Please sign in to comment.