Skip to content

Instantly share code, notes, and snippets.

View ganigithub's full-sized avatar
🎯
Focusing

Ganesh Nagarvani ganigithub

🎯
Focusing
View GitHub Profile
ticker = "NSE:INFY"
interval_high = kite.quote(ticker)[ticker]['ohlc']['high']
print(interval_high)
#output : 1610.7
interval_low = kite.quote(ticker)[ticker]['ohlc']['low']
print(interval_low)
#output : 1592.05
from pynse import *
quote = nse.get_quote('INFY')
interval_high = quote['high']
print(interval_high)
#output : 1610.7
interval_low = quote['low']
print(interval_low)
form kiteconnect import KiteTicker
tokens = [738561, 5633] #token numbers of instruments
def on_ticks(ws, ticks):
print(ticks)
def on_connect(ws, response):
# Subscribe to a list of instrument_tokens
ws.subscribe(tokens)
import time
ticker_symbol = "NSE:GLENMARK"
trading_symbol = 'GLENMARK'
quantity = 1
for i in range(10000):
ltp = kite.ltp(ticker_symbol)[ticker_symbol]["last_price"]
import time
ticker_symbol = "NSE:GLENMARK"
trading_symbol = "GLENMARK"
quantity = 1
#The time at which we want to place order (24 hr format)
entry_hour = 13
entry_minute = 00
def instrument_token(data, symbol):
"""
This function will return the token number of the instrument from data
"""
return data[data.tradingsymbol == symbol].instrument_token.values[0]
def historical_data(symbol, from_date, to_date, interval):
"""
This function will return historical data of the instrument for specific period of days for specific interval
"""
from selenium import webdriver
from pyotp import TOTP
from time import sleep
def login(self, webdriver_path, url, user_id, pwd, totp):
"""
This function will login to zerodha account with inspect element opened.
"""
service = webdriver.chrome.service.Service(webdriver_path)
def stock_1(self, driver):
"""
This function finds BankNifty future and gets its chart
"""
#marketwatch
sleep(1)
driver.find_element_by_xpath("/html/body/div[1]/div[1]/div/div/div[1]/a[1]/span").click()
sleep(1)
pip install pyautogui
import pyautogui as pg
def inspect(self, x_dev_tools,y_dev_tools,x_bottom_symbol,y_bottom_symbol,x_network,y_network,x_xhr,y_xhr,x_refresh,y_refresh):
"""
This function will open developer tools and navigate to network panel.
Input parameters are the coordinates of buttons on screen.
"""
#click on inspect menu
import json
import pyperclip
def minute_data(self,x_day_chart,y_day_chart,x_min_chart,y_min_chart,x_minute_url,y_minute_url,x_response,y_response,x_data,y_data):
#convert day to minute
sleep(2)
pg.click(x_day_chart , y_day_chart, interval=1)
#select 1 minute