Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functions for equity and currency option chain #67

Merged
merged 1 commit into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jugaad_data/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__= "0.25"
__version__= "0.26"
12 changes: 12 additions & 0 deletions jugaad_data/nse/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class NSELive:
"all_indices": "/allIndices",
"live_index": "/equity-stockIndices",
"index_option_chain": "/option-chain-indices",
"equity_option_chain": "/option-chain-equities",
"currency_option_chain": "/option-chain-currency",
"pre_open_market": "/market-data-pre-open",
"holiday_list": "/holiday-master?type=trading"
}
Expand Down Expand Up @@ -101,6 +103,16 @@ def index_option_chain(self, symbol="NIFTY"):
data = {"symbol": symbol}
return self.get("index_option_chain", data)

@live_cache
def equities_option_chain(self, symbol):
data = {"symbol": symbol}
return self.get("equity_option_chain", data)

@live_cache
def currency_option_chain(self, symbol="USDINR"):
data = {"symbol": symbol}
return self.get("currency_option_chain", data)

@live_cache
def live_fno(self):
return self.live_index("SECURITIES IN F&O")
Expand Down
12 changes: 12 additions & 0 deletions tests/test_nse_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ def test_index_option_chain():
assert "filtered" in d
assert "records" in d

def test_equities_option_chain():
d = n.equities_option_chain("RELIANCE")
assert "filtered" in d
assert "records" in d
assert "data" in d["records"]

def test_currency_option_chain():
d = n.currency_option_chain("USDINR")
assert "filtered" in d
assert "records" in d
assert "data" in d["records"]

def test_live_fno():
d = n.live_fno()
assert "SECURITIES IN F&O" == d['name']
Expand Down