Skip to content

Instantly share code, notes, and snippets.

View samchaaa's full-sized avatar
🥑
hi

Sam Chakerian samchaaa

🥑
hi
View GitHub Profile
@brettkelly
brettkelly / oauth_example.py
Created February 26, 2013 18:55
Authenticate with the Evernote Cloud API using OAuth and Python
# Python OAuth example
import evernote.edam.userstore.constants as UserStoreConstants
import evernote.edam.type.ttypes as Types
from evernote.api.client import EvernoteClient
##
# Helper function to turn query string parameters into a
# Python dictionary
##
@jlln
jlln / separator.py
Last active November 9, 2023 19:59
Efficiently split Pandas Dataframe cells containing lists into multiple rows, duplicating the other column's values.
def splitDataFrameList(df,target_column,separator):
''' df = dataframe to split,
target_column = the column containing the values to split
separator = the symbol used to perform the split
returns: a dataframe with each entry for the target column separated, with each element moved into a new row.
The values in the other columns are duplicated across the newly divided rows.
'''
def splitListToRows(row,row_accumulator,target_column,separator):
split_row = row[target_column].split(separator)
@StuartGordonReid
StuartGordonReid / OrnsteinUhlenbeck.py
Created June 15, 2015 14:23
Ornstein Uhlenbeck Stochastic Process
import math
import numpy
import random
import decimal
import scipy.linalg
import numpy.random as nrand
import matplotlib.pyplot as plt
"""
Note that this Gist uses the Model Parameters class found here - https://gist.github.com/StuartGordonReid/f01f479c783dd40cc21e
from sklearn.qda import QDA
#from sklearn.ensemble import RandomForestRegressor
from sklearn import preprocessing
import numpy as np
import pandas as pd
def initialize(context):
context.assets = sid(8554) # Trade SPY
context.model = QDA()
context.lookback = 5 # Look back
@antonio-catalano
antonio-catalano / DynamicAlgo.py
Created April 19, 2018 13:11
dynamic programming code
"It's a reworked version of Problem 14 that you find here: http://interactivepython.org/runestone/static/pythonds/Recursion/pythondsProgrammingExercises.html"
dizio_1 = { (2,2): 1, (3,4): 2, (4,6): 3, (5,7): 4, (9,10): 5, (9,11): 6, (13,15): 7, (16,19): 8, \
(25,37): 9, (35,45):10 }
def createTab ( _Dict ): #create the graphic tab
dizio = _Dict
print('','Item', 'Weight', 'Value','\n', sep=" " )
for key in dizio:
spazio = " "
@druska
druska / engine.c
Created September 17, 2018 15:18
Quant Cup 1's winning order book implementation
/*****************************************************************************
* QuantCup 1: Price-Time Matching Engine
*
* Submitted by: voyager
*
* Design Overview:
* In this implementation, the limit order book is represented using
* a flat linear array (pricePoints), indexed by the numeric price value.
* Each entry in this array corresponds to a specific price point and holds
* an instance of struct pricePoint. This data structure maintains a list
from fastapi import FastAPI
from pydantic import BaseModel
import torchvision
from torchvision import transforms
import torch
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
from PIL import Image
import numpy as np
import cv2
import io, json
@ih2502mk
ih2502mk / list.md
Last active July 26, 2024 18:55
Quantopian Lectures Saved
@Kurry
Kurry / natural_language_to_bql_function_system_prompt.md
Created November 8, 2023 01:40
Natural Language System Prompt for GPT-4 Turbo

Prompt for AI Bot:

You are a data retrieval AI, equipped with the knowledge of Bloomberg Query Language (BQL). Your function is to parse natural language requests related to financial data and return the appropriate BQL formulas to retrieve that data. You have access to a comprehensive database of BQL function examples which you can search through to find the most relevant formula based on the user's request.

When you receive a request, you should:

  1. Identify the key elements of the request:
    • The financial instrument (e.g., "AAPL US Equity")
    • The data type needed (e.g., daily prices)
  • The time frame (e.g., last year)