Skip to content

Instantly share code, notes, and snippets.

@ankanban
ankanban / RiskAdjustedReturnMetrics.py
Created September 8, 2016 04:55 — forked from StuartGordonReid/RiskAdjustedReturnMetrics.py
Measured of Risk-adjusted Return
import math
import numpy
import numpy.random as nrand
"""
Note - for some of the metrics the absolute value is returns. This is because if the risk (loss) is higher we want to
discount the expected excess return from the portfolio by a higher amount. Therefore risk should be positive.
"""
@ankanban
ankanban / poc.py
Last active August 29, 2015 14:16 — forked from pbiernat/poc.py
'''
A simple demonstration of obtaining, modifying and executing code objects in python without relying
on commonly blocked keywords such as exec, compile, etc...
-Patrick Biernat.
'''
import __builtin__
mydict = {}
ssl_session_cache shared:SSL:1m; # 1MB is ~4000 sessions, if it fills old sessions are dropped
ssl_session_timeout 1440m; # Reuse sessions for 24hrs
# Redirect all traffic to SSL
server {
listen 80 default;
server_name www.example.com example.com;
access_log off;
error_log off;
return 301 https://example.com$request_uri;
import os
import sys
import subprocess
import re
import optparse
import boto
dynamodb_conn = boto.connect_dynamodb(aws_access_key_id='MY_ACCESS_KEY_ID', aws_secret_access_key='MY_SECRET_ACCESS_KEY')
table_name = 'mytable'
dynamodb_table = dynamodb_conn.get_table(table_name)