Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
create database price_history_db | |
CREATE CONTINUOUS QUERY "cq_1m" ON "price_history_db" BEGIN SELECT MIN(price) as low, MAX(price) as high, FIRST(price) as open, LAST(price) as close, SUM(size) as volume INTO "price_1m" FROM "trade" GROUP BY time(1m), symbol END | |
CREATE CONTINUOUS QUERY "cq_5m" ON "price_history_db" BEGIN SELECT MIN(low) as low, MAX(high) as high, FIRST(open) as open, LAST(close) as close, SUM(volume) as volume INTO "price_5m" FROM "price_1m" GROUP BY time(5m), symbol END | |
CREATE CONTINUOUS QUERY "cq_15m" ON "price_history_db" BEGIN SELECT MIN(low) as low, MAX(high) as high, FIRST(open) as open, LAST(close) as close, SUM(volume) as volume INTO "price_15m" FROM "price_5m" GROUP BY time(15m), symbol END | |
CREATE CONTINUOUS QUERY "cq_1h" ON "price_history_db" BEGIN SELECT MIN(low) as low, MAX(high) as high, FIRST(open) as open, LAST(close) as close, SUM(volume) as volume INTO "price_1h" FROM "price_15m" GROUP BY time(1h), symbol END | |
CREATE CONTINUOUS QUERY "cq_6h" ON "price_history_db" BEGIN SELECT |
This file contains 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 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 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 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 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 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 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 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 |