express-option-chain icon indicating copy to clipboard operation
express-option-chain copied to clipboard

Feature to subscribe to multiple expiries

Open pramakrishn opened this issue 2 years ago • 9 comments

The existing functionality allows users to subscribe to a single expiry when utilizing the option chain feature. The capability to subscribe to multiple expiry dates concurrently is missing. This will broaden the versatility of the option chain and significantly benefit users managing diverse portfolios.

while subscribing users should be able to provide input like

data = {
'23-07-2023': ['NFO:BANKNIFTY', 'NFO:NIFTY'],
'25-08-2023': ['NFO:HDFCBANK', 'NFO:BANKNIFTY', 'NFO:NIFTY']
}

pramakrishn avatar Jul 08 '23 21:07 pramakrishn

Code describing the advanced usage: how to save the file in csv stream = OptionStream(symbols, secrets, expiry='23-02-2023', criteria=criteria, redis_config=RedisConfig(db=1) ) stream.start() after starting the stream. Can you please help me.

Gil3232 avatar Jul 15 '23 18:07 Gil3232

@Gil3232 After starting the stream, you can use this code to create a csv I have added few columns, based on your requirement you can modify it


option_chain_fetcher = OptionChainFetcher()

option_chain = option_chain_fetcher.get_option_chain('NFO:BANKNIFTY')
import csv


filename = 'banknifty.csv'

# Write to the CSV file
with open(filename, 'w', newline='') as f:
    writer = csv.writer(f)

    headers = [
        'exchange', 'symbol', 'strike_price', 'ce_premium',
        'ce_bid_price', 'ce_ask_price', 'pe_premium',
        'pe_bid_price', 'pe_ask_price'
    ]
    writer.writerow(headers)

    expiry = option_chain['expiry']
    for expiry_date, options in expiry.items():
        for option in options:
            row = dict.fromkeys(headers, '')
            row['exchange'] = option_chain['exchange']
            row['symbol'] = option_chain['trading_symbol']
            row['strike_price'] = option['strike_price']

            for ce_pe in ('ce', 'pe'):
                if ce_pe in option:
                    row[f'{ce_pe}_premium'] = option[ce_pe]['premium']
                    row[f'{ce_pe}_bid_price'] = option[ce_pe]['bid_price']
                    row[f'{ce_pe}_ask_price'] = option[ce_pe]['ask_price']

            writer.writerow(row.values())


pramakrishn avatar Jul 15 '23 21:07 pramakrishn

Thank you so much.

On Sun, Jul 16, 2023 at 2:52 AM Prajwal Ramakrishna < @.***> wrote:

@Gil3232 https://github.com/Gil3232 After starting the stream, you can use this code to create a csv I have added few columns, based on your requirement you can modify it

option_chain_fetcher = OptionChainFetcher() option_chain = option_chain_fetcher.get_option_chain('NFO:BANKNIFTY')import csv

filename = 'banknifty.csv'

Write to the CSV filewith open(filename, 'w', newline='') as f:

writer = csv.writer(f)

headers = [
    'exchange', 'symbol', 'strike_price', 'ce_premium',
    'ce_bid_price', 'ce_ask_price', 'pe_premium',
    'pe_bid_price', 'pe_ask_price'
]
writer.writerow(headers)

expiry = option_chain['expiry']
for expiry_date, options in expiry.items():
    for option in options:
        row = dict.fromkeys(headers, '')
        row['exchange'] = option_chain['exchange']
        row['symbol'] = option_chain['trading_symbol']
        row['strike_price'] = option['strike_price']

        for ce_pe in ('ce', 'pe'):
            if ce_pe in option:
                row[f'{ce_pe}_premium'] = option[ce_pe]['premium']
                row[f'{ce_pe}_bid_price'] = option[ce_pe]['bid_price']
                row[f'{ce_pe}_ask_price'] = option[ce_pe]['ask_price']

        writer.writerow(row.values())

— Reply to this email directly, view it on GitHub https://github.com/pramakrishn/express-option-chain/issues/1#issuecomment-1636888916, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBHVTOIKTPM5Y5WBUIAUURLXQMC2RANCNFSM6AAAAAA2DCNUA4 . You are receiving this because you were mentioned.Message ID: @.***>

Gil3232 avatar Jul 16 '23 02:07 Gil3232

hi can this be done with proper gui, i am sure you have one, for some one who wants to focus on trading rather than coding, i have script for nsepython lib, which works but not reliable as data from nse is not fetched easily on every call

hbinmadi avatar Oct 29 '23 20:10 hbinmadi

my plan is to hire some one to develop me a reliable gui, which gives me real time change in io in near atm + 1000 -1000 of bank nifty option and change in price eg: pcr/ money in near ATM options,

hbinmadi avatar Oct 29 '23 21:10 hbinmadi

The existing functionality allows users to subscribe to a single expiry when utilizing the option chain feature. The capability to subscribe to multiple expiry dates concurrently is missing. This will broaden the versatility of the option chain and significantly benefit users managing diverse portfolios.

while subscribing users should be able to provide input like


data = {

'23-07-2023': ['NFO:BANKNIFTY', 'NFO:NIFTY'],

'25-08-2023': ['NFO:HDFCBANK', 'NFO:BANKNIFTY', 'NFO:NIFTY']

}

Any news about this update

hbinmadi avatar Nov 10 '23 07:11 hbinmadi

Hi, How to fetch all FNO derivatives as per the symbol mention in an excel sheet? Suppose I had mentioned a cell name in excel as: Symbol Reliance then Reliance derivative data will fetch and show the CE/Pe max oi, LTPm Chng LTP, Volume, Ch in Oi, Max Oi strikes CE/PE then if i type TATAPOWER then their derivative data as above will show.

sujeetk789 avatar Dec 05 '23 18:12 sujeetk789

Hi @sujeetk789, this project supports retrieving the data through APIs. If you have knowledge of programming, you can use the above snippet of code to write the data to an excel sheet.

pramakrishn avatar Dec 07 '23 12:12 pramakrishn

@hbinmadi I am not certain about the date.

pramakrishn avatar Dec 07 '23 12:12 pramakrishn