Пример #1
0
 def __init__(self, trade):
     self.__tradeId = int(trade["tid"])
     self.__dateTime = base.tid_to_datetime(trade["tid"])
     currency = trade["price_currency"]
     self.__price = base.from_value_int(currency, trade["price_int"])
     self.__amount = base.from_amount_int(trade["amount_int"])
     self.__type = trade["trade_type"]
Пример #2
0
 def __init__(self, trade):
     self.__tradeId = int(trade["tid"])
     self.__dateTime = base.tid_to_datetime(trade["tid"])
     currency = trade["price_currency"]
     self.__price = base.from_value_int(currency, trade["price_int"])
     self.__amount = base.from_amount_int(trade["amount_int"])
     self.__type = trade["trade_type"]
Пример #3
0
    def parseBar(self, csvRowDict):
        tid = int(csvRowDict["id"])
        price = float(csvRowDict["price"])
        amount = float(csvRowDict["amount"])
        tradeType = csvRowDict["type"]

        dateTime = base.tid_to_datetime(tid)
        # Localize the datetime if a timezone was given.
        if self.__timezone:
            dateTime = dt.localize(dateTime, self.__timezone)

        return TradeBar(dateTime, price, amount, tradeType)
Пример #4
0
    def parseBar(self, csvRowDict):
        tid = int(csvRowDict["id"])
        price = float(csvRowDict["price"])
        amount = float(csvRowDict["amount"])
        tradeType = csvRowDict["type"]

        dateTime = base.tid_to_datetime(tid)
        # Localize the datetime if a timezone was given.
        if self.__timezone:
            dateTime = dt.localize(dateTime, self.__timezone)

        return TradeBar(dateTime, price, amount, tradeType)
Пример #5
0
def download_trades_since(currency, tid, ignoreMultiCurrency, retries=3):
    logger.info("Downloading trades since %s." % (base.tid_to_datetime(tid)))
    # logger.info("Downloading trades since %d." % (tid))

    done = False
    while not done:
        try:
            response = download_trades_impl(currency, tid)
            done = True
        except Exception, e:
            if retries == 0:
                raise e
            else:
                logger.error("%s. Retrying..." % (e))
                retries -= 1
Пример #6
0
def download_trades_since(currency, tid, ignoreMultiCurrency, retries=3):
    logger.info("Downloading trades since %s." % (base.tid_to_datetime(tid)))
    # logger.info("Downloading trades since %d." % (tid))

    done = False
    while not done:
        try:
            response = download_trades_impl(currency, tid)
            done = True
        except Exception, e:
            if retries == 0:
                raise e
            else:
                logger.error("%s. Retrying..." % (e))
                retries -= 1