Posts

Showing posts from April, 2022

Filter Overbought and Oversold Stocks using JAVA and Zerodha Kiteconnect API.

IMPORT LIBRARIES import com.zerodhatech.kiteconnect.KiteConnect; import com.zerodhatech.kiteconnect.kitehttp.exceptions.KiteException; import com.zerodhatech.models.*; import java.io.IOException; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import org.json.JSONException; DECLARE VARIABLES public static KiteConnect kiteSdk; public static String instrumentToken[][]=new String[1900][2]; public static int instrumentCount=0; public static boolean stopScan=false;  CONNECTING TO KITE String req_token=JOptionPane.showInputDialog(this,"ENTER REQUEST TOKEN"); String api_key=""; String sec_key=""; kiteSdk = new KiteConnect(""); kiteSdk.setUserId("LP8865"); User users = null;          try {              users = kiteSdk.generateSession(req_token, sec_key);          }  catch (IOException ex) {                    } catch (KiteException | JSONException ex) {         Logger.getLo

Create Option Chain using PYTHON.

from tkinter import * from tkinter import ttk import sqlite3 import time import threading from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta from kiteconnect import KiteConnect root=Tk() root.geometry("680x350") root.config(background="black") style= ttk.Style() style.theme_use('winnative') stopScan=False def startThread():     t1=threading.Thread(target=optionChain)     t1.start() def connectZerodha():     global kite     kite=KiteConnect(api_key="")     request_token=entryToken.get()     data=kite.generate_session(request_token,api_secret="")     kite.set_access_token(data["access_token"])     top.destroy()     expiry()     connectButton.config(bg="palegreen",text="CONNECTED") def popup():     global top,entryToken     top=Toplevel(root)     entryToken=ttk.Entry(top)     entryToken.grid(row=0,column=0)     Button(top,text="SUBMIT",command=connectZerodha).gr

How to place order in zerodha when RSI crosses below 30? Algo Trading Python

How to place order in zerodha when RSI crosses below 30? Algo Trading Python COMPLETE CODE from tkinter import * from tkinter import ttk import sqlite3 import threading from datetime import datetime, timedelta from kiteconnect import KiteConnect root=Tk() root.geometry("720x400") root.config(background="black") style= ttk.Style() style.theme_use('winnative') stopPos=False stopStrat=False def startThread(thread):     match thread:         case 0:             t1=threading.Thread(target=pnl)             t1.start()         case 1:             t1=threading.Thread(target=addStrategy)             t1.start() def stopThread(thread):     global stopPos,stopStrat     match thread:         case 0:             stopPos=True         case 1:             stopStrat=True def connectZerodha():     global kite     kite=KiteConnect(api_key="")     request_token=entryToken.get()     data=kite.generate_session(request_token,api_secret="")     kite.set_access_tok

How to Place Order in Zerodha using Python

HOW TO PLACE ORDER IN ZERODHA USING PYTHON GUI from tkinter import * from tkinter import ttk import sqlite3 import threading from kiteconnect import KiteConnect root=Tk() root.geometry("670x200") root.config(background="black") style= ttk.Style() style.theme_use('winnative') topFrame=Frame(root) Button(topFrame,text="CONNECT",command=popup,width=20,bg="green4",fg="white",font=("Arial Black",10)).grid(row=0,column=0) username=Label(topFrame,width=20,font=("Arial Black",10)) username.grid(row=0,column=1) Button(topFrame,text="SL&QUANTITY",command=generateFields,width=20,bg="green4",fg="white",font=("Arial Black",10)).grid(row=0,column=2) orderFrame=Frame(root) Label(orderFrame,text="NAME",width=20,bg="gray10",fg="white",font=("Arial Black",10)).grid(row=0,column=0) name=Entry(orderFrame,font=("Arial Black",10)) name.gr

JTable Row Color Based on Value of Each Row.

  How to color each row in Java Table. We need to inherit the property of table renderer to do this. Let’s see how to color the row in table in java. PROGRAM import java.awt.Color; import java.awt.Component; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; /** * * @author Mukesh */ public class renderClass extends DefaultTableCellRenderer { DefaultTableModel model=null; public renderClass(JTable jtable) { super(); model=(DefaultTableModel)jtable.getModel(); } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if(Double.parseDouble(model.getValueAt(row,1).toString())>=0) { cell.setForeground(Color.green); return cell; } else { cell.setForeground(Color

Zerodha Algo Trading Python, How to connect to kiteconnect?

Image
Here I am going to show you how to integrate python program to zerodha kite connect. Let us see each step in detail. STEP 1: KITE CONNECT SIGN UP Goto https://kite.trade/ Click Sign up Enter the information and submit STEP 2: APP CREATION Login into https://kite.trade/ Click create new APP Enter any name in App name field Insert your Zerodha client id in “Client ID” Field Enter any url in Redirect URL Field. eg:-https://kite.zerodha.com/ Click create to create the app. Activate the APP by paying 2000 rs. Page that looks like below one is displayed Three things that we need to integrate our code to Zerodha API Key ( Found at the app page above) API secret ( Found at the app page above) Request Token ( We need to generate this separately) Before generating request token we need to  add TOTP  in Zerodha HOW TO ADD TOTP IN ZERODHA Go to play store  download Authy  App. Open the App add complete the mobile verification Go to  Zerodha profile Click  Password and Security Next, click on Enabl

Zerodha Algo Trading, Java, How to connect to kiteconnect?

Image
  Here I am going to show you how to integrate java program to zerodha kite connect. Let us see each step in detail. STEP 1: KITE CONNECT SIGN UP Goto https://kite.trade/ Click Sign up Enter the information and submit STEP 2: APP CREATION Login into https://kite.trade/ Click create new APP Enter any name in App name field Insert your Zerodha client id in “Client ID” Field Enter any url in Redirect URL Field. eg:-https://kite.zerodha.com/ Click create to create the app. Activate the APP by paying 2000 rs. Page that looks like below one is displayed Three things that we need to integrate our code to Zerodha API Key ( Found at the app page above) API secret ( Found at the app page above) Request Token ( We need to generate this separately) Before generating request token we need to  add TOTP  in Zerodha HOW TO ADD TOTP IN ZERODHA Go to play store  download Authy  App. Open the App add complete the mobile verification Go to  Zerodha profile Click  Password and Security Next, click on Enabl