पायथन ट्रेडिंग

Submitted by बोकलत on 14 May, 2021 - 03:36

पायथन ट्रेडिंग कोड्स यासाठी हा धागा काढत आहे.
१. Download Historical data in Excel (1Day Candle)

from nsepy import get_history as gh
import datetime as dt
import dateutil.relativedelta as dr
import pandas as pd
stock = [''List of stocks'']
to_date = dt.date.today()
start_date = to_date - dr.relativedelta(days = 300)
for X in stock:
data = gh(X,start_date,to_date)
data.to_excel(X + '.xlsx')
print(data)

2. Zerodha Automatic login

from kiteconnect import KiteConnect
from selenium import webdriver
import time
import os

cwd = os.chdir("txt file path")

def autologin():
token_path = "automatic login.txt"
key_secret = open(token_path,'r').read().split()
kite = KiteConnect(key_secret[0])
service = webdriver.chrome.service.Service('./chromedriver')
service.start()
options = webdriver.ChromeOptions()
# options.add_argument('--headless')
options = options.to_capabilities()
driver = webdriver.Remote(service.service_url, options)
driver.get('https://kite.zerodha.com/')
driver.implicitly_wait(300)
username = driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div/div/form/div[2]/input')
password = driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div/div/form/div[3]/input')
username.send_keys(key_secret[0])
password.send_keys(key_secret[1])
driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div/div/form/div[4]/button').click()
pin = driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div/div/form/div[2]/div/input')
pin.send_keys(key_secret[2])
driver.find_element_by_xpath('/html/body/div[1]/div/div/div[1]/div/div/div/form/div[3]/button').click()
time.sleep(300)

Groups audience: 
Group content visibility: 
Use group defaults