Example #1
0
                            symbol.upper(), interval)
                        checksum_file_name = "{}-{}-{}.zip.CHECKSUM".format(
                            symbol.upper(), interval, date)
                        download_file(checksum_path, checksum_file_name,
                                      date_range, folder)

        current += 1


if __name__ == "__main__":
    parser = get_parser('klines')
    args = parser.parse_args(sys.argv[1:])

    if not args.symbols:
        print("fetching all symbols from exchange")
        symbols = get_all_symbols()
        num_symbols = len(symbols)
    else:
        symbols = args.symbols
        num_symbols = len(symbols)

    if args.dates:
        dates = args.dates
    else:
        dates = pd.date_range(end=datetime.today(),
                              periods=MAX_DAYS).to_pydatetime().tolist()
        dates = [date.strftime("%Y-%m-%d") for date in dates]
        download_monthly_klines(symbols, num_symbols, args.intervals,
                                args.years, args.months, args.startDate,
                                args.endDate, args.folder, args.checksum)
    download_daily_klines(symbols, num_symbols, args.intervals, dates,
Example #2
0
                                             symbol)
                    checksum_file_name = "{}-trades-{}.zip.CHECKSUM".format(
                        symbol.upper(), date)
                    download_file(checksum_path, checksum_file_name,
                                  date_range, folder)

        current += 1


if __name__ == "__main__":
    parser = get_parser('trades')
    args = parser.parse_args(sys.argv[1:])

    if not args.symbols:
        print("fetching all symbols from exchange")
        symbols = get_all_symbols(args.type)
        num_symbols = len(symbols)
    else:
        symbols = args.symbols
        num_symbols = len(symbols)
        print("fetching {} symbols from exchange".format(num_symbols))

    if args.dates:
        dates = args.dates
    else:
        dates = pd.date_range(end=datetime.today(),
                              periods=MAX_DAYS).to_pydatetime().tolist()
        dates = [date.strftime("%Y-%m-%d") for date in dates]
        download_monthly_trades(args.type, symbols, num_symbols, args.years,
                                args.months, args.startDate, args.endDate,
                                args.folder, args.checksum)