This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from upstox_api.api import * | |
| from datetime import datetime | |
| from pprint import pprint | |
| import os, sys | |
| from tempfile import gettempdir | |
| try: input = raw_input | |
| except NameError: pass | |
| u = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- encoding: utf-8 -*- | |
| # requires a recent enough python with idna support in socket | |
| # pyopenssl, cryptography and idna | |
| from OpenSSL import SSL | |
| from cryptography import x509 | |
| from cryptography.x509.oid import NameOID | |
| import idna | |
| from socket import socket |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="ticker.js"></script> | |
| <script> | |
| var ticker = new KiteTicker({api_key: "api_key", access_token: "access_token"}); | |
| ticker.connect(); | |
| ticker.on("ticks", onTicks); | |
| ticker.on("connect", subscribe); | |
| function onTicks(ticks) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Hi traders, | |
| Here is a simple generic example for implementing a postback mechanism. You can host this in a remote server or in your local server itself. | |
| Run Locally | |
| =========== | |
| 1. Install ngrok from https://ngrok.com/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ################## Ticks to candles in kiteconnect python #################### | |
| # Author : Arun B | |
| # Reference : http://ezeetrading.in/Articles/Candles_formation_from_tick_data_zerodha.html | |
| # Purpose : Convert ticks to candles by putting ticks in a queue. This redues time wasted in on_ticks function | |
| ################################################################################ | |
| from kiteconnect import KiteTicker | |
| import datetime | |
| from copy import copy | |
| import queue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ################## Ticks to candles in kiteconnect python #################### | |
| # Author : Arun B | |
| # Reference : http://ezeetrading.in/Articles/Candles_formation_from_tick_data_zerodha.html | |
| # Purpose : Convert ticks to candles by putting ticks in a queue. This redues time wasted in on_ticks function | |
| ################################################################################ | |
| from kiteconnect import KiteTicker | |
| import datetime | |
| from copy import copy | |
| import queue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import json | |
| import os | |
| import logmatic | |
| import logging | |
| from logging.config import dictConfig | |
| import requests | |
| from http import HTTPStatus | |
| import re | |
| from kiteconnect import KiteConnect |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ####################################################################### | |
| # Author : Arun B | |
| # | |
| # Purpose : Automate the process of generating access token for kiteconnect in python | |
| ############################################################################ | |
| # For this code to run you have to download geckodriver and put it in /usr/local/bin | |
| from kiteconnect import KiteConnect,KiteTicker | |
| import requests | |
| from selenium import webdriver | |
| from selenium.webdriver.common.by import By |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import json | |
| import os | |
| import logmatic | |
| import logging | |
| from logging.config import dictConfig | |
| import requests | |
| from http import HTTPStatus | |
| __author__ = "GannyS" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import pandas_ta as ta | |
| from dateutil import parser | |
| df = pd.read_csv('AUD_CAD.csv', sep=',', names=[ | |
| 'datetime', 'bid_open', 'bid_high', 'bid_low', 'bid_close', 'ask_open', 'ask_high', 'ask_low', 'ask_close', 'mid_open', 'mid_high', 'mid_low', 'mid_close', 'volume'], error_bad_lines=False, parse_dates=['datetime']) | |
| df.ta.atr(append=True, high='bid_high', low='bid_low', close='bid_close') | |
| print(df) |