Skip to main content

Posts

Showing posts from May, 2020

Process Tick data to form One minute OHCLV Using SQL

|| श्री || Ticks to usable Time Frame Tick data is raw data that we need to process into the usable time frame. As I am using Zerodha ticker service it gives me data every tick. If we need to find an opportunity for trading, required to process the data to make it usable. Here I am saving data into mssql data base to store tick data. Below is my table structure.         You can use below script to use table. I am storing only current day data for Nifty50 stock and Nifty50Index. In my table End of the day will move this data into my historical table which store 1 min data. and truncate table. CREATE TABLE [dbo].[TickerData]( [TimeStamp] [datetime] NULL, [Open] [decimal](9, 2) NULL, [High] [decimal](9, 2) NULL, [Low] [decimal](9, 2) NULL, [Close] [decimal](9, 2) NULL, [Volume] [bigint] NULL, [InstrumentID] [bigint] NULL, [recordid] [bigint] IDENTITY(1,1) NOT NULL,  CONSTRAINT [PK_TickerData] PRIMARY KEY CLUSTERED ( [reco

How to fetch data using c# code and get last x day candle and Save DB

|| श्री ||  Zerodha Historical Data.      Here we are going to look into how to get historical data from Zerodha Kite API and manipulate it.     Historical data is important to make decision on the basis of support and resistance level . If we need to find these important levels then we may need data from previous days. We required to get data and manipulate it.  Prerequisite :- you required to subscribe for historical api.  Please have look at below image. Here my intention is when we login to system in background my application should check when my db last updated historical data and from there onward it start fetching data.  Historical Data Service In above code have check limit number of days we can request data is maximum 60 days.  So i tried such way if we request more than 60 days it will fetch record in 60 days batch.  Kite Api Response - Kite respond us data using List of Historical   object but it not having instrument i