This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import math | |
from datetime import datetime, timedelta | |
import requests | |
SLOTS_PER_EPOCH = 32 | |
SECONDS_PER_SLOT = 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
def rsi(ohlc: pd.DataFrame, period: int = 14) -> pd.Series: | |
"""See source https://github.com/peerchemist/finta | |
and fix https://www.tradingview.com/wiki/Talk:Relative_Strength_Index_(RSI) | |
Relative Strength Index (RSI) is a momentum oscillator that measures the speed and change of price movements. | |
RSI oscillates between zero and 100. Traditionally, and according to Wilder, RSI is considered overbought when above 70 and oversold when below 30. | |
Signals can also be generated by looking for divergences, failure swings and centerline crossovers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8; py-indent-offset:4 -*- | |
############################################################################### | |
# Copyright (C) 2019 Daniel Rodriguez - MIT License | |
# - https://opensource.org/licenses/MIT | |
# - https://en.wikipedia.org/wiki/MIT_License | |
############################################################################### | |
import argparse | |
import random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyCallable(object): | |
def __init__(self, urlparts, callable): | |
self.urlparts = urlparts | |
self.callable = callable | |
def __call__(self, **kwargs): | |
print kwargs | |
print self.urlparts | |
def __getattr__(self, name): | |
# Return a callable object of this same type so that you can just keep | |
# chaining together calls and just adding that missing attribute to the |