Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

How to Fetch Upstox Historical Intraday API Data into Excel sheet using Microsoft Power Query

2 min read

In the previous session, we learned how Algomojo users can Get Free Upstox Interactive API and Historical Data API and in this tutorial, we are going to learn how to use Historical Intraday API, how to test the historical data API, and how to fetch Upstox Historical Intraday API Data into Excel sheet using Microsoft power query.

How to Test using Postman

Postman is an innovative tool to understand the API and In Algomojo we use Postman a lot to test and deploy robust API solutions for algotrading. Here is a video tutorial that explains how to use Postman to test Algomojo API to fetch historical data and helps understand the API data format much better before designing your trading strategies using the APIs.

Fetch Upstox Historical Intraday API Data into Excel sheet

Once you test the Historical API then next solution is to bring the historical data API into excel. Inorder to bring a Rest API with post method it is highly recommended to use Microsoft power query to fetch the historical data.

Requirements

Requirements

1)Algomojo – Upstox Trading Account
2)Upstox API
3)Microsoft Office 2013, Office 365 or Higher Version

What is a Power Query?

According to Microsoft portal, Power Query is a data connection technology that enables you to discover, connect, combine, and refine data sources to meet your analysis needs. Features in Power Query are available in Excel and Power BI Desktop.

Video Tutorial on Fetching Free Upstox API data

Microsoft Power Query

let
    url = "https://upapi.algomojo.com/1.0/Historical",
    body = "{
    ""api_key"":""8dedb0aae13f84107fa22651e4c53284"",
    ""api_secret"":""8bc7d9166092522db22da9c345345345"",
    ""data"":
      {
        ""symbol"":""RELIANCE"",
        ""exchange"":""NSE_EQ"",
        ""interval"":""5"",
        ""start_date"":""24-01-2021"",
        ""end_date"":""29-01-2021"",
        ""format"":""json""
      }
}",
    Source = Json.Document(Web.Contents(url, [Headers=[#"Content-Type"="application/json"],Content =Text.ToBinary(body)])),
    data = Source[data],
    #"Converted to Table" = Table.FromList(data, Splitter.SplitTextByDelimiter(","), null, null, ExtraValues.Error),
    #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", Int64.Type}, {"Column2", type number}, {"Column3", type number}, {"Column4", type number}, {"Column5", type number}, {"Column6", Int64.Type}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "DateTime"}, {"Column2", "Open"}, {"Column3", "High"}, {"Column4", "Low"}, {"Column5", "Close"}, {"Column6", "Volume"}}),
    #"Added Custom" = Table.AddColumn(#"Renamed Columns", "Timestamp", each #datetime(1970,1,1,0,0,0) + #duration(0, 5,30, [DateTime]/1000)),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"DateTime"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Columns",{"Timestamp", "Open", "High", "Low", "Close", "Volume"}),
    #"Renamed Columns1" = Table.RenameColumns(#"Reordered Columns",{{"Timestamp", "DateTime"}})
in
    #"Renamed Columns1"

Download the Excel Sheet with PowerQuery to Fetch Upstox Historical Data

Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Send Smart Options Execution Orders from Futures or Spot…

This tutorial provides instructions on how to utilize simple buy and sell trading signals in Spot/Future charts to place option orders (including ATM, ITM,...
Rajandran R
11 min read

Algomojo Autocancellation of Limit Orders After N seconds

In this tutorial, I'm going to demonstrate how to use Amibroker AFL code to perform auto cancellation of limit order after N...
Rajandran R
3 min read

How to Squareoff All OpenPositions using Tradingview – Automation…

One of the most demanded requests from Tradingview-based automated traders is how to square-off all open positions when a particular time is reached. There...
Rajandran R
1 min read

2 Replies to “How to Fetch Upstox Historical Intraday API Data into…”

  1. Hi! What is the maximum amount of historical data we can get? Do they provide historical options data as well?

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More