Authors Indian Quant

7 days 30 days All time Recent Popular
Nano Course On Python For Trading
==========================
Module 1

Python makes it very easy to analyze and visualize time series data when you’re a beginner. It's easier when you don't have to install python on your PC (that's why it's a nano course, you'll learn python...

... on the go). You will not be required to install python in your PC but you will be using an amazing python editor, Google Colab Visit
https://t.co/EZt0agsdlV

This course is for anyone out there who is confused, frustrated, and just wants this python/finance thing to work!

In Module 1 of this Nano course, we will learn about :

# Using Google Colab
# Importing libraries
# Making a Random Time Series of Black Field Research Stock (fictional)

# Using Google Colab

Intro link is here on YT: https://t.co/MqMSDBaQri

Create a new Notebook at https://t.co/EZt0agsdlV and name it AnythingOfYourChoice.ipynb

You got your notebook ready and now the game is on!
You can add code in these cells and add as many cells as you want

# Importing Libraries

Imports are pretty standard, with a few exceptions.
For the most part, you can import your libraries by running the import.
Type this in the first cell you see. You need not worry about what each of these does, we will understand it later.
Nano Course On Python For Trading
==========================
Module 2

In this post, I will attempt to show a simple Python code to download the past 5 years' Nifty50 stocks EOD Data using the NSEpy library in less than 2


The first few lines are simple to import statements. Pulling public library NSEpy https://t.co/OW1TPC7QXC that we can use to extract historical and real-time data from NSE’s website. Then, we import the most popular pandas library.


Then I define a function "fetchData" that fetches the data using the built-in get_history function of the nsepy library. I adjust the original data frame to store open, high, low and close prices. The original data frame sends more columns - Volume, Turnover, %Deliverable, etc.


I then go ahead and put all Nifty50 tickers in a Python list named nifty50list. I also set our start-date (2014-01-01), end-date(2022-01-21) in the YYYY-MM-DD format, and the path where I want to save my files on my PC.


Finally, I loop through all the Nifty50 tickers calling the fetchData function on each of them and saving them in the path specified above in the CSV format e.g. ADANIPORTS.csv, which came first. This process is repeated for each and every symbol in Nifty50.
Nano Course On Python For Trading
==========================
Module 4

In this post, I will attempt to teach you how to write a trading strategy in Equity Segment that runs on your PC and create a Telegram bot that sends you buy/sell signals with Stop Loss.


Prerequisite: If you hadn't gone through the earlier modules, I strongly recommend you go through them all. Module 2: https://t.co/pciDOJXyVI

Note:
If you liked my content, you can donate, tip and support me on this link (any amount you prefer)


We are going to implement below strategy:

Rules: There should be three candles -> high of candle 1 > high of candle 2 > high of candle 3 and low of candle 1 < low of candle 2 < low of candle 3, where candle 3 is T-1 day, candle 2 is T-2 day and candle 1 is of T-3 Day, T = today.


If on today(day=T), the stock crosses yesterday high(candle 3), then send a buy signal to your telegram handle with candle 3 low as SL.

Before we get started with code, let's create a telegram bot using BotFather.

Step 1: Search BotFather in the telegram.
Step 2: type /newbot and then give the name to your bot. Refer to the second image as an example