Skip to content

Instantly share code, notes, and snippets.

View SathishN's full-sized avatar
🎯
Focusing

Sathish SathishN

🎯
Focusing
View GitHub Profile
def resample(df, interval='5min'):
df_s = df.copy()
df_r = df_s.resample(interval, label='right', closed='right') \
.agg({'Open': 'first',
'High': 'max',
'Low': 'min',
'Close': 'last',
'Volume': 'sum',
'OI': 'last'}).dropna()
This file has been truncated, but you can view the full file.
timestamp,symbol_id,symbol,ltp,ltq,atp,ttq,day_open,day_high,day_low,prev_day_close,oi,prev_day_oi,turnover,special_tag,tick_seq,best_bid_price,best_bid_qty,best_ask_price,best_ask_qty,tick_type,change,change_perc,oi_change,oi_change_perc
06-01-2021 09:19:40.000000,300321726,NIFTY21JUNFUT,15611.00000,,,301800,15612.50000,15620.70000,15600.10000,15583.20000,10622700,10552725,,,,15609.20000,75,15611.05000,75,2,27.80000,0.17840,69975,0.66310
06-01-2021 09:19:42.000000,300321726,NIFTY21JUNFUT,15609.05000,300.00000,15612.48000,302100.00000,15612.50000,15620.70000,15600.10000,15583.20000,10622700,10552725,4716530208.00000,,269,15609.00000,75,15611.05000,75,1,25.85000,0.16588,69975,0.66310
06-01-2021 09:19:42.000000,300321726,NIFTY21JUNFUT,15609.05000,300.00000,15612.48000,302100.00000,15612.50000,15620.70000,15600.10000,15583.20000,10622700,10552725,4716530208.00000,,269,15609.00000,75,15611.05000,75,1,25.85000,0.16588,69975,0.66310
06-01-2021 09:19:42.000000,300321726,NIFTY21JUNFUT,15609.05000,300.00000,15612.4800
@SathishN
SathishN / Free_Intraday_StockData_Test_BarChart_API_Gist.py
Created January 25, 2020 06:26 — forked from BlackArbsCEO/Free_Intraday_StockData_Test_BarChart_API_Gist.py
Example code from 'Get Free Intraday Stock Data With Python and BarChart OnDemand API' blog post.
# -*- coding: utf-8 -*-
import time
t0 = time.clock()
import pandas as pd
from pandas.tseries.offsets import BDay
import numpy as np
import datetime as dt
from copy import copy
@SathishN
SathishN / Git-pull-all
Created June 11, 2018 03:16
Powershell script to git pull from origin on all sub directories
$dirs = ls -name -Exclude *.*;
Write-Host 'Base Dir : ' (get-location) -ForegroundColor yellow ;
foreach($dir in $dirs) {
cd $dir;
if(Test-Path ".\.git") {
Write-Host 'Git pull from orgin on :' (get-location) -ForegroundColor Magenta;
&git.exe pull -v --no-rebase "origin" 2> $null
#IF YOU FOUND THIS USEFUL, Please Donate some Bitcoin .... 1FWt366i5PdrxCC6ydyhD8iywUHQ2C7BWC
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from subprocess import check_output
from keras.layers.core import Dense, Activation, Dropout
from keras.layers.recurrent import LSTM
from keras.layers.advanced_activations import LeakyReLU, PReLU
import pandas as pd
import os
file = os.path.abspath('C:\\Zerodha\\Pi\\Exported\\Nifty 50.csv')
df = pd.read_csv(file)
df['Date'] = pd.to_datetime(df['Date'], format = '%d/%m/%y %I:%M:%S %p')
df['Time'] = df['Date'].apply(lambda x: x.strftime('%H:%M'))
df['Date'] = df['Date'].apply(lambda x: x.strftime('%y-%m-%d'))
df.set_index('Date', drop=True, inplace=True)
df.columns = ['O', 'H', 'L', 'C', 'V', 'Time']
using System.Net;
using global::ServiceStack;
using global::ServiceStack.Logging;
using global::ServiceStack.ServiceHost;
public class AuthenticateFilter
{
private static readonly ILog Log = LogManager.GetLogger(typeof(AuthenticateFilter));
using global::ServiceStack;
using global::ServiceStack.Common.Web;
using global::ServiceStack.WebHost.Endpoints;
public class CorsFeature : IPlugin
{
public const string DefaultMethods = "GET, POST, PUT, DELETE, OPTIONS";
public const string DefaultHeaders = "Content-Type";
private static bool isInstalled = false;