How to use the akshare.futures_spot_price function in akshare

To help you get started, we’ve selected a few akshare examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jindaxiang / akshare / example / daily_run.py View on Github external
def down_load(date):
    date = akshare.cons.convert_date(date) if date is not None else datetime.date.today()
    if date not in calendar:
        warnings.warn("%s非交易日" % date.strftime("%Y%m%d"))
        return
    # ----------------------------------------------------------------------
    print("\n" + "-" * 80 + "\n展期")
    df = akshare.get_roll_yield_bar(type_method="var", date=date)
    df.to_csv(s["root"] + "展期%s.csv" % date)

    # ----------------------------------------------------------------------
    print("\n" + "-" * 80 + "\n基差")
    df = akshare.futures_spot_price(date)
    df.to_csv(s["root"] + "基差%s.csv" % date)

    # ----------------------------------------------------------------------
    print("\n" + "-" * 80 + "\n会员持仓排名之和")
    df = akshare.get_rank_sum_daily(start_day=date, end_day=date)
    df.to_csv(s["root"] + "会员持仓排名%s.csv" % date)

    # ----------------------------------------------------------------------
    print("\n" + "-" * 80 + "\n仓单")
    df = akshare.get_receipt(date)
    df.to_csv(s["root"] + "仓单%s.csv" % date)

    # ----------------------------------------------------------------------
    if s["qqEmail"] != "*":
        akshare.send_email("akshare", s["qqEmail"], s["secret"], s["qqEmail"], "smtp.qq.com", "465", ["展期%s.csv" % date, "基差%s.csv" % date, "会员持仓排名%s.csv" % date, "仓单%s.csv" % date], s["root"], True)