Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Sanyam Bansal Sanyambansal76

🎯
Focusing
View GitHub Profile
@Sanyambansal76
Sanyambansal76 / stop_loss.py
Last active Sep 13, 2020
Trailing Stop Loss Order - Quantconnect - BootCamp
View stop_loss.py
class BootCampTask(QCAlgorithm):
# Order ticket for our stop order, Datetime when stop order was last hit
stopMarketTicket = None
stopMarketOrderFillTime = datetime.min
highestSPYPrice = -1
def Initialize(self):
self.SetStartDate(2018, 12, 1)
self.SetEndDate(2018, 12, 10)
View sample_senzing_data.json
{"SOCIAL_HANDLE":"robertseaman","FIRST_NAME":"Robert","DATE_OF_BIRTH":"4/8/1980","ADDR_STATE":"LA","ADDR_POSTAL_CODE":"71232","SSN_NUMBER":"053-39-12313","ENTITY_TYPE":"TEST","GENDER":"M","srccode":"MDMPER","CC_ACCOUNT_NUMBER":"55342022087733443","RECORD_ID":"123123125","DSRC_ACTION":"A","ADDR_CITY":"Delhi","DRIVERS_LICENSE_STATE":"DE","PHONE_NUMBER":"225-671-0796","NAME_LAST":"SEAMAN","entityid":"284430033443","ADDR_LINE1":"772 Armstrong RD"}
View install_psql_client_11.1.sh
sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudp apt-get install postgresql-client-11
@Sanyambansal76
Sanyambansal76 / local_settings.py
Created Oct 8, 2018 — forked from rochacbruno/local_settings.py
Django Profiling Middleware with hotshot or Cprofile
View local_settings.py
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
'yourapp.middleware.ProfileMiddleware',
'yourapp.middleware.CProfileMiddleware'
)
View file_system_error.txt
https://ccm.net/faq/3505-repair-file-system-errors-on-ubuntu
@Sanyambansal76
Sanyambansal76 / speed_test.py
Created Sep 2, 2018
Linux Speed Test command line
View speed_test.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2018 Matt Martz
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@Sanyambansal76
Sanyambansal76 / install_docker.sh
Last active Mar 7, 2019
Install docker and docker compose ubuntu16.04
View install_docker.sh
#!/usr/bin/env bash
# install docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
sudo usermod -aG docker ${USER}
su - ${USER}
id -nG
echo "Now Enter you password"
@Sanyambansal76
Sanyambansal76 / sql_replace_in_django_orm.py
Created May 1, 2018 — forked from simonw/sql_replace_in_django_orm.py
How to use the SQL replace function in a Django ORM query
View sql_replace_in_django_orm.py
from django.db.models import F, Func, Value
from myapp.models import MyModel
# Annotation
MyModel.objects.filter(description__icontains='\r\n').annotate(
fixed_description=Func(
F('description'),
Value('\r\n'), Value('\n'),
function='replace',
)
@Sanyambansal76
Sanyambansal76 / Order Book Gdax
Created Aug 9, 2017
List contains 3 index [ price, size, num-orders ]
View Order Book Gdax
{
u'bids': [
[
u'3272.07',
u'0.10051789',
1
],
[
u'3270.8',
u'3.55364293',
View Financial Time API
{
u'title': {
u'title': u'SPORT NEWS IN BRIEF'
},
u'modelVersion': u'1',
u'apiUrl': u'http://api.ft.com/content/items/v1/b0cb0082-97aa-11db-a680-0000779e2340',
u'location': {
u'uri': u'http://www.ft.com/cms/b0cb0082-97aa-11db-a680-0000779e2340.html'
},
u'id': u'b0cb0082-97aa-11db-a680-0000779e2340',