Example #1
0
#     3,
#     url="https://fred.stlouisfed.org/graph/fredgraph.csv?bgcolor=%23e1e9f0&chart_type=line&drp=0&fo=open%20sans&graph_bgcolor=%23ffffff&height=450&mode=fred&recession_bars=on&txtcolor=%23444444&ts=12&tts=12&width=1168&nt=0&thu=0&trc=0&show_legend=yes&show_axis_titles=yes&show_tooltip=yes&id=BAMLH0A0HYM2&scale=left&cosd=2015-10-28&coed=2020-10-28&line_color=%234572a7&link_values=false&line_style=solid&mark_type=none&mw=3&lw=2&ost=-99999&oet=99999&mma=0&fml=a&fq=Daily%2C%20Close&fam=avg&fgst=lin&fgsnd=2020-02-01&line_index=1&transformation=lin&vintage_date=2020-10-29&revision_date=2020-10-29&nd=1996-12-31",
#     index="DATE",
#     subset="BAMLH0A0HYM2",
#     name="number:Option Spreads"
# )
# P.remove_dots(3, "BAMLH0A0HYM2")
# P.percentages(3, "BAMLH0A0HYM2")
# P.stacked(3, "BAMLH0A0HYM2", inverse=True)


# P.d_yfi(2, "^VIX", name="number:VIX")

# P.d_yfi(2, "^GSPC", name="number:S&P")

P.minimize(P.ids, normalize=True)

def fred(input):
    return parse("year-month-day", str(input.split(" ")[0]), normalize=True)

def yfi(input):
    return parse("year-month-day", str(input), normalize=True)

P.parse_indexes_as_date([
    [1, yfi],
    [2, yfi],
    # [3, yfi],
    # [3, yfi]
])

# Meta-creators
Example #2
0
# 1. store index [0] of list as x
# 2. prepend x to list
# 3. pop last value off list
P.topple(1, "NAV")

P.dataset(
    2, {
        "url": "NDQ.AX.yfi",
        "range": "daily",
        "name": "NASDAQ ETF",
        "index": "date",
        "subsets": ["close"],
        "scrape_every": "1 day"
    })

P.minimize([1, 2], normalize=True)

# our "callables" for date parsing our datasets


def nyfed_dp(input):
    s = str(input).split(":")[0].split("T")[0]
    return parse("year-month-day", s, normalize=True)


def yahoofin_dp(input):
    return parse("year-month-day", str(input), normalize=True)


P.parse_indexes_as_date([[1, yahoofin_dp], [2, yahoofin_dp]])
Example #3
0
        "scrape_every": "1 day"
    })
P.sma(3, "close", period=5)

P.dataset(
    4, {
        "url": "^IXIC.yfi",
        "range": "daily",
        "name": "NASDAQ",
        "index": "date",
        "subsets": ["close"],
        "scrape_every": "1 day"
    })
P.sma(4, "close", period=5)

P.minimize([1, 2, 3, 4], normalize=True)

# our "callables" for date parsing our datasets


def nyfed_dp(input):
    s = str(input).split(":")[0].split("T")[0]
    return parse("year-month-day", s, normalize=True)


def yahoofin_dp(input):
    return parse("year-month-day", str(input), normalize=True)


P.parse_indexes_as_date([[1, nyfed_dp], [2, yahoofin_dp], [3, yahoofin_dp],
                         [4, yahoofin_dp]])