Spaces:
Sleeping
Sleeping
from pydantic import BaseModel, ConfigDict, Field | |
from typing import Any, List | |
## Search Model | |
class Stock(BaseModel): | |
ID: str | |
title: str | |
NSE_Symbol: str | |
contract_id: str | |
search_response_example = { | |
"ID": "zomato-ltd", | |
"title": "Zomato Ltd.", | |
"NSE_Symbol": "ZOMATO", | |
"contract_id": "GSTK543320" | |
} | |
## LTP Model | |
class LTP(BaseModel): | |
ltp: float | |
ltp_response_example = { | |
"ltp" : 209.50 | |
} | |
## Historical Data | |
class HISTORICAL(BaseModel): | |
data: List[dict] | |
historical_response_example = { | |
"data": [ | |
{ | |
"Date": "2024-06-24T09:15:00+05:30", | |
"Open": 193.9, | |
"High": 194.84, | |
"Low": 192.02, | |
"Close": 194.15, | |
"Volume": 2767062 | |
}, | |
{ | |
"Date": "2024-06-24T09:30:00+05:30", | |
"Open": 194.14, | |
"High": 194.2, | |
"Low": 192.8, | |
"Close": 193.97, | |
"Volume": 4066133 | |
} | |
] | |
} | |
## Historical Data | |
class CHAIN(BaseModel): | |
ltp: float | |
expiry: str | |
data: List[dict] | |
chain_response_example = { | |
"ltp": 52000.01, | |
"expiry": "BANKNIFTY24703", | |
"data": [ | |
{ | |
"Symbol_CE": "BANKNIFTY2470351600CE", | |
"OI_CALL": 3347, | |
"CALL": 676.8, | |
"strikePrice": 51600, | |
"PUT": 43.3, | |
"OI_PUT": 61530, | |
"Symbol_PE": "BANKNIFTY2470351600PE" | |
}, | |
{ | |
"Symbol_CE": "BANKNIFTY2470351700CE", | |
"OI_CALL": 4870, | |
"CALL": 585.55, | |
"strikePrice": 51700, | |
"PUT": 56.45, | |
"OI_PUT": 66516, | |
"Symbol_PE": "BANKNIFTY2470351700PE" | |
}, | |
] | |
} | |
## News Data | |
class NEWS(BaseModel): | |
data: List[dict] | |
news_response_example = { | |
"data": [ | |
{ | |
"title": "Karnataka's new gig worker draft bill: Why Morgan Stanley is 'overweight' on Zomato", | |
"summary": "NSE Morgan Stanley has maintained an overweight rating on Zomato with a target price of ₹235 per share.", | |
"url": "https://www.cnbctv18.com/market/karnataka-new-draft-gig-worker-bill-zomato-shares-price-stock-morgan-stanley-target-overweight-19436697.htm", | |
"pubDate": "2024-07-02T09:38:15", | |
"source": "CNBC TV18", | |
"companyName": "Zomato", | |
"symbol": "ZOMATO", | |
"blogUrl": "https://www.cnbctv18.com/market/karnataka-new-draft-gig-worker-bill-zomato-shares-price-stock-morgan-stanley-target-overweight-19436697.htm", | |
"topics": "Regulatory and Legal" | |
}, | |
{ | |
"title": "Zomato Shares Touch An All-Time High After ESOP Plan Gets Shareholders’ Nod", | |
"summary": "Shares of Zomato reached an all-time high of INR 209.75 apiece during Tuesday’s intraday trading session The price surge in the stock came after Zomato said it has secured approval from its shareholders to grant", | |
"url": "https://inc42.com/buzz/zomato-shares-touch-an-all-time-high-after-esop-plan-gets-shareholders-nod/", | |
"pubDate": "2024-07-02T07:36:51", | |
"source": "Inc42", | |
"companyName": "Zomato", | |
"symbol": "ZOMATO", | |
"blogUrl": "https://inc42.com/buzz/zomato-shares-touch-an-all-time-high-after-esop-plan-gets-shareholders-nod/", | |
"topics": "Financial Results" | |
} | |
] | |
} | |
## Signal Model | |
class SIGNAL(BaseModel): | |
data: dict | |
signal_response_example = { | |
"data": { | |
"signal_status": True, | |
"strike": 24350, | |
"option_type": "CE", | |
"entry_price": 99.5, | |
"stoploss": 88, | |
"index_candle": { | |
"Date": "2024-07-08T15:15:00+05:30", | |
"Open": 24311.6, | |
"High": 24344.25, | |
"Low": 24301.5, | |
"Close": 24331.05, | |
"RSI": 60.153783549430166, | |
"Prev_RSI": 56.04770925328034, | |
"Signal": 1, | |
"Option": 24350, | |
"direction": "CE", | |
"symbol": "NIFTY2471124350CE" | |
}, | |
"symbol_candle": { | |
"Date": "2024-07-08T15:15:00+05:30", | |
"Open": 94.45, | |
"High": 99.5, | |
"Low": 88, | |
"Close": 95.2, | |
"Volume": 57868625 | |
} | |
} | |
} | |
## get all stocks | |
class ALL(BaseModel): | |
data: str | |
all_response_example = { | |
"data": '''[{\"isin\":\"INE002A01018\",\"growwContractId\":\"GSTK500325\"''' | |
} |