Skip to content

Instantly share code, notes, and snippets.

View masayang's full-sized avatar

Masa Nakamura masayang

View GitHub Profile
@masayang
masayang / NYSE_tradingdays.py
Last active December 22, 2018 11:08 — forked from jckantor/NYSE_tradingdays.py
Python dateutil rule sets for NYSE trading days and holiday observances.
from dateutil import rrule
import datetime
# Generate ruleset for holiday observances on the NYSE
def NYSE_holidays(a=datetime.date.today(), b=datetime.date.today()+datetime.timedelta(days=365)):
rs = rrule.rruleset()
# Include all potential holiday observances
rs.rrule(rrule.rrule(rrule.YEARLY, dtstart=a, until=b, bymonth=12, bymonthday=31, byweekday=rrule.FR)) # New Years Day
@masayang
masayang / setup.py
Created March 20, 2017 06:55
setup.py
from setuptools import setup
setup(
name='flask_yahoo_finance',
version='0.1',
long_description=__doc__,
packages=['flask_yahoo_finance'],
include_package_data=True,
zip_safe=False,
install_requires=['yahoo-finance']
$ pip install yahoo-finance
@masayang
masayang / gist:5baa6fb8e6099e5f7762c66421cb0bef
Created March 20, 2017 06:45
flask_yahoo_finance initial directory
.
├── LICENSE
├── README.md
├── flask_yahoo_finance
│   └── __init__.py
├── setup.py
└── tests
└── __init__.py
@masayang
masayang / H.csv
Created February 17, 2015 07:12
timestamps of H's tweets as well as Y's tweets
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
2015-02-14 11:33:06
2015-02-14 11:29:04
2015-02-14 11:25:04
2015-02-14 09:46:53
2015-02-14 09:40:55
2015-02-14 09:31:07
2015-02-14 09:09:58
2015-02-14 08:51:48
2015-02-14 08:48:22
2015-02-14 08:46:36
@masayang
masayang / D-Wave
Created January 5, 2015 07:45
TD D-Wave for StockFinder
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:TD D-Wave
'|*** Example: plot = price.close - price.close(1)
'|******************************************************************
Static Wave As Integer
Static MinA As Single
@masayang
masayang / longerfriends.list
Created March 10, 2013 23:48
友達推奨MrJob
foo, bar, masayang, steve, nakamura, ryoma, corbert
bar, foo, chibi, loki, ichikawa
masayang, foo, steve, loki, corbert, ichikawa, moraimon, sada, matsuno
steve, bar, nakamura, micky, samuel, chibi, ryoma, moses, anko, moraimon
nakamura, foo, bar, masayang, steve, wendy, ryoma, ichikawa, moraimon, matsuno
micky, steve, loki, corbert, ichikawa, regan, moraimon, sada
samuel, bar, chester, loki, regan
wendy, foo, bar, samuel, chibi, ryoma, loki, moses, matsuno
chester, foo, samuel, loki, regan, sada
chibi, masayang, steve, anko
@masayang
masayang / friends.list
Created March 10, 2013 22:50
共通友達を数えるMrJob
W, A, B, C
X, A, B, C, D, Z
Y, A, B, E
Z, A, B, D, E
@masayang
masayang / mapper.py
Created March 9, 2013 07:28
MrJobを使ったMapReduce処理記述と実行
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from mrjob.job import MRJob
class MRWordCounter(MRJob):
def mapper(self, key, line):
for word in line.split():
yield word, 1
@masayang
masayang / installation_procedure.txt
Created March 9, 2013 07:19
MrJob設置手順・環境切り替え
# 設置手順
source virtualenvwrapper.sh
mkvirtualenv mrjob
pip install mrjob
# MrJob環境の開放
deactivate
#MrJob環境への切り替え
workon mrjob