from pymongo import MongoClient
from datetime import datetime

# Connect to MongoDB
client = MongoClient("mongodb://jenya:DJenya$Mongo%40St0ckDB@172.105.59.175:27017/")  # Replace with your MongoDB URI
db = client['trade_iq']  # Replace with your database name
collection = db['nse_data1']  # Replace with your collection name

checkSymbols = ['OMFURN-ST', 'ADL', 'RELINFRA', 'HARRMALAYA', 'HCL-INSYS', 'MARINE-BE', 'REPL-BE', 'RVHL-BE', 'WANBURY-BZ', 'MIRCELECTR', 'MODIRUBBER', 'OSWALAGRO', 'VERA-ST', 'BORORENEW-BE', 'MODISONLTD', 'AJOONI', 'TECILCHEM', 'MOKSH', 'PARASPETRO', 'CORALFINAC', 'PVP', 'PANACEABIO', 'AMBANIORGO-ST', 'ZENITHEXPO', 'RUCHINFRA', 'ATLASCYCLE', 'KCPSUGIND', 'INDIANCARD-BE', 'HINDCON-BE', 'GANGAFORGE', 'SVPGLOB-BE', 'SGIL-BE', 'ANTGRAPHIC', 'BEWLTD-ST', 'ARCHIES', 'PRECOT-BE', 'UWCSL-ST', 'JAINAM-ST', 'EIFFL', 'PANSARI', 'ARTNIRMAN-BE', 'PREMIER-BE', 'CCHHL', 'LAMBODHARA-BE', 'MANORG', 'KOTHARIPRO-BE', 'FOCUS', 'DMCC-BE', 'ZODIAC', 'SPMLINFRA-BE', 'SUNFLAG-BE', 'MANAKCOAT-BE', 'HAVISHA', 'TREJHARA', 'VIVO-SM', 'ALPSINDUS-BE', 'SHREERAMA-BE', 'UCAL-BE', 'KREBSBIO-BE', 'MHLXMIRU-BE', 'LFIC', 'PRECISION-ST', 'MALLCOM', 'CROWN', 'SOFTTECH-BE', 'CALSOFT', 'XELPMOC', 'BLUECOAST-BE', 'AKSHOPTFBR-BE', 'DIL-BE', 'MUKTAARTS', 'SHAILY-BE', 'UMAEXPORTS', 'MINDPOOL-SM', '3PLAND-BE', 'SOMATEX-BE', 'BALAJITELE-BE', 'NKIND-BE', 'AXISCADES-BE', 'SONUINFRA-ST', 'ARENTERP-BE', 'BANARBEADS-BE', 'ICDSLTD-BE', 'GSTL-ST', 'SAMBHAAV-BE', 'NEXTMEDIA-BE', 'TNTELE-BE', 'GUJRAFFIA-BE', 'AYMSYNTEX', 'AURUM', 'PKTEA-BE', 'RADHIKAJWE', 'SHREEPUSHK', 'SEYAIND-BE', 'KORE-ST', 'SHRENIK', 'COFFEEDAY-BE', 'TIMESGTY-BE', 'TVSELECT', 'DHANBANK-BE', 'TIPSFILMS-BE', 'UMANGDAIRY-BE', 'KRIDHANINF-BE', 'CENTEXT', 'INDSWFTLTD-BE', 'MSPL', 'MCLEODRUSS-BE', 'BASML', 'DJML-BE', 'SECL-ST', 'IIFLCAPS', 'KERNEX-BE', 'VISASTEEL-BE', 'IEL-BE', 'SGL', 'PIONEEREMB-BE', 'OMKARCHEM-BZ', 'GMRAIRPORT', 'HOVS', 'BINANIIND', 'MADHUCON', 'INFOMEDIA', 'INSPIRISYS', 'DONEAR', 'PLASTIBLEN', 'PRAENG', 'HBLENGINE', 'ZEEMEDIA', 'SARLAPOLY-BE', 'BAGFILMS-BE', 'IZMO-BE', 'SEQUENT', 'TTL-BE', 'ORIENTALTL', 'ZENITHSTL', 'MCON-ST', 'WEBELSOLAR-BE', 'FSC-BZ', 'GUJAPOLLO', 'MEGASOFT', 'ALPA', 'AKI-BE', 'LAL', 'NAGREEKCAP-BE', 'ENERGYDEV-BE', 'RHL-BE', 'BGRENERGY-BE', 'BURNPUR', 'ARIES-BE', 'RPOWER', 'QUICKTOUCH-ST', 'BANG-BE', 'MMP', 'DIGISPICE', 'SAHANA-ST', 'RBL', 'RANEENGINE', 'GVT&D', 'LOTUSEYE', 'LPDC-BE', 'TPHQ-BE', 'URAVI', 'ALBERTDAVD', 'SETCO-BE', 'UNIVPHOTO-BE', 'REFEX', 'GROBTEA', 'KKVAPOW-SM', 'SOMICONVEY', 'GILLANDERS-BE', 'GEEKAYWIRE', 'VLEGOV', 'MBLINFRA', 'YUDIZ-SM', 'ORIENTLTD-BE', 'ASIANHOTNR-BE', 'ISFT', 'ZAGGLE', 'AURDIS-ST', 'CELLECOR-SM', 'GICL-ST', 'NBIFIN-BE', 'DIGIKORE-ST', 'AARTISURF', 'COMMITTED-ST', 'ARVINDPORT-ST', 'ONDOOR-ST', 'SHANTHALA-ST', 'PARAGON-ST', 'TRANSTEEL-ST', 'LGHL-BE', 'INTENTECH', 'CLEDUCATE', 'SHAH', 'MARINETRAN-ST', 'WIPL-BE', 'PRESSTONIC-ST', 'RPPINFRA-BE', 'MOTISONS', 'RBZJEWEL', 'A2ZINFRA-BE', 'JALAN-ST', 'VSCL-ST', 'SURANASOL', 'TECHLABS-ST', 'KCEIL-ST', 'DYNPRO', 'OPTIEMUS', 'COCHINSHIP', 'COMSYN-BE', 'HINDMOTORS', 'LASA', 'MCL-BE', 'LOVABLE', 'EPACK', 'SIGNPOST-BE', 'SIGNORIA-SM', 'ENFUSE-ST', 'K2INFRA-ST', 'ALUWIND-SM', 'RBS-ST', 'AURUMPP1-E1', 'EMMIL-ST', 'HOACFOODS-ST', 'GPECO-ST', 'RETAIL', 'WINNY-ST', 'SPCL-ST', 'DPEL-ST', 'DELPHIFX-BE', 'RNFI-ST', 'RELTD', 'APRAMEYA-ST', 'FORCAS-ST', 'ELGIRUBCO-BE', 'JAYBEE-ST', 'ASAHISONG', 'BOSS-ST', 'SPPPOLY-ST', 'VASWANI', 'OSELDEVICE-ST', 'PELATRO-ST', 'INDOUS-BE', 'AVIANSH-ST', 'SHAKTIPUMP-BE', 'RAPPID-ST', 'THESL-ST', 'HVAX-ST', 'FRESHARA-ST', 'MEP-BZ', 'OBSCP-ST', 'UHTL-ST', 'CINELINE-BE', 'RACLGEAR', 'NTPCGREEN', 'EIEL', 'LAMOSAIC-ST', 'CMMIPL-SZ', 'ITTL-ST', 'RAJPUTANA-SM', 'C2C-SM', 'ABHAPOWER-ST', 'APEXECO-SM', 'SAMPANN-BE', 'AGARWALTUF-SM', 'SURAKSHA', 'GANESHIN-SM', 'ROSSTECH', 'ODIGMA-BE', 'ETML-SM', 'DHANLAXMI-ST', 'INNOVANA', '698GR2054-GS', 'SAILIFE', 'VMM', 'PURPLEUTED-SM', 'MOBIKWIK', 'SFML-SM', 'IKS', 'ANUHPHR', 'IGIL', '675GS2029-GS', 'IDENTICAL-ST', 'SRPL-BZ', 'SUULD-BZ', 'CLOUD-SZ', 'DAMCAPITAL', 'MAMATA-BE', 'TRANSRAILL', 'CEWATER', 'NMSTEEL-ST', 'SANATHAN', 'MOKSH-RE-BE', 'UPLPP-E1', 'VENTIVE', 'CARRARO', 'SENORES', 'KITEX-BE', 'UNIMECH', 'CONSUMER', 'ANYA-ST', 'ARSHIYA-BZ', 'CEREBRAINT-BZ', 'ECAPINSURE', 'INDOFARM', 'PCJEWELLER', 'MOHITIND-BE', 'THOMASCOTT-BE', 'NDL', 'MTEDUCARE-BE', 'LYPSAGEMS', 'ORBTEXP-BE']

for symbol in checkSymbols:
    # Define the query
    query = {
        "timestamp": {
            "$gte": datetime(2025, 1, 7),
            "$lt": datetime(2025, 1, 8)
        }
    }

    # Delete the document
    result = collection.delete_one(query)

    # Output the result
    if result.deleted_count > 0:
        print(f"Document for '{symbol}' on 2025-01-07 has been deleted.")
    else:
        print("No document found matching the criteria.")
