diff --git a/DATA/GOLD/TradeHistory/TradeHistory_data.csv b/DATA/GOLD/TradeHistory/TradeHistory_data.csv index 44c71964..d67559c0 100644 --- a/DATA/GOLD/TradeHistory/TradeHistory_data.csv +++ b/DATA/GOLD/TradeHistory/TradeHistory_data.csv @@ -1,167 +1,167 @@ -datetime,segment,stock_name,side,buy_quantity,buy_price,buy_amount,sell_quantity,sell_price,sell_amount,holding_quantity,holding_price,holding_amount -2020-05-05 11:31:20,EQ,BHAGERIA,BUY,10,116.55,1165.5,0,,,10,116.55,1165.5 -2020-05-19 14:44:06,EQ,BHAGERIA,BUY,5,100.0,500.0,0,,,15,111.03,1665.5 -2020-06-15 10:57:42,EQ,BHAGERIA,SELL,0,111.03,12546.77,15,113.0,1695.0,0,0.0,0.0 -2021-08-06 11:42:14,EQ,BPCL,BUY,43,457.0,19651.0,0,,,43,457.0,19651.0 -2022-08-10 09:26:12,EQ,BPCL,SELL,0,457.0,150284.45,43,328.85,14140.55,0,0.0,0.0 -2021-02-09 14:25:00,EQ,GOLDBEES,BUY,2,41.82,83.64,0,,,2,41.82,83.64 -2021-06-04 12:10:54,EQ,GOLDBEES,SELL,0,41.82,1757.69,2,42.03,84.06,0,0.0,0.0 -2021-03-04 00:00:00,EQ,HERANBA,BUY,23,627.0,14421.0,0,,,23,627.0,14421.0 -2021-03-05 15:24:27,EQ,HERANBA,SELL,0,627.0,514140.0,12,820.0,9840.0,11,-45429.0,-499719.0 -2021-03-09 10:38:35,EQ,HERANBA,SELL,0,-45429.0,-35207475.0,11,775.0,8525.0,0,0.0,0.0 -2020-07-29 14:14:01,EQ,IDEA,BUY,20,8.2,164.0,0,,,20,8.2,164.0 -2020-07-30 15:15:54,EQ,IDEA,BUY,50,7.95,397.5,0,,,70,8.02,561.5 -2021-06-14 13:21:53,EQ,IDEA,SELL,0,8.02,77.41,70,9.65,675.5,0,0.0,0.0 -2021-04-12 10:50:01,EQ,INFY,BUY,3,1434.6,4303.8,0,,,3,1434.6,4303.8 -2021-04-12 10:55:51,EQ,INFY,BUY,5,1433.95,7169.75,0,,,8,1434.19,11473.55 -2021-06-14 13:23:56,EQ,INFY,SELL,0,1434.19,2089620.29,8,1457.0,11656.0,0,0.0,0.0 -2024-06-04 12:19:21,EQ,IRCTC,BUY,3,896.2,2688.6,0,,,3,896.2,2688.6 -2024-06-13 13:58:03,EQ,KPITTECH,BUY,2,1500.0,3000.0,0,,,2,1500.0,3000.0 -2022-05-13 00:00:00,EQ,LICI,BUY,15,904.0,13560.0,0,,,15,904.0,13560.0 -2022-08-10 09:27:00,EQ,LICI,SELL,0,904.0,618652.4,15,684.35,10265.25,0,0.0,0.0 -2021-02-09 14:25:00,EQ,NIFTYBEES,BUY,1,162.52,162.52,0,,,1,162.52,162.52 -2021-06-14 13:19:01,EQ,NIFTYBEES,SELL,0,162.52,27457.75,1,168.95,168.95,0,0.0,0.0 -2020-07-29 14:12:52,EQ,PNB,BUY,30,32.95,988.5,0,,,30,32.95,988.5 -2021-06-14 13:20:29,EQ,PNB,SELL,0,32.95,1365.78,30,41.45,1243.5,0,0.0,0.0 -2021-05-10 11:04:16,EQ,SBIN,BUY,14,365.0,5110.0,0,,,14,365.0,5110.0 -2021-06-04 12:15:06,EQ,SBIN,SELL,0,365.0,159140.0,14,436.0,6104.0,0,0.0,0.0 -2021-06-15 13:16:17,EQ,TATACHEM,BUY,20,751.2,15024.0,0,,,20,751.2,15024.0 -2022-08-10 09:33:26,EQ,TATACHEM,SELL,0,751.2,773736.0,20,1030.0,20600.0,0,0.0,0.0 -2020-04-21 14:41:30,EQ,TATAMOTORS,BUY,14,75.1,1051.4,0,,,14,75.1,1051.4 -2020-05-04 14:33:45,EQ,TATAMOTORS,BUY,5,83.8,419.0,0,,,19,77.39,1470.4 -2020-07-03 13:31:19,EQ,TATAMOTORS,BUY,15,104.0,1560.0,0,,,34,89.13,3030.4 -2021-04-12 10:44:33,EQ,TATAMOTORS,BUY,26,295.0,7670.0,0,,,60,178.34,10700.4 -2022-05-11 11:50:35,EQ,TATAMOTORS,BUY,40,385.0,15400.0,0,,,100,261.0,26100.4 -2021-02-08 11:39:33,EQ,TATAPOWER,BUY,72,90.0,6480.0,0,,,72,90.0,6480.0 -2021-02-22 11:44:35,EQ,TATAPOWER,BUY,33,90.0,2970.0,0,,,105,90.0,9450.0 -2022-05-11 11:58:14,EQ,TATAPOWER,BUY,64,224.75,14384.0,0,,,169,141.03,23834.0 -2022-08-10 09:30:24,EQ,TATAPOWER,SELL,0,141.03,32457.96,19,230.15,4372.85,150,-57.49,-8623.96 -2021-06-15 13:36:57,EQ,VOLTAS,BUY,4,1059.0,4236.0,0,,,4,1059.0,4236.0 -2022-08-10 09:15:00,EQ,VOLTAS,SELL,0,1059.0,1044174.0,4,986.0,3944.0,0,0.0,0.0 -2020-07-27 10:47:51,EQ,YESBANK,BUY,100,12.3,1230.0,0,,,100,12.3,1230.0 -2020-07-29 14:11:01,EQ,YESBANK,BUY,50,11.75,587.5,0,,,150,12.12,1817.5 -2021-11-10 13:16:26,EQ,YESBANK,SELL,0,12.12,157.52,150,13.0,1950.0,0,0.0,0.0 -2024-06-13 12:11:08,FO,NIFTY-CE-23350-13Jun2024,BUY,25,59.0,1475.0,0,,,25,59.0,1475.0 -2024-06-13 13:28:13,FO,NIFTY-CE-23350-13Jun2024,SELL,0,59.0,3652.1,25,61.9,1547.5,0,0.0,0.0 -2024-06-20 09:57:52,FO,NIFTY-CE-23450-20Jun2024,BUY,50,70.0,3500.0,0,,,50,70.0,3500.0 -2024-06-20 10:02:14,FO,NIFTY-CE-23450-20Jun2024,SELL,0,70.0,5428.5,25,77.55,1938.75,25,-77.14,-1928.5 -2024-06-20 10:02:14,FO,NIFTY-CE-23450-20Jun2024,SELL,0,-77.14,-5982.21,25,77.55,1938.75,0,0.0,0.0 -2024-06-18 11:00:46,FO,NIFTY-CE-23500-20Jun2024,BUY,25,120.0,3000.0,0,,,25,120.0,3000.0 -2024-06-18 11:22:18,FO,NIFTY-CE-23500-20Jun2024,SELL,0,120.0,16278.0,25,135.65,3391.25,0,0.0,0.0 -2024-06-21 12:52:27,FO,NIFTY-CE-23500-27Jun2024,BUY,25,125.0,3125.0,0,,,25,125.0,3125.0 -2024-06-21 12:52:27,FO,NIFTY-CE-23500-27Jun2024,BUY,75,125.0,9375.0,0,,,100,125.0,12500.0 -2024-06-21 13:56:13,FO,NIFTY-CE-23500-27Jun2024,SELL,0,125.0,18875.0,75,151.0,11325.0,25,-255.0,-6375.0 -2024-06-21 13:56:13,FO,NIFTY-CE-23500-27Jun2024,SELL,0,-255.0,-38505.0,25,151.0,3775.0,0,0.0,0.0 -2024-06-25 11:23:23,FO,NIFTY-CE-23550-27Jun2024,BUY,100,126.2,12620.0,0,,,100,126.2,12620.0 -2024-06-25 12:03:52,FO,NIFTY-CE-23550-27Jun2024,SELL,0,126.2,16191.46,100,128.3,12830.0,0,0.0,0.0 -2024-06-19 10:21:57,FO,NIFTY-CE-23600-20Jun2024,BUY,25,49.95,1248.75,0,,,25,49.95,1248.75 -2024-06-19 10:47:19,FO,NIFTY-CE-23600-20Jun2024,BUY,25,30.0,750.0,0,,,50,39.98,1998.75 -2024-06-19 11:42:42,FO,NIFTY-CE-23600-20Jun2024,SELL,0,39.98,1918.8,50,48.0,2400.0,0,0.0,0.0 -2024-06-20 10:11:43,FO,NIFTY-CE-23650-20Jun2024,BUY,25,15.0,375.0,0,,,25,15.0,375.0 -2024-06-20 10:11:43,FO,NIFTY-CE-23650-20Jun2024,BUY,25,15.0,375.0,0,,,50,15.0,750.0 -2024-06-20 10:15:20,FO,NIFTY-CE-23650-20Jun2024,SELL,0,15.0,188.25,50,12.55,627.5,0,0.0,0.0 -2024-06-20 10:23:38,FO,NIFTY-CE-23650-20Jun2024,BUY,50,15.0,750.0,0,,,50,15.0,750.0 -2024-06-20 10:24:50,FO,NIFTY-CE-23650-20Jun2024,SELL,0,15.0,204.75,50,13.65,682.5,0,0.0,0.0 -2024-06-20 10:28:21,FO,NIFTY-CE-23650-20Jun2024,BUY,25,14.75,368.75,0,,,25,14.75,368.75 -2024-06-20 10:28:21,FO,NIFTY-CE-23650-20Jun2024,BUY,75,14.75,1106.25,0,,,100,14.75,1475.0 -2024-06-20 12:28:31,FO,NIFTY-CE-23650-20Jun2024,SELL,0,14.75,88.5,75,6.0,450.0,25,55.46,1386.5 -2024-06-20 12:28:31,FO,NIFTY-CE-23650-20Jun2024,SELL,0,55.46,332.76,25,6.0,150.0,0,0.0,0.0 -2024-06-26 13:32:12,FO,NIFTY-CE-23800-27Jun2024,BUY,100,109.1,10910.0,0,,,100,109.1,10910.0 -2024-06-26 13:58:40,FO,NIFTY-CE-23800-27Jun2024,SELL,0,109.1,13201.1,25,121.0,3025.0,75,-30.55,-2291.1 -2024-06-26 13:58:40,FO,NIFTY-CE-23800-27Jun2024,SELL,0,-30.55,-3696.31,50,121.0,6050.0,25,56.21,1405.21 -2024-06-26 13:58:40,FO,NIFTY-CE-23800-27Jun2024,SELL,0,56.21,6801.21,25,121.0,3025.0,0,0.0,0.0 -2024-06-26 15:00:09,FO,NIFTY-CE-23800-27Jun2024,BUY,100,121.0,12100.0,0,,,100,121.0,12100.0 -2024-06-27 10:08:12,FO,NIFTY-CE-23800-27Jun2024,SELL,0,121.0,21398.85,50,176.85,8842.5,50,-185.98,-9298.85 -2024-06-27 10:33:11,FO,NIFTY-CE-23800-27Jun2024,SELL,0,-185.98,-32545.97,50,175.0,8750.0,0,0.0,0.0 -2024-07-02 12:44:33,FO,NIFTY-CE-24000-04Jul2024,BUY,100,181.55,18155.0,0,,,100,181.55,18155.0 -2024-07-02 14:54:13,FO,NIFTY-CE-24000-04Jul2024,SELL,0,181.55,36509.7,25,201.1,5027.5,75,-244.73,-18354.71 -2024-07-02 14:54:13,FO,NIFTY-CE-24000-04Jul2024,SELL,0,-244.73,-49215.08,25,201.1,5027.5,50,617.21,30860.38 -2024-07-02 14:54:13,FO,NIFTY-CE-24000-04Jul2024,SELL,0,617.21,124089.58,50,201.05,10052.5,0,0.0,0.0 -2024-07-01 11:31:03,FO,NIFTY-CE-24050-04Jul2024,BUY,100,182.85,18285.0,0,,,100,182.85,18285.0 -2024-07-01 13:45:26,FO,NIFTY-CE-24050-04Jul2024,SELL,0,182.85,35043.2,75,191.65,14373.75,25,-670.33,-16758.2 -2024-07-01 13:45:26,FO,NIFTY-CE-24050-04Jul2024,SELL,0,-670.33,-128501.9,25,191.7,4792.5,0,0.0,0.0 -2024-06-28 12:13:12,FO,NIFTY-CE-24100-04Jul2024,BUY,50,170.0,8500.0,0,,,50,170.0,8500.0 -2024-06-28 12:21:13,FO,NIFTY-CE-24100-04Jul2024,BUY,50,145.0,7250.0,0,,,100,157.5,15750.0 -2024-06-28 14:29:25,FO,NIFTY-CE-24100-04Jul2024,SELL,0,157.5,26775.0,50,170.0,8500.0,50,-220.5,-11025.0 -2024-06-28 14:29:25,FO,NIFTY-CE-24100-04Jul2024,SELL,0,-220.5,-37485.0,50,170.0,8500.0,0,0.0,0.0 -2024-07-10 11:46:04,FO,NIFTY-CE-24100-11Jul2024,BUY,100,167.0,16700.0,0,,,100,167.0,16700.0 -2024-07-10 12:11:22,FO,NIFTY-CE-24100-11Jul2024,SELL,0,167.0,30711.3,75,183.9,13792.5,25,-560.45,-14011.3 -2024-07-10 12:11:22,FO,NIFTY-CE-24100-11Jul2024,SELL,0,-560.45,-103039.1,25,183.85,4596.25,0,0.0,0.0 -2024-07-05 10:44:46,FO,NIFTY-CE-24200-11Jul2024,BUY,50,168.3,8415.0,0,,,50,168.3,8415.0 -2024-07-05 11:33:05,FO,NIFTY-CE-24200-11Jul2024,SELL,0,168.3,29662.88,50,176.25,8812.5,0,0.0,0.0 -2024-07-05 12:36:40,FO,NIFTY-CE-24250-11Jul2024,BUY,75,162.6,12195.0,0,,,75,162.6,12195.0 -2024-07-05 15:12:21,FO,NIFTY-CE-24250-11Jul2024,SELL,0,162.6,30081.0,25,185.0,4625.0,50,-357.72,-17886.0 -2024-07-05 15:12:21,FO,NIFTY-CE-24250-11Jul2024,SELL,0,-357.72,-66178.2,50,185.0,9250.0,0,0.0,0.0 -2024-07-04 11:16:40,FO,NIFTY-CE-24300-04Jul2024,BUY,25,50.0,1250.0,0,,,25,50.0,1250.0 -2024-07-04 11:23:32,FO,NIFTY-CE-24300-04Jul2024,SELL,0,50.0,2635.0,25,52.7,1317.5,0,0.0,0.0 -2024-07-08 15:02:08,FO,NIFTY-CE-24300-11Jul2024,BUY,100,120.0,12000.0,0,,,100,120.0,12000.0 -2024-07-09 09:47:45,FO,NIFTY-CE-24300-11Jul2024,SELL,0,120.0,17454.0,100,145.45,14545.0,0,0.0,0.0 -2024-07-09 10:19:25,FO,NIFTY-CE-24300-11Jul2024,BUY,100,140.0,14000.0,0,,,100,140.0,14000.0 -2024-07-09 10:20:55,FO,NIFTY-CE-24300-11Jul2024,SELL,0,140.0,19250.0,25,137.5,3437.5,75,-70.0,-5250.0 -2024-07-09 10:20:55,FO,NIFTY-CE-24300-11Jul2024,SELL,0,-70.0,-9621.5,25,137.45,3436.25,50,87.43,4371.5 -2024-07-09 10:20:55,FO,NIFTY-CE-24300-11Jul2024,SELL,0,87.43,12026.0,50,137.55,6877.5,0,0.0,0.0 -2024-07-11 11:05:32,FO,NIFTY-CE-24300-11Jul2024,BUY,25,14.05,351.25,0,,,25,14.05,351.25 -2024-07-11 14:11:00,FO,NIFTY-CE-24300-11Jul2024,SELL,0,14.05,280.3,25,19.95,498.75,0,0.0,0.0 -2024-07-11 09:16:44,FO,NIFTY-CE-24350-11Jul2024,BUY,25,59.75,1493.75,0,,,25,59.75,1493.75 -2024-07-11 09:16:44,FO,NIFTY-CE-24350-11Jul2024,BUY,50,59.75,2987.5,0,,,75,59.75,4481.25 -2024-07-11 09:16:44,FO,NIFTY-CE-24350-11Jul2024,BUY,25,59.75,1493.75,0,,,100,59.75,5975.0 -2024-07-11 09:26:06,FO,NIFTY-CE-24350-11Jul2024,BUY,100,40.0,4000.0,0,,,200,49.88,9975.0 -2024-07-11 10:13:20,FO,NIFTY-CE-24350-11Jul2024,SELL,0,49.88,1064.83,125,21.35,2668.75,75,118.8,8910.17 -2024-07-11 10:13:20,FO,NIFTY-CE-24350-11Jul2024,SELL,0,118.8,2536.43,75,21.35,1601.25,0,0.0,0.0 -2024-07-09 12:44:04,FO,NIFTY-CE-24400-11Jul2024,BUY,25,89.0,2225.0,0,,,25,89.0,2225.0 -2024-07-09 12:44:04,FO,NIFTY-CE-24400-11Jul2024,BUY,125,89.0,11125.0,0,,,150,89.0,13350.0 -2024-07-09 13:17:26,FO,NIFTY-CE-24400-11Jul2024,SELL,0,89.0,10421.9,100,117.1,11710.0,50,58.56,2928.1 -2024-07-09 13:17:26,FO,NIFTY-CE-24400-11Jul2024,SELL,0,58.56,6857.61,50,117.1,5855.0,0,0.0,0.0 -2024-07-11 11:05:32,FO,NIFTY-CE-24400-11Jul2024,SELL,0,0.0,0.0,25,4.3,107.5,-25,-0.0,0.0 -2024-07-11 14:09:06,FO,NIFTY-CE-24400-11Jul2024,BUY,25,2.5,62.5,0,,,0,0.0,0.0 -2024-07-18 09:47:51,FO,NIFTY-CE-24600-18Jul2024,BUY,100,49.65,4965.0,0,,,100,49.65,4965.0 -2024-07-18 09:57:15,FO,NIFTY-CE-24600-18Jul2024,SELL,0,49.65,4324.51,100,87.1,8710.0,0,0.0,0.0 -2024-07-16 13:57:37,FO,NIFTY-CE-24650-18Jul2024,BUY,25,70.1,1752.5,0,,,25,70.1,1752.5 -2024-07-16 13:57:37,FO,NIFTY-CE-24650-18Jul2024,BUY,25,70.05,1751.25,0,,,50,70.08,3503.75 -2024-07-18 09:55:59,FO,NIFTY-CE-24650-18Jul2024,SELL,0,70.08,3955.73,50,56.45,2822.5,0,0.0,0.0 -2024-07-18 10:14:50,FO,NIFTY-CE-24650-18Jul2024,BUY,100,50.0,5000.0,0,,,100,50.0,5000.0 -2024-07-18 10:22:23,FO,NIFTY-CE-24650-18Jul2024,SELL,0,50.0,2000.0,100,40.0,4000.0,0,0.0,0.0 -2024-07-18 12:00:26,FO,NIFTY-CE-24650-18Jul2024,BUY,100,17.15,1715.0,0,,,100,17.15,1715.0 -2024-07-18 12:18:21,FO,NIFTY-CE-24650-18Jul2024,SELL,0,17.15,874.65,100,51.0,5100.0,0,0.0,0.0 -2024-06-14 11:21:06,FO,NIFTY-PE-23450-20Jun2024,BUY,25,124.7,3117.5,0,,,25,124.7,3117.5 -2024-06-14 12:09:30,FO,NIFTY-PE-23450-20Jun2024,SELL,0,124.7,15961.6,25,128.0,3200.0,0,0.0,0.0 -2024-06-24 11:39:16,FO,NIFTY-PE-23550-27Jun2024,BUY,25,137.6,3440.0,0,,,25,137.6,3440.0 -2024-06-24 11:39:16,FO,NIFTY-PE-23550-27Jun2024,BUY,25,137.6,3440.0,0,,,50,137.6,6880.0 -2024-06-24 11:39:16,FO,NIFTY-PE-23550-27Jun2024,BUY,25,137.6,3440.0,0,,,75,137.6,10320.0 -2024-06-24 11:39:16,FO,NIFTY-PE-23550-27Jun2024,BUY,25,137.7,3442.5,0,,,100,137.62,13762.5 -2024-06-24 11:46:51,FO,NIFTY-PE-23550-27Jun2024,SELL,0,137.62,19398.24,100,140.95,14095.0,0,0.0,0.0 -2024-06-19 09:22:02,FO,NIFTY-PE-23600-20Jun2024,BUY,25,75.0,1875.0,0,,,25,75.0,1875.0 -2024-06-19 09:29:57,FO,NIFTY-PE-23600-20Jun2024,SELL,0,75.0,7500.0,25,100.0,2500.0,0,0.0,0.0 -2024-07-05 09:44:03,FO,NIFTY-PE-24000-11Jul2024,BUY,25,50.35,1258.75,0,,,25,50.35,1258.75 -2024-07-05 09:54:34,FO,NIFTY-PE-24000-11Jul2024,SELL,0,50.35,2895.12,25,57.5,1437.5,0,0.0,0.0 -2024-07-02 09:45:41,FO,NIFTY-PE-24150-04Jul2024,BUY,25,125.0,3125.0,0,,,25,125.0,3125.0 -2024-07-02 09:53:05,FO,NIFTY-PE-24150-04Jul2024,SELL,0,125.0,17543.75,25,140.35,3508.75,0,0.0,0.0 -2024-07-03 09:15:54,FO,NIFTY-PE-24250-04Jul2024,BUY,100,104.55,10455.0,0,,,100,104.55,10455.0 -2024-07-03 12:33:30,FO,NIFTY-PE-24250-04Jul2024,BUY,50,63.0,3150.0,0,,,150,90.7,13605.0 -2024-07-03 15:29:00,FO,NIFTY-PE-24250-04Jul2024,SELL,0,90.7,5124.55,25,56.5,1412.5,125,67.84,8480.45 -2024-07-03 15:29:00,FO,NIFTY-PE-24250-04Jul2024,SELL,0,67.84,3833.16,25,56.5,1412.5,100,46.47,4647.29 -2024-07-03 15:29:00,FO,NIFTY-PE-24250-04Jul2024,SELL,0,46.47,2625.72,25,56.5,1412.5,75,26.95,2021.57 -2024-07-03 15:29:00,FO,NIFTY-PE-24250-04Jul2024,SELL,0,26.95,1522.92,25,56.5,1412.5,50,9.97,498.65 -2024-07-03 15:29:00,FO,NIFTY-PE-24250-04Jul2024,SELL,0,9.97,563.48,25,56.5,1412.5,25,-2.59,-64.83 -2024-07-03 15:29:00,FO,NIFTY-PE-24250-04Jul2024,SELL,0,-2.59,-146.5,25,56.5,1412.5,0,0.0,0.0 -2024-07-05 11:50:06,FO,NIFTY-PE-24300-11Jul2024,BUY,50,120.0,6000.0,0,,,50,120.0,6000.0 -2024-07-05 11:51:36,FO,NIFTY-PE-24300-11Jul2024,BUY,25,119.15,2978.75,0,,,75,119.72,8978.75 -2024-07-05 11:51:36,FO,NIFTY-PE-24300-11Jul2024,BUY,25,119.15,2978.75,0,,,100,119.58,11957.5 -2024-07-05 11:58:36,FO,NIFTY-PE-24300-11Jul2024,SELL,0,119.58,14486.51,25,121.15,3028.75,75,-33.72,-2529.01 -2024-07-05 11:58:36,FO,NIFTY-PE-24300-11Jul2024,SELL,0,-33.72,-4085.2,25,121.15,3028.75,50,31.12,1556.18 -2024-07-05 11:58:36,FO,NIFTY-PE-24300-11Jul2024,SELL,0,31.12,3770.64,50,121.15,6057.5,0,0.0,0.0 -2024-07-09 10:23:03,FO,NIFTY-PE-24350-11Jul2024,BUY,100,80.3,8030.0,0,,,100,80.3,8030.0 -2024-07-09 10:23:04,FO,NIFTY-PE-24350-11Jul2024,SELL,0,80.3,6468.16,75,80.55,6041.25,25,62.47,1561.84 -2024-07-09 10:23:04,FO,NIFTY-PE-24350-11Jul2024,SELL,0,62.47,5032.23,25,80.55,2013.75,0,0.0,0.0 -2024-07-22 11:06:51,FO,NIFTY-PE-24600-25Jul2024,BUY,75,252.15,18911.25,0,,,75,252.15,18911.25 -2024-07-22 11:24:32,FO,NIFTY-PE-24600-25Jul2024,SELL,0,252.15,63945.24,75,253.6,19020.0,0,0.0,0.0 -2024-07-15 13:23:50,FO,NIFTY-PE-24650-18Jul2024,BUY,50,115.25,5762.5,0,,,50,115.25,5762.5 -2024-07-15 14:18:31,FO,NIFTY-PE-24650-18Jul2024,SELL,0,115.25,13340.19,50,115.75,5787.5,0,0.0,0.0 -2024-07-16 13:57:37,FO,NIFTY-PE-24650-18Jul2024,BUY,25,77.65,1941.25,0,,,25,77.65,1941.25 -2024-07-16 13:57:37,FO,NIFTY-PE-24650-18Jul2024,BUY,25,77.7,1942.5,0,,,50,77.68,3883.75 -2024-07-18 09:47:40,FO,NIFTY-PE-24650-18Jul2024,SELL,0,77.68,5456.67,50,70.25,3512.5,0,0.0,0.0 -2024-07-18 14:25:45,FO,NIFTY-PE-24650-18Jul2024,BUY,100,3.0,300.0,0,,,100,3.0,300.0 -2024-05-24 00:00:00,MF,MIRAE-ASSET-TAX-SAVER-DIRECT-GROWTH,BUY,20,48.77,1000.27,0,,,20,48.77,1000.27 -2024-07-02 00:00:00,MF,MIRAE-ASSET-TAX-SAVER-DIRECT-GROWTH,BUY,19,51.84,999.99,0,,,39,50.26,2000.27 -2024-05-24 00:00:00,MF,SBI-MAGNUM-TAXGAIN-SCHEME-DIR-GR,BUY,2,428.89,999.31,0,,,2,428.89,999.31 -2024-07-02 00:00:00,MF,SBI-MAGNUM-TAXGAIN-SCHEME-DIR-GR,BUY,2,455.11,1001.24,0,,,4,441.62,2000.56 +datetime,exchange,segment,stock_name,side,buy_quantity,buy_price,buy_amount,sell_quantity,sell_price,sell_amount,holding_quantity,holding_price,holding_amount +2020-05-05 11:31:20,NSE,EQ,BHAGERIA,BUY,10,116.55,1165.5,0,0.0,0.0,10,116.55,10 +2020-05-19 14:44:06,NSE,EQ,BHAGERIA,BUY,5,100.0,500.0,0,0.0,0.0,15,111.03,15 +2020-06-15 10:57:42,NSE,EQ,BHAGERIA,SELL,0,111.03,1665.5,15,113.0,1695.0,0,111.03,0 +2021-08-06 11:42:14,NSE,EQ,BPCL,BUY,43,457.0,19651.0,0,0.0,0.0,43,457.0,43 +2022-08-10 09:26:12,NSE,EQ,BPCL,SELL,0,457.0,19651.0,43,328.85,14140.55,0,457.0,0 +2021-02-09 14:25:00,NSE,EQ,GOLDBEES,BUY,2,41.82,83.64,0,0.0,0.0,2,41.82,2 +2021-06-04 12:10:54,NSE,EQ,GOLDBEES,SELL,0,41.82,83.64,2,42.03,84.06,0,41.82,0 +2021-03-04 00:00:00,NSE,EQ,HERANBA,BUY,23,627.0,14421.0,0,0.0,0.0,23,627.0,23 +2021-03-05 15:24:27,NSE,EQ,HERANBA,SELL,0,627.0,7524.0,12,820.0,9840.0,11,627.0,11 +2021-03-09 10:38:35,NSE,EQ,HERANBA,SELL,0,627.0,6897.0,11,775.0,8525.0,0,627.0,0 +2020-07-29 14:14:01,NSE,EQ,IDEA,BUY,20,8.2,164.0,0,0.0,0.0,20,8.2,20 +2020-07-30 15:15:54,NSE,EQ,IDEA,BUY,50,7.95,397.5,0,0.0,0.0,70,8.02,70 +2021-06-14 13:21:53,NSE,EQ,IDEA,SELL,0,8.02,561.5,70,9.65,675.5,0,8.02,0 +2021-04-12 10:50:01,NSE,EQ,INFY,BUY,3,1434.6,4303.8,0,0.0,0.0,3,1434.6,3 +2021-04-12 10:55:51,NSE,EQ,INFY,BUY,5,1433.95,7169.75,0,0.0,0.0,8,1434.19,8 +2021-06-14 13:23:56,NSE,EQ,INFY,SELL,0,1434.19,11473.55,8,1457.0,11656.0,0,1434.19,0 +2024-06-04 12:19:21,NSE,EQ,IRCTC,BUY,3,896.2,2688.6,0,0.0,0.0,3,896.2,3 +2024-06-13 13:58:03,NSE,EQ,KPITTECH,BUY,2,1500.0,3000.0,0,0.0,0.0,2,1500.0,2 +2022-05-13 00:00:00,NSE,EQ,LICI,BUY,15,904.0,13560.0,0,0.0,0.0,15,904.0,15 +2022-08-10 09:27:00,NSE,EQ,LICI,SELL,0,904.0,13560.0,15,684.35,10265.25,0,904.0,0 +2021-02-09 14:25:00,NSE,EQ,NIFTYBEES,BUY,1,162.52,162.52,0,0.0,0.0,1,162.52,1 +2021-06-14 13:19:01,NSE,EQ,NIFTYBEES,SELL,0,162.52,162.52,1,168.95,168.95,0,162.52,0 +2020-07-29 14:12:52,NSE,EQ,PNB,BUY,30,32.95,988.5,0,0.0,0.0,30,32.95,30 +2021-06-14 13:20:29,NSE,EQ,PNB,SELL,0,32.95,988.5,30,41.45,1243.5,0,32.95,0 +2021-05-10 11:04:16,NSE,EQ,SBIN,BUY,14,365.0,5110.0,0,0.0,0.0,14,365.0,14 +2021-06-04 12:15:06,NSE,EQ,SBIN,SELL,0,365.0,5110.0,14,436.0,6104.0,0,365.0,0 +2021-06-15 13:16:17,NSE,EQ,TATACHEM,BUY,20,751.2,15024.0,0,0.0,0.0,20,751.2,20 +2022-08-10 09:33:26,NSE,EQ,TATACHEM,SELL,0,751.2,15024.0,20,1030.0,20600.0,0,751.2,0 +2020-04-21 14:41:30,NSE,EQ,TATAMOTORS,BUY,14,75.1,1051.4,0,0.0,0.0,14,75.1,14 +2020-05-04 14:33:45,NSE,EQ,TATAMOTORS,BUY,5,83.8,419.0,0,0.0,0.0,19,77.39,19 +2020-07-03 13:31:19,NSE,EQ,TATAMOTORS,BUY,15,104.0,1560.0,0,0.0,0.0,34,89.13,34 +2021-04-12 10:44:33,NSE,EQ,TATAMOTORS,BUY,26,295.0,7670.0,0,0.0,0.0,60,178.34,60 +2022-05-11 11:50:35,NSE,EQ,TATAMOTORS,BUY,40,385.0,15400.0,0,0.0,0.0,100,261.0,100 +2021-02-08 11:39:33,NSE,EQ,TATAPOWER,BUY,72,90.0,6480.0,0,0.0,0.0,72,90.0,72 +2021-02-22 11:44:35,NSE,EQ,TATAPOWER,BUY,33,90.0,2970.0,0,0.0,0.0,105,90.0,105 +2022-05-11 11:58:14,NSE,EQ,TATAPOWER,BUY,64,224.75,14384.0,0,0.0,0.0,169,141.03,169 +2022-08-10 09:30:24,NSE,EQ,TATAPOWER,SELL,0,141.03,2679.56,19,230.15,4372.85,150,141.03,150 +2021-06-15 13:36:57,NSE,EQ,VOLTAS,BUY,4,1059.0,4236.0,0,0.0,0.0,4,1059.0,4 +2022-08-10 09:15:00,NSE,EQ,VOLTAS,SELL,0,1059.0,4236.0,4,986.0,3944.0,0,1059.0,0 +2020-07-27 10:47:51,NSE,EQ,YESBANK,BUY,100,12.3,1230.0,0,0.0,0.0,100,12.3,100 +2020-07-29 14:11:01,NSE,EQ,YESBANK,BUY,50,11.75,587.5,0,0.0,0.0,150,12.12,150 +2021-11-10 13:16:26,NSE,EQ,YESBANK,SELL,0,12.12,1817.5,150,13.0,1950.0,0,12.12,0 +2024-06-13 12:11:08,FON,FO,NIFTY-CE-23350-13Jun2024,BUY,25,59.0,1475.0,0,0.0,0.0,25,59.0,25 +2024-06-13 13:28:13,FON,FO,NIFTY-CE-23350-13Jun2024,SELL,0,59.0,1475.0,25,61.9,1547.5,0,59.0,0 +2024-06-20 09:57:52,FON,FO,NIFTY-CE-23450-20Jun2024,BUY,50,70.0,3500.0,0,0.0,0.0,50,70.0,50 +2024-06-20 10:02:14,FON,FO,NIFTY-CE-23450-20Jun2024,SELL,0,70.0,1750.0,25,77.55,1938.75,25,70.0,25 +2024-06-20 10:02:14,FON,FO,NIFTY-CE-23450-20Jun2024,SELL,0,70.0,1750.0,25,77.55,1938.75,0,70.0,0 +2024-06-18 11:00:46,FON,FO,NIFTY-CE-23500-20Jun2024,BUY,25,120.0,3000.0,0,0.0,0.0,25,120.0,25 +2024-06-18 11:22:18,FON,FO,NIFTY-CE-23500-20Jun2024,SELL,0,120.0,3000.0,25,135.65,3391.25,0,120.0,0 +2024-06-21 12:52:27,FON,FO,NIFTY-CE-23500-27Jun2024,BUY,25,125.0,3125.0,0,0.0,0.0,25,125.0,25 +2024-06-21 12:52:27,FON,FO,NIFTY-CE-23500-27Jun2024,BUY,75,125.0,9375.0,0,0.0,0.0,100,125.0,100 +2024-06-21 13:56:13,FON,FO,NIFTY-CE-23500-27Jun2024,SELL,0,125.0,9375.0,75,151.0,11325.0,25,125.0,25 +2024-06-21 13:56:13,FON,FO,NIFTY-CE-23500-27Jun2024,SELL,0,125.0,3125.0,25,151.0,3775.0,0,125.0,0 +2024-06-25 11:23:23,FON,FO,NIFTY-CE-23550-27Jun2024,BUY,100,126.2,12620.0,0,0.0,0.0,100,126.2,100 +2024-06-25 12:03:52,FON,FO,NIFTY-CE-23550-27Jun2024,SELL,0,126.2,12620.0,100,128.3,12830.0,0,126.2,0 +2024-06-19 10:21:57,FON,FO,NIFTY-CE-23600-20Jun2024,BUY,25,49.95,1248.75,0,0.0,0.0,25,49.95,25 +2024-06-19 10:47:19,FON,FO,NIFTY-CE-23600-20Jun2024,BUY,25,30.0,750.0,0,0.0,0.0,50,39.98,50 +2024-06-19 11:42:42,FON,FO,NIFTY-CE-23600-20Jun2024,SELL,0,39.98,1998.75,50,48.0,2400.0,0,39.98,0 +2024-06-20 10:11:43,FON,FO,NIFTY-CE-23650-20Jun2024,BUY,25,15.0,375.0,0,0.0,0.0,25,15.0,25 +2024-06-20 10:11:43,FON,FO,NIFTY-CE-23650-20Jun2024,BUY,25,15.0,375.0,0,0.0,0.0,50,15.0,50 +2024-06-20 10:15:20,FON,FO,NIFTY-CE-23650-20Jun2024,SELL,0,15.0,750.0,50,12.55,627.5,0,15.0,0 +2024-06-20 10:23:38,FON,FO,NIFTY-CE-23650-20Jun2024,BUY,50,15.0,750.0,0,0.0,0.0,50,15.0,50 +2024-06-20 10:24:50,FON,FO,NIFTY-CE-23650-20Jun2024,SELL,0,15.0,750.0,50,13.65,682.5,0,15.0,0 +2024-06-20 10:28:21,FON,FO,NIFTY-CE-23650-20Jun2024,BUY,25,14.75,368.75,0,0.0,0.0,25,14.75,25 +2024-06-20 10:28:21,FON,FO,NIFTY-CE-23650-20Jun2024,BUY,75,14.75,1106.25,0,0.0,0.0,100,14.75,100 +2024-06-20 12:28:31,FON,FO,NIFTY-CE-23650-20Jun2024,SELL,0,14.75,1106.25,75,6.0,450.0,25,14.75,25 +2024-06-20 12:28:31,FON,FO,NIFTY-CE-23650-20Jun2024,SELL,0,14.75,368.75,25,6.0,150.0,0,14.75,0 +2024-06-26 13:32:12,FON,FO,NIFTY-CE-23800-27Jun2024,BUY,100,109.1,10910.0,0,0.0,0.0,100,109.1,100 +2024-06-26 13:58:40,FON,FO,NIFTY-CE-23800-27Jun2024,SELL,0,109.1,2727.5,25,121.0,3025.0,75,109.1,75 +2024-06-26 13:58:40,FON,FO,NIFTY-CE-23800-27Jun2024,SELL,0,109.1,5455.0,50,121.0,6050.0,25,109.1,25 +2024-06-26 13:58:40,FON,FO,NIFTY-CE-23800-27Jun2024,SELL,0,109.1,2727.5,25,121.0,3025.0,0,109.1,0 +2024-06-26 15:00:09,FON,FO,NIFTY-CE-23800-27Jun2024,BUY,100,121.0,12100.0,0,0.0,0.0,100,121.0,100 +2024-06-27 10:08:12,FON,FO,NIFTY-CE-23800-27Jun2024,SELL,0,121.0,6050.0,50,176.85,8842.5,50,121.0,50 +2024-06-27 10:33:11,FON,FO,NIFTY-CE-23800-27Jun2024,SELL,0,121.0,6050.0,50,175.0,8750.0,0,121.0,0 +2024-07-02 12:44:33,FON,FO,NIFTY-CE-24000-04Jul2024,BUY,100,181.55,18155.0,0,0.0,0.0,100,181.55,100 +2024-07-02 14:54:13,FON,FO,NIFTY-CE-24000-04Jul2024,SELL,0,181.55,4538.75,25,201.1,5027.5,75,181.55,75 +2024-07-02 14:54:13,FON,FO,NIFTY-CE-24000-04Jul2024,SELL,0,181.55,4538.75,25,201.1,5027.5,50,181.55,50 +2024-07-02 14:54:13,FON,FO,NIFTY-CE-24000-04Jul2024,SELL,0,181.55,9077.5,50,201.05,10052.5,0,181.55,0 +2024-07-01 11:31:03,FON,FO,NIFTY-CE-24050-04Jul2024,BUY,100,182.85,18285.0,0,0.0,0.0,100,182.85,100 +2024-07-01 13:45:26,FON,FO,NIFTY-CE-24050-04Jul2024,SELL,0,182.85,13713.75,75,191.65,14373.75,25,182.85,25 +2024-07-01 13:45:26,FON,FO,NIFTY-CE-24050-04Jul2024,SELL,0,182.85,4571.25,25,191.7,4792.5,0,182.85,0 +2024-06-28 12:13:12,FON,FO,NIFTY-CE-24100-04Jul2024,BUY,50,170.0,8500.0,0,0.0,0.0,50,170.0,50 +2024-06-28 12:21:13,FON,FO,NIFTY-CE-24100-04Jul2024,BUY,50,145.0,7250.0,0,0.0,0.0,100,157.5,100 +2024-06-28 14:29:25,FON,FO,NIFTY-CE-24100-04Jul2024,SELL,0,157.5,7875.0,50,170.0,8500.0,50,157.5,50 +2024-06-28 14:29:25,FON,FO,NIFTY-CE-24100-04Jul2024,SELL,0,157.5,7875.0,50,170.0,8500.0,0,157.5,0 +2024-07-10 11:46:04,FON,FO,NIFTY-CE-24100-11Jul2024,BUY,100,167.0,16700.0,0,0.0,0.0,100,167.0,100 +2024-07-10 12:11:22,FON,FO,NIFTY-CE-24100-11Jul2024,SELL,0,167.0,12525.0,75,183.9,13792.5,25,167.0,25 +2024-07-10 12:11:22,FON,FO,NIFTY-CE-24100-11Jul2024,SELL,0,167.0,4175.0,25,183.85,4596.25,0,167.0,0 +2024-07-05 10:44:46,FON,FO,NIFTY-CE-24200-11Jul2024,BUY,50,168.3,8415.0,0,0.0,0.0,50,168.3,50 +2024-07-05 11:33:05,FON,FO,NIFTY-CE-24200-11Jul2024,SELL,0,168.3,8415.0,50,176.25,8812.5,0,168.3,0 +2024-07-05 12:36:40,FON,FO,NIFTY-CE-24250-11Jul2024,BUY,75,162.6,12195.0,0,0.0,0.0,75,162.6,75 +2024-07-05 15:12:21,FON,FO,NIFTY-CE-24250-11Jul2024,SELL,0,162.6,4065.0,25,185.0,4625.0,50,162.6,50 +2024-07-05 15:12:21,FON,FO,NIFTY-CE-24250-11Jul2024,SELL,0,162.6,8130.0,50,185.0,9250.0,0,162.6,0 +2024-07-04 11:16:40,FON,FO,NIFTY-CE-24300-04Jul2024,BUY,25,50.0,1250.0,0,0.0,0.0,25,50.0,25 +2024-07-04 11:23:32,FON,FO,NIFTY-CE-24300-04Jul2024,SELL,0,50.0,1250.0,25,52.7,1317.5,0,50.0,0 +2024-07-08 15:02:08,FON,FO,NIFTY-CE-24300-11Jul2024,BUY,100,120.0,12000.0,0,0.0,0.0,100,120.0,100 +2024-07-09 09:47:45,FON,FO,NIFTY-CE-24300-11Jul2024,SELL,0,120.0,12000.0,100,145.45,14545.0,0,120.0,0 +2024-07-09 10:19:25,FON,FO,NIFTY-CE-24300-11Jul2024,BUY,100,140.0,14000.0,0,0.0,0.0,100,140.0,100 +2024-07-09 10:20:55,FON,FO,NIFTY-CE-24300-11Jul2024,SELL,0,140.0,3500.0,25,137.5,3437.5,75,140.0,75 +2024-07-09 10:20:55,FON,FO,NIFTY-CE-24300-11Jul2024,SELL,0,140.0,3500.0,25,137.45,3436.25,50,140.0,50 +2024-07-09 10:20:55,FON,FO,NIFTY-CE-24300-11Jul2024,SELL,0,140.0,7000.0,50,137.55,6877.5,0,140.0,0 +2024-07-11 11:05:32,FON,FO,NIFTY-CE-24300-11Jul2024,BUY,25,14.05,351.25,0,0.0,0.0,25,14.05,25 +2024-07-11 14:11:00,FON,FO,NIFTY-CE-24300-11Jul2024,SELL,0,14.05,351.25,25,19.95,498.75,0,14.05,0 +2024-07-11 09:16:44,FON,FO,NIFTY-CE-24350-11Jul2024,BUY,25,59.75,1493.75,0,0.0,0.0,25,59.75,25 +2024-07-11 09:16:44,FON,FO,NIFTY-CE-24350-11Jul2024,BUY,50,59.75,2987.5,0,0.0,0.0,75,59.75,75 +2024-07-11 09:16:44,FON,FO,NIFTY-CE-24350-11Jul2024,BUY,25,59.75,1493.75,0,0.0,0.0,100,59.75,100 +2024-07-11 09:26:06,FON,FO,NIFTY-CE-24350-11Jul2024,BUY,100,40.0,4000.0,0,0.0,0.0,200,49.88,200 +2024-07-11 10:13:20,FON,FO,NIFTY-CE-24350-11Jul2024,SELL,0,49.88,6234.38,125,21.35,2668.75,75,49.88,75 +2024-07-11 10:13:20,FON,FO,NIFTY-CE-24350-11Jul2024,SELL,0,49.88,3740.62,75,21.35,1601.25,0,49.88,0 +2024-07-09 12:44:04,FON,FO,NIFTY-CE-24400-11Jul2024,BUY,25,89.0,2225.0,0,0.0,0.0,25,89.0,25 +2024-07-09 12:44:04,FON,FO,NIFTY-CE-24400-11Jul2024,BUY,125,89.0,11125.0,0,0.0,0.0,150,89.0,150 +2024-07-09 13:17:26,FON,FO,NIFTY-CE-24400-11Jul2024,SELL,0,89.0,8900.0,100,117.1,11710.0,50,89.0,50 +2024-07-09 13:17:26,FON,FO,NIFTY-CE-24400-11Jul2024,SELL,0,89.0,4450.0,50,117.1,5855.0,0,89.0,0 +2024-07-11 11:05:32,FON,FO,NIFTY-CE-24400-11Jul2024,SELL,0,89.0,2225.0,25,4.3,107.5,-25,89.0,-25 +2024-07-11 14:09:06,FON,FO,NIFTY-CE-24400-11Jul2024,BUY,25,2.5,62.5,0,0.0,0.0,0,89.0,0 +2024-07-18 09:47:51,FON,FO,NIFTY-CE-24600-18Jul2024,BUY,100,49.65,4965.0,0,0.0,0.0,100,49.65,100 +2024-07-18 09:57:15,FON,FO,NIFTY-CE-24600-18Jul2024,SELL,0,49.65,4965.0,100,87.1,8710.0,0,49.65,0 +2024-07-16 13:57:37,FON,FO,NIFTY-CE-24650-18Jul2024,BUY,25,70.1,1752.5,0,0.0,0.0,25,70.1,25 +2024-07-16 13:57:37,FON,FO,NIFTY-CE-24650-18Jul2024,BUY,25,70.05,1751.25,0,0.0,0.0,50,70.08,50 +2024-07-18 09:55:59,FON,FO,NIFTY-CE-24650-18Jul2024,SELL,0,70.08,3503.75,50,56.45,2822.5,0,70.08,0 +2024-07-18 10:14:50,FON,FO,NIFTY-CE-24650-18Jul2024,BUY,100,50.0,5000.0,0,0.0,0.0,100,50.0,100 +2024-07-18 10:22:23,FON,FO,NIFTY-CE-24650-18Jul2024,SELL,0,50.0,5000.0,100,40.0,4000.0,0,50.0,0 +2024-07-18 12:00:26,FON,FO,NIFTY-CE-24650-18Jul2024,BUY,100,17.15,1715.0,0,0.0,0.0,100,17.15,100 +2024-07-18 12:18:21,FON,FO,NIFTY-CE-24650-18Jul2024,SELL,0,17.15,1715.0,100,51.0,5100.0,0,17.15,0 +2024-06-14 11:21:06,FON,FO,NIFTY-PE-23450-20Jun2024,BUY,25,124.7,3117.5,0,0.0,0.0,25,124.7,25 +2024-06-14 12:09:30,FON,FO,NIFTY-PE-23450-20Jun2024,SELL,0,124.7,3117.5,25,128.0,3200.0,0,124.7,0 +2024-06-24 11:39:16,FON,FO,NIFTY-PE-23550-27Jun2024,BUY,25,137.6,3440.0,0,0.0,0.0,25,137.6,25 +2024-06-24 11:39:16,FON,FO,NIFTY-PE-23550-27Jun2024,BUY,25,137.6,3440.0,0,0.0,0.0,50,137.6,50 +2024-06-24 11:39:16,FON,FO,NIFTY-PE-23550-27Jun2024,BUY,25,137.6,3440.0,0,0.0,0.0,75,137.6,75 +2024-06-24 11:39:16,FON,FO,NIFTY-PE-23550-27Jun2024,BUY,25,137.7,3442.5,0,0.0,0.0,100,137.62,100 +2024-06-24 11:46:51,FON,FO,NIFTY-PE-23550-27Jun2024,SELL,0,137.62,13762.5,100,140.95,14095.0,0,137.62,0 +2024-06-19 09:22:02,FON,FO,NIFTY-PE-23600-20Jun2024,BUY,25,75.0,1875.0,0,0.0,0.0,25,75.0,25 +2024-06-19 09:29:57,FON,FO,NIFTY-PE-23600-20Jun2024,SELL,0,75.0,1875.0,25,100.0,2500.0,0,75.0,0 +2024-07-05 09:44:03,FON,FO,NIFTY-PE-24000-11Jul2024,BUY,25,50.35,1258.75,0,0.0,0.0,25,50.35,25 +2024-07-05 09:54:34,FON,FO,NIFTY-PE-24000-11Jul2024,SELL,0,50.35,1258.75,25,57.5,1437.5,0,50.35,0 +2024-07-02 09:45:41,FON,FO,NIFTY-PE-24150-04Jul2024,BUY,25,125.0,3125.0,0,0.0,0.0,25,125.0,25 +2024-07-02 09:53:05,FON,FO,NIFTY-PE-24150-04Jul2024,SELL,0,125.0,3125.0,25,140.35,3508.75,0,125.0,0 +2024-07-03 09:15:54,FON,FO,NIFTY-PE-24250-04Jul2024,BUY,100,104.55,10455.0,0,0.0,0.0,100,104.55,100 +2024-07-03 12:33:30,FON,FO,NIFTY-PE-24250-04Jul2024,BUY,50,63.0,3150.0,0,0.0,0.0,150,90.7,150 +2024-07-03 15:29:00,FON,FO,NIFTY-PE-24250-04Jul2024,SELL,0,90.7,2267.5,25,56.5,1412.5,125,90.7,125 +2024-07-03 15:29:00,FON,FO,NIFTY-PE-24250-04Jul2024,SELL,0,90.7,2267.5,25,56.5,1412.5,100,90.7,100 +2024-07-03 15:29:00,FON,FO,NIFTY-PE-24250-04Jul2024,SELL,0,90.7,2267.5,25,56.5,1412.5,75,90.7,75 +2024-07-03 15:29:00,FON,FO,NIFTY-PE-24250-04Jul2024,SELL,0,90.7,2267.5,25,56.5,1412.5,50,90.7,50 +2024-07-03 15:29:00,FON,FO,NIFTY-PE-24250-04Jul2024,SELL,0,90.7,2267.5,25,56.5,1412.5,25,90.7,25 +2024-07-03 15:29:00,FON,FO,NIFTY-PE-24250-04Jul2024,SELL,0,90.7,2267.5,25,56.5,1412.5,0,90.7,0 +2024-07-05 11:50:06,FON,FO,NIFTY-PE-24300-11Jul2024,BUY,50,120.0,6000.0,0,0.0,0.0,50,120.0,50 +2024-07-05 11:51:36,FON,FO,NIFTY-PE-24300-11Jul2024,BUY,25,119.15,2978.75,0,0.0,0.0,75,119.72,75 +2024-07-05 11:51:36,FON,FO,NIFTY-PE-24300-11Jul2024,BUY,25,119.15,2978.75,0,0.0,0.0,100,119.58,100 +2024-07-05 11:58:36,FON,FO,NIFTY-PE-24300-11Jul2024,SELL,0,119.58,2989.38,25,121.15,3028.75,75,119.58,75 +2024-07-05 11:58:36,FON,FO,NIFTY-PE-24300-11Jul2024,SELL,0,119.58,2989.38,25,121.15,3028.75,50,119.58,50 +2024-07-05 11:58:36,FON,FO,NIFTY-PE-24300-11Jul2024,SELL,0,119.58,5978.75,50,121.15,6057.5,0,119.58,0 +2024-07-09 10:23:03,FON,FO,NIFTY-PE-24350-11Jul2024,BUY,100,80.3,8030.0,0,0.0,0.0,100,80.3,100 +2024-07-09 10:23:04,FON,FO,NIFTY-PE-24350-11Jul2024,SELL,0,80.3,6022.5,75,80.55,6041.25,25,80.3,25 +2024-07-09 10:23:04,FON,FO,NIFTY-PE-24350-11Jul2024,SELL,0,80.3,2007.5,25,80.55,2013.75,0,80.3,0 +2024-07-22 11:06:51,FON,FO,NIFTY-PE-24600-25Jul2024,BUY,75,252.15,18911.25,0,0.0,0.0,75,252.15,75 +2024-07-22 11:24:32,FON,FO,NIFTY-PE-24600-25Jul2024,SELL,0,252.15,18911.25,75,253.6,19020.0,0,252.15,0 +2024-07-15 13:23:50,FON,FO,NIFTY-PE-24650-18Jul2024,BUY,50,115.25,5762.5,0,0.0,0.0,50,115.25,50 +2024-07-15 14:18:31,FON,FO,NIFTY-PE-24650-18Jul2024,SELL,0,115.25,5762.5,50,115.75,5787.5,0,115.25,0 +2024-07-16 13:57:37,FON,FO,NIFTY-PE-24650-18Jul2024,BUY,25,77.65,1941.25,0,0.0,0.0,25,77.65,25 +2024-07-16 13:57:37,FON,FO,NIFTY-PE-24650-18Jul2024,BUY,25,77.7,1942.5,0,0.0,0.0,50,77.68,50 +2024-07-18 09:47:40,FON,FO,NIFTY-PE-24650-18Jul2024,SELL,0,77.68,3883.75,50,70.25,3512.5,0,77.68,0 +2024-07-18 14:25:45,FON,FO,NIFTY-PE-24650-18Jul2024,BUY,100,3.0,300.0,0,0.0,0.0,100,3.0,100 +2024-05-24 00:00:00,BMF,MF,MIRAE-ASSET-TAX-SAVER-DIRECT-GROWTH,BUY,20,48.77,999.95,0,0.0,0.0,20,50.0,20 +2024-07-02 00:00:00,BMF,MF,MIRAE-ASSET-TAX-SAVER-DIRECT-GROWTH,BUY,19,51.84,999.95,0,0.0,0.0,39,51.28,39 +2024-05-24 00:00:00,BMF,MF,SBI-MAGNUM-TAXGAIN-SCHEME-DIR-GR,BUY,2,428.89,999.75,0,0.0,0.0,2,499.88,2 +2024-07-02 00:00:00,BMF,MF,SBI-MAGNUM-TAXGAIN-SCHEME-DIR-GR,BUY,2,455.11,999.89,0,0.0,0.0,4,499.91,4 diff --git a/NOTEBOOKS/01_ETL_Bronze2Silver_Layer_TradeHistory.ipynb b/NOTEBOOKS/01_ETL_Bronze2Silver_Layer_TradeHistory.ipynb index 797f45ee..80d32b8d 100644 --- a/NOTEBOOKS/01_ETL_Bronze2Silver_Layer_TradeHistory.ipynb +++ b/NOTEBOOKS/01_ETL_Bronze2Silver_Layer_TradeHistory.ipynb @@ -9,12 +9,12 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", - "from common_utilities import replace_punctuation_from_columns,global_paths" + "from common_utilities import replace_punctuation_from_columns, global_path" ] }, { @@ -26,7 +26,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -49,7 +49,7 @@ " 8 price 166 non-null float64 \n", "dtypes: datetime64[ns](1), float64(3), object(5)\n", "memory usage: 13.0+ KB\n", - "Silver Layer csv file for trade history successfully created at:\n", + "SILVER Layer csv file for trade history successfully created at:\n", "C:\\Users\\prashant.tripathi\\Code\\Upstox\\DATA\\SILVER\\TradeHistory\\TradeHistory_data.csv\n" ] } @@ -59,7 +59,7 @@ "df_TradeHistory = []\n", "\n", "# Loop through List of all CSV files in the folder\n", - "for file_path in TRADEHISTORY_BRONZE_LAYER_PATH.glob(\"*.csv\"):\n", + "for file_path in global_path.tradehistory_bronze_layer_path.glob(\"*.csv\"):\n", " # Read the CSV file\n", " df = pd.read_csv(file_path)\n", " # Append the DataFrame to the list\n", @@ -124,11 +124,11 @@ "]\n", "\n", "# Save the result as a csv file\n", - "df_TradeHistory.to_csv(TradeHistory_SILVER_FILE_PATH, index=None)\n", + "df_TradeHistory.to_csv(global_path.tradehistory_silver_file_path, index=None)\n", "df_TradeHistory.info()\n", "\n", "print(\"SILVER Layer csv file for trade history successfully created at:\")\n", - "print(TradeHistory_SILVER_FILE_PATH.resolve())" + "print(global_path.tradehistory_silver_file_path.resolve())" ] } ], diff --git a/NOTEBOOKS/02_ETL_Bronze2Silver_Layer_BillSummary.ipynb b/NOTEBOOKS/02_ETL_Bronze2Silver_Layer_BillSummary.ipynb index 7f96f145..7527d5df 100644 --- a/NOTEBOOKS/02_ETL_Bronze2Silver_Layer_BillSummary.ipynb +++ b/NOTEBOOKS/02_ETL_Bronze2Silver_Layer_BillSummary.ipynb @@ -9,12 +9,12 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", - "from common_utilities import replace_punctuation_from_columns,global_paths" + "from common_utilities import replace_punctuation_from_columns,global_path" ] }, { @@ -26,7 +26,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -46,7 +46,7 @@ " 5 bill_number 53 non-null int32 \n", "dtypes: float64(2), int32(1), object(3)\n", "memory usage: 2.7+ KB\n", - "Silver Layer csv file for Bill Summary successfully created at:\n", + "SILVER Layer csv file for Bill Summary successfully created at:\n", "C:\\Users\\prashant.tripathi\\Code\\Upstox\\DATA\\SILVER\\BillSummary\\BillSummary_data.csv\n" ] } @@ -56,7 +56,7 @@ "df_BillSummary = []\n", "\n", "# Loop through List of all CSV files in the folder\n", - "for file_path in BillSummary_BRONZE_LAYER_PATH.glob(\"*.csv\"):\n", + "for file_path in global_path.billsummary_bronze_layer_path.glob(\"*.csv\"):\n", " # Read the CSV file\n", " df = pd.read_csv(file_path)\n", " # Append the DataFrame to the list\n", @@ -81,11 +81,11 @@ "df_BillSummary = df_BillSummary[[\"date\", \"exchange\", \"segment\", \"debit_amount\", \"credit_amount\", \"bill_number\"]]\n", "\n", "# Save the result as a csv file\n", - "df_BillSummary.to_csv(BillSummary_SILVER_FILE_PATH, index=None)\n", + "df_BillSummary.to_csv(global_path.billsummary_silver_file_path, index=None)\n", "df_BillSummary.info()\n", "\n", "print(\"SILVER Layer csv file for Bill Summary successfully created at:\")\n", - "print(BillSummary_SILVER_FILE_PATH.resolve())" + "print(global_path.billsummary_silver_file_path.resolve())" ] } ], diff --git a/NOTEBOOKS/03_ETL_Bronze2Silver_Layer_StockPrice.ipynb b/NOTEBOOKS/03_ETL_Bronze2Silver_Layer_StockPrice.ipynb index 7d582d90..cfe9c741 100644 --- a/NOTEBOOKS/03_ETL_Bronze2Silver_Layer_StockPrice.ipynb +++ b/NOTEBOOKS/03_ETL_Bronze2Silver_Layer_StockPrice.ipynb @@ -9,12 +9,12 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", - "from common_utilities import replace_punctuation_from_columns,global_paths" + "from common_utilities import replace_punctuation_from_columns,global_path" ] }, { @@ -26,7 +26,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -46,7 +46,7 @@ " 5 close 13688 non-null float64\n", "dtypes: float64(4), object(2)\n", "memory usage: 641.8+ KB\n", - "Silver Layer csv file for Stock Price history successfully created at:\n", + "SILVER Layer csv file for Stock Price history successfully created at:\n", "C:\\Users\\prashant.tripathi\\Code\\Upstox\\DATA\\SILVER\\StockPrice\\StockPrice_data.csv\n" ] } @@ -56,7 +56,7 @@ "df_StockPrice = []\n", "\n", "# Loop through List of all CSV files in the folder\n", - "for file_path in StockPrice_BRONZE_LAYER_PATH.glob(\"*.NS.csv\"):\n", + "for file_path in global_path.stockprice_bronze_layer_path.glob(\"*.NS.csv\"):\n", " # Read the CSV file\n", " df = pd.read_csv(file_path)\n", "\n", @@ -79,11 +79,11 @@ "\n", "# Save the result as a csv file\n", "df_StockPrice = df_StockPrice[[\"date\", \"stock_name\", \"open\", \"high\", \"low\", \"close\"]]\n", - "df_StockPrice.to_csv(StockPrice_SILVER_FILE_PATH, index=None)\n", + "df_StockPrice.to_csv(global_path.stockprice_silver_file_path, index=None)\n", "df_StockPrice.info()\n", "\n", "print(\"SILVER Layer csv file for Stock Price history successfully created at:\")\n", - "print(StockPrice_SILVER_FILE_PATH.resolve())" + "print(global_path.stockprice_silver_file_path.resolve())" ] } ], diff --git a/NOTEBOOKS/04_ETL_Bronze2Silver_Layer_Symbol.ipynb b/NOTEBOOKS/04_ETL_Bronze2Silver_Layer_Symbol.ipynb index 690dc2a1..9e1e0fb0 100644 --- a/NOTEBOOKS/04_ETL_Bronze2Silver_Layer_Symbol.ipynb +++ b/NOTEBOOKS/04_ETL_Bronze2Silver_Layer_Symbol.ipynb @@ -9,12 +9,12 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", - "from common_utilities import replace_punctuation_from_columns,global_paths" + "from common_utilities import replace_punctuation_from_columns,global_path" ] }, { @@ -26,7 +26,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -45,7 +45,7 @@ " 4 instrument_type 4328 non-null object\n", "dtypes: object(5)\n", "memory usage: 202.9+ KB\n", - "Silver Layer csv file for Symbol successfully created at:\n", + "SILVER Layer csv file for Symbol successfully created at:\n", "C:\\Users\\prashant.tripathi\\Code\\Upstox\\DATA\\SILVER\\Symbol\\Symbol_data.csv\n" ] } @@ -55,7 +55,7 @@ "df_Symbol = []\n", "\n", "# Loop through List of all CSV files in the folder\n", - "for file_path in Symbol_BRONZE_LAYER_PATH.glob(\"*.csv\"):\n", + "for file_path in global_path.symbol_bronze_layer_path.glob(\"*.csv\"):\n", " # Read the CSV file\n", " df = pd.read_csv(file_path)\n", " # Append the DataFrame to the list\n", @@ -71,11 +71,11 @@ "df_Symbol = df_Symbol.sort_values(by=[\"scrip_code\"])\n", "\n", "# Save the result as a csv file\n", - "df_Symbol.to_csv(Symbol_SILVER_FILE_PATH, index=None)\n", + "df_Symbol.to_csv(global_path.symbol_silver_file_path, index=None)\n", "df_Symbol.info()\n", "\n", "print(\"SILVER Layer csv file for Symbol successfully created at:\")\n", - "print(Symbol_SILVER_FILE_PATH.resolve())" + "print(global_path.symbol_silver_file_path.resolve())" ] } ], diff --git a/NOTEBOOKS/05_ETL_Silver2Gold_Layer_TradeHistory.ipynb b/NOTEBOOKS/05_ETL_Silver2Gold_Layer_TradeHistory.ipynb index 84184f3b..2dcce630 100644 --- a/NOTEBOOKS/05_ETL_Silver2Gold_Layer_TradeHistory.ipynb +++ b/NOTEBOOKS/05_ETL_Silver2Gold_Layer_TradeHistory.ipynb @@ -9,12 +9,12 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", - "from common_utilities import Portfolio,global_paths" + "from common_utilities import Portfolio, global_path" ] }, { @@ -26,20 +26,30 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "# read the csv file\n", - "df_TradeHistory = pd.read_csv(TradeHistory_SILVER_FILE_PATH)\n", - "\n", - "# replace scrip code to compnay name\n", - "df_Symbol = pd.read_csv(Symbol_SILVER_FILE_PATH)\n", - "df_Symbol[\"scrip_code\"] = df_Symbol[\"scrip_code\"].astype(str)\n", + "df_TradeHistory = pd.read_csv(global_path.tradehistory_silver_file_path)\n", "\n", "# Convert 'datetime' to datetime type\n", "df_TradeHistory[\"datetime\"] = pd.to_datetime(df_TradeHistory[\"datetime\"])\n", "\n", + "# sort the dataframe by date\n", + "df_TradeHistory = df_TradeHistory.sort_values(by=\"datetime\")" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "# replace scrip code to compnay name\n", + "df_Symbol = pd.read_csv(global_path.symbol_silver_file_path)\n", + "df_Symbol[\"scrip_code\"] = df_Symbol[\"scrip_code\"].astype(str)\n", + "\n", "# Merge df_TradeHistory with df_Symbol on the matching columns\n", "df_TradeHistory = df_TradeHistory.merge(\n", " df_Symbol[[\"scrip_code\", \"symbol\"]],\n", @@ -49,21 +59,69 @@ ")\n", "\n", "# Assign the new column 'stock_name' in df_TradeHistory to the values from 'symbol'\n", - "df_TradeHistory[\"stock_name\"] = df_TradeHistory[\"symbol\"].combine_first(df_TradeHistory[\"stock_name\"])\n", + "df_TradeHistory[\"stock_name\"] = df_TradeHistory[\"symbol\"].combine_first(df_TradeHistory[\"stock_name\"])" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [], + "source": [ + "portfolio = Portfolio()\n", "\n", - "# sort the dataframe by date\n", - "df_TradeHistory = df_TradeHistory.sort_values(by=\"datetime\")\n", + "# Apply the function of trade logic to each row of the DataFrame\n", + "data = [portfolio.trade(row.to_dict()) for _, row in df_TradeHistory.iterrows()]\n", "\n", + "df_TradeHistory = pd.DataFrame(data)\n", "\n", - "portfolio = Portfolio()\n", - "data = [portfolio.trade(row) for _, row in df_TradeHistory.iterrows()]\n", + "# Select columns that end with 'price' or 'amount'\n", + "columns_to_round = [col for col in df_TradeHistory.columns if col.endswith('price') or col.endswith('amount')]\n", "\n", - "df_TradeHistory = pd.DataFrame(data)\n", - "# df_TradeHistory = df_TradeHistory.round(2)\n", - "df_TradeHistory.columns()\n", + "# Round the values in the selected columns to two decimal places\n", + "df_TradeHistory[columns_to_round] = df_TradeHistory[columns_to_round].round(2)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Index: 166 entries, 2 to 92\n", + "Data columns (total 14 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 datetime 166 non-null datetime64[ns]\n", + " 1 exchange 166 non-null object \n", + " 2 segment 166 non-null object \n", + " 3 stock_name 166 non-null object \n", + " 4 side 166 non-null object \n", + " 5 buy_quantity 166 non-null int64 \n", + " 6 buy_price 166 non-null float64 \n", + " 7 buy_amount 166 non-null float64 \n", + " 8 sell_quantity 166 non-null int64 \n", + " 9 sell_price 166 non-null float64 \n", + " 10 sell_amount 166 non-null float64 \n", + " 11 holding_quantity 166 non-null int64 \n", + " 12 holding_price 166 non-null float64 \n", + " 13 holding_amount 166 non-null int64 \n", + "dtypes: datetime64[ns](1), float64(5), int64(4), object(4)\n", + "memory usage: 19.5+ KB\n", + "GOLD Layer csv file for trade history successfully created at:\n", + "C:\\Users\\prashant.tripathi\\Code\\Upstox\\DATA\\GOLD\\TradeHistory\\TradeHistory_data.csv\n" + ] + } + ], + "source": [ "df_TradeHistory = df_TradeHistory[\n", " [\n", " \"datetime\",\n", + " \"exchange\",\n", " \"segment\",\n", " \"stock_name\",\n", " \"side\",\n", @@ -73,9 +131,8 @@ " \"sell_quantity\",\n", " \"sell_price\",\n", " \"sell_amount\",\n", - " \"profit_loss_amount\",\n", " \"holding_quantity\",\n", - " \"holding_price_avg\",\n", + " \"holding_price\",\n", " \"holding_amount\",\n", " ]\n", "]\n", @@ -84,10 +141,10 @@ "df_TradeHistory = df_TradeHistory.sort_values(by=[\"segment\", \"stock_name\", \"datetime\"])\n", "\n", "# Save the result as a csv file\n", - "df_TradeHistory.to_csv(TradeHistory_GOLD_FILE_PATH, index=None)\n", + "df_TradeHistory.to_csv(global_path.tradehistory_gold_file_path, index=None)\n", "df_TradeHistory.info()\n", "print(\"GOLD Layer csv file for trade history successfully created at:\")\n", - "print(TradeHistory_GOLD_FILE_PATH.resolve())" + "print(global_path.tradehistory_gold_file_path.resolve())" ] } ], diff --git a/NOTEBOOKS/common_utilities.py b/NOTEBOOKS/common_utilities.py index 45d9d358..d443e6bf 100644 --- a/NOTEBOOKS/common_utilities.py +++ b/NOTEBOOKS/common_utilities.py @@ -1,10 +1,10 @@ import os import re -import time import pathlib -import requests -from enum import Enum -from datetime import datetime + +# import time +# import requests +# from datetime import datetime def replace_punctuation_from_columns(columns): @@ -25,42 +25,6 @@ def replace_punctuation_from_columns(columns): return clean_columns -def get_stock_price_data(name, from_date, to_date): - """ - Fetches stock price data from Yahoo Finance for a given stock within the specified date range. - - Parameters: - name (str): Stock ticker name (e.g., 'SBIN.NS' for SBI). - from_date (str): Start date in 'YYYY-MM-DD' format. - to_date (str): End date in 'YYYY-MM-DD' format. - - Returns: - str: CSV data as text. - """ - - # Convert date strings to Unix timestamps - from_date_unix_ts = int( - time.mktime(datetime.strptime(from_date, "%Y-%m-%d").timetuple()) - ) - to_date_unix_ts = int( - time.mktime(datetime.strptime(to_date, "%Y-%m-%d").timetuple()) - ) - - # Construct the URL for the API call - url = f"https://query1.finance.yahoo.com/v7/finance/download/{name}?period1={from_date_unix_ts}&period2={to_date_unix_ts}&interval=1d&events=history&includeAdjustedClose=true" - - # Make the API call - response = requests.get(url) - - # Check if the request was successful - if response.status_code == 200: - # Return the CSV data as text - return response.text - else: - # Raise an exception if the request failed - response.raise_for_status() - - class Portfolio: def __init__(self): self.stocks = dict() @@ -137,59 +101,97 @@ def trade( } -# Current Working Dirctory Path -cwd = pathlib.Path(os.getcwd()) -if cwd.name != "Upstox": - cwd = cwd.parent - - -def global_path(source_path): +class GlobalPath: """ - funcation to generate file path + Global Paths Class """ - data_path = cwd.joinpath("DATA").joinpath(source_path).resolve() - data_path.parent.mkdir(parents=True, exist_ok=True) - return data_path + def __init__(self) -> None: + # Base Location (Current Working Dirctory Path) + self.base_path = pathlib.Path(os.getcwd()) + if self.base_path.name != "Upstox": + self.base_path = self.base_path.parent + self.base_path = self.base_path.joinpath("DATA") + + # TradeHistory Paths + self.tradehistory_bronze_layer_path = self.make_path("BRONZE/TradeHistory") + self.tradehistory_silver_layer_path = self.make_path("SILVER/TradeHistory") + self.tradehistory_gold_layer_path = self.make_path("GOLD/TradeHistory") + self.tradehistory_silver_file_path = self.make_path( + "SILVER/TradeHistory/TradeHistory_data.csv" + ) + self.tradehistory_gold_file_path = self.make_path( + "GOLD/TradeHistory/TradeHistory_data.csv" + ) -class GlobalPath(Enum): - """ - Global Paths ENUM - """ + # BillSummary Paths + self.billsummary_bronze_layer_path = self.make_path("BRONZE/BillSummary") + self.billsummary_silver_layer_path = self.make_path("SILVER/BillSummary") + self.billsummary_silver_file_path = self.make_path( + "SILVER/BillSummary/BillSummary_data.csv" + ) + + # StockPrice Paths + self.stockprice_bronze_layer_path = self.make_path("BRONZE/StockPrice") + self.stockprice_silver_layer_path = self.make_path("SILVER/StockPrice") + self.stockprice_silver_file_path = self.make_path( + "SILVER/StockPrice/StockPrice_data.csv" + ) + + # Symbol Paths + self.symbol_bronze_layer_path = self.make_path("BRONZE/Symbol") + self.symbol_silver_layer_path = self.make_path("SILVER/Symbol") + self.symbol_silver_file_path = self.make_path("SILVER/Symbol/Symbol_data.csv") + + # ProfitLoss Paths + self.profitloss_gold_layer_path = self.make_path("GOLD/ProfitLoss") + self.profitloss_gold_file_path = self.make_path( + "GOLD/ProfitLoss/ProfitLoss_data.csv" + ) + + # Holdings Paths + self.holdings_gold_layer_path = self.make_path("GOLD/Holdings") + self.holdings_gold_file_path = self.make_path("GOLD/Holdings/Holdings_data.csv") + + def make_path(self, source_path): + """ + funcation to generate file path + """ + data_path = self.base_path.joinpath(source_path).resolve() + data_path.parent.mkdir(parents=True, exist_ok=True) + return data_path + + +global_path = GlobalPath() + + +# def get_stock_price_data(name, from_date, to_date): +# """ +# Fetches stock price data from Yahoo Finance for a given stock within the specified date range. + +# Parameters: +# name (str): Stock ticker name (e.g., 'SBIN.NS' for SBI). +# from_date (str): Start date in 'YYYY-MM-DD' format. +# to_date (str): End date in 'YYYY-MM-DD' format. + +# Returns: +# str: CSV data as text. +# """ + +# # Convert date strings to Unix timestamps +# from_date_unix_ts = int(time.mktime(datetime.strptime(from_date, "%Y-%m-%d").timetuple())) +# to_date_unix_ts = int(time.mktime(datetime.strptime(to_date, "%Y-%m-%d").timetuple())) + +# # Construct the URL for the API call +# url = f"https://query1.finance.yahoo.com/v7/finance/download/{name}?period1={from_date_unix_ts}&period2={to_date_unix_ts}&interval=1d&events=history&includeAdjustedClose=true" + +# # Make the API call +# response = requests.get(url) - # Current Working Dirctory Path - CWD = cwd - - # TradeHistory - TRADEHISTORY_BRONZE_LAYER_PATH = global_path("BRONZE/TradeHistory") - TRADEHISTORY_SILVER_LAYER_PATH = global_path("SILVER/TradeHistory") - TRADEHISTORY_GOLD_LAYER_PATH = global_path("GOLD/TradeHistory") - TRADEHISTORY_SILVER_FILE_PATH = global_path( - "SILVER/TradeHistory/TradeHistory_data.csv" - ) - TRADEHISTORY_GOLD_FILE_PATH = global_path("GOLD/TradeHistory/TradeHistory_data.csv") - - # BillSummary - BILLSUMMARY_BRONZE_LAYER_PATH = global_path("BRONZE/BillSummary") - BILLSUMMARY_SILVER_LAYER_PATH = global_path("SILVER/BillSummary") - BILLSUMMARY_SILVER_FILE_PATH = global_path( - "SILVER/BillSummary/BillSummary_data.csv" - ) - - # StockPrice - STOCKPRICE_BRONZE_LAYER_PATH = global_path("BRONZE/StockPrice") - STOCKPRICE_SILVER_LAYER_PATH = global_path("SILVER/StockPrice") - STOCKPRICE_SILVER_FILE_PATH = global_path("SILVER/StockPrice/StockPrice_data.csv") - - # Symbol - SYMBOL_BRONZE_LAYER_PATH = global_path("BRONZE/Symbol") - SYMBOL_SILVER_LAYER_PATH = global_path("SILVER/Symbol") - SYMBOL_SILVER_FILE_PATH = global_path("SILVER/Symbol/Symbol_data.csv") - - # ProfitLoss - PROFITLOSS_GOLD_LAYER_PATH = global_path("GOLD/ProfitLoss") - PROFITLOSS_GOLD_FILE_PATH = global_path("GOLD/ProfitLoss/ProfitLoss_data.csv") - - # Holdings - HOLDINGS_GOLD_LAYER_PATH = global_path("GOLD/Holdings") - HOLDINGS_GOLD_FILE_PATH = global_path("GOLD/Holdings/Holdings_data.csv") +# # Check if the request was successful +# if response.status_code == 200: +# # Return the CSV data as text +# return response.text +# else: +# # Raise an exception if the request failed +# response.raise_for_status()