Skip to content

Instantly share code, notes, and snippets.

View ericyue's full-sized avatar

mooncake ericyue

View GitHub Profile
@ericyue
ericyue / short_term_alpha.ipynb
Created March 29, 2022 01:43 — forked from sebjai/short_term_alpha.ipynb
Market Making in Short-Term Alpha (Chapter 10.4.2 of Algorithmic and High-Frequency Trading by Cartea, Jaimungal, Penalva, published by Cambridge University Press)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ericyue
ericyue / tensorboard_logging.py
Created April 12, 2020 03:25 — forked from gyglim/tensorboard_logging.py
Logging to tensorboard without tensorflow operations. Uses manually generated summaries instead of summary ops
"""Simple example on how to log scalars and images to tensorboard without tensor ops.
License: BSD License 2.0
"""
__author__ = "Michael Gygli"
import tensorflow as tf
from StringIO import StringIO
import matplotlib.pyplot as plt
import numpy as np
# Silvius microphone client based on Tanel's client.py
__author__ = 'dwk'
import argparse
from ws4py.client.threadedclient import WebSocketClient
import threading
import sys
import urllib
import json
@ericyue
ericyue / a.py
Created February 21, 2017 19:21
def main():
# Read TFRecords files for training
def read_and_decode(filename_queue):
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)
return serialized_example
# Read TFRecords files for training
filename_queue = tf.train.string_input_producer(
@ericyue
ericyue / _feature_hasher.pyx
Created February 15, 2017 06:32 — forked from rafbarr/_feature_hasher.pyx
Very efficient implementation of feature hashing for Python.
# distutils: language=c++
import collections
import operator
from cpython.bytes cimport PyBytes_AS_STRING, PyBytes_GET_SIZE
import cython
import numpy as np
import pandas as pd
from libc.stdint cimport uint8_t, uint32_t
import datetime
import pytz
from tensorflow.contrib.session_bundle import exporter
from tensorflow.python.client import timeline
import glob
import json
import time
import math
import numpy as np
import os
set noswapfile
inoremap ( ()
inoremap [ []
inoremap " ""
inoremap ' ''
set t_Co=256
nnoremap ; :
:command W w
:command P set paste
@ericyue
ericyue / sharded_ps_benchmark.py
Created December 12, 2016 03:13 — forked from yaroslavvb/sharded_ps_benchmark.py
Example of local cluster with multiple workers/training loops sharded parameter server
#!/usr/bin/env python
# Benchmark transferring data.
#
# Take a independent workers communicating with b parameter shards
# Each worker tries to add to variables stored on parameter server as fast as
# possible.
#
# macbook
# ps=1: 1.6 GB/s
# ps=2: 2.6 GB/s
@ericyue
ericyue / tf_serving.sh
Created December 5, 2016 07:44 — forked from jarutis/tf_serving.sh
Install Tensorflow Serving on Centos 7 (CPU)
sudo su
# Java
yum -y install java-1.8.0-openjdk-devel
# Build Esentials (minimal)
yum -y install gcc gcc-c++ kernel-devel make automake autoconf swig git unzip libtool binutils
# Extra Packages for Enterprise Linux (EPEL) (for pip, zeromq3)
yum -y install epel-release
@ericyue
ericyue / wentao-sma.py
Created October 20, 2016 14:55
wentao-sma.py
import sys,os
import datetime
from pyalgotrade import bar
from pyalgotrade import strategy
from pyalgotrade import plotter
from pyalgotrade.technical import vwap,ma,cumret,cross
from pyalgotrade.barfeed import csvfeed
from pyalgotrade.bitstamp import broker
from pyalgotrade import broker as basebroker
from pyalgotrade.stratanalyzer import sharpe,drawdown,returns,trades