-
Notifications
You must be signed in to change notification settings - Fork 7
/
advanced_usage.py
22 lines (18 loc) · 930 Bytes
/
advanced_usage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from option_stream import OptionStream
from helper import get_secrets
from redis_helper import RedisConfig
# the option stream start should be in main module
if __name__ == '__main__':
secrets = get_secrets()
symbols = ['NFO:HDFCBANK', 'NFO:INFY', 'NFO:RELIANCE', 'NFO:DRREDDY', 'NFO:EICHERMOT']
# The percentage criteria filters out options with strike prices that are more than a specified value away
# from the current spot price. In this example, percentage value is set to 12.5%.
# By adding this criteria filter, it resolves to 262 tokens instead of 438 tokens if no filter was
# applied
criteria = {'name': 'percentage', 'properties': {'value': 12.5}}
stream = OptionStream(symbols, secrets,
expiry='23-02-2023',
criteria=criteria,
redis_config=RedisConfig(db=1)
)
stream.start()