Пример #1
0
def download_trades_by_month(currency,
                             year,
                             month,
                             csvFile,
                             ignoreMultiCurrency=False):
    """Download trades for a given month.

	:param currency: Currency in which trade was completed.
	:type currency: string.
	:param year: The year.
	:type year: int.
	:param month: The month.
	:type month: int.
	:param csvFile: The path to the CSV file to write the trades.
	:type csvFile: string.
	:param ignoreMultiCurrency: Ignore multi currency trades.
	:type ignoreMultiCurrency: boolean.

	.. note::
		This will take some time since Mt. Gox API returns no more than 1000 trades on each request
	"""

    # Calculate the first and last trade ids for the year.
    begin = datetime.datetime(year, month, 1)
    if month == 12:
        end = datetime.datetime(year + 1, 1, 1)
    else:
        end = datetime.datetime(year, month + 1, 1)
    tidBegin = base.datetime_to_tid(begin)
    tidEnd = base.datetime_to_tid(end)

    tradesFile = TradesFile(csvFile)
    download_trades(tradesFile, currency, tidBegin, tidEnd,
                    ignoreMultiCurrency)
Пример #2
0
def download_trades_by_month(currency, year, month, csvFile, ignoreMultiCurrency=False):
    """Download trades for a given month.

    :param currency: Currency in which trade was completed.
    :type currency: string.
    :param year: The year.
    :type year: int.
    :param month: The month.
    :type month: int.
    :param csvFile: The path to the CSV file to write the trades.
    :type csvFile: string.
    :param ignoreMultiCurrency: Ignore multi currency trades.
    :type ignoreMultiCurrency: boolean.

    .. note::
        This will take some time since Mt. Gox API returns no more than 1000 trades on each request
    """

    # Calculate the first and last trade ids for the year.
    begin = datetime.datetime(year, month, 1)
    if month == 12:
        end = datetime.datetime(year+1, 1, 1)
    else:
        end = datetime.datetime(year, month + 1, 1)
    tidBegin = base.datetime_to_tid(begin)
    tidEnd = base.datetime_to_tid(end)

    tradesFile = TradesFile(csvFile)
    download_trades(tradesFile, currency, tidBegin, tidEnd, ignoreMultiCurrency)
Пример #3
0
def download_trades_by_day(currency, year, month, day, csvFile, ignoreMultiCurrency=False):
    # Calculate the first and last trade ids for the year.
    begin = datetime.datetime(year, month, day)
    end = begin + datetime.timedelta(days=1)
    tidBegin = base.datetime_to_tid(begin)
    tidEnd = base.datetime_to_tid(end)

    tradesFile = TradesFile(csvFile)
    download_trades(tradesFile, currency, tidBegin, tidEnd, ignoreMultiCurrency)
Пример #4
0
def download_trades_by_day(currency, year, month, day, csvFile, ignoreMultiCurrency=False):
    # Calculate the first and last trade ids for the year.
    begin = datetime.datetime(year, month, day)
    end = begin + datetime.timedelta(days=1)
    tidBegin = base.datetime_to_tid(begin)
    tidEnd = base.datetime_to_tid(end)

    tradesFile = TradesFile(csvFile)
    download_trades(tradesFile, currency, tidBegin, tidEnd, ignoreMultiCurrency)
Пример #5
0
def download_trades_by_year(currency, year, csvFile):
	"""Download trades for a given year.

	:param currency: Currency in which trade was completed.
	:type currency: string.
	:param year: The year.
	:type year: int.
	:param csvFile: The path to the CSV file to write the trades.
	:type csvFile: string.

	.. note::
		This will take some time since Mt. Gox API returns no more than 1000 trades on each request
	"""

	# Calculate the first and last trade ids for the year.
	begin = datetime.datetime(year, 1, 1)
	end = datetime.datetime(year+1, 1, 1)
	tidBegin = base.datetime_to_tid(begin)
	tidEnd = base.datetime_to_tid(end)

	tradesFile = TradesFile(csvFile)
	download_trades(tradesFile, currency, tidBegin, tidEnd)